Explorar el Código

cleanup

this commit moves some files into folders and removes old code that isn't used
Joseph Brandenburg hace 1 mes
padre
commit
e8d99c3143

+ 3 - 3
base_definitions.py

@@ -137,7 +137,7 @@ class MantisTree(NodeTree):
         if (my_hash != self.hash) or force:
             self.hash = my_hash
             self.is_executing = True
-            from . import readtree
+            from .execution import readtree
             prGreen("Validating Tree: %s" % self.name)
             try:
                 import bpy # I am importing here so that the context passed in
@@ -184,7 +184,7 @@ class MantisTree(NodeTree):
             return
         prGreen("Executing Tree: %s" % self.name)
         self.is_executing = True
-        from . import readtree
+        from .execution import readtree
         try:
             context.scene.render.use_lock_interface = True
             readtree.execute_tree(self.parsed_tree, self, context, error_popups, profile=profile)
@@ -841,7 +841,7 @@ class MantisNode:
         # apply overlay variables here so this updates predictably
         if (isinstance(value, str) and
                 (self.signature, ui_socket.identifier) in self.mContext.tagged_for_overlay):
-            from .readtree import node_scan_overlays
+            from .execution.readtree import node_scan_overlays
             value = node_scan_overlays(self, ui_socket.identifier)
         # TODO: I need to make Node Groups apply overlays downstream, but since
         #       they don't update live anyway, no need just yet

+ 1 - 1
deformer_nodes.py

@@ -333,7 +333,7 @@ class DeformerHook(MantisDeformerNode):
         if isinstance(hook, (Bone, PoseBone)):
             driver['type']='SCRIPTED'
             driver['expression']="(((1/b)*a)+((1/b_001)*a_001)+((1/b_002)*a_002))/3"
-        from .drivers import CreateDrivers
+        from .utilities.drivers import CreateDrivers
         axes='XYZ'
         for i in range(3):
             suffix = "" if i == 0 else f"_{i:03d}" # explicit names -- 5.2 no longer uniquifies duplicates

+ 1 - 1
dev_helpers/visualize.py

@@ -133,7 +133,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 ..execution.readtree import check_and_add_root
     from ..utilities.utilities import trace_all_nodes_from_root
     import bpy
 

+ 26 - 26
readtree.py → execution/readtree.py

@@ -1,4 +1,4 @@
-from .utilities.utilities import prRed, prGreen, prPurple, prWhite, prOrange, \
+from ..utilities.utilities import prRed, prGreen, prPurple, prWhite, prOrange, \
                         wrapRed, wrapGreen, wrapPurple, wrapWhite, wrapOrange
 
 
@@ -23,7 +23,7 @@ from .utilities.utilities import prRed, prGreen, prPurple, prWhite, prOrange, \
 # solution to hypothetical BUG could be to do traversal on the links
 # instead of the sockets.
 def grp_node_reroute_common(in_node, out_node, interface):
-    from .base_definitions import links_sort_key
+    from ..base_definitions import links_sort_key
     for in_node_input in in_node.inputs:
         i = 0
         if len(in_node_input.links)>1: # sort here to ensure correct sub_sort_id
@@ -46,7 +46,7 @@ def grp_node_reroute_common(in_node, out_node, interface):
             out_link.die()
 
 def reroute_links_grp(group, all_nodes):
-    from .internal_nodes import GroupInterface
+    from ..internal_nodes import GroupInterface
     interface = GroupInterface(
         ( *group.signature, "InputInterface"),
         group.base_tree, group.ui_node, 'INPUT',)
@@ -59,7 +59,7 @@ 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_nodes import GroupInterface
+        from ..internal_nodes import GroupInterface
         interface = GroupInterface(
             ( *group.signature, "OutputInterface"),
             group.base_tree, group.ui_node, 'OUTPUT',)
@@ -72,10 +72,10 @@ def reroute_links_grpout(group_output, all_nodes):
 # FIXME I don't think these signatures are unique.
 # TODO this is a really silly and bad and also really dumb way to do this
 def insert_lazy_parents(mantis_node):
-    from .link_nodes import LinkInherit
+    from ..link_nodes import LinkInherit
     inherit_node = None
     if mantis_node.inputs["Relationship"].is_connected:
-        from .utilities.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.
@@ -105,11 +105,11 @@ def insert_lazy_parents(mantis_node):
 #                                  DATA FROM NODES                                  #
 # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** #
 
-from .base_definitions import replace_types, NodeSocket
+from ..base_definitions import replace_types, NodeSocket
 
 def autogen_node(base_tree, ui_socket, signature, mContext):
     mantis_node=None
-    from .internal_nodes import AutoGenNode
+    from ..internal_nodes import AutoGenNode
     mantis_node = AutoGenNode(signature, base_tree)
     mantis_node.mContext = mContext
     mantis_node.outputs.init_sockets([ui_socket.name])
@@ -119,7 +119,7 @@ def autogen_node(base_tree, ui_socket, signature, mContext):
 # TODO: investigate whether I can set the properties in the downstream nodes directly.
 #       I am doing this in Schema Solver and it seems to work quite efficiently.
 def make_connections_to_ng_dummy(base_tree, tree_path_names, local_mantis_nodes, all_mantis_nodes, to_mantis_node):
-    from .socket_definitions import no_default_value
+    from ..socket_definitions import no_default_value
     for inp in to_mantis_node.ui_node.inputs:
         if inp.bl_idname in no_default_value:
             continue
@@ -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 .utilities.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
@@ -142,7 +142,7 @@ def make_connections_to_ng_dummy(base_tree, tree_path_names, local_mantis_nodes,
                 prRed("No available auto-generated class for input %s in %s" % (inp.name, np.name))
 
 def gen_mantis_nodes(base_tree, current_tree, tree_path_names, mContext, all_mantis_nodes, local_mantis_nodes, dummy_nodes, group_nodes, schema_nodes ):
-    from .internal_nodes import DummyNode
+    from ..internal_nodes import DummyNode
     for ui_node in current_tree.nodes:
         # HACK I found that this isn't being set sometimes. I wonder why? It makes the most sense to do this here.
         if hasattr(ui_node, 'initialized'): ui_node.initialized=True
@@ -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.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.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.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.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.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.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.
@@ -438,7 +438,7 @@ def insert_default_values_base_tree(base_tree, all_mantis_nodes):
             signature = ("MANTIS_AUTOGENERATED", "MANTIS_DEFAULT_ARMATURE",)
             autogen_mantis_node = all_mantis_nodes.get(signature)
             if autogen_mantis_node is None:
-                from .xForm_nodes import xFormArmature
+                from ..xForm_nodes import xFormArmature
                 autogen_mantis_node = xFormArmature(signature, base_tree)
                 autogen_mantis_node.parameters['Name']=base_tree.name+'_MANTIS_AUTOGEN'
                 autogen_mantis_node.mContext =  InputNode.mContext
@@ -457,7 +457,7 @@ def parse_tree(base_tree, error_popups=False):
     from uuid import uuid4
     base_tree.execution_id = uuid4().__str__() # set the unique id of this execution
 
-    from .base_definitions import MantisExecutionContext
+    from ..base_definitions import MantisExecutionContext
     mContext = MantisExecutionContext(base_tree=base_tree)
 
     import time
@@ -478,7 +478,7 @@ def parse_tree(base_tree, error_popups=False):
     from collections import deque
     unsolved_schema = deque()
 
-    from .base_definitions import array_output_types, GraphError
+    from ..base_definitions import array_output_types, GraphError
     for mantis_node in all_mantis_nodes.values():
         # TODO I still need to assign mContext here because of autogen_node
         # so I have to do a deeper refactor to ensure autogen nodes get this at creation time.
@@ -578,7 +578,7 @@ def parse_tree(base_tree, error_popups=False):
             continue # screen out the ui_node schema nodes, group in/out, and group placeholders
         # cleanup autogen nodes
         if mantis_node.signature[0] == "MANTIS_AUTOGENERATED" and len(mantis_node.inputs) == 0 and len(mantis_node.outputs) == 1:
-            from .base_definitions import can_remove_socket_for_autogen
+            from ..base_definitions import can_remove_socket_for_autogen
             output=list(mantis_node.outputs.values())[0]
             value=list(mantis_node.parameters.values())[0]
             # We can remove this node if it is safe to push it into the other node's socket.
@@ -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.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 .utilities.node_common import GraphError
+    from ..utilities.node_common import GraphError
     from collections import deque
     xForm_pass = deque()
     execution_failed = False
@@ -689,7 +689,7 @@ def execute_tree(nodes, base_tree, context, error_popups = False, profile=False)
     mContext.execution_failed = False
 
     interface_nodes = {}
-    from .internal_nodes import GroupInterface
+    from ..internal_nodes import GroupInterface
     for node in nodes.values():
         if isinstance(node, GroupInterface):
             interface_nodes[node.signature] = node
@@ -709,7 +709,7 @@ def execute_tree(nodes, base_tree, context, error_popups = False, profile=False)
     select_me = []
     profiler = None
     if profile:
-        from .dev_helpers.profile_nodes import NodeProfiler
+        from ..dev_helpers.profile_nodes import NodeProfiler
         profiler = NodeProfiler()
         profiler.new_session(mContext.execution_id)
         sort_key = 'total'
@@ -794,7 +794,7 @@ def execute_tree(nodes, base_tree, context, error_popups = False, profile=False)
         if not execution_failed:
             prGreen(f"Executed tree of {len(sorted_nodes)} nodes in {tot_time} seconds")
         if profiler:
-            from .dev_helpers.profile_nodes import summarize_profile
+            from ..dev_helpers.profile_nodes import summarize_profile
             summarize_profile(profiler._current, pass_name='bPrepare', sort_key = sort_key)
             summarize_profile(profiler._current, pass_name='bTransformPass', sort_key = sort_key)
             summarize_profile(profiler._current, pass_name='bRelationshipPass', sort_key = sort_key)

+ 20 - 20
schema_solve.py → execution/schema_solve.py

@@ -1,11 +1,11 @@
-from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
+from ..utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               prOrange,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
-from .utilities.utilities import init_connections, init_dependencies, get_link_in_out
-from .base_definitions import (SchemaUINode, custom_props_types, \
+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 .utilities.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
 
@@ -80,12 +80,12 @@ class SchemaSolver:
                 mantis_node.fill_parameters(ui_node)
             # HACK to make Group Nodes work
             if ui_node.bl_idname == "NodeGroupInput":
-                from .schema_nodes import SchemaConstInput
+                from ..schema_nodes import SchemaConstInput
                 mantis_node = SchemaConstInput(signature=signature, base_tree=self.node.base_tree, parent_schema_node=self.node)
                 self.schema_nodes[signature] = mantis_node
                 mantis_node.fill_parameters(ui_node)
             if ui_node.bl_idname == "NodeGroupOutput":
-                from .schema_nodes import SchemaConstOutput
+                from ..schema_nodes import SchemaConstOutput
                 mantis_node = SchemaConstOutput(signature=signature, base_tree=self.node.base_tree, parent_schema_node=self.node)
                 self.schema_nodes[signature] = mantis_node
                 mantis_node.fill_parameters(ui_node)
@@ -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.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:
@@ -201,7 +201,7 @@ class SchemaSolver:
             mantis_node.mContext=mContext
 
     def handle_link_from_index_input(self, index, frame_mantis_nodes, ui_link):
-        from .base_definitions import can_remove_socket_for_autogen
+        from ..base_definitions import can_remove_socket_for_autogen
         _from_name, to_name = get_link_in_out(ui_link)
         to_node = frame_mantis_nodes[ (*self.autogen_path_names, to_name+self.index_str()) ]
 
@@ -302,7 +302,7 @@ class SchemaSolver:
         to_name = get_link_in_out(ui_link)[1]
         to_node = frame_mantis_nodes[(*self.autogen_path_names, to_name+self.index_str())]
         to_socket=ui_link.to_socket.name
-        from .base_definitions import MantisNodeGroup, SchemaGroup
+        from ..base_definitions import MantisNodeGroup, SchemaGroup
         if isinstance(to_ui_node, (SchemaGroup, MantisNodeGroup)):
             to_socket=ui_link.to_socket.identifier
         connection = from_node.outputs[incoming.from_socket].connect(node=to_node, socket=to_socket)
@@ -314,7 +314,7 @@ class SchemaSolver:
         from collections import deque
         unprepared = deque(from_node.hierarchy_dependencies)
         self.prepare_nodes(unprepared)
-        from .utilities.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
@@ -382,7 +382,7 @@ class SchemaSolver:
         # connection = incoming.from_node.outputs[incoming.from_socket].connect(node=to_node, socket=ui_link.to_socket.name)
         for l in all_links:
             # we need to copy the link with the new from-node info
-            from .base_definitions import NodeLink
+            from ..base_definitions import NodeLink
             to_socket_name=ui_link.to_socket.name
             if to_node.node_type in ['DUMMY_SCHEMA']:
                 to_socket_name=ui_link.to_socket.identifier
@@ -450,7 +450,7 @@ class SchemaSolver:
             if not from_node:
                 from_node = self.schema_nodes[(*self.tree_path_names, from_ui_node.bl_idname)]
             to_node = outgoing.to_node
-            from .schema_nodes import SchemaIndex
+            from ..schema_nodes import SchemaIndex
             if isinstance(from_node, SchemaIndex):
                 signature = ("MANTIS_AUTOGENERATED", *self.tree_path_names[1:-1], self.index_str(),
                              ui_link.from_socket.name, ui_link.from_socket.identifier)
@@ -498,7 +498,7 @@ class SchemaSolver:
         # connected up correctly. between the output and the schema's generated nodes.
         # so seek BACK from the output node and grab the from-node that is connected to
         #  the link. then modify the ui_link to point to that node.
-        from .base_definitions import DummyLink
+        from ..base_definitions import DummyLink
         if not isinstance(ui_link, DummyLink): # make it a Dummy so i can modify it
             ui_link = DummyLink(ui_link.from_socket, ui_link.to_socket,
                                 multi_input_sort_id=ui_link.multi_input_sort_id)
@@ -562,7 +562,7 @@ class SchemaSolver:
              This function also adds to held_links to pass data between iterations.
         """
 
-        from .schema_nodes_ui import (SchemaIndex,
+        from ..schema_nodes_ui import (SchemaIndex,
                                         SchemaArrayInput,
                                         SchemaArrayInputGet,
                                         SchemaArrayInputAll,
@@ -571,8 +571,8 @@ class SchemaSolver:
                                         SchemaConstOutput,
                                         SchemaOutgoingConnection,
                                         SchemaIncomingConnection,)
-        from .utilities.utilities import clear_reroutes, link_mantis_nodes
-        from .base_definitions import array_output_types
+        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.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
@@ -707,7 +707,7 @@ class SchemaSolver:
                 self.handle_link_to_constant_output(frame_mantis_nodes, self.index, ui_link,  to_ui_node)
             if isinstance(to_ui_node, SchemaArrayOutput):
                 if from_node.bl_idname in array_output_types:
-                    from .base_definitions import DummyLink
+                    from ..base_definitions import DummyLink
                     for l in from_node.rerouted:
                         new_link = DummyLink(
                             from_socket=l.from_node.outputs[l.from_socket],
@@ -743,7 +743,7 @@ class SchemaSolver:
 
 
     def finalize(self, mantis_nodes_in_frame):
-        from .schema_nodes_ui import (SchemaOutgoingConnection,)
+        from ..schema_nodes_ui import (SchemaOutgoingConnection,)
         for i in range(len(self.held_links)):
             link = self.held_links.pop()
             to_np = link.to_socket.node; from_np = link.from_socket.node
@@ -797,7 +797,7 @@ class SchemaSolver:
 
     def solve(self):
         if self.solve_length < 1:
-            from .base_definitions import GraphError
+            from ..base_definitions import GraphError
             for o in self.node.outputs:
                 if o.is_linked:
                     raise GraphError(f"ERROR: Schema {self} has a length"

+ 1 - 1
link_nodes.py

@@ -777,7 +777,7 @@ class LinkDrivenParameter(MantisLinkNode):
         driver = self.evaluate_input("Value")
         try:
             for i, val in enumerate(self.parameters["Value"]):
-                from .drivers import MantisDriver
+                from .utilities.drivers import MantisDriver
                 if isinstance(val, MantisDriver):
                     driver["ind"] = i
                     val = driver

+ 6 - 6
misc_nodes.py

@@ -927,7 +927,7 @@ class UtilityDriver(MantisNode):
 
     def __init__(self, signature, base_tree):
         super().__init__(signature, base_tree, DriverSockets)
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         additional_parameters = {
           "Driver":MantisDriver(),
         }
@@ -938,13 +938,13 @@ class UtilityDriver(MantisNode):
 
     def reset_execution(self):
         super().reset_execution()
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         self.parameters["Driver"]=MantisDriver()
         self.prepared=True
 
     def bRelationshipPass(self, bContext = None,):
         prepare_parameters(self)
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         #prPurple("Executing Driver Node")
         my_vars = []
         keys = self.evaluate_input("fCurve")
@@ -982,7 +982,7 @@ class UtilitySwitch(MantisNode):
 
     def __init__(self, signature, base_tree):
         super().__init__(signature, base_tree, SwitchSockets)
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         additional_parameters = {
           "Driver":MantisDriver(),
         }
@@ -1008,7 +1008,7 @@ class UtilitySwitch(MantisNode):
 
     def reset_execution(self):
         super().reset_execution()
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         self.parameters["Driver"]=MantisDriver()
         self.prepared=True
 
@@ -1019,7 +1019,7 @@ class UtilitySwitch(MantisNode):
         if xForm : xForm = xForm.bGetObject()
         if not xForm:
             raise RuntimeError("Could not evaluate xForm for %s" % self)
-        from .drivers import MantisDriver
+        from .utilities.drivers import MantisDriver
         my_driver ={ "owner" : None,
                      "prop"  : None, # will be filled out in the node that uses the driver
                      "ind"   : -1, # same here

+ 0 - 303
ops_nodegroup.py

@@ -7,8 +7,6 @@ from .utilities.utilities import (prRed, prGreen, prPurple, prWhite,
                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
                               wrapOrange,)
 
-
-
 def mantis_tree_poll_op(context):
     space = context.space_data
     if hasattr(space, "node_tree"):
@@ -306,7 +304,6 @@ class ExecuteNodeTree(Operator):
         prGreen("Finished executing tree in %f seconds" % (time() - start_time))
         return {"FINISHED"}
 
-
 class SelectNodesOfType(Operator):
     """Selects all nodes of same type as active node."""
     bl_idname = "mantis.select_nodes_of_type"
@@ -329,7 +326,6 @@ class SelectNodesOfType(Operator):
 
         return {"FINISHED"}
 
-
 def get_parent_tree_interface_enum(operator, context):
     ret = []; i = -1
     tree = bpy.data.node_groups[operator.tree_invoked]
@@ -425,7 +421,6 @@ class ConnectNodeToInput(Operator):
             t.is_executing = False
         return {"FINISHED"}
 
-
 class QueryNodeSockets(Operator):
     """Utility Operator for querying the data in a socket"""
     bl_idname = "mantis.query_sockets"
@@ -478,7 +473,6 @@ class ForceDisplayUpdate(Operator):
         base_tree.display_update(context)
         return {"FINISHED"}
 
-
 class CleanUpNodeGraph(bpy.types.Operator):
     """Clean Up Node Graph"""
     bl_idname = "mantis.nodes_cleanup"
@@ -498,8 +492,6 @@ class CleanUpNodeGraph(bpy.types.Operator):
         SugiyamaGraph(base_tree, 12)
         return {'FINISHED'}
 
-
-
 class MantisMuteNode(Operator):
     """Mantis Test Operator"""
     bl_idname = "mantis.mute_node"
@@ -528,254 +520,6 @@ class MantisMuteNode(Operator):
                 hide.default_value = node.mute
         return {"FINISHED"}
 
-ePropertyType =(
-        ('BOOL'  , "Boolean", "Boolean", 0),
-        ('INT'   , "Integer", "Integer", 1),
-        ('FLOAT' , "Float"  , "Float"  , 2),
-        ('VECTOR', "Vector" , "Vector" , 3),
-        ('STRING', "String" , "String" , 4),
-        #('ENUM'  , "Enum"   , "Enum"   , 5),
-    )
-
-
-from .base_definitions import xFormNode
-
-
-class AddCustomProperty(bpy.types.Operator):
-    """Add Custom Property to xForm Node"""
-    bl_idname = "mantis.add_custom_property"
-    bl_label = "Add Custom Property"
-    bl_options = {'REGISTER', 'UNDO'}
-
-
-    prop_type : bpy.props.EnumProperty(
-        items=ePropertyType,
-        name="New Property Type",
-        description="Type of data for new Property",
-        default = 'BOOL',)
-    prop_name  : bpy.props.StringProperty(default='Prop')
-
-    min:bpy.props.FloatProperty(default = 0)
-    max:bpy.props.FloatProperty(default = 1)
-    soft_min:bpy.props.FloatProperty(default = 0)
-    soft_max:bpy.props.FloatProperty(default = 1)
-    description:bpy.props.StringProperty(default = "")
-
-    tree_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-    node_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-
-    @classmethod
-    def poll(cls, context):
-        return True #( hasattr(context, 'node') )
-
-    def invoke(self, context, event):
-        self.tree_invoked = context.node.id_data.name
-        self.node_invoked = context.node.name
-        wm = context.window_manager
-        return wm.invoke_props_dialog(self)
-
-    def execute(self, context):
-        n = bpy.data.node_groups[self.tree_invoked].nodes[self.node_invoked]
-        # For whatever reason, context.node doesn't exist anymore
-        #   (probably because I use a window to execute)
-        # so as a sort of dumb workaround I am saving it to a hidden
-        #  property of the operator... it works but Blender complains.
-        socktype = ''
-        if not (self.prop_name):
-            self.report({'ERROR_INVALID_INPUT'}, "Must name the property.")
-            return {'CANCELLED'}
-        if self.prop_type == 'BOOL':
-            socktype = 'ParameterBoolSocket'
-        if self.prop_type == 'INT':
-            socktype = 'ParameterIntSocket'
-        if self.prop_type == 'FLOAT':
-            socktype = 'ParameterFloatSocket'
-        if self.prop_type == 'VECTOR':
-            socktype = 'ParameterVectorSocket'
-        if self.prop_type == 'STRING':
-            socktype = 'ParameterStringSocket'
-        #if self.prop_type == 'ENUM':
-        #    sock_type = 'ParameterStringSocket'
-        if (s := n.inputs.get(self.prop_name)):
-            try:
-                number = int(self.prop_name[-3:])
-                # see if it has a number
-                number+=1
-                self.prop_name = self.prop_name[:-3] + str(number).zfill(3)
-            except ValueError:
-                self.prop_name+='.001'
-                # WRONG # HACK # TODO # BUG #
-        new_prop = n.inputs.new( socktype, self.prop_name)
-        if self.prop_type in ['INT','FLOAT']:
-            new_prop.min = self.min
-            new_prop.max = self.max
-            new_prop.soft_min = self.soft_min
-            new_prop.soft_max = self.soft_max
-        new_prop.description = self.description
-        # now do the output
-        n.outputs.new( socktype, self.prop_name)
-        tag_mantis_node_for_update(context, n)
-        return {'FINISHED'}
-
-def main_get_existing_custom_properties(operator, context):
-    ret = []; i = -1
-    n = bpy.data.node_groups[operator.tree_invoked].nodes[operator.node_invoked]
-    for inp in n.inputs:
-        if 'Parameter' in inp.bl_idname:
-            ret.append( (inp.identifier, inp.name, "Custom Property to Modify", i := i + 1), )
-    return ret
-
-
-class EditCustomProperty(bpy.types.Operator):
-    """Edit Custom Property"""
-    bl_idname = "mantis.edit_custom_property"
-    bl_label = "Edit Custom Property"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    def get_existing_custom_properties(self, context):
-        return main_get_existing_custom_properties(self, context)
-
-    prop_edit : bpy.props.EnumProperty(
-        items=get_existing_custom_properties,
-        name="Property to Edit?",
-        description="Select which property to edit",)
-    prop_type : bpy.props.EnumProperty(
-        items=ePropertyType,
-        name="New Property Type",
-        description="Type of data for new Property",
-        default = 'BOOL',)
-    prop_name  : bpy.props.StringProperty(default='Prop')
-    min:bpy.props.FloatProperty(default = 0)
-    max:bpy.props.FloatProperty(default = 1)
-    soft_min:bpy.props.FloatProperty(default = 0)
-    soft_max:bpy.props.FloatProperty(default = 1)
-    description:bpy.props.StringProperty(default = "") # TODO: use getters to fill these automatically
-
-    tree_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-    node_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-
-    @classmethod
-    def poll(cls, context):
-        return True #( hasattr(context, 'node') )
-
-    def invoke(self, context, event):
-        self.tree_invoked = context.node.id_data.name
-        self.node_invoked = context.node.name
-        wm = context.window_manager
-        return wm.invoke_props_dialog(self)
-
-    def execute(self, context):
-        n = bpy.data.node_groups[self.tree_invoked].nodes[self.node_invoked]
-        prop = n.inputs.get( self.prop_edit )
-        if prop:
-            prop.name = self.prop_name
-            if (s := n.inputs.get(self.prop_edit)):
-                if self.prop_type in ['INT','FLOAT']:
-                    prop.min = self.min
-                    prop.max = self.max
-                    prop.soft_min = self.soft_min
-                    prop.soft_max = self.soft_max
-                prop.description = self.description
-            tag_mantis_node_for_update(context, n)
-            return {'FINISHED'}
-        else:
-            self.report({'ERROR_INVALID_INPUT'}, "Cannot edit a property that does not exist.")
-
-
-
-class RemoveCustomProperty(bpy.types.Operator):
-    """Remove a Custom Property from an xForm Node"""
-    bl_idname = "mantis.remove_custom_property"
-    bl_label = "Remove Custom Property"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    def get_existing_custom_properties(self, context):
-        return main_get_existing_custom_properties(self, context)
-
-    prop_remove : bpy.props.EnumProperty(
-        items=get_existing_custom_properties,
-        name="Property to remove?",
-        description="Select which property to remove",)
-    tree_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-    node_invoked : bpy.props.StringProperty(options ={'HIDDEN'})
-
-    @classmethod
-    def poll(cls, context):
-        return True #(hasattr(context, 'active_node') )
-
-    def invoke(self, context, event):
-        self.tree_invoked = context.node.id_data.name
-        self.node_invoked = context.node.name
-        t = context.node.id_data
-        # HACK the props dialog makes this necesary
-        #  because context.node only exists during the event that
-        #  was created by clicking on the node.
-        t.nodes.active = context.node # HACK
-        context.node.select = True # HACK
-        # I need this bc of the callback for the enum property.
-        #  for whatever reason I can't use tree_invoked there
-        wm = context.window_manager
-        return wm.invoke_props_dialog(self)
-
-    def execute(self, context):
-        n = bpy.data.node_groups[self.tree_invoked].nodes[self.node_invoked]
-        # For whatever reason, context.node doesn't exist anymore
-        #   (probably because I use a window to execute)
-        # so as a sort of dumb workaround I am saving it to a hidden
-        #  property of the operator... it works.
-        for i, inp in enumerate(n.inputs):
-            if inp.identifier == self.prop_remove:
-                break
-        else:
-            self.report({'ERROR'}, "Input not found")
-            return {'CANCELLED'}
-        # it's possible that the output property's identifier isn't the
-        #   exact same... but I don' care. Shouldn't ever happen. TODO
-        for j, out in enumerate(n.outputs):
-            if out.identifier == self.prop_remove:
-                break
-        else:
-            self.report({'ERROR'}, "Output not found")
-            raise RuntimeError("This should not happen!")
-        n.inputs.remove ( n.inputs [i] )
-        n.outputs.remove( n.outputs[j] )
-        tag_mantis_node_for_update(context, n)
-        return {'FINISHED'}
-
-
-
-# SIMPLE node operators...
-# May rewrite these in a more generic way later
-class FcurveAddKeyframeInput(bpy.types.Operator):
-    """Add a keyframe input to the fCurve node"""
-    bl_idname = "mantis.fcurve_node_add_kf"
-    bl_label = "Add Keyframe"
-    bl_options = {'INTERNAL', 'REGISTER', 'UNDO'}
-
-    @classmethod
-    def poll(cls, context):
-        return (hasattr(context, 'active_node') )
-
-    def execute(self, context):
-        num_keys = len( context.node.inputs)-1
-        context.node.inputs.new("KeyframeSocket", "Keyframe."+str(num_keys).zfill(3))
-        return {'FINISHED'}
-
-class FcurveRemoveKeyframeInput(bpy.types.Operator):
-    """Remove a keyframe input from the fCurve node"""
-    bl_idname = "mantis.fcurve_node_remove_kf"
-    bl_label = "Remove Keyframe"
-    bl_options = {'INTERNAL', 'REGISTER', 'UNDO'}
-
-    @classmethod
-    def poll(cls, context):
-        return (hasattr(context, 'active_node') )
-
-    def execute(self, context):
-        n = context.node
-        n.inputs.remove(n.inputs[-1])
-        return {'FINISHED'}
-
 class DriverAddDriverVariableInput(bpy.types.Operator):
     """Add a Driver Variable input to the Driver node"""
     bl_idname = "mantis.driver_node_add_variable"
@@ -791,7 +535,6 @@ class DriverAddDriverVariableInput(bpy.types.Operator):
         context.node.inputs.new("DriverVariableSocket", chr(i))
         return {'FINISHED'}
 
-
 class DriverRemoveDriverVariableInput(bpy.types.Operator):
     """Remove a DriverVariable input from the active Driver node"""
     bl_idname = "mantis.driver_node_remove_variable"
@@ -807,39 +550,6 @@ class DriverRemoveDriverVariableInput(bpy.types.Operator):
         n.inputs.remove(n.inputs[-1])
         return {'FINISHED'}
 
-class LinkArmatureAddTargetInput(bpy.types.Operator):
-    """Add a Driver Variable input to the Driver node"""
-    bl_idname = "mantis.link_armature_node_add_target"
-    bl_label = "Add Target"
-    bl_options = {'INTERNAL', 'REGISTER', 'UNDO'}
-
-    @classmethod
-    def poll(cls, context):
-        return hasattr(context, 'node')
-
-    def execute(self, context):           # unicode for 'a'
-        num_targets = len( list(context.node.inputs)[6:])//2
-        context.node.inputs.new("xFormSocket", "Target."+str(num_targets).zfill(3))
-        context.node.inputs.new("FloatFactorSocket", "Weight."+str(num_targets).zfill(3))
-        return {'FINISHED'}
-
-
-class LinkArmatureRemoveTargetInput(bpy.types.Operator):
-    """Remove a DriverVariable input from the active Driver node"""
-    bl_idname = "mantis.link_armature_node_remove_target"
-    bl_label = "Remove Target"
-    bl_options = {'INTERNAL', 'REGISTER', 'UNDO'}
-
-    @classmethod
-    def poll(cls, context):
-        return hasattr(context, 'node')
-
-    def execute(self, context):
-        n = context.node
-        n.inputs.remove(n.inputs[-1]); n.inputs.remove(n.inputs[-1])
-        return {'FINISHED'}
-
-
 class CollectionAddNewOutput(bpy.types.Operator):
     """Add a new Collection output to the Driver node"""
     bl_idname = "mantis.collection_add_new"
@@ -887,7 +597,6 @@ class CollectionAddNewOutput(bpy.types.Operator):
         n.update_interface()
         return {'FINISHED'}
 
-
 # TODO: should this prune the children, too?
 class CollectionRemoveOutput(bpy.types.Operator):
     """Remove a Collection output to the Driver node"""
@@ -943,7 +652,6 @@ def get_socket_enum(operator, context):
             valid_types.append( (cls.bl_idname, cls.bl_label, "Socket Type", i := i + 1), )
     return valid_types
 
-
 class B4_4_0_Workaround_NodeTree_Interface_Update(Operator):
     """Selects all nodes of same type as active node."""
     bl_idname = "mantis.node_tree_interface_update_4_4_0_workaround"
@@ -980,7 +688,6 @@ class B4_4_0_Workaround_NodeTree_Interface_Update(Operator):
             tree.prevent_next_exec=True
         return {"FINISHED"}
 
-
 class ConvertBezierCurveToNURBS(Operator):
     """Converts all bezier splines of curve to NURBS."""
     bl_idname = "mantis.convert_bezcrv_to_nurbs"
@@ -1089,19 +796,9 @@ classes = [
         MantisMuteNode,
         SelectNodesOfType,
         ConnectNodeToInput,
-        # xForm
-        AddCustomProperty,
-        EditCustomProperty,
-        RemoveCustomProperty,
-        # EditFCurveNode,
-        FcurveAddKeyframeInput,
-        FcurveRemoveKeyframeInput,
         # Driver
         DriverAddDriverVariableInput,
         DriverRemoveDriverVariableInput,
-        # Armature Link Node
-        LinkArmatureAddTargetInput,
-        LinkArmatureRemoveTargetInput,
         # managing collections
         CollectionAddNewOutput,
         CollectionRemoveOutput,

+ 1 - 1
preferences.py

@@ -39,7 +39,7 @@ def filepath_idiot_test(path):
     def do_error_popup():
             def error_popup_draw(self, context):
                 self.layout.label(text="A maximum of 1000 widget files is allowed in the Widget Library.")
-                self.layout.label(text="Make sure the WIdget Library does not scan a huge number of files/folders.")
+                self.layout.label(text="Make sure the Widget Library does not scan a huge number of files/folders.")
             from bpy import context
             context.window_manager.popup_menu(error_popup_draw, title="Error", icon='ERROR')
     try:

+ 1 - 1
drivers.py → utilities/drivers.py

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

+ 1 - 1
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 ..execution.readtree import sort_execution
     from .utilities import get_ui_node
     sorted_nodes, execution_failed = sort_execution(nodes, xForm_pass)
     if execution_failed:

+ 2 - 2
utilities/node_common.py

@@ -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)

+ 1 - 1
xForm_nodes.py

@@ -84,7 +84,7 @@ class xFormNode(MantisNode):
             # we need to trace back all inputs
             custom_prop_data = self.evaluate_input(input, i)
             if not isinstance(custom_prop_data, custom_prop_template): continue
-            from .drivers import MantisDriver
+            from .utilities.drivers import MantisDriver
             name = custom_prop_data.name
             if name in ob.keys():
                 raise RuntimeError("Error: cannot create a custom property with "