SPIN Framework
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

spin::ReferencedNode Class Reference

The base class for all SPIN scene graph nodes. More...

#include <ReferencedNode.h>

Inheritance diagram for spin::ReferencedNode:
spin::Contour spin::GridNode spin::GroupNode spin::MeasurementNode spin::AnimationNode spin::AttractorNode spin::ConstraintsNode spin::DSPNode spin::GeometryNode spin::KinectCloud spin::LightSource spin::Menu3D spin::ModelNode spin::ParticleSystem spin::RayNode spin::ReporterNode spin::ShapeNode spin::SwitchNode spin::TextNode

List of all members.

Public Member Functions

 ReferencedNode (SceneManager *sceneManager, const char *initID)
virtual void registerNode (SceneManager *s)
virtual void callbackUpdate (osg::NodeVisitor *nv)
virtual void updateNodePath (bool updateChildren=true)
int setAttachmentNode (osg::Group *n)
void updateChildNodePaths ()
void setParent (const char *newvalue)
void attachTo (const char *parentID)
void detachFrom (const char *parentID)
bool inGraph ()
unsigned int getNumParents () const
std::string getParentID (int i) const
ReferencedNodegetParentNode (int i)
std::vector< ReferencedNode * > getChildren ()
virtual void setContext (const char *newvalue)
void setAlpha (float alpha)
float getAlpha () const
const char * getContext () const
std::string getContextString () const
virtual void setParam (const char *paramName, const char *paramValue)
virtual void setParam (const char *paramName, float paramValue)
void setStateSetFromFile (const char *filename)
void setStateSet (const char *s)
const char * getStateSet () const
virtual void updateStateSet ()
osg::Group * getAttachmentNode () const
virtual void debug ()
virtual std::vector< lo_message > getState () const
virtual void stateDump ()
virtual void stateDump (lo_address addr)
std::string getID () const
std::string getNodeType () const
t_symbolgetNodeSymbol ()
bool addCronScript (bool serverSide, const std::string &label, const std::string &scriptPath, double freq, const std::string &params)
bool callCronScripts ()
bool enableCronScript (const char *label, int enable)
bool removeCronScript (const char *label)
bool addEventScript (bool serverSide, const std::string &label, const std::string &eventName, const std::string &scriptPath, const std::string &params)
bool callEventScript (const std::string &eventName, cppintrospection::ValueList &args)
bool enableEventScript (const char *label, int enable)
bool removeEventScript (const char *label)

Public Attributes

osg::NodePath currentNodePath_
bool scheduleForDeletion_

Protected Member Functions

bool legalParent (t_symbol *newParent)
void setNodeType (std::string t)

Protected Attributes

SceneManagersceneManager_

Detailed Description

The base class for all SPIN scene graph nodes.

Any node that is to be attached to the scene graph needs to be extended from the ReferencedNode class. By doing so, the OSC networking interface is created automatically, and the wx gui is automatically populated with the nodes editable properties.


Member Function Documentation

void spin::ReferencedNode::attachTo ( const char *  parentID)

Attach this node to the node with parentID (if found).

void spin::ReferencedNode::callbackUpdate ( osg::NodeVisitor *  nv) [virtual]

For nodes that require regular programmatic control, there is a callback that is evaluated with every refresh. This function can thus be used for animations, or any other periodic updates.

Note that changes to the scene graph structure (eg, moving/deleting nodes should NOT be done within this callback because traversals stacks will become corrupted. The technique is rather to enable a flag and then do the actual change in the SceneManager::updateGraph() method.

Reimplemented in spin::AnimationNode, spin::AttractorNode, spin::CollisionShape, spin::ConstraintsNode, spin::Contour, spin::DSPNode, spin::GeometryNode, spin::GroupNode, spin::KinectCloud, spin::Listener, spin::MeasurementNode, spin::ParticleSystem, spin::PointerNode, spin::ReporterNode, spin::SoundNode, spin::TextNode, and spin::UserNode.

void spin::ReferencedNode::debug ( ) [virtual]

Debug print (to log/console)

Reimplemented in spin::CollisionShape, spin::GroupNode, and spin::ReporterNode.

void spin::ReferencedNode::detachFrom ( const char *  parentID)

Detaches the node from the parentID (if found). Note: you can pass "*" for the parentID and the node will be detached from ALL parents.

osg::Group* spin::ReferencedNode::getAttachmentNode ( ) const [inline]

subclasses of ReferencedNode may contain complicated subgraphs, and any children get attached not to the node pointer itself, but to an attachmentNode. This attachmentNode essentially defines the origin of the local coordinate system of this node (according to the subgraph). This function returns a pointer to this node.

const char* spin::ReferencedNode::getContext ( ) const [inline]

Returns the current host

std::string spin::ReferencedNode::getID ( ) const [inline]

Return the string id for this node

std::string spin::ReferencedNode::getParentID ( int  i) const

Returns the parent id (string)

ReferencedNode * spin::ReferencedNode::getParentNode ( int  i)

Returns the current parent as an osg::Group

std::vector< lo_message > spin::ReferencedNode::getState ( ) const [virtual]
bool spin::ReferencedNode::inGraph ( )

The inGraph method checks if the node is actually attached to the scene graph. There are cases (eg, SwitchNode or using detachFrom) that may cause a node to be orphaned (not attached anywhere). In these cases, reporters and pointers and anything that maintains a list of targets must check if the node is inGraph().

bool spin::ReferencedNode::legalParent ( t_symbol newParent) [protected]

TO BE DEPRECATED? The idea is that one type of node can only be attached to certain types of other nodes, but that has not been implemented. Currently, the only illegal parents include the node itself, or any children.

void spin::ReferencedNode::setContext ( const char *  newvalue) [virtual]

A node can 'belong' to a certain host machine, allowing it to be rendered or behave differently than on other machines.

NOTE: the "NULL" string means that it belongs to no specific context.

NOTE: a scene operating in SERVER_MODE will always create the node, so this feature is only really relevant for clients applications.

Reimplemented in spin::ModelNode, spin::ShapeNode, and spin::TextNode.

void spin::ReferencedNode::setParent ( const char *  newvalue)

This method schedules a change in parent for this node. The setParent() does not immediately change the scenegraph, since it can be called at any time, even while in a traversal. The graph is updated later using the attach() method, which is called by SceneManager->updateGraph() when there is a legal time to re-order the scenegraph.

Internally, this method just sets the newParent property.

void spin::ReferencedNode::stateDump ( lo_address  addr) [virtual]

Request to send the node state to one address

void spin::ReferencedNode::stateDump ( ) [virtual]

Request to broadcast the node state via SceneManager.

Reimplemented in spin::GroupNode.

void spin::ReferencedNode::updateChildNodePaths ( )

An internal method that keeps track of the nodepath (for efficient computation of global position, etc.

void spin::ReferencedNode::updateNodePath ( bool  updateChildren = true) [virtual]

IMPORTANT: subclasses of ReferencedNode are allowed to contain complicated subgraphs, and can also change their attachmentNode so that children are attached anywhere in that subgraph. If that is the case, the updateNodePath() function MUST be overridden, and extra nodes must be manually pushed onto currentNodePath_.

Reimplemented in spin::GroupNode, spin::ModelNode, and spin::UserNode.

void spin::ReferencedNode::updateStateSet ( ) [virtual]

In derived classes, you can handle how a stateset gets applied to a node (eg, which part of the subgraph it is attached by overriding the updateStateSet method.

Reimplemented in spin::GeometryNode, spin::GroupNode, spin::ModelNode, and spin::ShapeNode.


The documentation for this class was generated from the following files: