From aeaaa50f6cdfbc0ebc6eee2615d7f81178da68c4 Mon Sep 17 00:00:00 2001 From: timoore Date: Wed, 5 Sep 2007 22:12:00 +0000 Subject: [PATCH] Fix material animations with only a On 8/31/07, K. Hoercher wrote: > > Some notes: > > - I found that in order to make the example from model-howto.html work > > ( starting at "To make a texture replaceable at runtime") one has to > > specify a valid (i.e. loadable) in the material animation. The cause seems to be the condition in SGMaterialAnimation.cxx l.277 ignoring any texture update by the UpdateCallback (only there is looked at) without an already existing stateSet. That in turn will not be created with a alone l. 379ff. Unless I overlooked some compelling reason contradicting, I'd like to suggest allowing for a stateSet to be created for those situations too. I think that would match the behaviour of animation.cxx (PRE_OSG_PLIB_20061029) and is imho the more expected and also documented one. --- simgear/scene/model/SGMaterialAnimation.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simgear/scene/model/SGMaterialAnimation.cxx b/simgear/scene/model/SGMaterialAnimation.cxx index 7e6a2acb..ed543148 100644 --- a/simgear/scene/model/SGMaterialAnimation.cxx +++ b/simgear/scene/model/SGMaterialAnimation.cxx @@ -376,6 +376,8 @@ SGMaterialAnimation::createAnimationGroup(osg::Group& parent) osgDB::FilePathList texturePathList = osgDB::getDataFilePathList(); + if (getConfig()->hasChild("texture-prop")) + osg::StateSet* stateSet = group->getOrCreateStateSet(); if (getConfig()->hasChild("texture")) { std::string textureName = getConfig()->getStringValue("texture"); std::string textureFile; -- 2.39.5