[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24930] trunk/blender/source/blender/ editors/armature/editarmature.c: fixed a crash when duplicating bones with ID-Props
Campbell Barton
ideasman42 at gmail.com
Thu Nov 26 20:08:57 CET 2009
Revision: 24930
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24930
Author: campbellbarton
Date: 2009-11-26 20:08:56 +0100 (Thu, 26 Nov 2009)
Log Message:
-----------
fixed a crash when duplicating bones with ID-Props
remove duplicate code from armature_duplicate_selected_exec
Modified Paths:
--------------
trunk/blender/source/blender/editors/armature/editarmature.c
Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c 2009-11-26 18:45:08 UTC (rev 24929)
+++ trunk/blender/source/blender/editors/armature/editarmature.c 2009-11-26 19:08:56 UTC (rev 24930)
@@ -2573,7 +2573,7 @@
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 @@
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 @@
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));
+ eBone= duplicateEditBone(curBone, curBone->name, arm->edbo, obedit);
- curBone->temp = eBone;
- eBone->temp = curBone;
-
- 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);
- }
- }
- }
}
}
}
More information about the Bf-blender-cvs
mailing list