diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-22 19:33:13 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-22 19:33:13 +0300 |
commit | f4e5addf938dd2b9397d943e0851337563f38495 (patch) | |
tree | 4028c610eddf6b40c0ad12049fc1a273a6d98d6e /source/blender/makesrna/intern/rna_pose.c | |
parent | 01bb474d4f6e1ed3936894417119ae0baac177a8 (diff) |
Bug fix, IRC, patch provided by Dan Eicher
Custom bone shape link/unlink now respects ID user counting.
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 3b0d3e1eb1e..51a44c027e4 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -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"); |