Forráskód Böngészése

Fix: move head/tail check to catch more errors

Head/Tail check is now done after the parent is set. Sometimes the bone's head is in
the same place as the tail because of a connected-parent moving the head of the
bone to the same place as the tail, this is caught by the check now.
Joseph Brandenburg 9 hónapja
szülő
commit
066954442b
1 módosított fájl, 3 hozzáadás és 8 törlés
  1. 3 8
      xForm_containers.py

+ 3 - 8
xForm_containers.py

@@ -443,21 +443,16 @@ class xFormBone:
         tailoffset = Vector((0,length,0)) #Vector((0,self.tailoffset, 0))
         tailoffset = matrix.copy().to_3x3() @ tailoffset
         eb.tail    = eb.head + tailoffset
-
-        if eb.head == eb.tail:
-            raise RuntimeError(wrapRed(f"Could not create edit bone: {name} because bone head was located in the same place as bone tail."))
-
-        
         if (eb.name != name):
             raise RuntimeError("Could not create edit bone: ", name)
         assert (eb.name), "Bone must have a name."
         self.bObject = eb.name
         # The bone should have relationships going in at this point.
         
-        assert (self.bObject), "eh? %s" % eb.name
-        
         self.bSetParent(eb)
-        
+
+        if eb.head == eb.tail:
+            raise RuntimeError(wrapRed(f"Could not create edit bone: {name} because bone head was located in the same place as bone tail."))
         
         # Setup Deform attributes...
         eb.use_deform            = self.evaluate_input("Deform")