[Bf-blender-cvs] [4cc1012] object_nodes: Context function for getting the object nodes in the node editor.

Lukas Tönne noreply at git.blender.org
Tue Nov 24 09:42:30 CET 2015


Commit: 4cc10122f28352b6909d7898ea0798eec2eb61fb
Author: Lukas Tönne
Date:   Fri Jul 17 03:20:53 2015 +0200
Branches: object_nodes
https://developer.blender.org/rB4cc10122f28352b6909d7898ea0798eec2eb61fb

Context function for getting the object nodes in the node editor.

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

M	release/scripts/startup/bl_operators/object_nodes.py

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

diff --git a/release/scripts/startup/bl_operators/object_nodes.py b/release/scripts/startup/bl_operators/object_nodes.py
index 6952014..161e782 100644
--- a/release/scripts/startup/bl_operators/object_nodes.py
+++ b/release/scripts/startup/bl_operators/object_nodes.py
@@ -29,6 +29,13 @@ class ObjectNodeTree(NodeTree):
     bl_label = 'Object Nodes'
     bl_icon = 'OBJECT_DATA'
 
+    @classmethod
+    def get_from_context(cls, context):
+    	ob = context.object
+    	if ob:
+    		return ob.node_tree, ob.node_tree, ob
+    	else:
+    		return None, None, None
 
 class ObjectNodesNew(Operator):
     """Create new object node tree"""
@@ -42,4 +49,3 @@ class ObjectNodesNew(Operator):
 
     def execute(self, context):
     	return bpy.ops.node.new_node_tree(type='ObjectNodeTree', name="NodeTree")
-    	#return {'FINISHED'}




More information about the Bf-blender-cvs mailing list