Parcourir la source

cleanup Curve Pin & add locks

during this commit's development, I experimented with setting a parent on the curve pin. I decided against it... the curve pin is already sort of a child of
the curve, and setting the matrices is really tricky when parents are involved.
moreover, when i did it manually to test, I found no real benefit to setting the parents
perhaps it was even messing things up, it certainly complicates things.
Joseph Brandenburg il y a 6 mois
Parent
commit
e985f7290c
1 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. 10 5
      xForm_containers.py

+ 10 - 5
xForm_containers.py

@@ -899,6 +899,13 @@ class xFormCurvePin(MantisNode):
         ob = data.objects.get(self.evaluate_input("Name"))
         if not ob:
             ob = data.objects.new(self.evaluate_input("Name"), None)
+            ob.lock_location   = [True, True, True]
+            ob.lock_rotation   = [True, True, True]
+            ob.lock_scale      = [True, True, True]
+            ob.lock_rotation_w = True
+            ob.empty_display_type = 'CONE'
+            ob.empty_display_size = 0.10
+
         self.bObject = ob
         
         reset_object_data(ob)
@@ -936,12 +943,10 @@ class xFormCurvePin(MantisNode):
         # now if all goes well... the matrix will be correct.
         dg = bContext.view_layer.depsgraph
         dg.update()
-        # and the matrix should be correct now.
-        self.parameters['Matrix'] = ob.matrix_world
-        self.prepared = True
-    
-    def bExecute(self, bContext=None):
+        # and the matrix should be correct now - copy because it may be modified
+        self.parameters['Matrix'] = ob.matrix_world.copy() 
         print( wrapGreen("Created Curve Pin: ") + wrapOrange(self.bObject.name) )
+        self.prepared = True; self.executed = True
 
     def bFinalize(self, bContext = None):
         finish_drivers(self)