CAnimatedMeshSceneNode::setMesh does now set the animation speed again to that of the mesh.

.x meshloader regards now AnimTicksPerSecond (thx @qian for a test-model and bugreport).
CAnimatedMeshSceneNode::setMesh had commented-out the setAnimationSpeed line in version r3526 which was about a joint-cache fix for skinned meshes. But there was no comment about why that line had to be removed or commented out, so my guess is that this was only a test (I hope). And it caused animation-speed values for the meshes to be ignored unless user specified it explicitly while animation range was still changed in setMesh.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5097 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2015-04-27 13:01:24 +00:00
parent a5911bc765
commit e138121a1d
6 changed files with 45 additions and 2 deletions

View File

@ -1,6 +1,8 @@
--------------------------
Changes in 1.9 (not yet released)
- CAnimatedMeshSceneNode::setMesh does now set the animation speed again to that of the mesh (had been changed in 1.7, but not for obvious reasons)
- .x meshloader regards now AnimTicksPerSecond (thx @qian for a test-model and bugreport)
- Interface getMeshType moved from IAnimatedMesh up to IMesh.
- Add b3d mesh-writer. Static writer written by Hendu, support for animated meshes added by JLouisB, testing and bugfixes by CuteAlien.
- Node-collision functions of SceneCollisionManager like getSceneNodeFromScreenCoordinatesBB will now ignore collisions against empty boundingboxes.

View File

@ -239,7 +239,6 @@ void loadModel(const c8* fn)
else
{
scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m);
animModel->setAnimationSpeed(30);
Model = animModel;
}
Model->setMaterialFlag(video::EMF_LIGHTING, UseLight);

View File

@ -849,7 +849,7 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)
}
// get start and begin time
// setAnimationSpeed(Mesh->getAnimationSpeed());
setAnimationSpeed(Mesh->getAnimationSpeed()); // NOTE: This had been commented out (but not removed!) in r3526. Which caused meshloader-values for speed to be ignored unless users specified explicitly. Missing a test-case where this could go wrong so I put the code back in.
setFrameLoop(0, Mesh->getFrameCount());
}

View File

@ -47,6 +47,7 @@ namespace scene
//! sets the frames between the animation is looped.
//! the default is 0 - MaximalFrameCount of the mesh.
//! NOTE: setMesh will also change this value and set it to the full range of animations of the mesh
virtual bool setFrameLoop(s32 begin, s32 end) _IRR_OVERRIDE_;
//! Sets looping mode which is on by default. If set to false,
@ -61,6 +62,7 @@ namespace scene
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) _IRR_OVERRIDE_;
//! sets the speed with which the animation is played
//! NOTE: setMesh will also change this value and set it to the default speed of the mesh
virtual void setAnimationSpeed(f32 framesPerSecond) _IRR_OVERRIDE_;
//! gets the speed with which the animation is played

View File

@ -520,6 +520,11 @@ bool CXMeshFileLoader::parseDataObject()
return parseDataObjectAnimationSet();
}
else
if (objectName == "AnimTicksPerSecond")
{
return parseDataObjectAnimationTicksPerSecond();
}
else
if (objectName == "Material")
{
// template materials now available thanks to joeWright
@ -1607,6 +1612,39 @@ bool CXMeshFileLoader::parseDataObjectAnimationSet()
return true;
}
bool CXMeshFileLoader::parseDataObjectAnimationTicksPerSecond()
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: reading AnimationTicksPerSecond", ELL_DEBUG);
#endif
if (!readHeadOfDataObject())
{
os::Printer::log("No opening brace in Animation found in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_WARNING);
return false;
}
const u32 ticks = readInt();
if (!checkForOneFollowingSemicolons())
{
os::Printer::log("No closing semicolon in AnimationTicksPerSecond in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_WARNING);
return false;
}
if (!checkForClosingBrace())
{
os::Printer::log("No closing brace in AnimationTicksPerSecond in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_WARNING);
return false;
}
AnimatedMesh->setAnimationSpeed(ticks);
return true;
}
bool CXMeshFileLoader::parseDataObjectAnimation()
{

View File

@ -118,6 +118,8 @@ private:
bool parseDataObjectAnimationSet();
bool parseDataObjectAnimationTicksPerSecond();
bool parseDataObjectAnimation();
bool parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint);