diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-26 22:08:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-26 22:08:56 +0300 |
commit | 5457ab4fc39fcb6047f37a0aee534cfba689b53f (patch) | |
tree | 86cb0906980107140ad2c02d6e81e2663d081da5 /source/blender/editors/armature | |
parent | 9d026b30e7fec37a90c7ab565d9522cc22e8b2de (diff) |
fixed a crash when duplicating bones with ID-Props
remove duplicate code from armature_duplicate_selected_exec
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 34a6000a7b8..f8aacd3112d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2573,7 +2573,7 @@ void updateDuplicateSubtarget(EditBone *dupBone, ListBase *editbones, Object *ob EditBone *duplicateEditBoneObjects(EditBone *curBone, char *name, ListBase *editbones, Object *src_ob, Object *dst_ob) { - EditBone *eBone = MEM_callocN(sizeof(EditBone), "addup_editbone"); + EditBone *eBone = MEM_mallocN(sizeof(EditBone), "addup_editbone"); /* Copy data from old bone to new bone */ memcpy(eBone, curBone, sizeof(EditBone)); @@ -2589,6 +2589,10 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, char *name, ListBase *edit unique_editbone_name(editbones, eBone->name, NULL); BLI_addtail(editbones, eBone); + /* copy the ID property */ + if(curBone->prop) + eBone->prop= IDP_CopyProperty(curBone->prop); + /* Lets duplicate the list of constraints that the * current bone has. */ @@ -2653,37 +2657,12 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) for (curBone=arm->edbo->first; curBone && curBone!=firstDup; curBone=curBone->next) { if (EBONE_VISIBLE(arm, curBone)) { if (curBone->flag & BONE_SELECTED) { - eBone=MEM_callocN(sizeof(EditBone), "addup_editbone"); - eBone->flag |= BONE_SELECTED; - - /* Copy data from old bone to new bone */ - memcpy(eBone, curBone, sizeof(EditBone)); - curBone->temp = eBone; - eBone->temp = curBone; + eBone= duplicateEditBone(curBone, curBone->name, arm->edbo, obedit); - unique_editbone_name(arm->edbo, eBone->name, NULL); - BLI_addtail(arm->edbo, eBone); if (!firstDup) firstDup=eBone; - /* Lets duplicate the list of constraints that the - * current bone has. - */ - if (obedit->pose) { - bPoseChannel *chanold, *channew; - - chanold = verify_pose_channel(obedit->pose, curBone->name); - if (chanold) { - /* WARNING: this creates a new posechannel, but there will not be an attached bone - * yet as the new bones created here are still 'EditBones' not 'Bones'. - */ - channew= verify_pose_channel(obedit->pose, eBone->name); - if(channew) { - duplicate_pose_channel_data(channew, chanold); - } - } - } } } } |