root/OpenSceneGraph/trunk/src/osgAnimation/BoneMapVisitor.cpp
@
13041
| Revision 13041, 1.3 kB (checked in by robert, 14 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* -*-c++-*- |
| 2 | * Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net> |
| 3 | * |
| 4 | * This library is open source and may be redistributed and/or modified under |
| 5 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
| 6 | * (at your option) any later version. The full license is in LICENSE file |
| 7 | * included with this distribution, and on the openscenegraph.org website. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * OpenSceneGraph Public License for more details. |
| 13 | * |
| 14 | * Authors: |
| 15 | * Cedric Pinson <cedric.pinson@plopbyte.net> |
| 16 | */ |
| 17 | |
| 18 | #include <osgAnimation/BoneMapVisitor> |
| 19 | #include <osgAnimation/Skeleton> |
| 20 | |
| 21 | using namespace osgAnimation; |
| 22 | |
| 23 | BoneMapVisitor::BoneMapVisitor() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} |
| 24 | |
| 25 | void BoneMapVisitor::apply(osg::Node&) { return; } |
| 26 | void BoneMapVisitor::apply(osg::Transform& node) |
| 27 | { |
| 28 | Bone* bone = dynamic_cast<Bone*>(&node); |
| 29 | if (bone) |
| 30 | { |
| 31 | _map[bone->getName()] = bone; |
| 32 | traverse(node); |
| 33 | } |
| 34 | Skeleton* skeleton = dynamic_cast<Skeleton*>(&node); |
| 35 | if (skeleton) |
| 36 | traverse(node); |
| 37 | } |
| 38 | |
| 39 | const BoneMap& BoneMapVisitor::getBoneMap() const |
| 40 | { |
| 41 | return _map; |
| 42 | } |
Note: See TracBrowser
for help on using the browser.
