]> git.mxchange.org Git - simgear.git/commitdiff
set data variance to DYNAMIC for animated effect attributes
authorTim Moore <timoore33@gmail.com>
Sun, 26 Dec 2010 17:34:00 +0000 (18:34 +0100)
committerTim Moore <timoore33@gmail.com>
Sun, 26 Dec 2010 17:34:00 +0000 (18:34 +0100)
simgear/scene/material/EffectBuilder.hxx

index c1d48405b04e1433c3c5c8cf25b84dfe1971e14b..a30efa5ebd4d7873d4d76399b84400d7379fc38b 100644 (file)
@@ -23,6 +23,7 @@
 #include <string>
 #include <cstring>
 
+#include <osg/Object>
 #include <osgDB/Registry>
 
 #include <boost/bind.hpp>
@@ -578,6 +579,19 @@ new_EEPropListener(const Func& func, const std::string* propName,
         (func, 0, namesBegin, namesEnd);
 }
 
+/**
+ * Set DYNAMIC data variance on an osg::Object.
+ */
+
+inline void setDynamicVariance(void* obj)
+{
+}
+
+inline void setDynamicVariance(osg::Object* obj)
+{
+    obj->setDataVariance(osg::Object::DYNAMIC);
+}
+
 /**
  * Initialize the value and the possible updating of an effect
  * attribute. If the value is specified directly, set it. Otherwise,
@@ -598,6 +612,7 @@ initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj,
     const SGPropertyNode* valProp = getEffectPropertyNode(effect, prop);
     if (!valProp)
         return;
+    setDynamicVariance(obj);
     if (valProp->nChildren() == 0) {
         setter(obj, valProp->getValue<OSGParamType>());
     } else {
@@ -650,6 +665,7 @@ initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj,
     const SGPropertyNode* valProp = getEffectPropertyNode(effect, prop);
     if (!valProp)
         return;
+    setDynamicVariance(obj);
     if (valProp->nChildren() == 0) { // Has <use>?
         setter(obj, Bridge<OSGParamType>::get(valProp->getValue<sg_type>()));
     } else {