Browse Source

Errors now only create a popup when manually executing the tree

Joseph Brandenburg 8 months ago
parent
commit
9b85b96caa
3 changed files with 17 additions and 8 deletions
  1. 2 2
      base_definitions.py
  2. 2 2
      ops_nodegroup.py
  3. 13 4
      readtree.py

+ 2 - 2
base_definitions.py

@@ -93,7 +93,7 @@ class MantisTree(NodeTree):
 
 
         
         
     
     
-    def execute_tree(self,context):
+    def execute_tree(self,context, error_popups = False):
         self.handler_flip = False
         self.handler_flip = False
         if self.is_exporting:
         if self.is_exporting:
             return
             return
@@ -102,7 +102,7 @@ class MantisTree(NodeTree):
         self.is_executing = True
         self.is_executing = True
         from . import readtree
         from . import readtree
         try:
         try:
-            readtree.execute_tree(self.parsed_tree, self, context)
+            readtree.execute_tree(self.parsed_tree, self, context, error_popups)
         except RecursionError as e:
         except RecursionError as e:
             prRed("Recursion error while parsing tree.")
             prRed("Recursion error while parsing tree.")
         finally:
         finally:

+ 2 - 2
ops_nodegroup.py

@@ -230,7 +230,7 @@ class ExecuteNodeTree(Operator):
             from pstats import SortKey
             from pstats import SortKey
             with cProfile.Profile() as pr:
             with cProfile.Profile() as pr:
                 tree.update_tree(context)
                 tree.update_tree(context)
-                tree.execute_tree(context)
+                tree.execute_tree(context, error_popups = True)
                 # from the Python docs at https://docs.python.org/3/library/profile.html#module-cProfile
                 # from the Python docs at https://docs.python.org/3/library/profile.html#module-cProfile
                 s = io.StringIO()
                 s = io.StringIO()
                 sortby = SortKey.TIME
                 sortby = SortKey.TIME
@@ -241,7 +241,7 @@ class ExecuteNodeTree(Operator):
 
 
         else:
         else:
             tree.update_tree(context)
             tree.update_tree(context)
-            tree.execute_tree(context)
+            tree.execute_tree(context, error_popups = True)
         prGreen("Finished executing tree in %f seconds" % (time() - start_time))
         prGreen("Finished executing tree in %f seconds" % (time() - start_time))
         return {"FINISHED"}
         return {"FINISHED"}
 
 

+ 13 - 4
readtree.py

@@ -585,7 +585,7 @@ def execution_error_cleanup(node, exception, switch_objects = [] ):
 
 
 
 
 #execute tree is really slow overall, but still completes 1000s of nodes in only 
 #execute tree is really slow overall, but still completes 1000s of nodes in only 
-def execute_tree(nodes, base_tree, context):
+def execute_tree(nodes, base_tree, context, error_popups = False):
     # return
     # return
     import bpy
     import bpy
     from time import time
     from time import time
@@ -655,7 +655,10 @@ def execute_tree(nodes, base_tree, context):
                             if isinstance(ob, bpy.types.Object):
                             if isinstance(ob, bpy.types.Object):
                                 select_me.append(ob)
                                 select_me.append(ob)
                     except Exception as e:
                     except Exception as e:
-                        raise execution_error_cleanup(n, e,)
+                        if error_popups:
+                            raise execution_error_cleanup(n, e,)
+                        else:
+                            raise e
                     n.prepared=True
                     n.prepared=True
                     executed.append(n)
                     executed.append(n)
                     for conn in n.hierarchy_connections:
                     for conn in n.hierarchy_connections:
@@ -674,13 +677,19 @@ def execute_tree(nodes, base_tree, context):
                 if not n.executed:
                 if not n.executed:
                     n.bExecute(context)
                     n.bExecute(context)
             except Exception as e:
             except Exception as e:
-                raise execution_error_cleanup(n, e,)
+                if error_popups:
+                    raise execution_error_cleanup(n, e,)
+                else:
+                    raise e
 
 
         for n in executed:
         for n in executed:
             try:
             try:
                 n.bFinalize(context)
                 n.bFinalize(context)
             except Exception as e:
             except Exception as e:
-                raise execution_error_cleanup(n, e,)
+                if error_popups:
+                    raise execution_error_cleanup(n, e,)
+                else:
+                    raise e
 
 
         switch_mode(mode='OBJECT', objects=switch_me)
         switch_mode(mode='OBJECT', objects=switch_me)
         for ob in switch_me:
         for ob in switch_me: