Class dnx.lr.NodeInstance
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.lr.NodeInstance

java.lang.Object
   |
   +----dnx.util.DNXObject
           |
           +----dnx.lr.NodeInstance

public class NodeInstance
extends DNXObject
A NodeInstance represents a particular instance of a node. If you DEF a node and then USE it multiple times, you conceptually have the same node in each different place but a different instance in each place. Each instance has a NodeInstance object associated with it. Given a NodeInstance object, you can attach data to that particular instance and retrieve its parent, children, and siblings. Note that NodeInstance objects are only created as necessary, to conserve space. However, this is invisible to the API user unless you cross within the internal boundary (typically by subclassing Traversal).

Variable Index

 o showInstanceNumber
 o showLinkedNodes

Method Index

 o addAuxNodes(AuxNodeTreeContext)
 o debugPrint()
Print out the subgraph rooted at this node instance onto System.err.
 o deleteAuxNodes(AuxNodeTreeContext)
 o enumerateAuxNodes()
 o getActualNode()
Return the actual Node to which this instance belongs.
 o getChild(int, int)
 o getChildObjectToViewerMatrix(Camera, Matrix4)
Return the object-to-viewer matrix for children of this node instance.
 o getFirstChild()
Return the first child of the given node instance, or null if there are no children.
 o getLastChild()
Return the last child of the given node instance, or null if there are no children.
 o getNextChild(int, int)
 o getNextSibling()
Return the next sibling of the given node instance, i.e.
 o getNodeTreeContext()
Same as getActualNode().getNodeTreeContext().
 o getObjectToViewerMatrix(Camera, Matrix4)
Return the object-to-viewer transformation matrix for the given node instance (which must be uniquified) and specified camera.
 o getParent()
Return the parent node instance of this instance.
 o getPrevChild(int, int)
 o getPrevSibling()
Return the previous sibling of the given node instance, i.e.
 o getPrimitiveNode()
Return the non-prototype Node to which this instance belongs.
 o getPrimitiveNodeInstance()
If this is an instance of a PrototypeNode, return the non-prototype node at the root of the prototype; otherwise return THIS.
 o getProperty(Object)
Get the value of a property.
 o getProperty(Object, Object)
Get the value of a property.
 o getPropertyEqual(Object)
Like getProperty() but compare keys with equals().
 o getPropertyEqual(Object, Object)
Like getProperty() but compare keys with equals().
 o getSceneContext()
Same as getActualNode().getSceneContext().
 o isUniquified()
 o locateChildFieldIndex(NodeInstance, IntReference)
Locate the field that contains the node instance CHILD in it.
 o locateChildNodeIndex(NodeInstance, IntReference)
Equivalent to locateChildFieldIndex() but returns the node index directly and stores the field index into the passed IntReference (which can be null if you don't care about the field index).
 o print(PrintAction)
Print out the subgraph rooted at this node instance.
 o putProperty(Object, Object)
Add an arbitrary property to a node instance.
 o putPropertyEqual(Object, Object)
Like putProperty() but compare keys with equals().
 o removeProperty(Object)
Remove a property from a node instance.
 o removePropertyEqual(Object)
Like removeProperty() but compare keys with equals().
 o toInstanceString()
 o toString()
 o traverse(InstanceTraversal)
Perform a traversal of this instance and any of its children.
 o unlink()
Make this node instance no longer be linked to any others.

Variables

 o showInstanceNumber
  public static boolean showInstanceNumber
 o showLinkedNodes
  public static boolean showLinkedNodes

Methods

 o getActualNode
  public final Node getActualNode()
Return the actual Node to which this instance belongs. Much of the time, you want to call getPrimitiveNode(), which telescopes past PrototypeNodes.
 o getPrimitiveNode
  public final Node getPrimitiveNode()
Return the non-prototype Node to which this instance belongs. If this node instance belongs to a PrototypeNode, this automatically retrieves the non-prototype Node at the root.
 o getNodeTreeContext
  public final NodeTreeContext getNodeTreeContext()
Same as getActualNode().getNodeTreeContext().
 o getSceneContext
  public final SceneContext getSceneContext()
Same as getActualNode().getSceneContext().
 o getParent
  public NodeInstance getParent()
Return the parent node instance of this instance. This will be null on non-uniquified node instances, but unless you're within the LR internal boundary, you should never see such a beast.
 o getChild
  public NodeInstance getChild(int fieldInd,
                               int nodeInd)
 o getNextChild
  public NodeInstance getNextChild(int fieldind,
                                   int nodeind)
 o getPrevChild
  public NodeInstance getPrevChild(int fieldind,
                                   int nodeind)
 o getNextSibling
  public NodeInstance getNextSibling()
Return the next sibling of the given node instance, i.e. the next child after this one of the same parent. If this is the last sibling, null is returned.
 o getPrevSibling
  public NodeInstance getPrevSibling()
Return the previous sibling of the given node instance, i.e. the previous child after this one of the same parent. If this is the first sibling, null is returned.
 o getFirstChild
  public NodeInstance getFirstChild()
Return the first child of the given node instance, or null if there are no children.
 o getLastChild
  public NodeInstance getLastChild()
Return the last child of the given node instance, or null if there are no children.
 o getPrimitiveNodeInstance
  public NodeInstance getPrimitiveNodeInstance()
If this is an instance of a PrototypeNode, return the non-prototype node at the root of the prototype; otherwise return THIS.
 o locateChildFieldIndex
  public int locateChildFieldIndex(NodeInstance child,
                                   IntReference nodeIndex)
Locate the field that contains the node instance CHILD in it. Return the index of the field directly, and store the index of the node instance within the field into nodeIndex (which can be null, if you don't care about the node index). If the child is not found, -1 is returned.
 o locateChildNodeIndex
  public int locateChildNodeIndex(NodeInstance child,
                                  IntReference fieldIndex)
Equivalent to locateChildFieldIndex() but returns the node index directly and stores the field index into the passed IntReference (which can be null if you don't care about the field index).
 o getObjectToViewerMatrix
  public final void getObjectToViewerMatrix(Camera cam,
                                            Matrix4 m)
Return the object-to-viewer transformation matrix for the given node instance (which must be uniquified) and specified camera. This converts a point in the local space of the node instance to a point in camera (viewer) space. Note that if you want the object-to-world matrix, you should take the result of this method and post-multiply by the viewer-to-world matrix of the camera. (It has to be done this way because for some nodes, such as BillboardNode, their contribution to the transformation depends on the position of the camera.) Note that the local space of transforming nodes (e.g. TransformNode) does *NOT* include the transformation from the node itself. Call getChildObjectViewerMatrix() if you want that. If you pass in null for the camera, this function will act as if the viewpoint is located at the origin in world space, and the returned matrix will be an object-to-world matrix. You should NOT do this, however, if there's any way to avoid it, because the resulting value will be incorrrect if there are any BillboardNodes along the path from this NodeInstance to the root. (One reason you might want to pass in null is if you're trying to compute the viewer-to-world matrix of a ViewNode; in such cases, it's reasonable to make results undefined if the viewpoint sits inside of a BillboardNode.)
 o getChildObjectToViewerMatrix
  public final void getChildObjectToViewerMatrix(Camera cam,
                                                 Matrix4 m)
Return the object-to-viewer matrix for children of this node instance. If this node instance is a transforming node (or is a prototype node whose root is a transforming node), this will take into account the transformation of that node.
 o isUniquified
  public boolean isUniquified()
 o unlink
  public void unlink()
Make this node instance no longer be linked to any others. If there are other instances of the node, we make a new node for the instance and recursively proceed up the tree.
 o addAuxNodes
  public void addAuxNodes(AuxNodeTreeContext geom)
 o deleteAuxNodes
  public int deleteAuxNodes(AuxNodeTreeContext geom)
 o enumerateAuxNodes
  public Enumeration enumerateAuxNodes()
 o putProperty
  public void putProperty(Object key,
                          Object value)
Add an arbitrary property to a node instance. This mechanism allows you to attach instance-specific data to an instance. Keys are compared using the `==' operator. Therefore, don't use strings as keys; instead, use the Symbol object, by calling Symbol.intern ("string") to convert a string into a Symbol. If the key already exists, its value is replaced. @see dnx.util.Symbol @see dnx.util.PropertyList
 o getProperty
  public Object getProperty(Object key)
Get the value of a property. Keys are compared using the `==' operator; this means that the keys should not be strings (use Symbols instead). If the key is not found, null is returned. @see dnx.util.Symbol @see dnx.util.PropertyList
 o getProperty
  public Object getProperty(Object key,
                            Object defalt)
Get the value of a property. Keys are compared using the `==' operator; this means that the keys should not be strings (use Symbols instead). If the key is not found, DEFALT is returned. @see dnx.util.Symbol @see dnx.util.PropertyList
 o removeProperty
  public boolean removeProperty(Object key)
Remove a property from a node instance. Keys are compared using the `==' operator; this means that the keys should not be strings (use Symbols instead). Return value is true if the key was found. @see dnx.util.Symbol @see dnx.util.PropertyList
 o putPropertyEqual
  public void putPropertyEqual(Object key,
                               Object value)
Like putProperty() but compare keys with equals().
 o getPropertyEqual
  public Object getPropertyEqual(Object key)
Like getProperty() but compare keys with equals().
 o getPropertyEqual
  public Object getPropertyEqual(Object key,
                                 Object defalt)
Like getProperty() but compare keys with equals().
 o removePropertyEqual
  public boolean removePropertyEqual(Object key)
Like removeProperty() but compare keys with equals().
 o traverse
  public final boolean traverse(InstanceTraversal trav)
Perform a traversal of this instance and any of its children. Return true if the traversal was terminated prematurely.
 o debugPrint
  public void debugPrint()
Print out the subgraph rooted at this node instance onto System.err.
 o print
  public void print(PrintAction a)
Print out the subgraph rooted at this node instance.
 o toInstanceString
  public String toInstanceString()
 o toString
  public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index