[Bf-committers] Python RNA Type Registration

Campbell Barton ideasman42 at gmail.com
Mon Aug 2 04:38:52 CEST 2010

On Mon, Aug 2, 2010 at 2:14 AM, Martin Poirier <theeth at yahoo.com> wrote:
> Hi,
> As mentioned during meeting, now that most of the bugs with rna types are fixed, I really think it's time to revisit my earlier proposal for metaclass based automatic registration.
> Here was the proposal: http://lists.blender.org/pipermail/bf-committers/2010-February/026328.html
> And here's the updated patch: http://blenderartists.org/~theeth/bf/register.patch
> Previous criticism was that it didn't handle running stuff from the text window (that's fixed now) and that it made debugging harder (during development, I added debug code that would spit out a list of all registered type, the module they came from (with complete back trace to declaration path), the order they were loaded in and so forth).
> Any other questions or objections, I'd be happy to discuss.
> Martin

Looks good, give useful backtraces and removes class list cruft,
you'll probably want to commit this patch yourself.

* would prefer not to have to subclass 2 types, but guess we cant get
around this, no big deal. eg.
class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):

* addons will need LoadModule() called from WM_OT_addon_enable, at the
moment they use the old style register.

* many addons will need updating, (heads up for Luca and Brendon!)

* perhaps we could make register/unregister optional class methods and
remove from the module, have to think about this, it would be annoying
if you didn't want to register a class but DID want to run
register/unregister functions though currently we don't do this AFAIK.

- Campbell

More information about the Bf-committers mailing list