NodeTree(ID)#
Poll Function#
The NodeTree.poll
function determines if a node tree is visible
in the given context (similar to how Panel.poll
and 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)
base classes — bpy_struct
, ID
subclasses —
CompositorNodeTree
, GeometryNodeTree
, ShaderNodeTree
, TextureNodeTree
- class bpy.types.NodeTree(ID)#
Node tree consisting of linked nodes used for shading, textures and compositing
- bl_description#
- Type:
string, default “”, (never None)
- bl_icon#
The node tree icon
- Type:
enum in Icon Items, default ‘NODETREE’
- bl_idname#
- Type:
string, default “”, (never None)
- bl_label#
The node tree label
- Type:
string, default “”, (never None)
- color_tag#
Color tag of the node group which influences the header color
NONE
None – Default tag for new node groups.ATTRIBUTE
Attribute.COLOR
Color.CONVERTER
Converter.DISTORT
Distort.FILTER
Filter.GEOMETRY
Geometry.INPUT
Input.MATTE
Matte.OUTPUT
Output.SCRIPT
Script.SHADER
Shader.TEXTURE
Texture.VECTOR
Vector.
- Type:
enum in [‘NONE’, ‘ATTRIBUTE’, ‘COLOR’, ‘CONVERTER’, ‘DISTORT’, ‘FILTER’, ‘GEOMETRY’, ‘INPUT’, ‘MATTE’, ‘OUTPUT’, ‘SCRIPT’, ‘SHADER’, ‘TEXTURE’, ‘VECTOR’], default ‘NONE’
- description#
Description of the node tree
- Type:
string, default “”, (never None)
- grease_pencil#
Grease Pencil data-block
- Type:
- interface#
Interface declaration for this node tree
- Type:
NodeTreeInterface
, (readonly)
- links#
- Type:
NodeLinks
bpy_prop_collection
ofNodeLink
, (readonly)
- nodes#
- Type:
Nodes
bpy_prop_collection
ofNode
, (readonly)
- type#
Node Tree type (deprecated, bl_idname is the actual node tree type identifier)
UNDEFINED
Undefined – Undefined type of nodes (can happen e.g. when a linked node tree goes missing).CUSTOM
Custom – Custom nodes.SHADER
Shader – Shader nodes.TEXTURE
Texture – Texture nodes.COMPOSITING
Compositing – Compositing nodes.GEOMETRY
Geometry – Geometry nodes.
- Type:
enum in [‘UNDEFINED’, ‘CUSTOM’, ‘SHADER’, ‘TEXTURE’, ‘COMPOSITING’, ‘GEOMETRY’], default ‘SHADER’, (readonly)
- view_center#
The current location (offset) of the view for this Node Tree
- Type:
mathutils.Vector
of 2 items in [-inf, inf], default (0.0, 0.0), (readonly)
- interface_update(context)#
Updated node group interface
- contains_tree(sub_tree)#
Check if the node tree contains another. Used to avoid creating recursive node groups
- Parameters:
sub_tree (
NodeTree
, (never None)) – Node Tree, Node tree for recursive check- Returns:
contained
- Return type:
boolean
- classmethod poll(context)#
Check visibility in the editor
- Return type:
boolean
- update()#
Update on editor changes
- classmethod get_from_context(context)#
Get a node tree from the context
- classmethod valid_socket_type(idname)#
Check if the socket type is valid for the node tree
- Parameters:
idname (string, (never None)) – Socket Type, Identifier of the socket type
- Return type:
boolean
- classmethod bl_rna_get_subclass(id, default=None)#
- Parameters:
id (string) – The RNA type identifier.
- Returns:
The RNA type or default when not found.
- Return type:
bpy.types.Struct
subclass