Procházet zdrojové kódy

UI: Bone Collection is now a multi-input socket

Joseph Brandenburg před 3 měsíci
rodič
revize
12e7f847e1
5 změnil soubory, kde provedl 21 přidání a 10 odebrání
  1. 1 1
      __init__.py
  2. 2 1
      base_definitions.py
  3. 1 1
      blender_manifest.toml
  4. 13 6
      xForm_containers.py
  5. 4 1
      xForm_definitions.py

+ 1 - 1
__init__.py

@@ -17,7 +17,7 @@ from .utilities import prRed
 
 MANTIS_VERSION_MAJOR=0
 MANTIS_VERSION_MINOR=11
-MANTIS_VERSION_SUB=17
+MANTIS_VERSION_SUB=18
 
 classLists = [module.TellClasses() for module in [
  link_definitions,

+ 2 - 1
base_definitions.py

@@ -604,7 +604,8 @@ SOCKETS_REMOVED=[("UtilityDriverVariable", "Transform Channel"),
                   # Node Class           #Prior bl_idname  # prior name # new bl_idname #       new name,          # Multi
 SOCKETS_RENAMED=[ ("LinkDrivenParameter", "DriverSocket",   "Driver",     "FloatSocket",        "Value",              False),
                   ("DeformerHook",        "IntSocket",      "Index",      "UnsignedIntSocket",  "Point Index",        False),
-                  ("SchemaConstOutput",   "IntSocket",      "Expose when N==",      "UnsignedIntSocket",  "Expose at Index", False)]
+                  ("SchemaConstOutput",   "IntSocket",      "Expose when N==",      "UnsignedIntSocket",  "Expose at Index", False),
+                  ("xFormBoneNode",   "BoneCollectionSocket",      "Bone Collection",      "BoneCollectionSocket",  "Bone Collection", True),]
 
                 # NODE CLASS NAME             IN_OUT    SOCKET TYPE     SOCKET NAME     INDEX   MULTI     DEFAULT
 SOCKETS_ADDED=[("DeformerMorphTargetDeform", 'INPUT', 'BooleanSocket', "Use Shape Key", 1,      False,    False),

+ 1 - 1
blender_manifest.toml

@@ -3,7 +3,7 @@ schema_version = "1.0.0"
 # Example of manifest file for a Blender extension
 # Change the values according to your extension
 id = "mantis"
-version = "0.11.17"
+version = "0.11.18"
 name = "Mantis"
 tagline = "Mantis is a rigging nodes toolkit"
 maintainer = "Nodespaghetti <josephbburg@protonmail.com>"

+ 13 - 6
xForm_containers.py

@@ -313,17 +313,24 @@ class xFormBone(xFormNode):
         #    Bone Collections are fully qualified by their hierarchy.
         #    Separate Strings with "|" and indicate hierarchy with ">". These are special characters.
         # NOTE: if the user names the collections differently at different times, this will take the FIRST definition and go with it
-        sCols = self.evaluate_input("Bone Collection")
-        bone_collections = sCols.split("|")
+        if self.inputs['Bone Collection'].links:
+            bCol_groups = []
+            for i, l in enumerate(self.inputs['Bone Collection'].links):
+                bCol_group = self.evaluate_input("Bone Collection", index=i)
+                bCol_groups.append(bCol_group)
+            bCols = '|'.join(bCol_groups)
+        else:
+            bCols = self.evaluate_input("Bone Collection")
+        bone_collections = bCols.split("|")
         for collection_list in bone_collections:
             hierarchy = collection_list.split(">")
             col_parent = None
-            for sCol in hierarchy:
-                if ( col := d.collections_all.get(sCol) ) is None:
-                    col = d.collections.new(sCol)
+            for bCol in hierarchy:
+                if ( col := d.collections_all.get(bCol) ) is None:
+                    col = d.collections.new(bCol)
                 col.parent = col_parent
                 col_parent = col
-            col.assign(eb)
+            d.collections_all.get(hierarchy[-1]).assign(eb)
         
         if (eb.name != name):
             prRed(f"Expected bone of name: {name}, got {eb.name} instead.")

+ 4 - 1
xForm_definitions.py

@@ -175,7 +175,10 @@ class xFormBoneNode(Node, xFormNode):
             s.hide = True
 
         for name, sock_type in display_names.items():
-            s = self.inputs.new(sock_type, name)
+            if name == 'Bone Collection': # HACK because I am not using Socket Templates yet
+                s = self.inputs.new(sock_type, name, use_multi_input=True)
+            else:
+                s = self.inputs.new(sock_type, name)
             if s.name in ['Custom Object', 'Bone Collection']:
                 continue
             s.hide = True