Bläddra i källkod

add new dataclasses for bone transforms

important: this does not implement the functionality of
the dataclasses or use them anywhere!!
That will come in future commits. It is kind of a big job.

the idea behind this change is to make matrix usage more consistent
for example by cleanly separating length from the matrix,
by adding metadata for e.g. space transforms

but most importantly the BBone dataclass helps us pack all the various
data from the BBone together
I'll add some methods to do bezier curve stuff, maybe.
it'll be nice and easy for the user, because all the BBone
data can be sent into the Bone as a bag of data

my goal is to make Bone nodes a bit more modular in the future
since graphs are kinda confusing right now
nodespaghetti 1 månad sedan
förälder
incheckning
cef56b4a5d
1 ändrade filer med 37 tillägg och 3 borttagningar
  1. 37 3
      mantis_dataclasses.py

+ 37 - 3
mantis_dataclasses.py

@@ -1,6 +1,5 @@
 from dataclasses import dataclass, field
-from typing import List, Any
-
+from typing import List, Any, Tuple
 
 @dataclass
 class MantisSocketTemplate():
@@ -44,4 +43,39 @@ class custom_prop_template():
     max : float|int = field(default=1)
     soft_min : float|int = field(default=1)
     soft_max : float|int = field(default=1)
-    description : str = field(default="")
+    description : str = field(default="")
+
+@dataclass
+class MantisBoneTransform():
+    matrix    : Any = field(default=[1,0,0,0,
+                                     0,1,0,0,
+                                     0,0,1,0,
+                                     0,0,0,1,]),
+    # I would like to have an intelligent way of handling
+    #  object- vs. world- space matrices
+    matrix_space  : str = field(default="OBJECT")
+    length    : float = field(default=1.0),
+
+@dataclass
+class MantisBBoneTransform():
+    num_bbone_segmetns: int = field(default=1)
+    # Offsets & Curve Handles
+    bbone_curveinx: float = field(default=0.0)
+    bbone_curveiny: float = field(default=0.0)
+    bbone_curveoutx: float = field(default=0.0)
+    bbone_curveouty: float = field(default=0.0)
+    # Easing
+    bbone_easein: float = field(default=1.0)
+    bbone_easeout: float = field(default=1.0)
+    # Roll
+    bbone_rollin: float = field(default=0.0)
+    bbone_rollout: float = field(default=0.0)
+    # Scale Vectors
+    bbone_scalein: Tuple[float, float, float] = field(
+        default_factory=lambda: (1.0, 1.0, 1.0) )
+    bbone_scaleout: Tuple[float, float, float] = field(
+        default_factory=lambda: (1.0, 1.0, 1.0) )
+    # Custom Handles
+    use_bbone_custom_handles: bool = field(default=False)
+    bbone_custom_handle_start: str = field(default=None)
+    bbone_custom_handle_end: str = field(default=None)