set data variance to DYNAMIC for animated effect attributes

This commit is contained in:
Tim Moore 2010-12-26 18:34:00 +01:00
parent b6a20fd6e4
commit 33e1a9457a

View File

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