Просмотр исходного кода

v0.11.22 fix color pallet mantis node

the mantis node was not using unique names
chaos and failure was the result
Joseph Brandenburg 11 месяцев назад
Родитель
Сommit
fa475423df
4 измененных файлов с 11 добавлено и 8 удалено
  1. 1 1
      __init__.py
  2. 1 1
      blender_manifest.toml
  3. 1 4
      misc_nodes.py
  4. 8 2
      ops_ui.py

+ 1 - 1
__init__.py

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

+ 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.21"
+version = "0.11.22"
 name = "Mantis"
 tagline = "Mantis is a rigging nodes toolkit"
 maintainer = "Nodespaghetti <josephbburg@protonmail.com>"

+ 1 - 4
misc_nodes.py

@@ -320,8 +320,7 @@ class InputThemeBoneColorSets(SimpleInputNode):
 class InputColorSetPallete(SimpleInputNode):
     '''A node representing the theme's colors'''
     def __init__(self, signature, base_tree):
-        super().__init__(signature, base_tree, MatrixFromCurveSockets)
-        self.init_parameters()
+        super().__init__(signature, base_tree)
         self.node_type = "UTILITY"
         # we'll go ahead and fill them here
         from .utilities import get_node_prototype
@@ -334,8 +333,6 @@ class InputColorSetPallete(SimpleInputNode):
         self.init_parameters()
         for o in ui_node.outputs:
             self.parameters[o.name] = o.default_value
-            prRed(o.name)
-            prPurple(o.default_value)
 
 class UtilityMatrixFromCurve(MantisNode):
     '''Get a matrix from a curve'''

+ 8 - 2
ops_ui.py

@@ -29,8 +29,14 @@ class ColorPalleteAddSocket(Operator):
     
     def execute(self, context):
         n = bpy.data.node_groups[self.tree_invoked].nodes[self.node_invoked]
-        # the name doesn't matter, will probably be Color Set.001 or something instead
-        n.outputs.new("ColorSetSocket", "Color Set")
+        #name them uniquely
+        number=0
+        for o in n.outputs:
+            if int(o.name[-3:]) == number:
+                number = int(o.name[-3:]) + 1
+            else: # my intention is to use the first number that isn't used
+                break # so break here because we have reached the end or a 'gap'
+        n.outputs.new("ColorSetSocket", "Color Set."+str(number).zfill(3))
         return {'FINISHED'}
 
 class ColorPalleteRemoveSocket(Operator):