root/OpenSceneGraph/trunk/src/osgAnimation/Bone.cpp @ 13041

Revision 13041, 1.9 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/*  -*-c++-*-
2 *  Copyright (C) 2008 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
15#include <osgAnimation/Bone>
16#include <osgAnimation/Skeleton>
17#include <osgAnimation/UpdateBone>
18#include <osgAnimation/BoneMapVisitor>
19
20using namespace osgAnimation;
21
22Bone::Bone(const Bone& b, const osg::CopyOp& copyop) : osg::MatrixTransform(b,copyop), _invBindInSkeletonSpace(b._invBindInSkeletonSpace), _boneInSkeletonSpace(b._boneInSkeletonSpace)
23{
24}
25
26Bone::Bone(const std::string& name)
27{
28    if (!name.empty())
29        setName(name);
30}
31
32
33void Bone::setDefaultUpdateCallback(const std::string& name)
34{
35    std::string cbName = name;
36    if (cbName.empty())
37        cbName = getName();
38    setUpdateCallback(new UpdateBone(cbName));
39}
40
41Bone* Bone::getBoneParent()
42{
43    if (getParents().empty())
44        return 0;
45    osg::Node::ParentList parents = getParents();
46    for (osg::Node::ParentList::iterator it = parents.begin(); it != parents.end(); ++it)
47    {
48        Bone* pb = dynamic_cast<Bone*>(*it);
49        if (pb)
50            return pb;
51    }
52    return 0;
53}
54const Bone* Bone::getBoneParent() const
55{
56    if (getParents().empty())
57        return 0;
58    const osg::Node::ParentList& parents = getParents();
59    for (osg::Node::ParentList::const_iterator it = parents.begin(); it != parents.end(); ++it)
60    {
61        const Bone* pb = dynamic_cast<const Bone*>(*it);
62        if (pb)
63            return pb;
64    }
65    return 0;
66}
Note: See TracBrowser for help on using the browser.