Revision: 17139
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17139
Author: aligorith
Date: 2008-10-21 03:40:47 +0200 (Tue, 21 Oct 2008)
Log Message:
-----------
#17873: "switch direction" for bones can cause infinite loop
Second attempt at fixing this bug. Previous fix caused segfault when all bones
in a chain are selected. Now it should segments which are selected (i.e. get
swapped) will get unparented from segments that aren't (i.e. aren't swapped, so
are still in old orientation)
Modified Paths:
--------------
trunk/blender/source/blender/src/editarmature.c
Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c 2008-10-21 01:11:18 UTC
(rev 17138)
+++ trunk/blender/source/blender/src/editarmature.c 2008-10-21 01:40:47 UTC
(rev 17139)
@@ -3277,7 +3277,8 @@
EditBone *ebo, *child=NULL, *parent=NULL;
/* loop over bones in chain */
- for (ebo= chain->data; ebo; child= ebo, ebo=parent) {
+ for (ebo= chain->data; ebo;) {
+ /* parent is this bone's original parent (to go to next
if we swap) */
parent= ebo->parent;
/* only if selected and editable */
@@ -3297,13 +3298,29 @@
else
ebo->flag &= ~BONE_CONNECTED;
- child->parent = NULL;
- child->flag &= ~BONE_CONNECTED;
-
- /* FIXME: other things that need fixing?
- * i.e. roll?
+ /* get next bones
+ * - child will become the new parent of
next bone
+ * - next bone to go to will be the
original parent
*/
+ child= ebo;
+ ebo= parent;
}
+ else {
+ /* not swapping this bone, however, if its
'parent' got swapped, unparent us from it
+ * as it will be facing in opposite direction
+ */
+ if ((parent) && (EBONE_VISIBLE(arm, parent) &&
EBONE_EDITABLE(parent))) {
+ ebo->parent= NULL;
+ ebo->flag &= ~BONE_CONNECTED;
+ }
+
+ /* get next bones
+ * - child will become new parent of next
bone (not swapping occurred, so set to NULL to prevent infinite-loop)
+ * - next bone to go to will be the
original parent (no change)
+ */
+ child= NULL;
+ ebo= parent;
+ }
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs