Replaced old style access of ValueObject values to new ValueObject::getScaleValue() methods
This commit is contained in:
@@ -16,13 +16,9 @@ struct ResizeArray : public osgDB::MethodObject
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Array* array = reinterpret_cast<osg::Array*>(objectPtr);
|
||||
array->resizeArray(index);
|
||||
|
||||
|
||||
@@ -54,12 +54,12 @@ struct GeodeGetDrawable : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.empty()) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (!uivo) return false;
|
||||
unsigned int index = 0;
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
|
||||
outputParameters.push_back(geode->getDrawable(uivo->getValue()));
|
||||
outputParameters.push_back(geode->getDrawable(index));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -72,17 +72,9 @@ struct GeodeSetDrawable : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.size()<2) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
OSG_NOTICE<<"GeodeSetChild "<<indexObject->className()<<std::endl;
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Drawable* child = dynamic_cast<osg::Drawable*>(inputParameters[1].get());
|
||||
if (!child) return false;
|
||||
|
||||
@@ -50,16 +50,10 @@ struct GroupGetChild : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.empty()) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Group* group = reinterpret_cast<osg::Group*>(objectPtr);
|
||||
outputParameters.push_back(group->getChild(index));
|
||||
|
||||
@@ -73,17 +67,9 @@ struct GroupSetChild : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.size()<2) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
OSG_NOTICE<<"GroupSetChild "<<indexObject->className()<<std::endl;
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Node* child = dynamic_cast<osg::Node*>(inputParameters[1].get());
|
||||
if (!child) return false;
|
||||
|
||||
@@ -121,16 +121,10 @@ struct ResizeDrawElements : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.empty()) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::DrawElements* de = reinterpret_cast<osg::DrawElements*>(objectPtr);
|
||||
de->resizeElements(index);
|
||||
|
||||
|
||||
@@ -10,16 +10,9 @@ struct SwitchGetValue : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.empty()) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
|
||||
outputParameters.push_back(new osg::BoolValueObject("return", sw->getValue(index)));
|
||||
@@ -35,42 +28,13 @@ struct SwitchSetValue : public osgDB::MethodObject
|
||||
{
|
||||
if (inputParameters.size()<2) return false;
|
||||
|
||||
osg::Object* indexObject = inputParameters[0].get();
|
||||
|
||||
unsigned int index = 0;
|
||||
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
|
||||
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
|
||||
if (uivo) index = uivo->getValue();
|
||||
}
|
||||
osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
|
||||
if (indexObject) indexObject->getScalarValue(index);
|
||||
|
||||
bool enabled = false;
|
||||
osg::Object* valueObject = inputParameters[1].get();
|
||||
if (!valueObject) return false;
|
||||
|
||||
dvo = dynamic_cast<osg::DoubleValueObject*>(valueObject);
|
||||
if (dvo)
|
||||
{
|
||||
enabled = dvo->getValue()!=0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(valueObject);
|
||||
if (uivo)
|
||||
{
|
||||
enabled = uivo->getValue()!=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::BoolValueObject* bo = dynamic_cast<osg::BoolValueObject*>(valueObject);
|
||||
if (bo)
|
||||
{
|
||||
enabled = bo->getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
osg::ValueObject* valueObject = inputParameters[1]->asValueObject();
|
||||
if (valueObject) valueObject->getScalarValue(enabled);
|
||||
|
||||
osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
|
||||
sw->setValue(index, enabled);
|
||||
|
||||
Reference in New Issue
Block a user