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 | |
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')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 31 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 5 |
4 files changed, 34 insertions, 8 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2d9ab636642..89f9511688f 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -763,12 +763,12 @@ static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id) Object *ob= (Object *)owner_id; /* only consider if F-Curve involves pose.bones */ - if ((fcu->rna_path) && strstr(fcu->rna_path, "bones")) { + if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) { bPoseChannel *pchan; char *bone_name; /* get bone-name, and check if this bone is selected */ - bone_name= BLI_getQuotedStr(fcu->rna_path, "bones["); + bone_name= BLI_getQuotedStr(fcu->rna_path, "pose.bones["); pchan= get_pose_channel(ob->pose, bone_name); if (bone_name) MEM_freeN(bone_name); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 8ae0ebacff7..59200a2de55 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -507,7 +507,7 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna) PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier) { - if(identifier[0]=='[' && identifier[1]=='"') { + if(identifier[0]=='[' && identifier[1]=='"') { // " (dummy comment to avoid confusing some function lists in text editors) /* id prop lookup, not so common */ PropertyRNA *r_prop= NULL; PointerRNA r_ptr; /* only support single level props */ 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); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 97918556976..f3d36d60c23 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -925,6 +925,11 @@ static void rna_def_fcurve(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)"); + prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "grp"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX this is not editable for now, since editing this will easily break the visible hierarchy + RNA_def_property_ui_text(prop, "Group", "Action Group that this F-Curve belongs to."); + /* Path + Array Index */ prop= RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set"); |