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
- annotation
Annotation data
- Type:
- 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)
- bl_use_group_interface
Determines the visibility of some UI elements related to node groups
- Type:
boolean, default True
- color_tag
Color tag of the node group which influences the header color
NONENone – Default color tag for new nodes and node groups.ATTRIBUTEAttribute.COLORColor.CONVERTERConverter.DISTORTDistort.FILTERFilter.GEOMETRYGeometry.INPUTInput.MATTEMatte.OUTPUTOutput.SCRIPTScript.SHADERShader.TEXTURETexture.VECTORVector.PATTERNPattern.INTERFACEInterface.GROUPGroup.
- Type:
enum in [
'NONE','ATTRIBUTE','COLOR','CONVERTER','DISTORT','FILTER','GEOMETRY','INPUT','MATTE','OUTPUT','SCRIPT','SHADER','TEXTURE','VECTOR','PATTERN','INTERFACE','GROUP'], default"'NONE'"
- default_group_node_width
The width for newly created group nodes
- Type:
int in [60, 700], default 140
- description
Description of the node tree
- Type:
string, default “”, (never None)
- interface
Interface declaration for this node tree
- Type:
NodeTreeInterface, (readonly)
- links
- Type:
NodeLinksbpy_prop_collectionofNodeLink, (readonly)
- nodes
- Type:
Nodesbpy_prop_collectionofNode, (readonly)
- type
Node Tree type (deprecated, bl_idname is the actual node tree type identifier)
UNDEFINEDUndefined – Undefined type of nodes (can happen e.g. when a linked node tree goes missing).CUSTOMCustom – Custom nodes.SHADERShader – Shader nodes.TEXTURETexture – Texture nodes.COMPOSITINGCompositing – Compositing nodes.GEOMETRYGeometry – 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.Vectorof 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
- debug_lazy_function_graph()
Get the internal lazy-function graph for this node tree
- Returns:
Dot Graph, Graph in dot format
- Return type:
string
- classmethod bl_rna_get_subclass(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
- Returns:
The RNA type or default when not found.
- Return type:
bpy.types.Structsubclass
Inherited Properties
Inherited Functions
References
|