procfunc

class procfunc.ProcNode[source]

Bases: Generic[T]

Result datatype for all functions that return shader nodes, geometry nodes or compositor nodes.

ProcNode stores the data necessary to construct a blender nodegroup upon later execution.

ProcNode defines dunders to allow concise construction of nodegraphs e.g. __getattr__ and __add__, which map to appropriate blender nodes.

__init__(node, known_value_type=None)[source]
Parameters:
  • node (Node)

  • known_value_type (type | None)

astype(dtype)[source]

Marks a node as having been converted to a different internal data type, similarly to np.astype

Currently this just adds runtime NodeType data to help subsequent type-inferred functions/operators make a correct choice of data_type.

e.g noise.color + (0.5, 0.5, 0.5) fails but noise.color.astype(t.Vector) + (0.5, 0.5, 0.5) works, because + is defined for Vector but not Color

Parameters:

dtype (type)

Return type:

ProcNode

classmethod from_nodetype(node_type, inputs, attrs)[source]
Parameters:
Return type:

ProcNode

item()[source]
Return type:

Node

property x: ProcNode[float]
property y: ProcNode[float]
property z: ProcNode[float]

Supported special methods: __add__, __mod__, __mul__, __pow__, __radd__, __req__, __rge__, __rgt__, __rle__, __rlt__, __rmod__, __rmul__, __rne__, __rpow__, __rsub__, __rtruediv__, __sub__, __truediv__

class procfunc.Shader[source]

Bases: object

Used only for type-annotating nodes as returning a shader.

Anythnig that would be a green socket in a SHADER nodegraph should be ProcNode[Shader]

class procfunc.NodeDataType[source]

Bases: Enum

INT = 'INT'
FLOAT = 'FLOAT'
RGBA = 'RGBA'
FLOAT_VECTOR = 'FLOAT_VECTOR'
FLOAT_VECTOR_2D = 'FLOAT2'
ROTATION = 'ROTATION'
STRING = 'STRING'
BOOLEAN = 'BOOLEAN'
FLOAT_MATRIX = 'FLOAT_MATRIX'
OBJECT = 'OBJECT'
GEOMETRY = 'GEOMETRY'
SHADER = 'SHADER'
COLLECTION = 'COLLECTION'
MATERIAL = 'MATERIAL'
classmethod from_str(s)[source]
Parameters:

s (str)

Return type:

NodeDataType

Supported special methods: __contains__, __getitem__, __iter__, __len__

procfunc.trace(func, trace_level=TraceLevel.GENERATORS, name=None, **inputs)[source]

Turn a python function into a graph datastructure.

Using this datastructure is (usually) equivelent to executing the function.

Parameters:
  • func (Callable) – The function to trace

  • trace_level (TraceLevel) – Granularity of the graph. Functions at this level become leaves; finer functions are traced through. choice() peeks through all options when trace_level >= RANDOM_CONTROL, or resolves to the chosen branch when finer.

  • name (str | None)

  • inputs (Any)

procfunc.RNG

alias of Generator

procfunc.module_path()[source]

Public API

What appears on each page below is controlled entirely by what each module exports. Add a name to the relevant __init__.py (or to its __all__) and it will show up on the next build; remove it and it disappears. Submodule pages likewise follow each submodule’s __all__ when defined, or fall back to every non-underscore name.

Index