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

Revision 11009, 1.9 kB (checked in by robert, 8 years ago)

From Cedric Pinson, "Here a list of changes:
Bone now inherit from MatrixTransform?. It simplify a lot the update of
Bone matrix. It helps to have the bone system more generic. eg it's now
possible to have animation data with precomputed bind matrix. The other
benefit, is now the collada plugin will be able to use osgAnimation to
display skinned mesh. Michael Plating did a great work to improve this
aspect, he is working on the collada plugin and should be able to submit
a new version soon.
The RigGeometry? has been refactored so now it works when you save and
reload RigGeometry? because the source is not touched anymore. The
benefit with this update is that it should be now possible to use a
MorphGeometry? as source for a RigGeometry?.

The bad news is that the format has changed, so i have rebuild osg-data
related to osgAnimation data, updated the blender exporter to export to
the new format.
The fbx plugin could be touched about this commit, i dont compile it so
i can't give more information about it.
The bvh plugin has been updated by Wang rui so this one is fixed with
the new code of osgAnimation.
The examples has been updated to work with the new code too...

The example osg-data/example.osg should be remove, it's an old example
that does not work.

For people using blender the blender exporter up to date is here:
it will be merge to as soon as the
modification will be push in the trunk.

[9093]1/*  -*-c++-*-
[10561]2 *  Copyright (C) 2008 Cedric Pinson <>
[9093]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 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
12 * OpenSceneGraph Public License for more details.
15#include <osgAnimation/Bone>
16#include <osgAnimation/Skeleton>
[11009]17#include <osgAnimation/UpdateBone>
[10561]18#include <osgAnimation/BoneMapVisitor>
[11009]20using namespace osgAnimation;
[11009]22Bone::Bone(const Bone& b, const osg::CopyOp& copyop) : osg::MatrixTransform(b,copyop), _invBindInSkeletonSpace(b._invBindInSkeletonSpace), _boneInSkeletonSpace(b._boneInSkeletonSpace)
[11009]26Bone::Bone(const std::string& name)
[9370]28    if (!name.empty())
29        setName(name);
[11009]33void Bone::setDefaultUpdateCallback(const std::string& name)
35    std::string cbName = name;
36    if (cbName.empty())
37        cbName = getName();
38    setUpdateCallback(new UpdateBone(cbName));
[11009]41Bone* Bone::getBoneParent()
43    if (getParents().empty())
44        return 0;
45    osg::Node::ParentList parents = getParents();
[11009]46    for (osg::Node::ParentList::iterator it = parents.begin(); it != parents.end(); ++it)
[9093]47    {
48        Bone* pb = dynamic_cast<Bone*>(*it);
49        if (pb)
50            return pb;
51    }
52    return 0;
[11009]54const Bone* Bone::getBoneParent() const
56    if (getParents().empty())
57        return 0;
58    const osg::Node::ParentList& parents = getParents();
[11009]59    for (osg::Node::ParentList::const_iterator it = parents.begin(); it != parents.end(); ++it)
[9093]60    {
61        const Bone* pb = dynamic_cast<const Bone*>(*it);
62        if (pb)
63            return pb;
64    }
65    return 0;
Note: See TracBrowser for help on using the browser.