Commit 8a070d9c authored by hybrid's avatar hybrid

Replaced BoneName by scene node's Name as suggested by rogerborg. Added...

Replaced BoneName by scene node's Name as suggested by rogerborg. Added setName method overload for stringc parameter.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1527 dfc29bdd-3216-0410-991c-e03cc46cb475
parent fce0e252
......@@ -60,7 +60,8 @@ namespace scene
ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
//! Get the name of the bone
virtual const c8* getBoneName() const = 0;
/** \deprecated Use getName instead. */
virtual const c8* getBoneName() const { return getName(); }
//! Get the index of the bone
virtual u32 getBoneIndex() const = 0;
......
......@@ -142,6 +142,14 @@ namespace scene
}
//! Sets the name of the node.
/** \param name New name of the scene node. */
virtual void setName(const core::stringc& name)
{
Name = name;
}
//! Get the axis aligned, not transformed bounding box of this node.
/** This means that if this node is an animated 3d character,
moving in a room, the bounding box will always be around the
......
......@@ -15,20 +15,13 @@ namespace scene
//! constructor
CBoneSceneNode::CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
u32 boneIndex, const c8* boneName)
: IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex), BoneName(boneName),
: IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex),
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
{
#ifdef _DEBUG
setDebugName("CBoneSceneNode");
#endif
}
//! Returns the name of the bone
const c8* CBoneSceneNode::getBoneName() const
{
return BoneName.c_str();
setName(boneName);
}
......@@ -111,8 +104,8 @@ void CBoneSceneNode::updateAbsolutePositionOfAllChildren()
void CBoneSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IBoneSceneNode::serializeAttributes(out, options);
out->addInt("BoneIndex", BoneIndex);
out->addString("BoneName", BoneName.c_str());
out->addEnum("AnimationMode", AnimationMode, BoneAnimationModeNames);
}
......@@ -120,8 +113,11 @@ void CBoneSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeRea
void CBoneSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
BoneIndex = in->getAttributeAsInt("BoneIndex");
BoneName = in->getAttributeAsString("BoneName");
AnimationMode = (E_BONE_ANIMATION_MODE)in->getAttributeAsEnumeration("AnimationMode", BoneAnimationModeNames);
// for legacy files (before 1.5)
const core::stringc boneName = in->getAttributeAsString("BoneName");
setName(boneName);
IBoneSceneNode::deserializeAttributes(in, options);
// TODO: add/replace bone in parent with bone from mesh
}
......
......@@ -8,7 +8,6 @@
// Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
#include "IBoneSceneNode.h"
#include "irrString.h"
namespace irr
{
......@@ -23,9 +22,6 @@ namespace scene
CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr,
s32 id=-1, u32 boneIndex=0, const c8* boneName=0);
//! Returns the name of the bone
virtual const c8* getBoneName() const;
//! Returns the index of the bone
virtual u32 getBoneIndex() const;
......@@ -68,7 +64,6 @@ namespace scene
void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node);
u32 BoneIndex;
core::stringc BoneName;
core::aabbox3d<f32> Box;
......@@ -76,10 +71,9 @@ namespace scene
E_BONE_SKINNING_SPACE SkinningSpace;
};
} // end namespace scene
} // end namespace irr
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment