bool CAnimatedMeshSceneNode::removeChild(ISceneNode* child)
found by ssexton

-added requested getJointCount() in AnimatedMeshSceneNode, which simply calls getJointCount on the held mesh

-added CSkinnedMesh::isStatic()

git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@1051 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
lukeph 2007-11-14 07:35:40 +00:00
parent cf487001a4
commit aedf5c9994
7 changed files with 48 additions and 7 deletions

View File

@ -125,6 +125,10 @@ namespace scene
//! same as getJointNode(const c8* jointName), but based on id
virtual IBoneSceneNode* getJointNode(u32 jointID) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the mesh.
virtual u32 getJointCount() const = 0;
//! Redundant command, please use getJointNode (only for backwards compatibility)
virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0;

View File

@ -195,6 +195,11 @@ namespace scene
virtual SRotationKey *createRotationKey(SJoint *joint) = 0;
virtual SWeight *createWeight(SJoint *joint) = 0;
virtual bool isStatic()=0;
};
} // end namespace scene

View File

@ -613,6 +613,17 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(u32 jointID)
return JointChildSceneNodes[jointID];
}
//! Gets joint count.
u32 CAnimatedMeshSceneNode::getJointCount() const
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return 0;
ISkinnedMesh *skinnedMesh=(ISkinnedMesh*)Mesh;
return skinnedMesh->getJointCount();
}
//! Returns a pointer to a child node, which has the same transformation as
//! the corrsesponding joint, if the mesh in this scene node is a ms3d mesh.
@ -642,20 +653,21 @@ bool CAnimatedMeshSceneNode::removeChild(ISceneNode* child)
return true;
}
if (JointsUsed) //stop it doing weird things while the joints are being made
{
if (ISceneNode::removeChild(child))
{
if (JointsUsed) //stop weird bugs caused while changing parents as the joints are being created
{
for (u32 i=0; i<JointChildSceneNodes.size(); ++i)
if (JointChildSceneNodes[i] == child)
{
//JointChildSceneNodes[i]->drop();
JointChildSceneNodes[i] = 0;
JointChildSceneNodes[i] = 0; //remove link to child
return true;
}
}
return true;
}
}
return false;

View File

@ -82,6 +82,9 @@ namespace scene
//! same as getJointNode(const c8* jointName), but based on id
virtual IBoneSceneNode* getJointNode(u32 jointID);
//! Gets joint count.
virtual u32 getJointCount() const;
//! Redundant command, please use getJointNode.
virtual ISceneNode* getMS3DJointNode(const c8* jointName);

View File

@ -1123,6 +1123,16 @@ CSkinnedMesh::SWeight *CSkinnedMesh::createWeight(SJoint *joint)
}
bool CSkinnedMesh::isStatic()
{
return !HasAnimation;
}
void CSkinnedMesh::normalizeWeights()
{
// note: unsure if weights ids are going to be used.
@ -1366,6 +1376,12 @@ void CSkinnedMesh::calculateTangents(
}
} // end namespace scene
} // end namespace irr

View File

@ -137,7 +137,7 @@ namespace scene
virtual SWeight *createWeight(SJoint *joint);
virtual bool isStatic();
private:

View File

@ -258,6 +258,7 @@
<Unit filename="CBillboardSceneNode.h" />
<Unit filename="CBoneSceneNode.cpp" />
<Unit filename="CBoneSceneNode.h" />
<Unit filename="CBurningShader_Raster_Reference.cpp" />
<Unit filename="CCSMLoader.cpp" />
<Unit filename="CCSMLoader.h" />
<Unit filename="CCameraFPSSceneNode.cpp" />