2.5 - Animation/RNA Bugfixes

* Settings for Bones can now be animated properly from UI
* Settings for constraints on bones and objects can now be keyframed properly
* Added missing 'subtarget' property wrapping for StretchTo constraint.
This commit is contained in:
Joshua Leung 2009-08-02 12:52:02 +00:00
parent c5f0be6d99
commit 1aa3885ef7
2 changed files with 27 additions and 1 deletions

@ -141,7 +141,21 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
static char *rna_Constraint_path(PointerRNA *ptr)
{
return BLI_sprintfN("constraints[%s]", ((bConstraint*)ptr->data)->name);
Object *ob= ptr->id.data;
bConstraint *con= ptr->data;
bPoseChannel *pchan= get_active_posechannel(ob);
ListBase *actlist= get_active_constraints(ob);
short inList = 0;
/* check if constraint is in the given list */
if (actlist)
inList= (BLI_findindex(actlist, con) != -1);
/* if constraint is in the list, the list is for the active bone... */
if ((inList) && (actlist != &ob->constraints) && (pchan))
return BLI_sprintfN("pose.pose_channels[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
else
return BLI_sprintfN("constraints[\"%s\"]", con->name);
}
static void rna_Constraint_update(bContext *C, PointerRNA *ptr)
@ -907,6 +921,11 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "subtarget");
RNA_def_property_ui_text(prop, "Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "volmode");
RNA_def_property_enum_items(prop, volume_items);

@ -58,6 +58,12 @@ static void rna_Pose_update(bContext *C, PointerRNA *ptr)
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
}
static char *rna_PoseChannel_path(PointerRNA *ptr)
{
// XXX do we really need the 'pose.' bit?
return BLI_sprintfN("pose.pose_channels[\"%s\"]", ((bPoseChannel*)ptr->data)->name);
}
static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
{
bActionGroup *grp= ptr->data;
@ -297,6 +303,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
srna= RNA_def_struct(brna, "PoseChannel", NULL);
RNA_def_struct_sdna(srna, "bPoseChannel");
RNA_def_struct_ui_text(srna, "Pose Channel", "Channel defining pose data for a bone in a Pose.");
RNA_def_struct_path_func(srna, "rna_PoseChannel_path");
RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties");
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);