Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-03-19 02:37:04 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-19 02:37:04 +0400
commitae25aa22105b060294095357692f2aed4c650ce8 (patch)
tree06548276f86326f21943f8ec7ef92765a97b5ab5 /doc
parent29b7b344fc48ed31b1e36818ab4767090691d6e2 (diff)
parent03762409cd4f812d152e42de9c4f9853df91be0b (diff)
svn merge ^/trunk/blender -r55372:55392
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bpy.types.NodeTree.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.NodeTree.py b/doc/python_api/examples/bpy.types.NodeTree.py
new file mode 100644
index 00000000000..401b3a01ae0
--- /dev/null
+++ b/doc/python_api/examples/bpy.types.NodeTree.py
@@ -0,0 +1,23 @@
+"""
+Poll Function
++++++++++++++++
+The :class:`NodeTree.poll` function determines if a node tree is visible
+in the given context (similar to how :class:`Panel.poll`
+and :class:`Menu.poll` define visibility). If it returns False,
+the node tree type will not be selectable in the node editor.
+
+A typical condition for shader nodes would be to check the active render engine
+of the scene and only show nodes of the renderer they are designed for.
+"""
+import bpy
+
+
+class CyclesNodeTree(bpy.types.NodeTree):
+ """ This operator is only visible when Cycles is the selected render engine"""
+ bl_label = "Cycles Node Tree"
+
+ @classmethod
+ def poll(cls, context):
+ return context.scene.render.engine == 'CYCLES'
+
+bpy.utils.register_class(CyclesNodeTree)