Browse Source

initial versioning for new interface classes

Joseph Brandenburg 3 tuần trước cách đây
mục cha
commit
528ad8f836
3 tập tin đã thay đổi với 35 bổ sung4 xóa
  1. 1 2
      __init__.py
  2. 1 1
      blender_manifest.toml
  3. 33 1
      versioning.py

+ 1 - 2
__init__.py

@@ -18,7 +18,7 @@ from .utilities import prRed
 
 MANTIS_VERSION_MAJOR=0
 MANTIS_VERSION_MINOR=12
-MANTIS_VERSION_SUB=26
+MANTIS_VERSION_SUB=27
 
 classLists = [module.TellClasses() for module in [
  link_nodes_ui,
@@ -312,7 +312,6 @@ def version_update_handler(filename):
     for node_tree in bpy.data.node_groups: # ensure it can update again after file load.
         if node_tree.bl_idname in ["MantisTree", "SchemaTree"]:
                 node_tree.is_exporting=False; node_tree.is_executing=False
-
     for node_tree in bpy.data.node_groups:
         if node_tree.bl_idname in ["MantisTree", "SchemaTree"]:
             if (node_tree.mantis_version[0] < MANTIS_VERSION_MAJOR) or \

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

+ 33 - 1
versioning.py

@@ -220,7 +220,6 @@ def cleanup_4_5_0_LTS_interface_workaround(*args, **kwargs):
             interface_item.description = ''
     # that should be enough!
 
-
 def up_0_12_25_replace_floor_offset_type(*args, **kwargs):
     # add an inherit color input.
     node = kwargs['node']
@@ -244,6 +243,38 @@ def up_0_12_25_replace_floor_offset_type(*args, **kwargs):
         print(e)
 
 
+def schema_enable_custom_interface_types(*args, **kwargs):
+    tree = kwargs['tree']
+    current_major_version = tree.mantis_version[0]
+    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 
+    # 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!")
+    try:
+        for item in tree.interface.items_tree:
+            if item.item_type == 'PANEL':
+                continue
+            elif hasattr (item, 'is_array'):
+                if item.parent and item.parent.name == 'Array':
+                    item.is_array = True
+                # if is_array exists we're in the custom interface class
+                # so we'll assume the other attributes exist
+                if item.parent and item.parent.name == 'Connection':
+                    item.is_connection=True
+                    item.connected_to=item.name
+                    # since heretofore it has been a requirement that the names match
+    except Exception as e:
+        prRed(f"Error updating version in tree: {tree.name}; see error:")
+        print(e)
+            
+
+
+
+
+
 
 versioning_tasks = [
     # node bl_idname    task                required keyword arguments
@@ -253,6 +284,7 @@ versioning_tasks = [
     (['MantisTree', 'SchemaTree'], cleanup_4_5_0_LTS_interface_workaround, ['tree']),
     (['InputWidget'], up_0_12_13_add_widget_scale, ['node']),
     (['LinkFloor'], up_0_12_25_replace_floor_offset_type, ['node']),
+    (['SchemaTree'], schema_enable_custom_interface_types, ['tree']),
 ]