File: bpy.types.NodeTree.py

package info (click to toggle)
blender 3.4.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 280,208 kB
  • sloc: ansic: 1,213,366; cpp: 1,148,738; python: 468,812; xml: 13,577; sh: 5,969; javascript: 304; lisp: 247; makefile: 67
file content (26 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
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"
    bl_icon = 'NONE'

    @classmethod
    def poll(cls, context):
        return context.scene.render.engine == 'CYCLES'


bpy.utils.register_class(CyclesNodeTree)