< GeeXLab Reference Guide />
> Back to Reference Guide Index
gh_node library
Description
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: 10
- gh_node.add_child ()
- gh_node.get_child_by_index ()
- gh_node.get_name ()
- gh_node.get_num_children ()
- gh_node.getid ()
- gh_node.kill ()
- gh_node.remove_child ()
- gh_node.set_name ()
- gh_node.set_children_render_state ()
- gh_node.get_children_render_state ()
add_child
Description
Adds a child to a parent.
Syntax
gh_node.add_child(
parent_id,
child_id
)
Languages
Parameters
- parent_id [ID]: parent node identifier
- child_id [ID]: child node identifier
Return Values
This function has no return value(s).
Code sample
gh_node.add_child(parent_id, child_id)
get_child_by_index
Description
Returns the node identifier of a child.
Syntax
child_id = gh_node.get_child_by_index(
node_id,
index
)
Languages
Parameters
- node_id [ID]: node identifier
- index [INTEGER]: index of a children from 0 to gh_node.get_num_children()-1
Return Values
- child_id [ID]: child identifier
Code sample
-- Gets the first child.
child = gh_node.get_child_by_index(node_id, 0)
get_name
Description
Sets the name of a node.
Syntax
name = gh_node.get_name(
node_id
)
Languages
Parameters
- node_id [ID]: node identifier
Return Values
Code sample
name = gh_node.getname(node_id)
get_num_children
Description
Gets the number of children of a particular node.
Syntax
num_children = gh_node.get_num_children(
node_id
)
Languages
Parameters
- node_id [ID]: node identifier
Return Values
- num_children [INTEGER]: number of children
Code sample
num_children = gh_node.get_num_children(node_id)
getid
Description
Gets the identifier of a node from its name.
Syntax
node_id = gh_node.getid(
name
)
Languages
Parameters
- name [STRING]: name of node
Return Values
- node_id [ID]: node identifier
Code sample
node_id = gh_node.getid("PhongShader")
kill
Description
Kills (cleanup and free resources) a node.
Syntax
gh_node.kill(
node_id
)
Languages
Parameters
- node_id [ID]: node identifier
Return Values
This function has no return value(s).
Code sample
gh_node.kill(node_id)
remove_child
Description
Removes a child from a parent.
Syntax
gh_node.remove_child(
parent_id,
child_id
)
Languages
Parameters
- parent_id [ID]: parent node identifier
- child_id [ID]: child node identifier
Return Values
This function has no return value(s).
Code sample
gh_node.remove_child(parent_id, child_id)
set_name
Description
Sets the name of a node.
Syntax
gh_node.set_name(
node_id,
name
)
Languages
Parameters
- node_id [ID]: node identifier
- name [STRING]: name of the node
Return Values
This function has no return value(s).
Code sample
gh_node.setname(node_id, "myKoolNodeName")
set_children_render_state
Description
Sets the children render state of a particular node.
Syntax
gh_node.set_children_render_state(
node_id,
state,
children
)
Languages
Parameters
- node_id [ID]: node identifier
- state [INTEGER]: state: enabled (1) or disabled (0)
- children [INTEGER]: apply this state to all children: yes (1) or no (0)
Return Values
This function has no return value(s).
Code sample
gh_node.set_children_render_state(node_id, 0, 0)
get_children_render_state
Description
Gets the children render state of a particular node.
Syntax
state = gh_node.get_children_render_state(
node_id
)
Languages
Parameters
- node_id [ID]: node identifier
Return Values
- state [INTEGER]: state: enabled (1) or disabled (0)
Code sample
state = gh_node.get_children_render_state(node_id)
| |