[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11165] trunk/blender/source/blender: Bugfix: 'Random' crashes after duplicating bones
Joshua Leung
aligorith at gmail.com
Wed Jul 4 09:07:13 CEST 2007
Revision: 11165
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11165
Author: aligorith
Date: 2007-07-04 09:07:12 +0200 (Wed, 04 Jul 2007)
Log Message:
-----------
Bugfix: 'Random' crashes after duplicating bones
This commit should fix some seemingly random crashes broken and I have been experiencing while editing armatures.
A backtrace revealed that autosave was choking on the PoseChannels that didn't have a Bone assigned to them. This was caused by the bone duplication code making a new PoseChannel for a duplicated bone, but that new bone not getting assigned to the PoseChannel yet, as the user was still in EditMode.
Modified Paths:
--------------
trunk/blender/source/blender/blenloader/intern/writefile.c
trunk/blender/source/blender/src/editarmature.c
Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c 2007-07-04 02:55:59 UTC (rev 11164)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c 2007-07-04 07:07:12 UTC (rev 11165)
@@ -767,21 +767,23 @@
static void write_pose(WriteData *wd, bPose *pose)
{
- bPoseChannel *chan;
+ bPoseChannel *chan;
/* Write each channel */
-
if (!pose)
return;
- // Write channels
+ /* Write channels */
for (chan=pose->chanbase.first; chan; chan=chan->next) {
write_constraints(wd, &chan->constraints);
- chan->selectflag= chan->bone->flag & (BONE_SELECTED|BONE_ACTIVE); // gets restored on read, for library armatures
+
+ /* prevent crashes with autosave, when a bone duplicated in editmode has not yet been assigned to its posechannel */
+ if (chan->bone)
+ chan->selectflag= chan->bone->flag & (BONE_SELECTED|BONE_ACTIVE); /* gets restored on read, for library armatures */
writestruct(wd, DATA, "bPoseChannel", 1, chan);
}
- // Write this pose
+ /* Write this pose */
writestruct(wd, DATA, "bPose", 1, pose);
}
Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c 2007-07-04 02:55:59 UTC (rev 11164)
+++ trunk/blender/source/blender/src/editarmature.c 2007-07-04 07:07:12 UTC (rev 11165)
@@ -1615,9 +1615,9 @@
if (!firstDup)
firstDup=eBone;
- /* Lets duplicate the list of constraits that the
- * current bone has.
- */
+ /* Lets duplicate the list of constraints that the
+ * current bone has.
+ */
if (OBACT->pose) {
bPoseChannel *chanold, *channew;
ListBase *listold, *listnew;
@@ -1625,7 +1625,10 @@
chanold = verify_pose_channel (OBACT->pose, curBone->name);
if (chanold) {
listold = &chanold->constraints;
- if (listold){
+ if (listold) {
+ /* 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(OBACT->pose, eBone->name);
if (channew) {
@@ -1646,7 +1649,6 @@
}
}
}
-
}
}
}
More information about the Bf-blender-cvs
mailing list