From: frohlich Date: Mon, 31 Dec 2007 15:48:02 +0000 (+0000) Subject: Modified Files: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9c51bf3edfe06562e872fd471128763fd6bd958a;p=simgear.git Modified Files: simgear/scene/model/animation.cxx: Create animation inputs if not already there. Fixes broken texture animations from past checkin. --- diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 81040876..b47da182 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -1726,8 +1726,6 @@ public: Translation(const SGVec3d& axis) : _axis(axis) { } - void setValue(double value) - { _value = value; } virtual void transform(osg::Matrix& matrix) { osg::Matrix tmp; @@ -1842,14 +1840,15 @@ void SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config, UpdateCallback* updateCallback) { - std::string propertyName = config->getStringValue("property", "/null"); + std::string propertyName = config->getStringValue("property", ""); SGSharedPtr value; - if (getModelRoot()->hasChild(propertyName)) - value = new SGPropertyExpression(getModelRoot()->getNode(propertyName)); - else + if (propertyName.empty()) value = new SGConstExpression(0); + else { + SGPropertyNode* inputProperty = getModelRoot()->getNode(propertyName, true); + value = new SGPropertyExpression(inputProperty); + } - SGSharedPtr animationValue; SGInterpTable* table = read_interpolation_table(config); if (table) { value = new SGInterpTableExpression(value, table); @@ -1859,7 +1858,7 @@ SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config, value = new SGStepExpression(value, config->getDoubleValue("step", 0), config->getDoubleValue("scroll", 0)); - animationValue = value->simplify(); + value = value->simplify(); } else { double biasValue = config->getDoubleValue("bias", 0); if (biasValue != 0) @@ -1874,7 +1873,7 @@ SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config, double maxClip = config->getDoubleValue("max", SGLimitsd::max()); value = new SGClipExpression(value, minClip, maxClip); } - animationValue = value->simplify(); + value = value->simplify(); } SGVec3d axis(config->getDoubleValue("axis/x", 0), config->getDoubleValue("axis/y", 0), @@ -1882,21 +1881,22 @@ SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config, Translation* translation; translation = new Translation(normalize(axis)); translation->setValue(config->getDoubleValue("starting-position", 0)); - updateCallback->appendTransform(translation, animationValue); + updateCallback->appendTransform(translation, value); } void SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config, UpdateCallback* updateCallback) { - std::string propertyName = config->getStringValue("property", "/null"); + std::string propertyName = config->getStringValue("property", ""); SGSharedPtr value; - if (getModelRoot()->hasChild(propertyName)) - value = new SGPropertyExpression(getModelRoot()->getNode(propertyName)); - else + if (propertyName.empty()) value = new SGConstExpression(0); + else { + SGPropertyNode* inputProperty = getModelRoot()->getNode(propertyName, true); + value = new SGPropertyExpression(inputProperty); + } - SGSharedPtr animationValue; SGInterpTable* table = read_interpolation_table(config); if (table) { value = new SGInterpTableExpression(value, table); @@ -1906,7 +1906,7 @@ SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config, value = new SGStepExpression(value, config->getDoubleValue("step", 0), config->getDoubleValue("scroll", 0)); - animationValue = value->simplify(); + value = value->simplify(); } else { double biasValue = config->getDoubleValue("bias", 0); if (biasValue != 0) @@ -1921,7 +1921,7 @@ SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config, double maxClip = config->getDoubleValue("max-deg", SGLimitsd::max()); value = new SGClipExpression(value, minClip, maxClip); } - animationValue = value->simplify(); + value = value->simplify(); } SGVec3d axis(config->getDoubleValue("axis/x", 0), config->getDoubleValue("axis/y", 0), @@ -1932,7 +1932,7 @@ SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config, Rotation* rotation; rotation = new Rotation(normalize(axis), center); rotation->setValue(config->getDoubleValue("starting-position-deg", 0)); - updateCallback->appendTransform(rotation, animationValue); + updateCallback->appendTransform(rotation, value); }