Răsfoiți Sursa

Fix Vector Division

Joseph Brandenburg 3 luni în urmă
părinte
comite
d2a048a2b7
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      math_nodes.py

+ 3 - 1
math_nodes.py

@@ -137,7 +137,9 @@ class MathStaticVector(MantisNode):
         if self.evaluate_input("Operation") == "MULTIPLY":
         if self.evaluate_input("Operation") == "MULTIPLY":
             v_result = a*b
             v_result = a*b
         if self.evaluate_input("Operation") == "DIVIDE":
         if self.evaluate_input("Operation") == "DIVIDE":
-            v_result = a/b
+            v_result = Vector((0,0,0)) # channel-wise division
+            for i, (axis_a, axis_b) in enumerate(zip(a,b)):
+                v_result[i] = axis_a/axis_b
         if self.evaluate_input("Operation") == "POWER":
         if self.evaluate_input("Operation") == "POWER":
             v_result = a**b
             v_result = a**b
         # since these are unary, we need to make a copy lest we create spooky effects elsewhere.
         # since these are unary, we need to make a copy lest we create spooky effects elsewhere.