diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-12 17:52:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-12 17:52:13 +0400 |
commit | 3497b2241e793764c2d57f7b26984957f2300d60 (patch) | |
tree | cff657183ce7fec560c361e05935f8fe435926db | |
parent | 004fa8e72973efab77a849fbd44bc46079b7e7aa (diff) |
Followup for r58992, fixing user decrement error
Some places like proxy rebuild didn't increent
custom shape user counter which lead to user
decrement errors later when freeing pose channels.
Try to keep custom object counter relevent, but
some corner cases might still be missing.
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 80e40efd1fb..bfef3542c45 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -613,7 +613,6 @@ void BKE_pose_channels_hash_free(bPose *pose) } } - void BKE_pose_channel_free(bPoseChannel *pchan) { if (pchan->custom) { @@ -731,6 +730,9 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f /* custom shape */ pchan->custom = pchan_from->custom; + if (pchan->custom) { + id_us_plus(&pchan->custom->id); + } } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d37ccae3089..eca607c08df 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1652,10 +1652,16 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected /* copy data in temp back over to the cleaned-out (but still allocated) original channel */ *pchan = pchanw; + if (pchan->custom) { + id_us_plus(&pchan->custom->id); + } } else { /* always copy custom shape */ pchan->custom = pchanp->custom; + if (pchan->custom) { + id_us_plus(&pchan->custom->id); + } if (pchanp->custom_tx) pchan->custom_tx = BKE_pose_channel_find_name(pose, pchanp->custom_tx->name); diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 40b96132699..e84008c3d15 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -487,6 +487,9 @@ static void pose_copy_menu(Scene *scene) break; case 8: /* Custom Bone Shape */ pchan->custom = pchanact->custom; + if (pchan->custom) { + id_us_plus(&pchan->custom->id); + } break; case 9: /* Visual Location */ BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc); |