Quick Links
- Homepage
- Downloads
- Code Sample Pack
- Gallery
- Forum

Documentation
- Overview
- GLSL Programs
- Live Coding
- Hack your first
  GLSL program

- Reference guide

Follow GLSL Hacker

GLSL Hacker @ Twitter

GLSL Hacker

Reference Guide
Host-API Lua / Python



» Back to Homepage
» Back to Developer's 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: 9

gh_node.getid

Description
Gets the identifier (id) of a node from its name.

Languages: Lua - Python

Parameters
  • name [STRING]: name of node.

    Return Values
  • node_id [INTEGER]: node identifier

    Code sample :

    gpu_program_id = gh_node.getid("PhongShader")


    gh_node.getptr

    Description
    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.

    Languages: Lua - Python

    Parameters
  • node_id [INTEGER]: Node identifier.

    Return Values
  • node_ptr [POINTER]: pointer to the underlying node.

    Code sample :

    mesh_ptr = gh_node.getptr(mesh_id)


    gh_node.set_name

    Description
    Sets the name of a node.

    Languages: Lua - Python

    Alias: setname

    Parameters
  • node [INTEGER]: Node identifier.
  • name [STRING]: Name of the node.

    Code sample :

    gh_node.setname(node, "myKoolNodeName")


    gh_node.get_name

    Description
    Sets the name of a node.

    Languages: Lua - Python

    Alias: getname

    Parameters
  • node [INTEGER]: Node identifier.

    Return Values
  • name [STRING]: Node name.

    Code sample :

    name = gh_node.getname(node)


    gh_node.kill

    Description
    Kills (cleanup and free resources) a node.

    Languages: Lua - Python

    Parameters
  • node [INTEGER]: Node identifier.

    Code sample :

    gh_node.kill(node)


    gh_node.get_num_children

    Description
    Gets the number of children of a particular node.

    Languages: Lua - Python

    Parameters
  • node [INTEGER]: Node identifier.

    Return Values
  • num_children [INTEGER]: Number of children.

    Code sample :

    num_children = gh_node.get_num_children(node)


    gh_node.get_child_by_index

    Description
    Returns the node identifier of a child.

    Languages: Lua - Python

    Parameters
  • node [INTEGER]: Node identifier.
  • index [INTEGER]: Index of a children from 0 to gh_node.get_num_children()-1.

    Return Values
  • child [INTEGER]: Child identifier

    Code sample :

    -- Gets the first child.
    child = gh_node.get_child_by_index(node, 0)


    gh_node.add_child

    Description
    Adds a child to a parent.

    Languages: Lua - Python

    Parameters
  • parent [INTEGER]: Parent node identifier.
  • child [INTEGER]: Child node identifier.

    Code sample :

    gh_node.add_child(parent, child)


    gh_node.remove_child

    Description
    Removes a child from a parent.

    Languages: Lua - Python

    Parameters
  • parent [INTEGER]: Parent node identifier.
  • child [INTEGER]: Child node identifier.

    Code sample :

    gh_node.remove_child(parent, child)






  • (C)2012 Geeks3D