From 5a7a20d01efe7e2d8e9bf74a2b3e83f8578ab3ab Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Jul 2014 14:09:08 +0000 Subject: [PATCH] Renamed osgDB::PropertyInterface to osgDB::ClassInterface to better reflect it's functionality git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14365 16af8721-9629-0410-8352-f15c8da7e697 --- CMakeLists.txt | 2 +- examples/osgpresentation/osgpresentation.cpp | 14 +- include/osg/Version | 2 +- .../{PropertyInterface => ClassInterface} | 24 +-- src/osgDB/CMakeLists.txt | 4 +- ...opertyInterface.cpp => ClassInterface.cpp} | 62 +++---- src/osgPlugins/lua/LuaScriptEngine.cpp | 158 +++++++++--------- src/osgPlugins/lua/LuaScriptEngine.h | 6 +- 8 files changed, 136 insertions(+), 136 deletions(-) rename include/osgDB/{PropertyInterface => ClassInterface} (89%) rename src/osgDB/{PropertyInterface.cpp => ClassInterface.cpp} (82%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 899649ba9..b7f85e264 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ PROJECT(OpenSceneGraph) SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MINOR_VERSION 3) SET(OPENSCENEGRAPH_PATCH_VERSION 3) -SET(OPENSCENEGRAPH_SOVERSION 112) +SET(OPENSCENEGRAPH_SOVERSION 113) # set to 0 when not a release candidate, non zero means that any generated # svn tags will be treated as release candidates of given number diff --git a/examples/osgpresentation/osgpresentation.cpp b/examples/osgpresentation/osgpresentation.cpp index 94f8d24cf..c68831ad7 100644 --- a/examples/osgpresentation/osgpresentation.cpp +++ b/examples/osgpresentation/osgpresentation.cpp @@ -29,7 +29,7 @@ #include -#include +#include int main(int argc, char** argv) { @@ -162,7 +162,7 @@ int main(int argc, char** argv) osgDB::writeNodeFile(*presentation, "pres.osgt"); - osgDB::PropertyInterface pi; + osgDB::ClassInterface pi; pi.getWhiteList()["osgPresentation::Presentation"]["filename"]=osgDB::BaseSerializer::RW_STRING; pi.getBlackList()["osgPresentation::Presentation"]["Children"]; @@ -314,11 +314,11 @@ int main(int argc, char** argv) osg::ref_ptr geometry = new osg::Geometry; osg::ref_ptr node = new osg::Node; - osgDB::PropertyInterface::PropertyMap properties; + osgDB::ClassInterface::PropertyMap properties; if (pi.getSupportedProperties(presentation.get(), properties, true)) { OSG_NOTICE<<"Have supported properites found."< obj = pi.createObject("osgVolume::VolumeTile"); if (obj.valid()) { OSG_NOTICE<<"obj created "<getCompoundClassName()< #include @@ -116,13 +116,13 @@ class PropertyOutputIterator; class PropertyInputIterator; -/** PropertyInterface provides a general means of checking for supported properties of classes, and getting/setting thoses properties. +/** ClassInterface provides a general means of checking for supported properties of classes, and getting/setting thoses properties. Uses the osgDB serializers to do the actual object querry/get/set. */ -class OSGDB_EXPORT PropertyInterface +class OSGDB_EXPORT ClassInterface { public: - PropertyInterface(); + ClassInterface(); /// get the Type of the specified property, return true if property is supported, otherwise false. @@ -223,14 +223,14 @@ protected: template -bool PropertyInterface::getProperty(const osg::Object* object, const std::string& propertyName, T& value) +bool ClassInterface::getProperty(const osg::Object* object, const std::string& propertyName, T& value) { if (copyPropertyDataFromObject(object, propertyName, &value, sizeof(T), getTypeEnum())) return true; else return object->getUserValue(propertyName, value); // fallback to check user data for property } template -bool PropertyInterface::setProperty(osg::Object* object, const std::string& propertyName, const T& value) +bool ClassInterface::setProperty(osg::Object* object, const std::string& propertyName, const T& value) { if (copyPropertyDataToObject(object, propertyName, &value, sizeof(T), getTypeEnum())) return true; else @@ -244,12 +244,12 @@ bool PropertyInterface::setProperty(osg::Object* object, const std::string& prop typedef osg::Object* ObjectPtr; template<> -inline bool PropertyInterface::getProperty(const osg::Object* object, const std::string& propertyName, ObjectPtr& value) +inline bool ClassInterface::getProperty(const osg::Object* object, const std::string& propertyName, ObjectPtr& value) { if (copyPropertyObjectFromObject(object, propertyName, &value, sizeof(ObjectPtr), getTypeEnum())) return true; else { - OSG_INFO<<"PropertyInterface::getProperty("<getUserDataContainer(); if (udc) { @@ -266,7 +266,7 @@ inline bool PropertyInterface::getProperty(const osg::Object* object, const std: } template<> -inline bool PropertyInterface::setProperty(osg::Object* object, const std::string& propertyName, const ObjectPtr& value) +inline bool ClassInterface::setProperty(osg::Object* object, const std::string& propertyName, const ObjectPtr& value) { osgDB::BaseSerializer::Type type = dynamic_cast(value) ? osgDB::BaseSerializer::RW_IMAGE : getTypeEnum(); // osgDB::BaseSerializer::Type type = getTypeEnum(); @@ -281,13 +281,13 @@ inline bool PropertyInterface::setProperty(osg::Object* object, const std::strin const osg::Object* outgoingObject = udc->getUserObject(objectIndex); if (outgoingObject==value) return true; - OSG_INFO<<"PropertyInterface::setProperty("<className()<<") replace object on UserDataContainer"<className()<<") replace object on UserDataContainer"<setName(propertyName); udc->setUserObject(objectIndex, value); } else { - OSG_INFO<<"PropertyInterface::setProperty("<className()<<") Adding object to UserDataContainer"<className()<<") Adding object to UserDataContainer"<setName(propertyName); udc->addUserObject(value); } diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 4cd22a1f6..00f17c945 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -52,6 +52,7 @@ SET(TARGET_H ${HEADER_PATH}/Archive ${HEADER_PATH}/AuthenticationMap ${HEADER_PATH}/Callbacks + ${HEADER_PATH}/ClassInterface ${HEADER_PATH}/ConvertUTF ${HEADER_PATH}/DatabasePager ${HEADER_PATH}/DatabaseRevisions @@ -69,7 +70,6 @@ SET(TARGET_H ${HEADER_PATH}/Input ${HEADER_PATH}/Output ${HEADER_PATH}/Options - ${HEADER_PATH}/PropertyInterface ${HEADER_PATH}/ParameterOutput ${HEADER_PATH}/PluginQuery ${HEADER_PATH}/ReaderWriter @@ -89,6 +89,7 @@ SET(TARGET_SRC Archive.cpp AuthenticationMap.cpp Callbacks.cpp + ClassInterface.cpp ConvertUTF.cpp DatabasePager.cpp DatabaseRevisions.cpp @@ -109,7 +110,6 @@ SET(TARGET_SRC Output.cpp Options.cpp PluginQuery.cpp - PropertyInterface.cpp ReaderWriter.cpp ReadFile.cpp Registry.cpp diff --git a/src/osgDB/PropertyInterface.cpp b/src/osgDB/ClassInterface.cpp similarity index 82% rename from src/osgDB/PropertyInterface.cpp rename to src/osgDB/ClassInterface.cpp index 43e567254..2fd1e49bc 100644 --- a/src/osgDB/PropertyInterface.cpp +++ b/src/osgDB/ClassInterface.cpp @@ -12,7 +12,7 @@ */ -#include +#include namespace osgDB // start of osgDB namespace { @@ -162,9 +162,9 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////// // -// PropertyInterface class provides a generic mechanism for get/setting class properties using the osgDB serializers +// ClassInterface class provides a generic mechanism for get/setting class properties using the osgDB serializers // -PropertyInterface::PropertyInterface(): +ClassInterface::ClassInterface(): _outputStream(0), _inputStream(0) { @@ -246,7 +246,7 @@ PropertyInterface::PropertyInterface(): } -bool PropertyInterface::areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgDB::BaseSerializer::Type rhs) const +bool ClassInterface::areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgDB::BaseSerializer::Type rhs) const { if (lhs==rhs) return true; @@ -269,14 +269,14 @@ bool PropertyInterface::areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgD return lhs==rhs; } -std::string PropertyInterface::getTypeName(osgDB::BaseSerializer::Type type) const +std::string ClassInterface::getTypeName(osgDB::BaseSerializer::Type type) const { TypeToTypeNameMap::const_iterator itr = _typeToTypeNameMap.find(type); if (itr != _typeToTypeNameMap.end()) return itr->second; else return std::string(); } -osgDB::BaseSerializer::Type PropertyInterface::getType(const std::string& typeName) const +osgDB::BaseSerializer::Type ClassInterface::getType(const std::string& typeName) const { TypeNameToTypeMap::const_iterator itr = _typeNameToTypeMap.find(typeName); if (itr != _typeNameToTypeMap.end()) return itr->second; @@ -284,35 +284,35 @@ osgDB::BaseSerializer::Type PropertyInterface::getType(const std::string& typeNa } -osgDB::ObjectWrapper* PropertyInterface::getObjectWrapper(const osg::Object* object) const +osgDB::ObjectWrapper* ClassInterface::getObjectWrapper(const osg::Object* object) const { return osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(object->getCompoundClassName()); } -osgDB::BaseSerializer* PropertyInterface::getSerializer(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const +osgDB::BaseSerializer* ClassInterface::getSerializer(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const { osgDB::ObjectWrapper* ow = getObjectWrapper(object); return (ow!=0) ? ow->getSerializer(propertyName, type) : 0; } -osg::Object* PropertyInterface::createObject(const std::string& compoundClassName) const +osg::Object* ClassInterface::createObject(const std::string& compoundClassName) const { osgDB::ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName); if (ow) { osg::Object* object = ow->createInstance(); - // OSG_NOTICE<<"PropertyInterface::createObject("<createInstance() : 0; } -bool PropertyInterface::copyPropertyDataFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType) +bool ClassInterface::copyPropertyDataFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType) { _poi->flush(); @@ -322,7 +322,7 @@ bool PropertyInterface::copyPropertyDataFromObject(const osg::Object* object, co if (!areTypesCompatible(sourceType, valueType)) { - OSG_NOTICE<<"PropertyInterface::copyPropertyDataFromObject() Types are not compatible, valueType = "<getObjectWrapperManager()->findWrapper(compoundClassName); if (!ow) return false; @@ -606,12 +606,12 @@ bool PropertyInterface::run(void* objectPtr, const std::string& compoundClassNam return false; } -bool PropertyInterface::run(osg::Object* object, const std::string& methodName, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const +bool ClassInterface::run(osg::Object* object, const std::string& methodName, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const { return run(object, object->getCompoundClassName(), methodName, inputParameters, outputParameters); } -bool PropertyInterface::hasMethod(const std::string& compoundClassName, const std::string& methodName) const +bool ClassInterface::hasMethod(const std::string& compoundClassName, const std::string& methodName) const { ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName); if (!ow) return false; @@ -637,7 +637,7 @@ bool PropertyInterface::hasMethod(const std::string& compoundClassName, const st return false; } -bool PropertyInterface::hasMethod(const osg::Object* object, const std::string& methodName) const +bool ClassInterface::hasMethod(const osg::Object* object, const std::string& methodName) const { return hasMethod(object->getCompoundClassName(), methodName); } diff --git a/src/osgPlugins/lua/LuaScriptEngine.cpp b/src/osgPlugins/lua/LuaScriptEngine.cpp index fd2c59954..39a735467 100644 --- a/src/osgPlugins/lua/LuaScriptEngine.cpp +++ b/src/osgPlugins/lua/LuaScriptEngine.cpp @@ -135,7 +135,7 @@ static int getContainerProperty(lua_State * _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -183,7 +183,7 @@ static int setContainerProperty(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -212,7 +212,7 @@ static int getContainerSize(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -234,7 +234,7 @@ static int callVectorClear(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -257,7 +257,7 @@ static int callVectorResize(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -279,7 +279,7 @@ static int callVectorReserve(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -301,7 +301,7 @@ static int callVectorAdd(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::VectorBaseSerializer* vs = dynamic_cast(bs); if (vs) { @@ -348,7 +348,7 @@ static int getMapProperty(lua_State * _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) @@ -403,7 +403,7 @@ static int setMapProperty(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) @@ -443,7 +443,7 @@ static int callMapClear(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) { @@ -465,7 +465,7 @@ static int getMapSize(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) { @@ -488,7 +488,7 @@ static int createMapIterator(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) { @@ -510,7 +510,7 @@ static int createMapReverseIterator(lua_State* _lua) // check to see if Object "is a" vector osgDB::BaseSerializer::Type type; - osgDB::BaseSerializer* bs = lse->getPropertyInterface().getSerializer(object, containerPropertyName, type); + osgDB::BaseSerializer* bs = lse->getClassInterface().getSerializer(object, containerPropertyName, type); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (ms) { @@ -1629,7 +1629,7 @@ static int callClassMethod(lua_State* _lua) inputParameters.insert(inputParameters.begin(), lse->popParameterObject()); } - if (lse->getPropertyInterface().run(object, compoundClassName, methodName, inputParameters, outputParameters)) + if (lse->getClassInterface().run(object, compoundClassName, methodName, inputParameters, outputParameters)) { for(osg::Parameters::iterator itr = outputParameters.begin(); itr != outputParameters.end(); @@ -2071,9 +2071,9 @@ public: int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& propertyName) const { osgDB::BaseSerializer::Type type; - if (!_pi.getPropertyType(object, propertyName, type)) + if (!_ci.getPropertyType(object, propertyName, type)) { - if (_pi.hasMethod(object, propertyName)) + if (_ci.hasMethod(object, propertyName)) { lua_pushlightuserdata(_lua, const_cast(this)); lua_pushstring(_lua, propertyName.c_str()); @@ -2104,7 +2104,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_BOOL): { bool value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushboolean(_lua, value ? 1 : 0); return 1; @@ -2114,7 +2114,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_STRING): { std::string value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushstring(_lua, value.c_str()); return 1; @@ -2124,7 +2124,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_GLENUM): { GLenum value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { std::string enumString = lookUpGLenumString(value); lua_pushstring(_lua, enumString.c_str()); @@ -2135,9 +2135,9 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_ENUM): { int value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { - osgDB::BaseSerializer* serializer = _pi.getSerializer(object, propertyName, type); + osgDB::BaseSerializer* serializer = _ci.getSerializer(object, propertyName, type); osgDB::IntLookup* lookup = serializer ? serializer->getIntLookup() : 0; if (lookup) { @@ -2155,7 +2155,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_SHORT): { short value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushinteger(_lua, value); return 1; @@ -2165,7 +2165,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_USHORT): { unsigned short value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushinteger(_lua, value); return 1; @@ -2175,7 +2175,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_INT): { int value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushinteger(_lua, value); return 1; @@ -2185,7 +2185,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_UINT): { unsigned int value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushinteger(_lua, value); return 1; @@ -2195,7 +2195,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_FLOAT): { float value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushnumber(_lua, value); return 1; @@ -2205,7 +2205,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_DOUBLE): { double value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { lua_pushnumber(_lua, value); return 1; @@ -2215,7 +2215,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC2F): { osg::Vec2f value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2225,7 +2225,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC3F): { osg::Vec3f value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2235,7 +2235,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC4F): { osg::Vec4f value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2245,7 +2245,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC2D): { osg::Vec2d value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2255,7 +2255,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC3D): { osg::Vec3d value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2265,7 +2265,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_VEC4D): { osg::Vec4d value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2278,7 +2278,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_MATRIXF): { osg::Matrixf value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2291,7 +2291,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_MATRIXD): { osg::Matrixd value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2301,7 +2301,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_BOUNDINGBOXF): { osg::BoundingBoxf value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2311,7 +2311,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_BOUNDINGBOXD): { osg::BoundingBoxd value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2321,7 +2321,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_BOUNDINGSPHEREF): { osg::BoundingSpheref value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2331,7 +2331,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_BOUNDINGSPHERED): { osg::BoundingSphered value; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushValue(value); return 1; @@ -2347,7 +2347,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& case(osgDB::BaseSerializer::RW_OBJECT): { osg::Object* value = 0; - if (_pi.getProperty(object, propertyName, value)) + if (_ci.getProperty(object, propertyName, value)) { pushObject(value); return 1; @@ -2364,7 +2364,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& break; } - OSG_NOTICE<<"LuaScriptEngine::pushPropertyToStack("<(lua_toboolean(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_toboolean(_lua, -1))); return 0; } else if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1)!=0)); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1)!=0)); return 0; } break; @@ -3037,7 +3037,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isstring(_lua, -1)) { - _pi.setProperty(object, propertyName, std::string(lua_tostring(_lua, -1))); + _ci.setProperty(object, propertyName, std::string(lua_tostring(_lua, -1))); return 0; } break; @@ -3046,7 +3046,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } else if (lua_isstring(_lua, -1)) @@ -3054,7 +3054,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string const char* enumString = lua_tostring(_lua, -1); GLenum value = lookUpGLenumValue(enumString); //getValue("GL",enumString); - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("<(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } else if (lua_isstring(_lua, -1)) { const char* enumString = lua_tostring(_lua, -1); - osgDB::BaseSerializer* serializer = _pi.getSerializer(object, propertyName, type); + osgDB::BaseSerializer* serializer = _ci.getSerializer(object, propertyName, type); osgDB::IntLookup* lookup = serializer ? serializer->getIntLookup() : 0; if (lookup) { int value = lookup->getValue(enumString); - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); } return 0; } @@ -3085,7 +3085,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3094,7 +3094,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3103,7 +3103,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3112,7 +3112,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3121,7 +3121,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3130,7 +3130,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { if (lua_isnumber(_lua, -1)) { - _pi.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); + _ci.setProperty(object, propertyName, static_cast(lua_tonumber(_lua, -1))); return 0; } break; @@ -3140,7 +3140,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec2f value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3150,7 +3150,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec3f value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3160,7 +3160,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec4f value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3170,7 +3170,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec2d value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3180,7 +3180,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec3d value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3190,7 +3190,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Vec4d value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3200,7 +3200,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Quat value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3210,7 +3210,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Plane value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3223,7 +3223,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Matrixd value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3236,7 +3236,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::Matrixd value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3246,7 +3246,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::BoundingBoxf value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3256,7 +3256,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::BoundingBoxd value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3266,7 +3266,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::BoundingSpheref value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3276,7 +3276,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string osg::BoundingSphered value; if (getValue(-1, value)) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } break; @@ -3294,7 +3294,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string if (value) { - _pi.setProperty(object, propertyName, value); + _ci.setProperty(object, propertyName, value); return 0; } else @@ -3306,7 +3306,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { OSG_NOTICE<<"Assigning property object (nil) to to object "<className()<<"::"<(bs); osgDB::MapBaseSerializer* ms = dynamic_cast(bs); if (vs) @@ -4101,7 +4101,7 @@ void LuaScriptEngine::pushContainer(osg::Object* object, const std::string& prop void LuaScriptEngine::createAndPushObject(const std::string& compoundName) const { - osg::ref_ptr object = _pi.createObject(compoundName); + osg::ref_ptr object = _ci.createObject(compoundName); if (!object) OSG_NOTICE<<"Failed to create object "< -#include +#include extern "C" { #include @@ -98,7 +98,7 @@ class LuaScriptEngine : public osg::ScriptEngine /** get the lua_State object.*/ lua_State* getLuaState() const { return _lua; } - osgDB::PropertyInterface& getPropertyInterface() const { return _pi; } + osgDB::ClassInterface& getClassInterface() const { return _ci; } int pushDataToStack(SerializerScratchPad* ssp) const; int getDataFromStack(SerializerScratchPad* ssp, osgDB::BaseSerializer::Type type, int pos) const; @@ -253,7 +253,7 @@ class LuaScriptEngine : public osg::ScriptEngine typedef std::map< osg::ref_ptr, std::string> ScriptMap; ScriptMap _loadedScripts; - mutable osgDB::PropertyInterface _pi; + mutable osgDB::ClassInterface _ci; };