Improved support for setting/getting properties via the osg::UserDataContainer.
This commit is contained in:
@@ -292,7 +292,18 @@ osgDB::BaseSerializer* PropertyInterface::getSerializer(const osg::Object* objec
|
||||
osg::Object* PropertyInterface::createObject(const std::string& compoundClassName) const
|
||||
{
|
||||
osgDB::ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
|
||||
return (ow!=0) ? ow->createInstance() : 0;
|
||||
if (ow)
|
||||
{
|
||||
osg::Object* object = ow->createInstance();
|
||||
OSG_NOTICE<<"PropertyInterface::createObject("<<compoundClassName<<"), wrapper found, created object="<<object<<std::endl;
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_NOTICE<<"PropertyInterface::createObject("<<compoundClassName<<"), No object wrapper avaiable."<<std::endl;
|
||||
return 0;
|
||||
}
|
||||
// return (ow!=0) ? ow->createInstance() : 0;
|
||||
}
|
||||
|
||||
bool PropertyInterface::copyPropertyDataFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
||||
@@ -366,7 +377,7 @@ bool PropertyInterface::copyPropertyDataToObject(osg::Object* object, const std:
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_INFO<<"PropertyInterface::copyPropertyDataFromObject() no serializer available."<<std::endl;
|
||||
OSG_NOTICE<<"PropertyInterface::copyPropertyDataFromObject() no serializer available."<<std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -389,7 +400,7 @@ bool PropertyInterface::copyPropertyObjectFromObject(const osg::Object* object,
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_INFO<<"PropertyInterface::copyPropertyObjectFromObject() no serializer available."<<std::endl;
|
||||
OSG_NOTICE<<"PropertyInterface::copyPropertyObjectFromObject() no serializer available."<<std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,6 +537,8 @@ public:
|
||||
|
||||
int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& propertyName) const
|
||||
{
|
||||
OSG_NOTICE<<"LuaScriptEngine::pushPropertyToStack("<<object<<", "<<propertyName<<")"<<std::endl;
|
||||
|
||||
osgDB::BaseSerializer::Type type;
|
||||
if (!_pi.getPropertyType(object, propertyName, type))
|
||||
{
|
||||
@@ -549,15 +551,20 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
||||
return 1;
|
||||
}
|
||||
|
||||
osg::CallbackObject* co = osg::getCallbackObject(object, propertyName);
|
||||
LuaCallbackObject* lco = dynamic_cast<LuaCallbackObject*>(co);
|
||||
osg::Object* uo = osg::getUserObject(object, propertyName);
|
||||
LuaCallbackObject* lco = dynamic_cast<LuaCallbackObject*>(uo);
|
||||
if (lco)
|
||||
{
|
||||
lua_rawgeti(_lua, LUA_REGISTRYINDEX, lco->getRef());
|
||||
return 1;
|
||||
}
|
||||
else if (uo)
|
||||
{
|
||||
pushObject(uo);
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSG_INFO<<"LuaScriptEngine::pushPropertyToStack("<<object<<", "<<propertyName<<") no property found."<<std::endl;
|
||||
OSG_NOTICE<<"LuaScriptEngine::pushPropertyToStack("<<object<<", "<<propertyName<<") no property found."<<std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user