Просмотр исходного кода

Fix: Custom Properties don't trigger tree update

I also took a moment to fix the leftover print in xForm_nodes
Brandenburg 3 недель назад
Родитель
Сommit
fcdc86d053
2 измененных файлов с 13 добавлено и 2 удалено
  1. 13 1
      ops_nodegroup.py
  2. 0 1
      xForm_nodes.py

+ 13 - 1
ops_nodegroup.py

@@ -22,6 +22,16 @@ def any_tree_poll(context):
         return True
     return False
 
+def tag_mantis_node_for_update(context, node):
+    if any_tree_poll(context):
+        from .base_definitions import get_signature_from_edited_tree
+        node_tree = context.space_data.path[0].node_tree
+        mantis_node = node_tree.parsed_tree.get(
+                    get_signature_from_edited_tree(node, context))
+        if mantis_node is None:
+            node_tree.hash = ''
+        else:
+            mantis_node.reset_execution_recursive() # tag this as a change.
 #########################################################################3
 
 class MantisGroupNodes(Operator):
@@ -604,7 +614,7 @@ class AddCustomProperty(bpy.types.Operator):
         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):
@@ -666,6 +676,7 @@ class EditCustomProperty(bpy.types.Operator):
                     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.")
@@ -728,6 +739,7 @@ class RemoveCustomProperty(bpy.types.Operator):
             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'}
 
 

+ 0 - 1
xForm_nodes.py

@@ -509,7 +509,6 @@ class xFormBone(xFormNode):
                 raise RuntimeError("Could not set value of custom parameter")
                 # it creates a more confusing error later sometimes, better to catch it here.
 
-            prRed(name)
             pb[name] = value
             ui_data = pb.id_properties_ui(name)
             description = ''