Node¶
-
class
guerilla.
Node
¶ Bases:
object
Base class of all the document’s nodes.
-
Name
¶ The node name
Type: str
-
belongstoreference
(ref)¶ Tells if the node belongs to the reference, or a sub reference
Parameters: ref ( Reference
) – The reference to testReturns: true is the node belongs to the reference or a sub reference Return type: bool
-
children
(type='Node', pattern=None, recursive=None)¶ Iterator over children
Examples:
>>> import guerilla >>> for node in guerilla.Document ().children (pattern="^Bott.*"): # iterate over the root nodes of Document named 'Bott...' ... print (node.getpath ()) Bottom
>>> import guerilla >>> for node in guerilla.Document ().children ("Camera"): # iterate over the root Camera nodes of Document ... print (node.getpath ()) Right Back Perspective Bottom Top Front Left
>>> import guerilla >>> for node in guerilla.Document ().children ("Light", recursive=True): # iterate over all the Light nodes of Document ... print (node.getpath ())
Parameters: Return type: iterator
-
static
create
(name, type='SceneGraphNode', parent=None)¶ Create a node Use current modification context if available
Examples:
>>> n = Node.create('foo'); n.name 'foo...' >>> n = Node.create('bar', type='STEREOCAMERA') Traceback (most recent call last): ValueError: not a valid node type: STEREOCAMERA >>> n = Node.create('bar') >>> n2 = Node.create('cbar', parent=n); n2.getpath() 'bar...|cbar'
-
createplug
(name, plugType='Plug', dataType='string', flags=0, value=None)¶ Create a Plug on node Use current modification context if available see. createplug function in Modifier class
-
delete
()¶ Delete a node
-
eval
(plug)¶ Called by the framework when plug (a node’s plug) must be evaluated
Parameters: plug ( Plug
) –Returns: The evaluated plug value Return type: <i>any</i>
-
findchild
(path)¶ Find a child node or plug using a path
Parameters: path (str) – the child node or plug path Returns: the child node or plug Return type: Node
orPlug
-
findparent
(name)¶ Find the first parent Node of this Node of a specific class
Parameters: name (str) – the parent’s class Returns: the node’s parent Return type: Node
-
getchild
(name)¶ Get a child node by its name
Parameters: name (str) – the child name Returns: The child node Return type: Node
-
getname
()¶ Get the Node name in its parent
Returns: The Node name Return type: [string or number]
-
getreference
()¶ Returns the reference node it is connected to
Returns: the reference node or None if not referenced Return type: Reference
-
getreferences
(Reference=None)¶ Returns the references in the document sorted depth first.
Parameters: Reference (topref) – an optional top reference Returns: references Return type: of
-
getstringcopy
()¶ Return a copy of the node and its content as a string to be pasted
Returns: The string copy Return type: str
-
hasAttr
(name, type)¶ Check whether a child node or plug of given type exists
Parameters:
-
hasChild
(name)¶ Check whether a child exists or not
Parameters: name (str) – child name Returns: True if child exists else False Return type: bool
-
hasPlug
(name)¶ Check whether a plug exists or not
Parameters: name (str) – plug name Returns: True if plug exists else False Return type: bool
-
iseditable
()¶ Indicates if the node can be edited by the user in the UI
The default behaviour is to return true if no IsEditable plug exists, otherwise it returns the IsEditable plug value. To render a node non editable, create a IsEditable dynamic plug, and set its value to false. Alternatively, use the seteditable function.
Returns: true if the node can be edited Return type: bool
-
isparent
(child)¶ Tells if this node is parent of the potential child
Parameters: child ( Node
) – the potential child to checkReturn type: bool
-
isreference
()¶ Tells if a node comes from a reference project
Returns: true if the node is a reference Return type: bool
-
loadfile
(filename)¶ load a file content in this node.
Parameters: filename (str) – The file name to load Returns: The created nodes or None if failed Return type: { Node
}
-
loadtemplate
(template, name)¶ load a template file
Parameters: Returns: The created node or None if failed
Return type:
-
onpathchanged
()¶ Called by the framework when the name of this node or of one of its parent is modified
-
pastestringcopy
(copy)¶ Paste a string copy into this node
See also getstringcopy for an example of copy/pasting.
Parameters: copy (str) – The string copy to paste Returns: The pasted nodes, or None if failed and an error message Return type: {Node},string
-
plugs
(type='Plug', typename=None)¶ Iterator over all plugs in Node
Return type: iterator
-
rename
(name)¶ Rename a node Use current modification context if available
Parameters: name (str) – node new name
-
savefile
(filename)¶ load a node to a file
Parameters: filename (str) – The file name to save Returns: True if success, or None and an error message Return type: bool,string
-
seteditable
(editable)¶ Change the editable state of the node
Parameters: editable (bool) – The new state of the node
-
setflags
()¶ Set the node flags
-