Revision: 25459 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25459 Author: aligorith Date: 2009-12-18 04:47:57 +0100 (Fri, 18 Dec 2009)
Log Message: ----------- 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. Modified Paths: -------------- trunk/blender/source/blender/editors/animation/anim_filter.c trunk/blender/source/blender/makesrna/intern/rna_access.c trunk/blender/source/blender/makesrna/intern/rna_action.c trunk/blender/source/blender/makesrna/intern/rna_fcurve.c Modified: trunk/blender/source/blender/editors/animation/anim_filter.c =================================================================== --- trunk/blender/source/blender/editors/animation/anim_filter.c 2009-12-18 03:41:26 UTC (rev 25458) +++ trunk/blender/source/blender/editors/animation/anim_filter.c 2009-12-18 03:47:57 UTC (rev 25459) @@ -763,12 +763,12 @@ 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); Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-12-18 03:41:26 UTC (rev 25458) +++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-12-18 03:47:57 UTC (rev 25459) @@ -507,7 +507,7 @@ 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 */ Modified: trunk/blender/source/blender/makesrna/intern/rna_action.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_action.c 2009-12-18 03:41:26 UTC (rev 25458) +++ trunk/blender/source/blender/makesrna/intern/rna_action.c 2009-12-18 03:47:57 UTC (rev 25459) @@ -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 @@ 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); Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-12-18 03:41:26 UTC (rev 25458) +++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-12-18 03:47:57 UTC (rev 25459) @@ -925,6 +925,11 @@ 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"); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs