From: timoore Date: Sun, 23 Dec 2007 23:33:04 +0000 (+0000) Subject: Pass ReaderWriter options to SGMaterialAnimation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=94be52886e1c9211219677094468679d3ae70d25;p=simgear.git Pass ReaderWriter options to SGMaterialAnimation It needs to grab the path list from options in order to support the texture change animation. --- diff --git a/simgear/scene/model/SGMaterialAnimation.cxx b/simgear/scene/model/SGMaterialAnimation.cxx index ed543148..8702b44c 100644 --- a/simgear/scene/model/SGMaterialAnimation.cxx +++ b/simgear/scene/model/SGMaterialAnimation.cxx @@ -354,8 +354,11 @@ private: SGMaterialAnimation::SGMaterialAnimation(const SGPropertyNode* configNode, - SGPropertyNode* modelRoot) : - SGAnimation(configNode, modelRoot) + SGPropertyNode* modelRoot, + const osgDB::ReaderWriter::Options* + options) : + SGAnimation(configNode, modelRoot), + texturePathList(options->getDatabasePathList()) { if (configNode->hasChild("global")) SG_LOG(SG_IO, SG_ALERT, "Use of in material animation is " @@ -373,9 +376,6 @@ SGMaterialAnimation::createAnimationGroup(osg::Group& parent) if (node) inputRoot = getModelRoot()->getRootNode()->getNode(node->getStringValue(), true); - - osgDB::FilePathList texturePathList = osgDB::getDataFilePathList(); - if (getConfig()->hasChild("texture-prop")) osg::StateSet* stateSet = group->getOrCreateStateSet(); if (getConfig()->hasChild("texture")) { diff --git a/simgear/scene/model/SGMaterialAnimation.hxx b/simgear/scene/model/SGMaterialAnimation.hxx index 0bae0084..ada24557 100644 --- a/simgear/scene/model/SGMaterialAnimation.hxx +++ b/simgear/scene/model/SGMaterialAnimation.hxx @@ -12,6 +12,7 @@ #endif #include +#include #include "animation.hxx" ////////////////////////////////////////////////////////////////////// @@ -21,12 +22,14 @@ class SGMaterialAnimation : public SGAnimation { public: SGMaterialAnimation(const SGPropertyNode* configNode, - SGPropertyNode* modelRoot); + SGPropertyNode* modelRoot, + const osgDB::ReaderWriter::Options* options); virtual osg::Group* createAnimationGroup(osg::Group& parent); virtual void install(osg::Node& node); private: osg::ref_ptr defaultMaterial; osg::Vec4 defaultAmbientDiffuse; + osgDB::FilePathList texturePathList; }; #endif // _SG_MATERIALANIMATION_HXX diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index d32308c2..5966b5ab 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -521,7 +521,7 @@ SGAnimation::animate(osg::Node* node, const SGPropertyNode* configNode, SGFlashAnimation animInst(configNode, modelRoot); animInst.apply(node); } else if (type == "material") { - SGMaterialAnimation animInst(configNode, modelRoot); + SGMaterialAnimation animInst(configNode, modelRoot, options); animInst.apply(node); } else if (type == "noshadow") { SGShadowAnimation animInst(configNode, modelRoot);