[Bf-blender-cvs] [e71fe924c55] master: Fix T71609: Resizing bone length to 0 gets it stuck to that size

Sybren A. Stüvel noreply at git.blender.org
Tue Dec 10 14:02:12 CET 2019


Commit: e71fe924c558f7115ac9cdd41d7c4668bc15d308
Author: Sybren A. Stüvel
Date:   Tue Dec 10 13:58:38 2019 +0100
Branches: master
https://developer.blender.org/rBe71fe924c558f7115ac9cdd41d7c4668bc15d308

Fix T71609: Resizing bone length to 0 gets it stuck to that size

The result of normalising the bone vector wasn't checked, so it resulted
in a zero-length vector being multiplied with the desired length. Choosing
an arbitrary vector prevents the bone being 'stuck' at zero length.

Thanks @mano-wii for the patch.

===================================================================

M	source/blender/makesrna/intern/rna_armature.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index b09a19bb39f..232f3d86fd3 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -497,7 +497,12 @@ static void rna_EditBone_length_set(PointerRNA *ptr, float length)
   float delta[3];
 
   sub_v3_v3v3(delta, ebone->tail, ebone->head);
-  normalize_v3(delta);
+  if (normalize_v3(delta) == 0.0f) {
+    /* Zero length means directional information is lost. Choose arbitrary direction to avoid
+     * getting stuck. */
+    delta[2] = 1.0f;
+  }
+
   madd_v3_v3v3fl(ebone->tail, ebone->head, delta, length);
 }



More information about the Bf-blender-cvs mailing list