Przeglądaj źródła

fix: when adding drivers with deformer, ensure a duplicate is used

Joseph Brandenburg 6 miesięcy temu
rodzic
commit
c0755a57de
1 zmienionych plików z 11 dodań i 0 usunięć
  1. 11 0
      xForm_containers.py

+ 11 - 0
xForm_containers.py

@@ -670,6 +670,17 @@ class xFormGeometryObject(xFormNode):
         # NOW: find out if we need to duplicate the object data.
         dupe_data=False
         node_line = trace_single_line(self, "Deformer")[0]
+        from .deformer_containers import DeformerHook
+        for deformer in node_line:
+            if isinstance(deformer, DeformerHook) and  \
+               deformer.evaluate_input("Affect Curve Radius") == True and \
+               self.bObject.type == 'CURVE':
+                    print(f"INFO: Duplicating data {self.bObject.data.name} in {self} so it can be used for drivers.")
+                    dupe_data=True; break
+        if dupe_data:
+            name = self.bObject.data.name
+            self.bObject.data=self.bObject.data.copy()
+            self.bObject.data.name = name+"_MANTIS"
         reset_object_data(self.bObject)
         matrix= get_matrix(self)
         self.parameters['Matrix'] = matrix