|
|
|
@ -379,7 +379,7 @@ public:
|
|
|
|
|
return mData.back().isSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void setVisible(Ogre::Node *node, int vis)
|
|
|
|
|
static void setVisible(Ogre::Node *node, bool vis)
|
|
|
|
|
{
|
|
|
|
|
// Skinned meshes are attached to the scene node, not the bone.
|
|
|
|
|
// We use the Node's user data to connect it with the mesh.
|
|
|
|
@ -746,16 +746,17 @@ private:
|
|
|
|
|
{
|
|
|
|
|
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
|
|
|
|
|
{
|
|
|
|
|
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
|
|
|
|
|
if(ctrl->recType == Nif::RC_NiUVController)
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiUVController *uv = static_cast<const Nif::NiUVController*>(ctrl.getPtr());
|
|
|
|
|
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW UVController::Value(entity, uv->data.getPtr(), &scene->mMaterialControllerMgr));
|
|
|
|
|
|
|
|
|
|
UVController::Function* function = OGRE_NEW UVController::Function(uv, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
UVController::Function* function = OGRE_NEW UVController::Function(uv, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
|
|
|
|
@ -765,13 +766,13 @@ private:
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiGeomMorpherController *geom = static_cast<const Nif::NiGeomMorpherController*>(ctrl.getPtr());
|
|
|
|
|
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW GeomMorpherController::Value(
|
|
|
|
|
entity, geom->data.getPtr(), geom->recIndex));
|
|
|
|
|
|
|
|
|
|
GeomMorpherController::Function* function = OGRE_NEW GeomMorpherController::Function(geom, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
GeomMorpherController::Function* function = OGRE_NEW GeomMorpherController::Function(geom, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
|
|
|
|
@ -796,7 +797,8 @@ private:
|
|
|
|
|
const Nif::NiStencilProperty *stencilprop = NULL;
|
|
|
|
|
node->getProperties(texprop, matprop, alphaprop, vertprop, zprop, specprop, wireprop, stencilprop);
|
|
|
|
|
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
|
|
|
|
|
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
|
|
|
|
@ -809,7 +811,7 @@ private:
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiAlphaController *alphaCtrl = static_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW AlphaController::Value(movable, alphaCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
|
|
|
|
|
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
|
|
|
|
@ -818,7 +820,7 @@ private:
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiMaterialColorController *matCtrl = static_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW MaterialColorController::Value(movable, matCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
|
|
|
|
|
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
|
|
|
|
@ -839,7 +841,7 @@ private:
|
|
|
|
|
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW FlipController::Value(
|
|
|
|
|
movable, flipCtrl, &scene->mMaterialControllerMgr));
|
|
|
|
|
FlipController::Function* function = OGRE_NEW FlipController::Function(flipCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
FlipController::Function* function = OGRE_NEW FlipController::Function(flipCtrl, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
|
|
|
|
@ -967,7 +969,7 @@ private:
|
|
|
|
|
|
|
|
|
|
partsys->setCullIndividually(false);
|
|
|
|
|
partsys->setParticleQuota(particledata->numParticles);
|
|
|
|
|
partsys->setKeepParticlesInLocalSpace(partflags & (Nif::NiNode::ParticleFlag_LocalSpace));
|
|
|
|
|
partsys->setKeepParticlesInLocalSpace((partflags & Nif::NiNode::ParticleFlag_LocalSpace) != 0);
|
|
|
|
|
|
|
|
|
|
int trgtid = NIFSkeletonLoader::lookupOgreBoneHandle(name, partnode->recIndex);
|
|
|
|
|
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
|
|
|
|
@ -1017,13 +1019,14 @@ private:
|
|
|
|
|
|
|
|
|
|
createParticleInitialState(partsys, particledata, partctrl);
|
|
|
|
|
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((partflags&Nif::NiNode::ParticleFlag_AutoPlay) ?
|
|
|
|
|
bool isParticleAutoPlay = (partflags&Nif::NiNode::ParticleFlag_AutoPlay) != 0;
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isParticleAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW ParticleSystemController::Value(partsys, partctrl));
|
|
|
|
|
|
|
|
|
|
ParticleSystemController::Function* function =
|
|
|
|
|
OGRE_NEW ParticleSystemController::Function(partctrl, (partflags&Nif::NiNode::ParticleFlag_AutoPlay));
|
|
|
|
|
OGRE_NEW ParticleSystemController::Function(partctrl, isParticleAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
|
|
|
|
@ -1032,7 +1035,7 @@ private:
|
|
|
|
|
// Emitting state will be overwritten on frame update by the ParticleSystemController,
|
|
|
|
|
// but set up an initial value anyway so the user can fast-forward particle systems
|
|
|
|
|
// immediately after creation if desired.
|
|
|
|
|
partsys->setEmitting(partflags&Nif::NiNode::ParticleFlag_AutoPlay);
|
|
|
|
|
partsys->setEmitting(isParticleAutoPlay);
|
|
|
|
|
}
|
|
|
|
|
ctrl = ctrl->next;
|
|
|
|
|
}
|
|
|
|
@ -1094,18 +1097,19 @@ private:
|
|
|
|
|
do {
|
|
|
|
|
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
|
|
|
|
|
{
|
|
|
|
|
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
|
|
|
|
|
if(ctrl->recType == Nif::RC_NiVisController)
|
|
|
|
|
{
|
|
|
|
|
const Nif::NiVisController *vis = static_cast<const Nif::NiVisController*>(ctrl.getPtr());
|
|
|
|
|
|
|
|
|
|
int trgtid = NIFSkeletonLoader::lookupOgreBoneHandle(name, ctrl->target->recIndex);
|
|
|
|
|
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW VisController::Value(trgtbone, vis->data.getPtr()));
|
|
|
|
|
|
|
|
|
|
VisController::Function* function = OGRE_NEW VisController::Function(vis, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
VisController::Function* function = OGRE_NEW VisController::Function(vis, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
|
|
|
|
@ -1120,11 +1124,11 @@ private:
|
|
|
|
|
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
|
|
|
|
|
// The keyframe controller will control this bone manually
|
|
|
|
|
trgtbone->setManuallyControlled(true);
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
|
|
|
|
|
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
|
|
|
|
|
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
|
|
|
|
|
Ogre::ControllerValueRealPtr());
|
|
|
|
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW KeyframeController::Value(trgtbone, nif, key->data.getPtr()));
|
|
|
|
|
KeyframeController::Function* function = OGRE_NEW KeyframeController::Function(key, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
|
|
|
|
KeyframeController::Function* function = OGRE_NEW KeyframeController::Function(key, isAnimationAutoPlay);
|
|
|
|
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
|
|
|
|
Ogre::ControllerFunctionRealPtr func(function);
|
|
|
|
|
|
|
|
|
|