SceneGraphNode

class guerilla.SceneGraphNode

Bases: guerilla.HostNode

Base class of all the objects that can be stored in the scene graph like primitives and groups

FreezeTransform

Indicate if the SceneGraphNode’s parameters are to be frozen

Type:types.bool
Hidden

The visibility state.

If true, the primitive and its children are hidden from all the layers, the shadow maps and the trace sets.

Type:bool
HierarchyMode

Indicates the transform mode of the node (local, world as PRMan, Maya or Max)

Type:types.enum
Instances

The dpendencies on instanced SceneGraphNodes

Type:None
InvWBounds

Invalidated when the world transform and/or bounds of the object has changed.

This plug is used to invalidate data the depends on the hierarchy rendering aspect. Notably, this plug is invalidated whenever a parent or child has its own InvWBounds invalidated.

Type:None
IsHidden

The visibility state. This plug tells if this node is visible, regarding its state and the state of its parents.

Type:bool
Material

The dependency on the connected Material

Type:None
Mermbership

The list of tags the node owns

Type:types.string
RibAttributes

The dependency on the additional Rib Attributes to be assigned

Type:None
Transform

The SceneGraphNode’s local to world transform

Type:transform
createinstance(instance)

Create an instance at this node

Parameters:instance (SceneGraphNode) – The SceneGraphNode to instanciate
static displayrenderattribute(category, name, show)

Enable/disable the display of a specific attribute in the properties

This function returns the attribute definition in the given category. Note that

not all values in the attribute can be overloaded.

param category:The name of the attribute category
type category:str
param name:The name of the attribute, either its renderer name, or display name or its plug name
type name:str
param show:Whether the attribute is displayed or not
type show:bool
fillanimationtemplate(template)

Fill a template table with the “Animation” attributes

Parameters:template (table) – The template table to fill
fillarealighttemplate(template)

Fill a template table with the “Area Light” attributes

Parameters:template (table) – The template table to fill
fillcurvestemplate(template)

Fill a template table with the “Curves” attributes

Parameters:template (table) – The template table to fill
fillgeometrytemplate(template)

Fill a template table with the “Geometry” attributes

Parameters:template (table) – The template table to fill
filllinkingtemplate(template)

Fill a template table with the “Linking” attributes

Parameters:template (table) – The template table to fill
fillopengltemplate(template)

Fill a template table with the “OpenGL” attributes

Parameters:template (table) – The template table to fill
fillparticlestemplate(template)

Fill a template table with the “Particles” attributes

Parameters:template (table) – The template table to fill
fillraytracingtemplate(template)

Fill a template table with the “Raytracing” attributes

Parameters:template (table) – The template table to fill
fillsamplingtemplate(template)

Fill a template table with the “Sampling” attributes

Parameters:template (table) – The template table to fill
fillscenenodetemplate(template)

Fill a template table with the “Primitive” attributes

Parameters:template (table) – The template table to fill
fillshadertemplate(template)

Fill a template table with the “Surface” attributes

Parameters:template (table) – The template table to fill
fillshadingtemplate(template)

Fill a template table with the “Shading” attributes

Parameters:template (table) – The template table to fill
fillsubdivtemplate(template)

Fill a template table with the “Subdivision” attributes

Parameters:template (table) – The template table to fill
filltransformtemplate(template)

Fill a template table with the “Transform” attributes

Parameters:template (table) – The template table to fill
fillvolumetrictemplate(template)

Fill a template table with the “Volumetric” attributes

Parameters:template (table) – The template table to fill
flatteninstance(name)

Flatten an instance by name, or all instances if name is nil

Parameters:name (str or None) – The instance name to flatten
getmatrix()

Returns the node’s first transform matrix.

Returns the node’s first transform matrix. Note that the result is possibly only a part of the whole node transform. The matrix is given in the space of the node, that is is either local or world, depending on the HierarchyMode plug value.

Returns:The node matrix
Return type:matrix
getparentworldmatrix()

Returns the exclusive world matrix of the node

Returns:The parent world matrix
Return type:matrix
getparentworldtransform()

Returns the exclusive world transform of the node

Returns:The parent world transform
Return type:transform
getposition()

Returns the node’s position.

Returns the node’s position. Note that the result is possibly only a part of the whole node transform. The position is given in the space of the node, that is is either local or world, depending on the HierarchyMode plug value.

Returns:The node position
Return type:point3
static getrenderattributedefinition(category, name)

Lookup the render attributes definition by for a category and aan attribute name

This function returns the attribute definition in the given category.

Parameters:
  • category (str) – The name of the attribute category
  • name (str) – The name of the attribute, either its renderer name, or display name or its plug name
Returns:

The attribute definition

Return type:

table

static getrenderattributes(path, origin)

Get the rendering attributes of a node/path

>>> result = guerilla.SceneGraphNode.getrenderattributes ("Group|Object", False)
>>> attributes = result['attributes']
>>> for name, value in attributes.iteritems ():
...     if isinstance (value, guerilla.subshader):
...             print (name, value.getname ())
...             for k, v in value.getparameters ().iteritems ():
...                     print (k, v)
...     else:
...             print (name, value)
Parameters:
  • path (str or Node) – the path of the node
  • origin (bool) – if true, the returned value contains information about the origin of the attributes
Returns:

The resulting attributes

Return type:

dictionary

getsgparent()

Returns the node’s hierarchical parent.

This method returns the parent SceneGraphNode in case the parent is not a SceneGraphNode.

For instance, ShaderNodeGizmo may be contained in a ShaderNodeMacro, which is not a SceneGraphNode.

return:The node parent
rtype:SceneGraphNode
gettransform()

Return the top Transform node of the transform stack of this SceneGraphNode or this if the stack is empty

Return type:Node
getworldmatrix()

Returns the node’s world transform first matrix.

Returns:The node world matrix
Return type:matrix
getworldposition()

Returns the node’s world position.

Returns:The node world position
Return type:point3
getworldtolocalmatrix()

Returns the inverse of the world matrix

Returns:The node world to local matrix
Return type:matrix
getworldtolocaltransform()

Returns the inverse of the world transform

Returns:The node world to local transform
Return type:transform
getworldtransform()

Returns the node’s world transform.

Returns:The node transform
Return type:transform
isinstance(path)

Returns true if the given path contains an instance

Parameters:path (str) – The path from this node
isleafinstance(path)

Returns true if the lath item of the path is an instance

Parameters:path (str) – The path from this node
listbytags(*args)

List children nodes (include self) that have specified tags

Available arguments:

Parameters:tags (str or {string}) – The tag or list of tags to check
Returns:The list of SceneGraphNode that have this tag.
Return type:{SceneGraphNode}

or

Parameters:tags (str or {string}) – The tags to match, as a list of string or a single string to match a single tag
Returns:The list of SceneGraphNode children that share the input tags
Return type:{SceneGraphNode}
static listrenderattributes()

Get the list of available render attributes

This function returns a dictionary of categories of attributes,

each category is a list of attributes.

removeinstance(path)

Remove an instance

Parameters:path (The) – path to the instance
setmatrix(m)

Set the local matrix of the node

Parameters:m (matrix) – The new local matrix of the node
static setrenderattributeproperty(category, name, property, value)

Set a render attribute property

The following properties can be modified:
  • ptysheet: bool, the attribute is displayed in the property sheet

    param category:The name of the attribute category
    type category:str
    param name:The name of the attribute, either its renderer name, or display name or its plug name
    type name:str
    param property:The name of the attribute property to set
    type property:str
    param value:The value of the attribute property to set
    type value:any
setworldmatrix(world)

Set the world matrix of the node

Parameters:world (matrix) – The new world matrix of the node
setworldposition(position)

Set the world position of the node, leaving the rest of the transform unchanged

Parameters:position (point3) – The new world position of the node
traverse(map, *args)

Traverse the hierarchy and call a map function on every node

Parameters:
  • map (function) – a function called at every node of the hierarchy
  • *args

    optional parameters given back to the map function

traverserender(traversal, *args)

Traverse the hierarchy with a traversal object

The traverserender method calls the traversal traverse method on each child

and instance of this node. The traverse method of the traversal, in turn, can call the traverserender on the passed node.

param traversal:
 A traversal object that must implement the traverse(child, …) method
type traversal:table
param *args:Optional arguments given to the traversal
type *args: