Explorar el Código

Cleanup: Move utility files into folder

Joseph Brandenburg hace 1 mes
padre
commit
52310a52c7

+ 4 - 4
__init__.py

@@ -8,13 +8,13 @@ from . import ( ops_nodegroup,
                 primitives_nodes_ui,
                 deformer_nodes_ui,
                 math_nodes_ui,
-                i_o,
                 schema_nodes_ui,
                 menu_classes,
               )
 from .ops_generate_tree import GenerateMantisTree
 
-from .utilities import prRed
+from .utilities import i_o
+from .utilities.utilities import prRed
 
 from .base_definitions import (MANTIS_VERSION_MAJOR,
                                MANTIS_VERSION_MINOR,
@@ -335,8 +335,8 @@ def autoload_components(filename):
     # this should not be blocking or slow!
     print("Auto-loading components")
     from os import path as os_path
-    from .utilities import get_component_library_items, get_default_collection
-    from .i_o import do_import
+    from .utilities.utilities import get_component_library_items, get_default_collection
+    from .utilities.i_o import do_import
     from .preferences import get_bl_addon_object
     import json
     from bpy import context, data

+ 19 - 11
base_definitions.py

@@ -5,12 +5,12 @@ from bpy.props import (BoolProperty, StringProperty, EnumProperty, CollectionPro
 from . import ops_nodegroup
 from bpy.types import NodeTree, Node, PropertyGroup, Operator, UIList, Panel
 
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
 
-from .utilities import get_socket_maps, relink_socket_map, do_relink
+from .utilities.utilities import get_socket_maps, relink_socket_map, do_relink
 from .mantis_dataclasses import MantisSocketTemplate
 
 FLOAT_EPSILON=0.0001 # used to check against floating point inaccuracy
@@ -47,7 +47,7 @@ def fix_reroute_colors(tree):
     if any((tree.is_executing, tree.is_exporting, tree.do_live_update==False, context.space_data is None) ):
         return
     from collections import deque
-    from .utilities import find_reroute_start_socket
+    from .utilities.utilities import find_reroute_start_socket
     from .socket_definitions import MantisSocket
     reroutes_without_color = deque()
     for n in tree.nodes:
@@ -113,6 +113,14 @@ class MantisTree(NodeTree):
 
     parsed_tree={}
 
+    # NOTE that these are class properties that should be serialized
+    #      to per-instance bpy properties when switching trees.
+    #      The class properties should, however, be associated to specific
+    #      trees by name so that the user can edit multiple trees at once.
+    # Selection Sync Dicts
+    node_to_object_map = {}
+    object_to_node_map = {}
+
     if (bpy.app.version < (4, 4, 0) or bpy.app.version >= (4,5,0)):  # in 4.4 this leads to a crash
         @classmethod
         def valid_socket_type(cls : NodeTree, socket_idname: str):
@@ -468,7 +476,7 @@ def node_group_update(node, force = False):
                 node.inputs.remove(remove_me.pop())
 
 
-        from .utilities import relink_socket_map_add_socket
+        from .utilities.utilities import relink_socket_map_add_socket
 
         reorder_me_input = []; input_index = 0
         reorder_me_output = []; output_index = 0
@@ -750,7 +758,7 @@ class MantisNode:
 
     @property
     def bl_idname(self): # this and the above exist solely to maintain interface w/bpy.types.Node
-        from .utilities import get_ui_node
+        from .utilities.utilities import get_ui_node
         return get_ui_node(self.ui_signature, self.base_tree).bl_idname
     
     def reset_execution(self) -> None:
@@ -871,7 +879,7 @@ class MantisNode:
             conn.reset_execution_recursive()
 
     def evaluate_input(self, input_name, index=0)  -> Any:
-        from .node_common import trace_single_line
+        from .utilities.node_common import trace_single_line
         if not (self.inputs.get(input_name)): # get the named parameter if there is no input
             return self.parameters.get(input_name) # this will return None if the parameter does not exist.
         # this trace() should give a key error if there is a problem
@@ -881,8 +889,8 @@ class MantisNode:
         return prop
 
     def fill_parameters(self, ui_node=None)  -> None:
-        from .utilities import get_ui_node
-        from .node_common import get_socket_value
+        from .utilities.utilities import get_ui_node
+        from .utilities.node_common import get_socket_value
         if not ui_node:
             if ( (self.signature[0] in  ["MANTIS_AUTOGENERATED", "SCHEMA_AUTOGENERATED" ]) or
                 (self.signature[-1] in ["NodeGroupOutput", "NodeGroupInput"]) ): # I think this is harmless
@@ -910,7 +918,7 @@ class MantisNode:
                 elif hasattr(node_socket, "default_value"):
                     if (value := get_socket_value(node_socket)) is not None:
                         if isinstance(value, str) and "$" in value:
-                            from .utilities import handle_overlay_detect
+                            from .utilities.utilities import handle_overlay_detect
                             value = handle_overlay_detect(self, node_socket.identifier, value)
                         self.parameters[key] = value
                     else:
@@ -924,7 +932,7 @@ class MantisNode:
            The first argument MUST be the name of the method as a string.
         """
         if args[0] == 'call_on_all_ancestors': raise RuntimeError("Very funny!")
-        from .utilities import get_all_dependencies
+        from .utilities.utilities import get_all_dependencies
         from collections import deque
         # get all dependencies by walking backward through the tree.
         all_dependencies = get_all_dependencies(self)
@@ -1072,7 +1080,7 @@ class NodeLink:
         self.to_socket = middle_node_in
         middle_node.outputs[middle_node_out].connect(to_node, to_socket)
         if re_init_hierarchy:
-            from .utilities import init_connections, init_dependencies
+            from .utilities.utilities import init_connections, init_dependencies
             init_connections(self.from_node)
             init_connections(middle_node)
             init_dependencies(middle_node)

+ 5 - 5
deformer_nodes.py

@@ -1,9 +1,9 @@
-from .node_common import *
+from .utilities.node_common import *
 from .xForm_nodes import xFormGeometryObject, xFormObjectInstance
 from .misc_nodes import InputExistingGeometryObject
 from .base_definitions import MantisNode
 from .mantis_dataclasses import MantisSocketTemplate
-from .utilities import (prRed, prGreen, prPurple, prWhite, prOrange,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite, prOrange,
                         wrapRed, wrapGreen, wrapPurple, wrapWhite,
                         wrapOrange,)
 
@@ -74,7 +74,7 @@ def standard_modifier_bind(self, bContext=None, operator=None):
         # we'll only bind it if it is un-muted.
         if self.evaluate_input("Enable in Viewport") == False:
             continue
-        from .utilities import bind_modifier_operator
+        from .utilities.utilities import bind_modifier_operator
         bind_modifier_operator(d, operator)
 
 class DeformerArmature(MantisDeformerNode):
@@ -366,7 +366,7 @@ class DeformerHook(MantisDeformerNode):
             ob=xf.bGetObject()
             if ob.type == 'CURVE':
                 spline_index = self.evaluate_input("Spline Index")
-                from .utilities import get_extracted_spline_object
+                from .utilities.utilities import get_extracted_spline_object
                 ob = get_extracted_spline_object(ob, spline_index, self.mContext)
             
             reuse = False
@@ -504,7 +504,7 @@ class DeformerMorphTargetDeform(MantisDeformerNode):
             return # nothing to do here.
         
         # at this point we make the node tree
-        from .geometry_node_graphgen import gen_morph_target_nodes
+        from .utilities.geometry_node_graphgen import gen_morph_target_nodes
         m, props_sockets = gen_morph_target_nodes(
                             self.evaluate_input("Name"),
                             xf.bGetObject(),

+ 2 - 2
deformer_nodes_ui.py

@@ -3,7 +3,7 @@ from bpy.types import NodeTree, Node, NodeSocket
 from .base_definitions import MantisUINode, DeformerNode, get_signature_from_edited_tree
 from.deformer_socket_templates import *
 
-from .utilities import (prRed, prGreen, prPurple, prWhite, prOrange,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite, prOrange,
                         wrapRed, wrapGreen, wrapPurple, wrapWhite,
                         wrapOrange,)
 
@@ -70,7 +70,7 @@ class DeformerHook(Node, DeformerNode):
             socket.hide=not is_curve_hook
 
 
-from .utilities import get_socket_maps, relink_socket_map
+from .utilities.utilities import get_socket_maps, relink_socket_map
 
 # TODO this should probably not be in this file but intstead in Utilities or something
 # NOTE this is a re-implementation that I had to do here.

+ 4 - 4
dev_helpers/visualize.py

@@ -3,7 +3,7 @@
 from bpy.types import Node, NodeTree, Operator
 from bpy.props import StringProperty
 
-from ..utilities import (prRed, prGreen, prPurple, prWhite,
+from ..utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -34,7 +34,7 @@ class MantisVisualizeNode(Node):
         return label
 
     def gen_data(self, mantis_node, mode='DEBUG_CONNECTIONS'):
-        from ..utilities import get_ui_node
+        from ..utilities.utilities import get_ui_node
         if mantis_node.node_type in ['SCHEMA', 'DUMMY']:
             np=None
         elif mantis_node.ui_signature is None:
@@ -134,7 +134,7 @@ def gen_vis_node( mantis_node,
 def visualize_tree(m_nodes, base_tree, context):
     # first create a MantisVisualizeTree
     from ..readtree import check_and_add_root
-    from ..utilities import trace_all_nodes_from_root
+    from ..utilities.utilities import trace_all_nodes_from_root
     import bpy
 
     base_tree.is_executing=True
@@ -228,7 +228,7 @@ class MantisVisualizeOutput(Operator):
 
     def execute(self, context):
         from time import time
-        from ..utilities import wrapGreen, prGreen
+        from ..utilities.utilities import wrapGreen, prGreen
 
         tree=context.space_data.path[0].node_tree
         tree.update_tree(context)

+ 1 - 1
drivers.py

@@ -1,4 +1,4 @@
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)

+ 1 - 1
internal_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from bpy.types import Node
 from .base_definitions import MantisNode, MantisSocketTemplate
 from uuid import uuid4

+ 4 - 4
link_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from bpy.types import Bone, NodeTree
 from .base_definitions import MantisNode, GraphError, FLOAT_EPSILON
 from .link_socket_templates import *
@@ -559,7 +559,7 @@ class LinkInverseKinematics(MantisLinkNode):
     # not very efficient but it's OK
     def set_pole_angle(self, constraint, angle: float) -> None:
         from math import pi
-        from .utilities import wrap
+        from .utilities.utilities import wrap
         constraint.pole_angle = wrap(-pi, pi, angle)
 
     def calc_pole_angle_pre(self, c, ik_bone):
@@ -592,7 +592,7 @@ class LinkInverseKinematics(MantisLinkNode):
         # this is the X-Axis of the bone's rest-pose, added to its bone
         knee_location = base_ik_bone.bone.matrix_local.col[0].xyz+start_effector
         ik_axis = (end_effector-start_effector).normalized()
-        from .utilities import project_point_to_plane
+        from .utilities.utilities import project_point_to_plane
         pole_planar_projection = project_point_to_plane(pole_location, start_effector, ik_axis)
         # this planar projection is necessary because the IK axis is different than the base_bone's y axis
         planar_projection = project_point_to_plane(knee_location, start_effector, ik_axis)
@@ -852,7 +852,7 @@ class LinkSplineIK(MantisLinkNode):
             for other_node in node_line: # trace and get the input
                 if other_node.node_type == 'XFORM':
                     proto_curve = other_node.bGetObject(); break
-            from .utilities import get_extracted_spline_object
+            from .utilities.utilities import get_extracted_spline_object
             curve = get_extracted_spline_object(proto_curve, spline_index, self.mContext)
             # link it to the view layer
             if (curve.name not in bContext.view_layer.active_layer_collection.collection.objects):

+ 1 - 1
link_nodes_ui.py

@@ -1,7 +1,7 @@
 import bpy
 from bpy.types import NodeTree, Node, NodeSocket
 from .base_definitions import LinkNode, GraphError
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)

+ 1 - 1
math_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from .base_definitions import MantisNode
 from .math_nodes_socket_templates import *
 

+ 1 - 1
math_nodes_ui.py

@@ -1,7 +1,7 @@
 import bpy
 from .base_definitions import MantisMathUINode
 from bpy.types import Node
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)

+ 1 - 1
menu_classes.py

@@ -83,7 +83,7 @@ class MantisAddArmature(Menu):
             components_path = bl_mantis_addon.preferences.ComponentsLibraryFolder
             # now we're clear to do the menu function
             layout = self.layout
-            from .utilities import get_component_library_items
+            from .utilities.utilities import get_component_library_items
             component_items = get_component_library_items()
             for component_item in component_items:
                 # how to "EXEC_DEFAULT" here?

+ 19 - 19
misc_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from .base_definitions import MantisNode, NodeSocket, FLOAT_EPSILON
 from .xForm_nodes import xFormArmature, xFormBone
 from .misc_nodes_socket_templates import *
@@ -93,7 +93,7 @@ def get_mesh_from_curve(curve_name : str, execution_id : str, bContext, ribbon=T
         from bpy import data
         curve = data.objects.get(curve_name)
         assert curve.type == 'CURVE', f"ERROR: object is not a curve: {curve_name}"
-        from .utilities import mesh_from_curve
+        from .utilities.utilities import mesh_from_curve
         curve_type='ribbon' if ribbon else 'wire'
         m_name = curve_name+'.'+str(hash(curve_name+'.'+curve_type+'.'+execution_id))
         if not (m := data.meshes.get(m_name)):
@@ -289,7 +289,7 @@ class InputThemeBoneColorSets(SimpleInputNode):
 
     def fill_parameters(self, ui_node=None):
         if not ui_node:
-            from .utilities import get_ui_node
+            from .utilities.utilities import get_ui_node
             ui_node = get_ui_node(self.ui_signature, self.base_tree)
         for i in range(20):
             self.parameters[f"Color {str(i).zfill(2)}"] = ui_node.outputs[i].default_value
@@ -302,7 +302,7 @@ class InputColorSetPallete(SimpleInputNode):
 
     def fill_parameters(self, ui_node=None):
         if not ui_node:
-            from .utilities import get_ui_node
+            from .utilities.utilities import get_ui_node
             ui_node = get_ui_node(self.ui_signature, self.base_tree)
         from .mantis_dataclasses import MantisSocketTemplate
         outputs = []
@@ -384,7 +384,7 @@ class UtilityMatrixFromCurve(MantisNode):
         else:
             if bContext is None: bContext = bpy.context # is this wise?
             m = get_mesh_from_curve(curve.name, self.base_tree.execution_id, bContext)
-            from .utilities import data_from_ribbon_mesh
+            from .utilities.utilities import data_from_ribbon_mesh
             #
             num_divisions = self.evaluate_input("Total Divisions")
             if num_divisions <= 0:
@@ -411,7 +411,7 @@ class UtilityMatrixFromCurve(MantisNode):
                 raise RuntimeError(f"Failed to read the curve {curve.name}.")
             normal=data[spline_index][2][0]
             # make sure the normal is perpendicular to the tail
-            from .utilities import make_perpendicular
+            from .utilities.utilities import make_perpendicular
             normal = make_perpendicular(axis, normal)
             mat = matrix_from_head_tail(head, tail, normal)
             # this is in world space... let's just convert it back
@@ -447,7 +447,7 @@ class UtilityPointFromCurve(MantisNode):
         else:
             if bContext is None: bContext = bpy.context # is this wise?
             m = get_mesh_from_curve(curve.name, self.base_tree.execution_id, bContext)
-            from .utilities import data_from_ribbon_mesh
+            from .utilities.utilities import data_from_ribbon_mesh
             #
             num_divisions = 1
             spline_index = self.evaluate_input("Spline Index")
@@ -488,7 +488,7 @@ class UtilityMatricesFromCurve(MantisNode):
         else:
             if bContext is None: bContext = bpy.context # is this wise?
             mesh = get_mesh_from_curve(curve.name, self.base_tree.execution_id, bContext)
-            from .utilities import data_from_ribbon_mesh
+            from .utilities.utilities import data_from_ribbon_mesh
             num_divisions = self.evaluate_input("Total Divisions")
             spline_index = self.evaluate_input("Spline Index")
             splines_factors = [ [] for i in range (spline_index)]
@@ -496,7 +496,7 @@ class UtilityMatricesFromCurve(MantisNode):
             splines_factors.append(factors)
             data = data_from_ribbon_mesh(mesh, splines_factors, curve.matrix_world)
             # [spline_index][points,tangents,normals][datapoint_index]
-            from .utilities import make_perpendicular
+            from .utilities.utilities import make_perpendicular
             matrices=[]
             for i in range(num_divisions):
                 if data[spline_index][1][i] < FLOAT_EPSILON: # radius is None:
@@ -577,7 +577,7 @@ class UtilityMatrixFromCurveSegment(MantisNode):
         else:
             if bContext is None: bContext = bpy.context # is this wise?
             m = get_mesh_from_curve(curve.name, self.base_tree.execution_id, bContext)
-            from .utilities import data_from_ribbon_mesh
+            from .utilities.utilities import data_from_ribbon_mesh
             # this section is dumb, but it is because the data_from_ribbon_mesh
             #  function is designed to pull data from many splines at once (for optimization)
             #  so we have to give it empty splines for each one we skip.
@@ -608,7 +608,7 @@ class UtilityMatrixFromCurveSegment(MantisNode):
             axis = (tail-head).normalized()
             normal=data[spline_index][2][segment_index]
             # make sure the normal is perpendicular to the tail
-            from .utilities import make_perpendicular
+            from .utilities.utilities import make_perpendicular
             normal = make_perpendicular(axis, normal)
             m = matrix_from_head_tail(head, tail, normal)
             m.translation = head - curve.location
@@ -663,7 +663,7 @@ class UtilityGetNearestFactorOnCurve(MantisNode):
                                     self.base_tree.execution_id,
                                     bContext, ribbon=False)
             # this is confusing but I am not re-writing these old functions
-            from .utilities import FindNearestPointOnWireMesh as nearest_point
+            from .utilities.utilities import FindNearestPointOnWireMesh as nearest_point
             spline_index = self.evaluate_input("Spline Index")
             ref_pt = self.evaluate_input("Reference Point")
             splines_points = [ [] for i in range (spline_index)]
@@ -1155,7 +1155,7 @@ class InputWidget(MantisNode):
         widgets_path = bl_mantis_addon.preferences.WidgetsLibraryFolder
         path = widgets_path+path # this guards the widgets root so the end-user
         #  can easily change the widgets directory without breaking things
-        from .utilities import get_default_collection
+        from .utilities.utilities import get_default_collection
         collection = get_default_collection(collection_type='WIDGET')
         file_name = os_path.split(path)[-1]
         obj_name = os_path.splitext(file_name)[0]
@@ -1181,7 +1181,7 @@ class InputWidget(MantisNode):
                 if len(self.bObject.modifiers) > 1 and self.bObject.modifiers[-1].name == "Simple Flip":
                     do_mirror=False
         else:
-            from .utilities import import_object_from_file
+            from .utilities.utilities import import_object_from_file
             self.bObject = import_object_from_file(path)
             if any(axes_flipped) or add_scale_modifier:
                 self.bObject = self.bObject.copy()
@@ -1193,7 +1193,7 @@ class InputWidget(MantisNode):
                 scale_modifier = self.bObject.modifiers.new("Scale Object Data", type='NODES')
             ng = data.node_groups.get("Scale Object Data")
             if ng is None:
-                from .geometry_node_graphgen import gen_scale_object_data_modifier
+                from .utilities.geometry_node_graphgen import gen_scale_object_data_modifier
                 ng = gen_scale_object_data_modifier()
             scale_modifier.node_group = ng
             scale_modifier['Socket_2']=scaling
@@ -1203,7 +1203,7 @@ class InputWidget(MantisNode):
                 flip_modifier = self.bObject.modifiers.new("Simple Flip", type="NODES")
             ng = data.node_groups.get("Simple Flip")
             if ng is None:
-                from .geometry_node_graphgen import gen_simple_flip_modifier
+                from .utilities.geometry_node_graphgen import gen_simple_flip_modifier
                 ng = gen_simple_flip_modifier()
             flip_modifier.node_group = ng
             # this changed at some point in Blender's versions ehhh
@@ -1280,7 +1280,7 @@ class UtilityDeclareCollections(MantisNode):
 
     def fill_parameters(self, ui_node=None):
         if ui_node is None:
-            from .utilities import get_ui_node
+            from .utilities.utilities import get_ui_node
             ui_node = get_ui_node(self.ui_signature, self.base_tree)
         templates=[]
         for out in ui_node.outputs:
@@ -1609,7 +1609,7 @@ class UtilityMatrixAlignRoll(MantisNode):
                                 " because the alignment vector is zero.")
         input=self.evaluate_input('Matrix').copy()
         y_axis= input.to_3x3().transposed()[1]
-        from .utilities import project_point_to_plane
+        from .utilities.utilities import project_point_to_plane
         projected=project_point_to_plane(
             align_axis.normalized(), Vector((0,0,0)), y_axis).normalized()
         # now that we have the projected vector, transform the points from
@@ -1684,7 +1684,7 @@ class UtilityArrayGet(MantisNode):
             oob   = self.evaluate_input("OoB Behaviour")
             index = self.evaluate_input("Index")
 
-            from .utilities import cap, wrap
+            from .utilities.utilities import cap, wrap
             # we must assume that the array has sent the correct number of links
             if oob == 'WRAP':
                 index = wrap(0, len(self.inputs['Array'].links), index)

+ 2 - 2
misc_nodes_ui.py

@@ -3,7 +3,7 @@ from bpy.types import Node
 from .base_definitions import MantisMiscNode, get_signature_from_edited_tree
 from .misc_nodes_socket_templates import *
 
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -578,7 +578,7 @@ class UtilityDeclareCollections(Node, MantisMiscNode):
     collection_declarations : bpy.props.StringProperty(default="")
 
     def update_interface(self):
-        from .utilities import get_socket_maps, do_relink
+        from .utilities.utilities import get_socket_maps, do_relink
         # we need to do dynamic stuff here like with interfaces
         socket_map_out = get_socket_maps(self)[1]
         self.outputs.clear()

+ 2 - 2
ops_generate_tree.py

@@ -1,6 +1,6 @@
 from bpy.types import Operator
 import bpy
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -1093,7 +1093,7 @@ class GenerateMantisTree(Operator):
                     print(s.getvalue())
             else:
                 do_generate_graph(context, node_tree, include_links_and_deforms =  self.include_links_and_deforms, generate_children=self.generate_children)
-            from .utilities import SugiyamaGraph
+            from .utilities.utilities import SugiyamaGraph
             try: # the graph gen code has selected the nodes to sort.
                 SugiyamaGraph(node_tree, 16)
             except ImportError: # if for some reason Sugiyama isn't available

+ 6 - 6
ops_nodegroup.py

@@ -2,7 +2,7 @@ import bpy
 from bpy.types import Operator
 from mathutils import Vector
 
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -50,7 +50,7 @@ class MantisGroupNodes(Operator):
             for path_item in context.space_data.path:
                 path_item.node_tree.is_exporting = True
 
-            from .i_o import export_to_json, do_import
+            from .utilities.i_o import export_to_json, do_import
             from random import random
             grp_name = "".join([chr(int(random()*30)+35) for i in range(20)])
             trees=[base_tree]
@@ -171,7 +171,7 @@ class MantisEditGroup(Operator):
                     active.is_updating = False
                 # call update to force the node group to check if its tree has changed
                 # now we need to loop through the tree and update all node groups of this type.
-                from .utilities import get_all_nodes_of_type
+                from .utilities.utilities import get_all_nodes_of_type
                 for g in get_all_nodes_of_type(base_tree, "MantisNodeGroup") + \
                          get_all_nodes_of_type(base_tree, "MantisSchemaGroup"):
                     if g.node_tree == active.node_tree:
@@ -273,7 +273,7 @@ class ExecuteNodeTree(Operator):
 
     def execute(self, context):
         from time import time
-        from .utilities import wrapGreen
+        from .utilities.utilities import wrapGreen
 
         tree=context.space_data.path[0].node_tree
 
@@ -494,7 +494,7 @@ class CleanUpNodeGraph(bpy.types.Operator):
 
     def execute(self, context):
         base_tree=context.space_data.path[-1].node_tree
-        from .utilities import SugiyamaGraph
+        from .utilities.utilities import SugiyamaGraph
         SugiyamaGraph(base_tree, 12)
         return {'FINISHED'}
 
@@ -992,7 +992,7 @@ class ConvertBezierCurveToNURBS(Operator):
         return (context.active_object is not None) and (context.active_object.type=='CURVE')
 
     def execute(self, context):
-        from .utilities import nurbs_copy_bez_spline
+        from .utilities.utilities import nurbs_copy_bez_spline
         curve = context.active_object
         bez=[]
         for spl in curve.data.splines:

+ 1 - 1
ops_ui.py

@@ -3,7 +3,7 @@
 
 import bpy
 from bpy.types import Operator
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)

+ 1 - 1
primitives_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from .base_definitions import MantisNode, NodeSocket
 
 def TellClasses():

+ 11 - 11
readtree.py

@@ -1,4 +1,4 @@
-from .utilities import prRed, prGreen, prPurple, prWhite, prOrange, \
+from .utilities.utilities import prRed, prGreen, prPurple, prWhite, prOrange, \
                         wrapRed, wrapGreen, wrapPurple, wrapWhite, wrapOrange
 
 
@@ -75,7 +75,7 @@ def insert_lazy_parents(mantis_node):
     from .link_nodes import LinkInherit
     inherit_node = None
     if mantis_node.inputs["Relationship"].is_connected:
-        from .node_common import trace_single_line
+        from .utilities.node_common import trace_single_line
         node_line, last_socket = trace_single_line(mantis_node, 'Relationship')
         # if last_socket is from a valid XFORM, it is the relationship in
         # because it was traversed from the xForm Out... so get the traverse target.
@@ -133,7 +133,7 @@ def make_connections_to_ng_dummy(base_tree, tree_path_names, local_mantis_nodes,
             #  using UUID signature leads to TERRIBLE CONFUSING BUGS.
             if from_mantis_node is None: 
                 from_mantis_node = autogen_node(base_tree, inp, signature, to_mantis_node.mContext)
-            from .node_common import get_socket_value
+            from .utilities.node_common import get_socket_value
             if from_mantis_node: # autogen can fail and we should catch it.
                 from_mantis_node.parameters = {inp.name:get_socket_value(inp)}
                 local_mantis_nodes[signature] = from_mantis_node; all_mantis_nodes[signature] = from_mantis_node
@@ -196,11 +196,11 @@ def data_from_tree(base_tree, tree_path, mContext, dummy_nodes, all_mantis_nodes
         current_tree = base_tree
     #
     if current_tree: # the node-group may not have a tree set - if so, ignore it.
-        from .utilities import clear_reroutes
+        from .utilities.utilities import clear_reroutes
         links = clear_reroutes(list(current_tree.links))
         gen_mantis_nodes(base_tree, current_tree, tree_path_names, mContext, all_mantis_nodes, local_mantis_nodes, dummy_nodes, group_nodes, all_schema)
 
-        from .utilities import link_mantis_nodes
+        from .utilities.utilities import link_mantis_nodes
         for link in links:
             link_mantis_nodes((None, *tree_path_names), link, local_mantis_nodes)
         if current_tree == base_tree:
@@ -216,7 +216,7 @@ forbidden_key_names = ["",]
 forbidden_in_key_name = ['$',]
 def node_scan_overlays(node, socket_id,):
     interface_nodes = node.mContext.interface_nodes
-    from .utilities import get_ui_node
+    from .utilities.utilities import get_ui_node
     ui_node = get_ui_node(node.ui_signature, node.base_tree)
     # we'll assume that the overlay tag system checked if this is linked.
     # First let's check if it is a simple input node, by checking outputs that are marked "input"
@@ -296,7 +296,7 @@ def node_scan_overlays(node, socket_id,):
     node.parameters[socket_id] = result
     return result # because sometimes I need to get the result, too
 
-from .utilities import check_and_add_root, init_connections, init_dependencies, init_schema_dependencies
+from .utilities.utilities import check_and_add_root, init_connections, init_dependencies, init_schema_dependencies
 
 def is_signature_in_other_signature(parent_signature, child_signature):
     # If the other signature is shorter, it isn't a child node
@@ -305,7 +305,7 @@ def is_signature_in_other_signature(parent_signature, child_signature):
     return parent_signature[0:] == child_signature[:len(parent_signature)]
 
 def solve_schema_to_tree(mantis_node, all_mantis_nodes, roots=[], error_popups=False):
-    from .utilities import get_ui_node
+    from .utilities.utilities import get_ui_node
     np = get_ui_node(mantis_node.signature, mantis_node.base_tree)
     from .schema_solve import SchemaSolver
     solver = SchemaSolver(mantis_node, all_mantis_nodes.copy(), np, error_popups=error_popups)
@@ -347,7 +347,7 @@ schema_bl_idnames = [   "SchemaIndex",
                         "SchemaIncomingConnection",
                     ]
 
-from .utilities import get_all_dependencies
+from .utilities.utilities import get_all_dependencies
 def get_schema_length_dependencies(node, all_nodes={}):
     """ Get a list of all dependencies for the given node's length or array properties.
         This function will also recursively search for dependencies in its sub-trees.
@@ -606,7 +606,7 @@ def parse_tree(base_tree, error_popups=False):
     prWhite("Number of Nodes: %s" % (len(kept_mantis_node)))
     return kept_mantis_node
 
-from .utilities import switch_mode
+from .utilities.utilities import switch_mode
 
 def execution_error_cleanup(node, exception, switch_objects = [], show_error=False ):
     from bpy import  context
@@ -644,7 +644,7 @@ def execution_error_cleanup(node, exception, switch_objects = [], show_error=Fal
     return exception
 
 def sort_execution(nodes):
-    from .node_common import GraphError
+    from .utilities.node_common import GraphError
     from collections import deque
     xForm_pass = deque()
     execution_failed = False

+ 2 - 2
schema_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from math import pi, tau
 from .base_definitions import MantisNode
 
@@ -18,7 +18,7 @@ def TellClasses():
     ]
 
 def schema_init_sockets(mantis_node, is_input = True, in_out='INPUT', category=''):
-    from .utilities import tree_from_mantis_node, read_schema_type
+    from .utilities.utilities import tree_from_mantis_node, read_schema_type
     parent_tree = tree_from_mantis_node(mantis_node.signature, mantis_node.base_tree)
     if is_input:
         sockets=mantis_node.inputs

+ 2 - 2
schema_nodes_ui.py

@@ -1,13 +1,13 @@
 import bpy
 from .base_definitions import SchemaUINode
 from bpy.types import Node
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
 from bpy.props import BoolProperty
 
-from .utilities import (get_socket_maps, relink_socket_map,
+from .utilities.utilities import (get_socket_maps, relink_socket_map,
                         do_relink, read_schema_type)
 
 from .schema_nodes_socket_templates import *

+ 7 - 7
schema_solve.py

@@ -1,11 +1,11 @@
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
-from .utilities import init_connections, init_dependencies, get_link_in_out
+from .utilities.utilities import init_connections, init_dependencies, get_link_in_out
 from .base_definitions import (SchemaUINode, custom_props_types, \
     MantisNodeGroup, SchemaGroup, replace_types, GraphError, links_sort_key)
-from .node_common import setup_custom_props_from_np
+from .utilities.node_common import setup_custom_props_from_np
 # a class that solves Schema nodes
 from bpy.types import NodeGroupInput, NodeGroupOutput
 
@@ -101,7 +101,7 @@ class SchemaSolver:
         """ Sort and store the links to/from the Schema group node."""
         for item in self.tree.interface.items_tree:
             if item.item_type == 'PANEL': continue
-            from .utilities import read_schema_type
+            from .utilities.utilities import read_schema_type
             parent_name = read_schema_type(item)
             # just gonna try and make the 
             match parent_name:
@@ -314,7 +314,7 @@ class SchemaSolver:
         from collections import deque
         unprepared = deque(from_node.hierarchy_dependencies)
         self.prepare_nodes(unprepared)
-        from .utilities import cap, wrap
+        from .utilities.utilities import cap, wrap
         get_index = from_node.evaluate_input("Index", self.index) # get the most recent link
         # getting the link at self.index just saves the trouble of killing the old links
         # that are left because this node is reused in each iteration of the schema
@@ -571,7 +571,7 @@ class SchemaSolver:
                                         SchemaConstOutput,
                                         SchemaOutgoingConnection,
                                         SchemaIncomingConnection,)
-        from .utilities import clear_reroutes, link_mantis_nodes
+        from .utilities.utilities import clear_reroutes, link_mantis_nodes
         from .base_definitions import array_output_types
         self.set_index_strings()
         frame_mantis_nodes = {}
@@ -660,7 +660,7 @@ class SchemaSolver:
                     {}, # just pass an empty dict, this argument is not needed in this context
                     self.all_nodes,
                     node)
-                from .utilities import init_schema_dependencies
+                from .utilities.utilities import init_schema_dependencies
                 init_schema_dependencies(node, self.all_nodes)
             else:
                 init_dependencies(node) # it is hard to overstate how important this single line of code is

+ 2 - 2
socket_definitions.py

@@ -47,7 +47,7 @@ else:
 
 
 
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -493,7 +493,7 @@ def default_update(ui_socket, context, do_execute=True):
         node_tree.update_tree(context, force=True)
     elif hasattr(ui_socket, 'default_value'):
         # we may not have to regenerate the tree; try and update the socket
-        from .utilities import tree_from_mantis_node
+        from .utilities.utilities import tree_from_mantis_node
         for mantis_node in node_tree.parsed_tree.values():
             # check to see if the mantis node is in the same ui-tree as this ui_socket
             if mantis_node.ui_signature is None: continue # autogenerated nodes

+ 1 - 1
timers.py

@@ -1,4 +1,4 @@
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)

+ 0 - 0
geometry_node_graphgen.py → utilities/geometry_node_graphgen.py


+ 5 - 5
i_o.py → utilities/i_o.py

@@ -194,7 +194,7 @@ def scan_tree_dependencies(base_tree, curves:set, armatures:set, ):
     for mantis_node in nodes.values():
         mantis_node.reset_execution()
         check_and_add_root(mantis_node, xForm_pass)
-    from .readtree import sort_execution
+    from ..readtree import sort_execution
     from .utilities import get_ui_node
     sorted_nodes, execution_failed = sort_execution(nodes, xForm_pass)
     if execution_failed:
@@ -400,7 +400,7 @@ def get_socket_data(socket, ignore_if_default=False):
 def get_node_data(ui_node):
     # if this is a node-group, force it to update its interface, because it may be messed up.
     # can remove this HACK when I have stronger guarentees about node-group's keeping the interface
-    from .base_definitions import node_group_update
+    from ..base_definitions import node_group_update
     if hasattr(ui_node, "node_tree"):
         ui_node.is_updating = True
         try: # HERE BE DANGER
@@ -482,7 +482,7 @@ def get_interface_data(tree, tree_in_out):
             # we need to get the socket class from the bl_idname
             bl_socket_idname = sock.bl_socket_idname
             # try and import it
-            from . import socket_definitions
+            from .. import socket_definitions
             # some mistakes in versioning makes it possible for older trees to have
             # standard Blender types instead of Mantis types
             if bl_socket_idname == 'NodeSocketFloat':
@@ -1006,7 +1006,7 @@ def do_import(data, context, search_multi_files=False, filepath='', skip_existin
                 if bpy.app.version != (4,5,0):
                     sock = tree.interface.new_socket(s_props["name"], in_out=s_props["in_out"], socket_type=socket_type)
                 else: # blender 4.5.0 LTS, have to workaround a bug!
-                    from .versioning import workaround_4_5_0_interface_update
+                    from ..versioning import workaround_4_5_0_interface_update
                     sock = workaround_4_5_0_interface_update(tree=tree, name=s_props["name"], in_out=s_props["in_out"],
                                                             sock_type=socket_type, parent_name=s_props.get("parent", ''))
 
@@ -1115,7 +1115,7 @@ def do_import(data, context, search_multi_files=False, filepath='', skip_existin
                         raise RuntimeError(f"Tree {sub_tree} not available to import.")
 
                 n.node_tree = grp_tree
-                from .base_definitions import node_group_update
+                from ..base_definitions import node_group_update
                 n.is_updating = True
                 try:
                     node_group_update(n, force = True)

+ 5 - 5
node_common.py → utilities/node_common.py

@@ -2,7 +2,7 @@ from .utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
-from .base_definitions import GraphError, NodeSocket, MantisNode
+from ..base_definitions import GraphError, NodeSocket, MantisNode
 from collections.abc import Callable
 # BE VERY CAREFUL
 # the x_containers files import * from this file
@@ -90,7 +90,7 @@ def trace_line_up_branching(mantis_node : MantisNode, output_name : str,
 # this function exists to walk back to the first ancestor node of XFORM or LINK without
 #  breaking the traverse behaviour which I still need for various reasons.
 def get_parent_xForm_info(mantis_node, socket_name = 'Relationship'):
-    from .mantis_dataclasses import xForm_info
+    from ..mantis_dataclasses import xForm_info
     # we re-implement the trace logic here for performance.
     # because this kind of connection has traversal (for Links to find their children), we must
     # simply seek back to the first available xForm or Link and get its xForm info.\
@@ -122,7 +122,7 @@ def get_parent_xForm_info(mantis_node, socket_name = 'Relationship'):
 def setup_custom_property_inputs_outputs(mantis_node):
     from .utilities import get_ui_node
     if mantis_node.signature[0] == 'SCHEMA_AUTOGENERATED':
-        from .base_definitions import custom_props_types
+        from ..base_definitions import custom_props_types
         if mantis_node.__class__.__name__ not in custom_props_types:
             # prRed(f"Reminder: figure out how to deal with custom property setting for Schema Node {mantis_node}")
             raise RuntimeError(wrapRed(f"Custom Properties not allowed for class {mantis_node.__class__.__name__}"))
@@ -246,7 +246,7 @@ def evaluate_sockets(mantis_node, b_object, props_sockets,):
                             # prGreen("Doing the thing")
                             for val_index, value in enumerate(mantis_node.evaluate_input(sock)):
                                 # assume this will work, both because val should have the right number of elements, and because this should be the right data type.
-                                from .drivers import MantisDriver
+                                from ..drivers import MantisDriver
                                 if isinstance(value, MantisDriver):
                                     getattr(b_object,prop)[val_index] =  default[val_index]
                                     print("Adding driver %s to %s in %s" % (wrapPurple(prop), wrapWhite(mantis_node.signature[-1]), mantis_node))
@@ -330,5 +330,5 @@ def finish_drivers(mantis_node):
                     drivers.append(finish_driver(mantis_node, b_object, (driver_item, sub_item[1]), sub_item[0]))
             else:
                 drivers.append(finish_driver(mantis_node, b_object, driver_item, prop))
-    from .drivers import CreateDrivers
+    from ..drivers import CreateDrivers
     CreateDrivers(drivers)

+ 14 - 14
utilities.py → utilities/utilities.py

@@ -56,7 +56,7 @@ def find_reroute_start_socket(reroute, track='BACK'):
 # this creates fake links that have the same interface as Blender's
 # so that I can bypass Reroutes
 def clear_reroutes(links):
-    from .base_definitions import DummyLink
+    from ..base_definitions import DummyLink
     kept_links, rerouted_starts = [], []
     rerouted = []
     all_links = links.copy()
@@ -152,7 +152,7 @@ def get_socket_maps(node, force=False):
                     continue
                 map[sock.identifier]=val
             else:
-                from .socket_definitions import no_default_value
+                from ..socket_definitions import no_default_value
                 if sock.bl_idname in no_default_value:
                     map[sock.identifier]=None
                 else:
@@ -185,7 +185,7 @@ def do_relink(node, socket, map, in_out='INPUT', parent_name = ''):
     from bpy.types import NodeSocket, Node
     get_string = '__extend__'
     if socket: get_string = socket.identifier
-    from .base_definitions import SchemaUINode
+    from ..base_definitions import SchemaUINode
     if (hasattr(node, "node_tree") or isinstance(node, SchemaUINode)) and get_string not in map.keys():
         # this happens when we are creating a new node group and need to update it from nothing.
         return
@@ -303,7 +303,7 @@ def update_interface(interface, name, in_out, sock_type, parent_name):
         if bpy_version != (4,5,0):
             socket = interface.new_socket(name=name,in_out=in_out, socket_type=sock_type, parent=interface_parent)
         else: # blender 4.5.0 LTS, have to workaround a bug!
-            from .versioning import workaround_4_5_0_interface_update
+            from ..versioning import workaround_4_5_0_interface_update
             socket = workaround_4_5_0_interface_update(tree=interface.id_data, name=name, in_out=in_out,
                                                        sock_type=sock_type, parent_name=parent_name, do_parent=True)
         if parent_name == 'Connection':
@@ -325,7 +325,7 @@ def relink_socket_map_add_socket(node, socket_collection, item,  in_out=None,):
     # have to work around a bug in 4.5.0 that prevents me from declaring custom socket types
     # I have arbitrarily chosen to use the NodeSocketGeometry type to signal that this one is affected.
     if bpy_version == (4, 5, 0) and item.bl_socket_idname == 'NodeSocketGeometry':
-        from .versioning import socket_add_workaround_for_4_5_0_LTS
+        from ..versioning import socket_add_workaround_for_4_5_0_LTS
         s = socket_add_workaround_for_4_5_0_LTS(item, socket_collection, multi)
     else:
         s = socket_collection.new(type=item.bl_socket_idname, name=item.name, identifier=item.identifier,  use_multi_input=multi)
@@ -421,7 +421,7 @@ def bind_modifier_operator(modifier, operator):
             operator(modifier=modifier.name)
 
 def get_default_collection(collection_type='WIDGET'):
-    from .preferences import get_bl_addon_object
+    from ..preferences import get_bl_addon_object
     from bpy import data, context
     mantis_addon = get_bl_addon_object(raise_error=True)
     match collection_type:
@@ -599,7 +599,7 @@ def import_curve_data_to_object(curve_name, curve_data):
 
 def get_component_library_items(path='ADD_ARMATURE'):
     from os import path as os_path
-    from .preferences import get_bl_addon_object
+    from ..preferences import get_bl_addon_object
     bl_mantis_addon = get_bl_addon_object()
     return_value=[]
     if bl_mantis_addon:
@@ -651,7 +651,7 @@ def init_dependencies(mantis_node):
 
 def schema_dependency_handle_item(schema, all_mantis_nodes, item,):
     hierarchy = True
-    from .base_definitions import from_name_filter, to_name_filter
+    from ..base_definitions import from_name_filter, to_name_filter
     if item.in_out == 'INPUT':
         dependencies = schema.dependencies
         hierarchy_dependencies = schema.hierarchy_dependencies
@@ -725,7 +725,7 @@ def check_and_add_root(n, roots, include_non_hierarchy=False):
     roots.append(n)
 
 def get_link_in_out(link):
-    from .base_definitions import replace_types
+    from ..base_definitions import replace_types
     from_name, to_name = link.from_socket.node.name, link.to_socket.node.name
     # catch special bl_idnames and bunch the connections up
     if link.from_socket.node.bl_idname in replace_types:
@@ -772,7 +772,7 @@ def link_mantis_nodes(tree_path_names, link, local_mantis_nodes, from_suffix='',
         raise RuntimeError(wrapRed(f"Link not connected: {from_mantis_node} -> {to_mantis_node} in tree" ))
     
 def get_all_dependencies(mantis_node):
-    from .base_definitions import GraphError
+    from ..base_definitions import GraphError
     """ find all dependencies for a mantis node"""
     nodes = []
     check_nodes = [mantis_node]
@@ -801,7 +801,7 @@ def get_all_nodes_of_type(base_tree, bl_idname):
     return nodes
 
 def trace_all_nodes_from_root(root, nodes):
-    from .base_definitions import GraphError
+    from ..base_definitions import GraphError
     """ find all dependencies for a mantis node"""
     nodes.add(root); check_nodes = [root]
     nodes_checked = set()
@@ -971,7 +971,7 @@ def handle_overlay_detect(node, socket_id, value) -> str:
 ####################################
 
 def make_perpendicular(v1, v2):
-    from .base_definitions import FLOAT_EPSILON
+    from ..base_definitions import FLOAT_EPSILON
     if (v1.length_squared < FLOAT_EPSILON) or (v2.length_squared < FLOAT_EPSILON):
         raise RuntimeError("Cannot generate perpendicular vetor for zero-length vector")
     projected = (v2.dot(v1) / v1.dot(v1)) * v1
@@ -1042,7 +1042,7 @@ def bind_extracted_spline_to_curve(new_ob, curve):
     # now, weirdly enough - we can't use parenting very easily because Blender
     # defines the parent on a curve relative to the evaluated path animation
     # Setting the inverse matrix is too much work. Use Copy Transforms instead.
-    from .xForm_nodes import reset_object_data
+    from ..xForm_nodes import reset_object_data
     reset_object_data(new_ob)
     c = new_ob.constraints.new("COPY_TRANSFORMS"); c.target=curve
     new_ob.parent=curve
@@ -1105,7 +1105,7 @@ def RibbonMeshEdgeLengths(m, ribbon):
     return lengths
 
 def EnsureCurveIsRibbon(crv, defaultRadius = 0.1):
-    from .base_definitions import FLOAT_EPSILON
+    from ..base_definitions import FLOAT_EPSILON
     crvRadius = 0
     crv.data.offset = 0
     if (crv.data.bevel_depth < FLOAT_EPSILON):

+ 6 - 6
versioning.py

@@ -4,7 +4,7 @@
 from bpy.types import Node, NodeSocket
 from bpy.app import version as bpy_version
 
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -78,12 +78,12 @@ def version_upgrade_very_old(*args, **kwargs):
                 node.inputs.move(len(node.inputs)-1, index)
         socket_map = None
         if rename_jobs:
-            from .utilities import get_socket_maps
+            from .utilities.utilities import get_socket_maps
             socket_maps = get_socket_maps(node)
         for socket, socket_index, new_bl_idname, new_name, multi in rename_jobs:
             old_id = socket.identifier
             print (f"Renaming socket {socket.identifier} to {new_name} in node {node.name}")
-            from .utilities import do_relink
+            from .utilities.utilities import do_relink
             if socket.is_output:
                 index = 1
                 in_out = "OUTPUT"
@@ -121,7 +121,7 @@ def version_upgrade_bone_0_12_0_from_older(*args, **kwargs):
         collection_input_is_array = node.inputs['Bone Collection'].is_multi_input
         if not collection_input_is_array: # it must be made into an array!
             prPurple(f"Updating \"Bone Collection\" Socket in {node.name}")
-            from .utilities import get_socket_maps
+            from .utilities.utilities import get_socket_maps
             socket_maps = get_socket_maps(node)
             socket_map = socket_maps[0]
             for i, socket in enumerate(node.inputs):
@@ -233,7 +233,7 @@ def up_0_12_25_replace_floor_offset_type(*args, **kwargs):
     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 > 24: return 
-    from .utilities import get_socket_maps, do_relink
+    from .utilities.utilities import get_socket_maps, do_relink
     socket_maps = get_socket_maps(node)
     prPurple(f"Fixing \"Offset\" socket in {node.name}")
     try:
@@ -360,7 +360,7 @@ def update_fcurve_and_armature_node_to_multi_socket(*args, **kwargs):
     live_updates = node.id_data.do_live_update
     node.id_data.do_live_update = False
     # First we have to get the socket maps and re-init the sockets
-    from .utilities import get_socket_maps, do_relink
+    from .utilities.utilities import get_socket_maps, do_relink
     convert_keys = {'UtilityFCurve' : [ 'Keyframe', ],
                     'LinkArmature'  : [ 'Target', 'Weight', ], }
     my_convert_keys = convert_keys[node.bl_idname]

+ 3 - 3
xForm_nodes.py

@@ -1,4 +1,4 @@
-from .node_common import *
+from .utilities.node_common import *
 from .base_definitions import MantisNode, NodeSocket
 from .xForm_socket_templates import *
 from .mantis_dataclasses import xForm_info
@@ -772,7 +772,7 @@ class xFormObjectInstance(xFormNode):
         modifier = self.bObject.modifiers.new("Object Instance", type='NODES')
         ng = data.node_groups.get("Object Instance")
         if ng is None:
-            from .geometry_node_graphgen import gen_object_instance_node_group
+            from .utilities.geometry_node_graphgen import gen_object_instance_node_group
             ng = gen_object_instance_node_group()
         modifier.node_group = ng
         modifier["Socket_0"] = source_ob
@@ -853,7 +853,7 @@ class xFormCurvePin(xFormNode):
         #
         # always do this so that everything stays consistent.
         spline_index = self.evaluate_input("Spline Index")
-        from .utilities import get_extracted_spline_object
+        from .utilities.utilities import get_extracted_spline_object
         curve = get_extracted_spline_object(curve, spline_index, self.mContext)
         # Link to Scene:
         for link_me in [ob, curve]:

+ 3 - 3
xForm_nodes_ui.py

@@ -1,7 +1,7 @@
 import bpy
 from .base_definitions import xFormNode
 from bpy.types import Node
-from .utilities import (prRed, prGreen, prPurple, prWhite,
+from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
@@ -87,7 +87,7 @@ def custom_prop_display_update(self, mantis_node = None):
         if len(mantis_node.inputs['Custom Properties'].links) != len(self.inputs['Custom Properties'].links):
             return # there is a problem somewhere
         for i, link in enumerate(mantis_node.inputs['Custom Properties'].links):
-            from .node_common import trace_single_line
+            from .utilities.node_common import trace_single_line
             node_line, _last_socket = trace_single_line(mantis_node, 'Custom Properties', i)
             if not node_line[-1].prepared:
                 return
@@ -100,7 +100,7 @@ def custom_prop_display_update(self, mantis_node = None):
             name = custom_prop_data.name
             type = custom_prop_data.prop_type
             custom_props[name] = type_map[type]
-    from .utilities import get_socket_maps, do_relink
+    from .utilities.utilities import get_socket_maps, do_relink
     _socket_map_in, socket_map_out = get_socket_maps(self)
     for name, type in custom_props.items():
         if socket_map_out.get(name) is None: