[Bf-blender-cvs] [051706b] object_nodes: Restrict the ObjectNodeEdit operator to only work on the object nodes.

Lukas Tönne noreply at git.blender.org
Sat Dec 5 11:34:25 CET 2015


Commit: 051706bf95e5c87322143e5114e36460e873e5aa
Author: Lukas Tönne
Date:   Sat Dec 5 08:36:30 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB051706bf95e5c87322143e5114e36460e873e5aa

Restrict the ObjectNodeEdit operator to only work on the object nodes.

We want to keep this separate from shader/compo/tex nodes which have
their own node group operators.

===================================================================

M	release/scripts/nodes/object_nodes.py

===================================================================

diff --git a/release/scripts/nodes/object_nodes.py b/release/scripts/nodes/object_nodes.py
index 15f2211..caf61f7 100644
--- a/release/scripts/nodes/object_nodes.py
+++ b/release/scripts/nodes/object_nodes.py
@@ -130,19 +130,22 @@ class ObjectNodeEdit(Operator):
         if hasattr(context, "node"):
             return context.node
         else:
-            return context.active_node
+            return getattr(context, "active_node", None)
 
     @classmethod
     def poll(cls, context):
         space = context.space_data
         if space.type != 'NODE_EDITOR':
             return False
+        treetype = getattr(bpy.types, space.tree_type)
+        if not issubclass(treetype, NodeTreeBase):
+            return False
         return True
 
     def execute(self, context):
         space = context.space_data
         node = self.get_node(context)
-        has_tree = node and hasattr(node, "id") and node.id and isinstance(node.id, bpy.types.NodeTree)
+        has_tree = node and node.id and isinstance(node.id, NodeTreeBase)
         exit = self.exit or not has_tree
 
         if exit:




More information about the Bf-blender-cvs mailing list