Skip to content

Commit

Permalink
GRAPHICS: Add Model::getNode()
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Feb 4, 2014
1 parent 83f9916 commit b390597
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/graphics/aurora/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ bool Model::hasNode(const Common::UString &name) {
return node != rootState->second->nodeEntities.end();
}

Ogre::SceneNode *Model::getNode(const Common::UString &name) {
StateMap::iterator rootState = _states.find("");
if (rootState == _states.end())
return 0;

NodeEntities::iterator node = rootState->second->nodeEntities.find(name);
if (node == rootState->second->nodeEntities.end())
return 0;

return node->second.node;
}

bool Model::playAnimation(bool loop) {
if (!_currentState || !_currentState->animation || !_currentState->animationState)
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/graphics/aurora/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class Model : public Renderable {

/** Does this node exist in the model? */
bool hasNode(const Common::UString &name);
/** Return the SceneNode of a node in the model. */
Ogre::SceneNode *getNode(const Common::UString &name);

/** Play the animation associated with the current state. */
bool playAnimation(bool loop);
Expand Down

0 comments on commit b390597

Please sign in to comment.