 Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
gh_node Library
gh_node is the module that manages all kind of nodes in the scene. Every object, gpu program, texture, material in the scene is derived from the node. A scene can be seen as a tree of nodes.
Number of functions: 9
gh_node.getid
Gets the identifier (id) of a node from its name.
: Lua - Python
name [STRING]: name of node.
node_id [INTEGER]: node identifier
:
gpu_program_id = gh_node.getid("PhongShader")
gh_node.getptr
Gets the pointer on a node. The pointer is the pointer in the C context. Using pointers is a way to quickly access to a paricular node. You can use node pointers only with functions suffixed with _ptr.
: Lua - Python
node_id [INTEGER]: Node identifier.
node_ptr [POINTER]: pointer to the underlying node.
:
mesh_ptr = gh_node.getptr(mesh_id)
gh_node.set_name
Sets the name of a node.
: Lua - Python
: setname
node [INTEGER]: Node identifier.
name [STRING]: Name of the node.
:
gh_node.setname(node, "myKoolNodeName")
gh_node.get_name
Sets the name of a node.
: Lua - Python
: getname
node [INTEGER]: Node identifier.
name [STRING]: Node name.
:
name = gh_node.getname(node)
gh_node.kill
Kills (cleanup and free resources) a node.
: Lua - Python
node [INTEGER]: Node identifier.
:
gh_node.kill(node)
gh_node.get_num_children
Gets the number of children of a particular node.
: Lua - Python
node [INTEGER]: Node identifier.
num_children [INTEGER]: Number of children.
:
num_children = gh_node.get_num_children(node)
gh_node.get_child_by_index
Returns the node identifier of a child.
: Lua - Python
node [INTEGER]: Node identifier.
index [INTEGER]: Index of a children from 0 to gh_node.get_num_children()-1.
child [INTEGER]: Child identifier
:
-- Gets the first child.
child = gh_node.get_child_by_index(node, 0)
gh_node.add_child
Adds a child to a parent.
: Lua - Python
parent [INTEGER]: Parent node identifier.
child [INTEGER]: Child node identifier.
:
gh_node.add_child(parent, child)
gh_node.remove_child
Removes a child from a parent.
: Lua - Python
parent [INTEGER]: Parent node identifier.
child [INTEGER]: Child node identifier.
:
gh_node.remove_child(parent, child)
|