Bug fix, IRC, patch provided by Dan Eicher

Custom bone shape link/unlink now respects ID user counting.
This commit is contained in:
Ton Roosendaal
2010-12-22 16:33:13 +00:00
parent 01bb474d4f
commit f4e5addf93

View File

@@ -283,6 +283,21 @@ static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Itasc_update(bmain, scene, ptr);
}
static void rna_PoseChannel_bone_custom_set(PointerRNA *ptr, PointerRNA value)
{
bPoseChannel *pchan = (bPoseChannel*)ptr->data;
if (pchan->custom) {
id_us_min(&pchan->custom->id);
pchan->custom = NULL;
}
pchan->custom = value.data;
id_us_plus(&pchan->custom->id);
}
static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -956,6 +971,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "custom");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_bone_custom_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");