diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-12-18 06:47:57 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-12-18 06:47:57 +0300 |
commit | f6e82f71a56fa76bf58eeb7bd77f2d2748a2c9e4 (patch) | |
tree | 2a6107439f31d261e7392e062ed310b17fb0dff7 /source/blender/makesrna/intern/rna_action.c | |
parent | 273674a2cd9a2e3266fa79a92dc7736a776ac36a (diff) |
RNA wrapping of Action Groups:
Finished wrapping Action Groups in RNA to help debug some bugs showing up in the Animation Editors for some files from the Durian team. Access is strictly read-only for these added settings, given the trouble already caused by these problems.
Diffstat (limited to 'source/blender/makesrna/intern/rna_action.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4cb7080f05e..3f6729136d5 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -29,6 +29,7 @@ #include "rna_internal.h" +#include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_scene_types.h" @@ -39,6 +40,21 @@ #ifdef RNA_RUNTIME +static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter) +{ + ListBaseIterator *internal= iter->internal; + FCurve *fcu= (FCurve*)internal->link; + bActionGroup *grp= fcu->grp; + + /* only continue if the next F-Curve (if existant) belongs in the same group */ + if ((fcu->next) && (fcu->next->grp == grp)) + internal->link= (Link*)fcu->next; + else + internal->link= NULL; + + iter->valid= (internal->link != NULL); +} + #else static void rna_def_dopesheet(BlenderRNA *brna) @@ -167,13 +183,18 @@ static void rna_def_action_group(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); - /* dna warns not to treat the Action Channel listbase in the Action Group struct like a - normal listbase. I'll leave this here but comment out, for Joshua to review. He can - probably shed some more light on why this is */ - /*prop= RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); + /* WARNING: be very careful when working with this list, since the endpoint is not + * defined like a standard ListBase. Adding/removing channels from this list needs + * extreme care, otherwise the F-Curve list running through adjacent groups does + * not match up with the one stored in the Action, resulting in curves which do not + * show up in animation editors. For that reason, such operations are currently + * prohibited. + */ + prop= RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "channels", NULL); RNA_def_property_struct_type(prop, "FCurve"); - RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group.");*/ + RNA_def_property_collection_funcs(prop, 0, "rna_ActionGroup_channels_next", 0, 0, 0, 0, 0); + RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group."); prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_SELECTED); |