diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-19 17:37:59 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-19 17:37:59 +0400 |
commit | adff6aeb1c749183921c0facd373972bbeb874b4 (patch) | |
tree | 07987d408713eee8a3dd8bb5cb4ecf3c112de654 /source/blender/editors/animation/anim_ipo_utils.c | |
parent | d880257d165888638b7c924fb6ef7071343b783e (diff) |
RNA: Generic Type Registration
The Python API to define Panels and Operators is based on subclassing,
this makes that system more generic, and based on RNA. Hopefully that
will make it easy to make various parts of Blender more extensible.
* The system simply uses RNA properties and functions and marks them
with REGISTER to make them part of the type registration process.
Additionally, the struct must provide a register/unregister callback
to create/free the PanelType or similar.
* From the python side there were some small changes, mainly that
registration now goes trough bpy.types.register instead of
bpy.ui.addPanel.
* Only Panels have been wrapped this way now. Check rna_ui.c to see
how this code works. There's still some rough edges and possibilities
to make it cleaner, though it works without any manual python code.
* Started some docs here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration
* Also changed some RNA_property and RNA_struct functions to not
require a PointerRNA anymore, where they were not required (which
is actually the cause of most changed files).
Diffstat (limited to 'source/blender/editors/animation/anim_ipo_utils.c')
-rw-r--r-- | source/blender/editors/animation/anim_ipo_utils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index ae0b8435635..4d4079a260a 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -135,19 +135,19 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu) /* for structname, we use a custom name if one is available */ // xxx we might want an icon from types? // xxx it is hard to differentiate between object and bone channels then, if ob + bone motion occur together... - nameprop= RNA_struct_name_property(&ptr); + nameprop= RNA_struct_name_property(ptr.type); if (nameprop) { /* this gets a string which will need to be freed */ structname= RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0); } else - structname= (char *)RNA_struct_ui_name(&ptr); + structname= (char *)RNA_struct_ui_name(ptr.type); /* Property Name is straightforward */ - propname= (char *)RNA_property_ui_name(&ptr, prop); + propname= (char *)RNA_property_ui_name(prop); /* Array Index - only if applicable */ - if (RNA_property_array_length(&ptr, prop)) { + if (RNA_property_array_length(prop)) { // XXX the format of these is not final... we don't know how this will go yet // format 1 style //static char *vectoritem[4]= {".X", ".Y", ".Z", ".W"}; @@ -158,8 +158,8 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu) static char *quatitem[4]= {"W ", "X ", "Y ", "Z "}; static char *coloritem[4]= {"R ", "G ", "B ", "A "}; - int tot= RNA_property_array_length(&ptr, prop); - int propsubtype= RNA_property_subtype(&ptr, prop); + int tot= RNA_property_array_length(prop); + int propsubtype= RNA_property_subtype(prop); /* get string to use for array index */ if ((tot == 4) && (propsubtype == PROP_ROTATION)) |