[Bf-committers] Operator Import/Export (proposed changes)

Campbell Barton ideasman42 at gmail.com
Tue Aug 31 17:59:31 CEST 2010

There are some changes I planned for a while and should do sooner then
later since our own scripts are meant as examples for new devs to
In brief the proposal is to have import/export be setup more like addons.

- move from "io" directory to "op"
- make each format into a package so "/op/io_obj/__init__.py, load.py, save.py"
  (I'm not fussed on submodule names, we just cant use import.py since
its a py keyword)
- only define operators in __init__.py, delay importing read/write
modules until the operators run
  (so blender loads faster!)

The main disadvantage I see with this is we don't have all files in a
simple flat directory anymore, but faster load times are a big
incentive for me.

This is fairly straightforward, but there are some other things to
consider while on the topic.

The changes suggested above basically make these match how our addons
work, we could just have all importers and exporters be addons, some
enabled by default.
For the user it wont matter much but this means we can have addons
show up in the menu by default without them being moved into another
SVN repository.

I'd also like to use mix-in classes for Importers/Exporters, this
means we can have generic invoke functions, not have to define
filename property on each operator, and we could generalize options
for batch import/export too.
Simple patch which adds bpy.types.Operator.Export
...this would be opt in since some scripts might want their own
invoke, but for now we have duplicate invoke() functions for most i/o.

- Campbell

More information about the Bf-committers mailing list