1
0

3 Коміти 29437e0cad ... 4fd017ca30

Автор SHA1 Опис Дата
  Joseph Brandenburg 4fd017ca30 5.0 work around arror updating group node during startup 10 місяців тому
  Joseph Brandenburg e5a1d37223 Add Custom Interface Socket Types 11 місяців тому
  Joseph Brandenburg 29437e0cad Add Custom Interface Socket Types 11 місяців тому
6 змінених файлів з 22 додано та 17 видалено
  1. 2 2
      base_definitions.py
  2. 1 1
      blender_manifest.toml
  3. 2 2
      internal_nodes.py
  4. 5 5
      readtree.py
  5. 2 5
      utilities.py
  6. 10 2
      versioning.py

+ 2 - 2
base_definitions.py

@@ -82,8 +82,8 @@ def hash_tree(tree):
     return hash(hash_data)
 
 MANTIS_VERSION_MAJOR=0
-MANTIS_VERSION_MINOR=12
-MANTIS_VERSION_SUB=27
+MANTIS_VERSION_MINOR=13
+MANTIS_VERSION_SUB=0
 
 class MantisTree(NodeTree):
     '''A custom node tree type that will show up in the editor type list'''

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

+ 2 - 2
internal_nodes.py

@@ -61,13 +61,13 @@ class AutoGenNode(MantisNode):
 #   going in or out of the group and connecting back out the other side
 # this is also where caching and overlays live
 class GroupInterface(MantisNode):
-    def __init__(self, signature, base_tree, prototype, in_out):
+    def __init__(self, signature, base_tree, ui_node, in_out):
         super().__init__(signature, base_tree)
         self.node_type = 'UTILITY'
         self.prepared, self.executed = True, True; sockets = []
         self.in_out = in_out
         # init the sockets based on in/out, then set up traversal
-        collection = prototype.inputs if in_out == 'INPUT' else prototype.outputs
+        collection = ui_node.inputs if in_out == 'INPUT' else ui_node.outputs
         for socket in collection: sockets.append(socket.identifier)
         self.inputs.init_sockets(sockets); self.outputs.init_sockets(sockets)
         for socket in self.inputs.keys(): self.set_traverse( [(socket, socket)] )

+ 5 - 5
readtree.py

@@ -46,10 +46,10 @@ def grp_node_reroute_common(in_node, out_node, interface):
             out_link.die()
 
 def reroute_links_grp(group, all_nodes):
-    from .internal_containers import GroupInterface
+    from .internal_nodes import GroupInterface
     interface = GroupInterface(
         ( *group.signature, "InputInterface"),
-        group.base_tree, group.prototype, 'INPUT',)
+        group.base_tree, group.ui_node, 'INPUT',)
     all_nodes[interface.signature] = interface
     if group.inputs:
         if group_input := all_nodes.get(( *group.signature, "NodeGroupInput")):
@@ -59,10 +59,10 @@ def reroute_links_grp(group, all_nodes):
 
 def reroute_links_grpout(group_output, all_nodes):
     if (group := all_nodes.get( ( *group_output.signature[:-1],) )):
-        from .internal_containers import GroupInterface
+        from .internal_nodes import GroupInterface
         interface = GroupInterface(
             ( *group.signature, "OutputInterface"),
-            group.base_tree, group.prototype, 'OUTPUT',)
+            group.base_tree, group.ui_node, 'OUTPUT',)
         all_nodes[interface.signature] = interface
         grp_node_reroute_common(group_output, group, interface)
     else:
@@ -308,7 +308,7 @@ def insert_default_values_base_tree(base_tree, all_mantis_nodes):
     # we can get this by name because group inputs are gathered to the bl_idname
     InputNode = all_mantis_nodes.get((None, 'NodeGroupInput'))
     if InputNode is None: return # nothing to do here.
-    ui_node = InputNode.prototype
+    ui_node = InputNode.ui_node
 
     for i, output in enumerate(InputNode.outputs):
         ui_output = ui_node.outputs[i] # I need this for the error messages to make sense

+ 2 - 5
utilities.py

@@ -145,9 +145,7 @@ def get_socket_maps(node, force=False):
                     keep_sockets.append(other_socket)
                 map[sock.identifier]= keep_sockets
             elif hasattr(sock, "default_value"):
-                if getattr(sock, "default_value") is not None:
-                    val = getattr(sock, "default_value")
-                elif sock.bl_idname == "EnumCurveSocket" and sock.get("default_value") is None:
+                if sock.bl_idname == "EnumCurveSocket" and sock.get("default_value") is None:
                     # HACK I need to add this special case because during file-load,
                     #  this value is None and should not be altered until it is set once.
                     continue
@@ -253,8 +251,7 @@ def read_schema_type(interface_item):
     version = tree.mantis_version
     old_version = False
     if  version[0] == 0: 
-        if version[1] < 12: old_version = True
-        elif version[1] == 12 and version[2] < 27: old_version = True
+        if version[1] < 13: old_version = True
     # unfortunately we need to check this stuff for the versioning code to run correctly the first time.
     # UNLESS I can find a way to prevent this code from running before versioning
 

+ 10 - 2
versioning.py

@@ -315,10 +315,13 @@ def schema_enable_custom_interface_types(*args, **kwargs):
     current_minor_version = tree.mantis_version[1]
     current_sub_version = tree.mantis_version[2]
     if  current_major_version > 0: return# major version must be 0
-    if current_minor_version > 12: return# minor version must be 12 or less
-    if current_minor_version == 12 and current_sub_version > 27: return 
+    if current_minor_version >= 13: return# minor version must be 12 or less
     # we need to set the new interface values on the schema interface stuff
     prGreen(f"Updating Schema tree {tree.name} to support new, improved UI!")
+    tree.do_live_update = False
+    for n in tree.nodes:
+        if hasattr(n, "is_updating"):
+            n.is_updating = True
     try:
         for item in tree.interface.items_tree:
             if item.item_type == 'PANEL':
@@ -339,6 +342,11 @@ def schema_enable_custom_interface_types(*args, **kwargs):
     except Exception as e:
         prRed(f"Error updating version in tree: {tree.name}; see error:")
         print(e)
+    finally:
+        for n in tree.nodes:
+            if hasattr(n, "is_updating"):
+                n.is_updating = False
+        tree.do_live_update = True