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
This commit is contained in:
parent
f2d11bb46e
commit
5a7a20d01e
@ -49,7 +49,7 @@ PROJECT(OpenSceneGraph)
|
|||||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||||
SET(OPENSCENEGRAPH_MINOR_VERSION 3)
|
SET(OPENSCENEGRAPH_MINOR_VERSION 3)
|
||||||
SET(OPENSCENEGRAPH_PATCH_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
|
# 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
|
# svn tags will be treated as release candidates of given number
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <osg/io_utils>
|
#include <osg/io_utils>
|
||||||
|
|
||||||
#include<osgDB/PropertyInterface>
|
#include<osgDB/ClassInterface>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
osgDB::writeNodeFile(*presentation, "pres.osgt");
|
osgDB::writeNodeFile(*presentation, "pres.osgt");
|
||||||
|
|
||||||
osgDB::PropertyInterface pi;
|
osgDB::ClassInterface pi;
|
||||||
|
|
||||||
pi.getWhiteList()["osgPresentation::Presentation"]["filename"]=osgDB::BaseSerializer::RW_STRING;
|
pi.getWhiteList()["osgPresentation::Presentation"]["filename"]=osgDB::BaseSerializer::RW_STRING;
|
||||||
pi.getBlackList()["osgPresentation::Presentation"]["Children"];
|
pi.getBlackList()["osgPresentation::Presentation"]["Children"];
|
||||||
@ -314,11 +314,11 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||||
osg::ref_ptr<osg::Node> node = new osg::Node;
|
osg::ref_ptr<osg::Node> node = new osg::Node;
|
||||||
osgDB::PropertyInterface::PropertyMap properties;
|
osgDB::ClassInterface::PropertyMap properties;
|
||||||
if (pi.getSupportedProperties(presentation.get(), properties, true))
|
if (pi.getSupportedProperties(presentation.get(), properties, true))
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
||||||
for(osgDB::PropertyInterface::PropertyMap::iterator itr = properties.begin();
|
for(osgDB::ClassInterface::PropertyMap::iterator itr = properties.begin();
|
||||||
itr != properties.end();
|
itr != properties.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
@ -412,7 +412,7 @@ int main(int argc, char** argv)
|
|||||||
if (pi.getSupportedProperties(event.get(), properties, true))
|
if (pi.getSupportedProperties(event.get(), properties, true))
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
||||||
for(osgDB::PropertyInterface::PropertyMap::iterator itr = properties.begin();
|
for(osgDB::ClassInterface::PropertyMap::iterator itr = properties.begin();
|
||||||
itr != properties.end();
|
itr != properties.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
@ -477,12 +477,12 @@ int main(int argc, char** argv)
|
|||||||
osg::ref_ptr<osg::Object> obj = pi.createObject("osgVolume::VolumeTile");
|
osg::ref_ptr<osg::Object> obj = pi.createObject("osgVolume::VolumeTile");
|
||||||
if (obj.valid()) { OSG_NOTICE<<"obj created "<<obj->getCompoundClassName()<<std::endl; }
|
if (obj.valid()) { OSG_NOTICE<<"obj created "<<obj->getCompoundClassName()<<std::endl; }
|
||||||
else { OSG_NOTICE<<"obj creation failed "<<std::endl; }
|
else { OSG_NOTICE<<"obj creation failed "<<std::endl; }
|
||||||
osgDB::PropertyInterface::PropertyMap properties;
|
osgDB::ClassInterface::PropertyMap properties;
|
||||||
|
|
||||||
if (pi.getSupportedProperties(obj.get(), properties, true))
|
if (pi.getSupportedProperties(obj.get(), properties, true))
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
OSG_NOTICE<<"Have supported properites found."<<std::endl;
|
||||||
for(osgDB::PropertyInterface::PropertyMap::iterator itr = properties.begin();
|
for(osgDB::ClassInterface::PropertyMap::iterator itr = properties.begin();
|
||||||
itr != properties.end();
|
itr != properties.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ extern "C" {
|
|||||||
#define OPENSCENEGRAPH_MAJOR_VERSION 3
|
#define OPENSCENEGRAPH_MAJOR_VERSION 3
|
||||||
#define OPENSCENEGRAPH_MINOR_VERSION 3
|
#define OPENSCENEGRAPH_MINOR_VERSION 3
|
||||||
#define OPENSCENEGRAPH_PATCH_VERSION 3
|
#define OPENSCENEGRAPH_PATCH_VERSION 3
|
||||||
#define OPENSCENEGRAPH_SOVERSION 112
|
#define OPENSCENEGRAPH_SOVERSION 113
|
||||||
|
|
||||||
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
|
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
|
||||||
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)
|
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef OSGDB_PROPERTYINTERFACE
|
#ifndef OSGDB_CLASSINTERFACE
|
||||||
#define OSGDB_PROPERTYINTERFACE 1
|
#define OSGDB_CLASSINTERFACE 1
|
||||||
|
|
||||||
#include <osgDB/ObjectWrapper>
|
#include <osgDB/ObjectWrapper>
|
||||||
#include <osgDB/Registry>
|
#include <osgDB/Registry>
|
||||||
@ -116,13 +116,13 @@ class PropertyOutputIterator;
|
|||||||
class PropertyInputIterator;
|
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.
|
Uses the osgDB serializers to do the actual object querry/get/set.
|
||||||
*/
|
*/
|
||||||
class OSGDB_EXPORT PropertyInterface
|
class OSGDB_EXPORT ClassInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyInterface();
|
ClassInterface();
|
||||||
|
|
||||||
|
|
||||||
/// get the Type of the specified property, return true if property is supported, otherwise false.
|
/// get the Type of the specified property, return true if property is supported, otherwise false.
|
||||||
@ -223,14 +223,14 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
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<T>())) return true;
|
if (copyPropertyDataFromObject(object, propertyName, &value, sizeof(T), getTypeEnum<T>())) return true;
|
||||||
else return object->getUserValue(propertyName, value); // fallback to check user data for property
|
else return object->getUserValue(propertyName, value); // fallback to check user data for property
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
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<T>())) return true;
|
if (copyPropertyDataToObject(object, propertyName, &value, sizeof(T), getTypeEnum<T>())) return true;
|
||||||
else
|
else
|
||||||
@ -244,12 +244,12 @@ bool PropertyInterface::setProperty(osg::Object* object, const std::string& prop
|
|||||||
typedef osg::Object* ObjectPtr;
|
typedef osg::Object* ObjectPtr;
|
||||||
|
|
||||||
template<>
|
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<ObjectPtr>())) return true;
|
if (copyPropertyObjectFromObject(object, propertyName, &value, sizeof(ObjectPtr), getTypeEnum<ObjectPtr>())) return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::getProperty("<<propertyName<<", Checking UserDataContainer for object ptr"<<std::endl;
|
OSG_INFO<<"ClassInterface::getProperty("<<propertyName<<", Checking UserDataContainer for object ptr"<<std::endl;
|
||||||
const osg::UserDataContainer* udc = object->getUserDataContainer();
|
const osg::UserDataContainer* udc = object->getUserDataContainer();
|
||||||
if (udc)
|
if (udc)
|
||||||
{
|
{
|
||||||
@ -266,7 +266,7 @@ inline bool PropertyInterface::getProperty(const osg::Object* object, const std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
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<osg::Image*>(value) ? osgDB::BaseSerializer::RW_IMAGE : getTypeEnum<ObjectPtr>();
|
osgDB::BaseSerializer::Type type = dynamic_cast<osg::Image*>(value) ? osgDB::BaseSerializer::RW_IMAGE : getTypeEnum<ObjectPtr>();
|
||||||
// osgDB::BaseSerializer::Type type = getTypeEnum<ObjectPtr>();
|
// osgDB::BaseSerializer::Type type = getTypeEnum<ObjectPtr>();
|
||||||
@ -281,13 +281,13 @@ inline bool PropertyInterface::setProperty(osg::Object* object, const std::strin
|
|||||||
const osg::Object* outgoingObject = udc->getUserObject(objectIndex);
|
const osg::Object* outgoingObject = udc->getUserObject(objectIndex);
|
||||||
if (outgoingObject==value) return true;
|
if (outgoingObject==value) return true;
|
||||||
|
|
||||||
OSG_INFO<<"PropertyInterface::setProperty("<<propertyName<<", "<<value->className()<<") replace object on UserDataContainer"<<std::endl;
|
OSG_INFO<<"ClassInterface::setProperty("<<propertyName<<", "<<value->className()<<") replace object on UserDataContainer"<<std::endl;
|
||||||
value->setName(propertyName);
|
value->setName(propertyName);
|
||||||
udc->setUserObject(objectIndex, value);
|
udc->setUserObject(objectIndex, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::setProperty("<<propertyName<<", "<<value->className()<<") Adding object to UserDataContainer"<<std::endl;
|
OSG_INFO<<"ClassInterface::setProperty("<<propertyName<<", "<<value->className()<<") Adding object to UserDataContainer"<<std::endl;
|
||||||
value->setName(propertyName);
|
value->setName(propertyName);
|
||||||
udc->addUserObject(value);
|
udc->addUserObject(value);
|
||||||
}
|
}
|
@ -52,6 +52,7 @@ SET(TARGET_H
|
|||||||
${HEADER_PATH}/Archive
|
${HEADER_PATH}/Archive
|
||||||
${HEADER_PATH}/AuthenticationMap
|
${HEADER_PATH}/AuthenticationMap
|
||||||
${HEADER_PATH}/Callbacks
|
${HEADER_PATH}/Callbacks
|
||||||
|
${HEADER_PATH}/ClassInterface
|
||||||
${HEADER_PATH}/ConvertUTF
|
${HEADER_PATH}/ConvertUTF
|
||||||
${HEADER_PATH}/DatabasePager
|
${HEADER_PATH}/DatabasePager
|
||||||
${HEADER_PATH}/DatabaseRevisions
|
${HEADER_PATH}/DatabaseRevisions
|
||||||
@ -69,7 +70,6 @@ SET(TARGET_H
|
|||||||
${HEADER_PATH}/Input
|
${HEADER_PATH}/Input
|
||||||
${HEADER_PATH}/Output
|
${HEADER_PATH}/Output
|
||||||
${HEADER_PATH}/Options
|
${HEADER_PATH}/Options
|
||||||
${HEADER_PATH}/PropertyInterface
|
|
||||||
${HEADER_PATH}/ParameterOutput
|
${HEADER_PATH}/ParameterOutput
|
||||||
${HEADER_PATH}/PluginQuery
|
${HEADER_PATH}/PluginQuery
|
||||||
${HEADER_PATH}/ReaderWriter
|
${HEADER_PATH}/ReaderWriter
|
||||||
@ -89,6 +89,7 @@ SET(TARGET_SRC
|
|||||||
Archive.cpp
|
Archive.cpp
|
||||||
AuthenticationMap.cpp
|
AuthenticationMap.cpp
|
||||||
Callbacks.cpp
|
Callbacks.cpp
|
||||||
|
ClassInterface.cpp
|
||||||
ConvertUTF.cpp
|
ConvertUTF.cpp
|
||||||
DatabasePager.cpp
|
DatabasePager.cpp
|
||||||
DatabaseRevisions.cpp
|
DatabaseRevisions.cpp
|
||||||
@ -109,7 +110,6 @@ SET(TARGET_SRC
|
|||||||
Output.cpp
|
Output.cpp
|
||||||
Options.cpp
|
Options.cpp
|
||||||
PluginQuery.cpp
|
PluginQuery.cpp
|
||||||
PropertyInterface.cpp
|
|
||||||
ReaderWriter.cpp
|
ReaderWriter.cpp
|
||||||
ReadFile.cpp
|
ReadFile.cpp
|
||||||
Registry.cpp
|
Registry.cpp
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <osgDB/PropertyInterface>
|
#include <osgDB/ClassInterface>
|
||||||
|
|
||||||
namespace osgDB // start of osgDB namespace
|
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),
|
_outputStream(0),
|
||||||
_inputStream(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;
|
if (lhs==rhs) return true;
|
||||||
|
|
||||||
@ -269,14 +269,14 @@ bool PropertyInterface::areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgD
|
|||||||
return lhs==rhs;
|
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);
|
TypeToTypeNameMap::const_iterator itr = _typeToTypeNameMap.find(type);
|
||||||
if (itr != _typeToTypeNameMap.end()) return itr->second;
|
if (itr != _typeToTypeNameMap.end()) return itr->second;
|
||||||
else return std::string();
|
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);
|
TypeNameToTypeMap::const_iterator itr = _typeNameToTypeMap.find(typeName);
|
||||||
if (itr != _typeNameToTypeMap.end()) return itr->second;
|
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());
|
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);
|
osgDB::ObjectWrapper* ow = getObjectWrapper(object);
|
||||||
return (ow!=0) ? ow->getSerializer(propertyName, type) : 0;
|
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);
|
osgDB::ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
|
||||||
if (ow)
|
if (ow)
|
||||||
{
|
{
|
||||||
osg::Object* object = ow->createInstance();
|
osg::Object* object = ow->createInstance();
|
||||||
// OSG_NOTICE<<"PropertyInterface::createObject("<<compoundClassName<<"), wrapper found, created object="<<object<<std::endl;
|
// OSG_NOTICE<<"ClassInterface::createObject("<<compoundClassName<<"), wrapper found, created object="<<object<<std::endl;
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::createObject("<<compoundClassName<<"), No object wrapper avaiable."<<std::endl;
|
OSG_NOTICE<<"ClassInterface::createObject("<<compoundClassName<<"), No object wrapper avaiable."<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// return (ow!=0) ? ow->createInstance() : 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)
|
bool ClassInterface::copyPropertyDataFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
||||||
{
|
{
|
||||||
_poi->flush();
|
_poi->flush();
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ bool PropertyInterface::copyPropertyDataFromObject(const osg::Object* object, co
|
|||||||
|
|
||||||
if (!areTypesCompatible(sourceType, valueType))
|
if (!areTypesCompatible(sourceType, valueType))
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::copyPropertyDataFromObject() Types are not compatible, valueType = "<<valueType<<", sourceType="<<sourceType<<std::endl;
|
OSG_NOTICE<<"ClassInterface::copyPropertyDataFromObject() Types are not compatible, valueType = "<<valueType<<", sourceType="<<sourceType<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,18 +343,18 @@ bool PropertyInterface::copyPropertyDataFromObject(const osg::Object* object, co
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::copyPropertyDataFromObject() Sizes not compatible, sourceSize = "<<sourceSize<<" valueSize = "<<valueSize<<std::endl;
|
OSG_NOTICE<<"ClassInterface::copyPropertyDataFromObject() Sizes not compatible, sourceSize = "<<sourceSize<<" valueSize = "<<valueSize<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::copyPropertyDataFromObject() serializer write failed."<<std::endl;
|
OSG_INFO<<"ClassInterface::copyPropertyDataFromObject() serializer write failed."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyInterface::copyPropertyDataToObject(osg::Object* object, const std::string& propertyName, const void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
bool ClassInterface::copyPropertyDataToObject(osg::Object* object, const std::string& propertyName, const void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
||||||
{
|
{
|
||||||
// copy data to PropertyInputIterator
|
// copy data to PropertyInputIterator
|
||||||
if (valueType==osgDB::BaseSerializer::RW_STRING)
|
if (valueType==osgDB::BaseSerializer::RW_STRING)
|
||||||
@ -377,18 +377,18 @@ bool PropertyInterface::copyPropertyDataToObject(osg::Object* object, const std:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::copyPropertyDataToObject() Types are not compatible, valueType = "<<valueType<<" ["<<getTypeName(valueType)<<"] , destinationType="<<destinationType<<" ["<<getTypeName(destinationType)<<"]"<<std::endl;
|
OSG_NOTICE<<"ClassInterface::copyPropertyDataToObject() Types are not compatible, valueType = "<<valueType<<" ["<<getTypeName(valueType)<<"] , destinationType="<<destinationType<<" ["<<getTypeName(destinationType)<<"]"<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::copyPropertyDataFromObject() no serializer available."<<std::endl;
|
OSG_INFO<<"ClassInterface::copyPropertyDataFromObject() no serializer available."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyInterface::copyPropertyObjectFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
bool ClassInterface::copyPropertyObjectFromObject(const osg::Object* object, const std::string& propertyName, void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
||||||
{
|
{
|
||||||
osgDB::BaseSerializer::Type sourceType;
|
osgDB::BaseSerializer::Type sourceType;
|
||||||
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, sourceType);
|
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, sourceType);
|
||||||
@ -400,18 +400,18 @@ bool PropertyInterface::copyPropertyObjectFromObject(const osg::Object* object,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::copyPropertyObjectFromObject() Types are not compatible, valueType = "<<valueType<<" ["<<getTypeName(valueType)<<"] , sourceType="<<sourceType<<" ["<<getTypeName(sourceType)<<"]"<<std::endl;
|
OSG_NOTICE<<"ClassInterface::copyPropertyObjectFromObject() Types are not compatible, valueType = "<<valueType<<" ["<<getTypeName(valueType)<<"] , sourceType="<<sourceType<<" ["<<getTypeName(sourceType)<<"]"<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::copyPropertyObjectFromObject() no serializer available."<<std::endl;
|
OSG_INFO<<"ClassInterface::copyPropertyObjectFromObject() no serializer available."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyInterface::copyPropertyObjectToObject(osg::Object* object, const std::string& propertyName, const void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
bool ClassInterface::copyPropertyObjectToObject(osg::Object* object, const std::string& propertyName, const void* valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
|
||||||
{
|
{
|
||||||
osgDB::BaseSerializer::Type destinationType;
|
osgDB::BaseSerializer::Type destinationType;
|
||||||
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, destinationType);
|
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, destinationType);
|
||||||
@ -423,13 +423,13 @@ bool PropertyInterface::copyPropertyObjectToObject(osg::Object* object, const st
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"PropertyInterface::copyPropertyObjectToObject() Types are not compatible, valueType = "<<valueType<<", destinationType="<<destinationType<<std::endl;
|
OSG_NOTICE<<"ClassInterface::copyPropertyObjectToObject() Types are not compatible, valueType = "<<valueType<<", destinationType="<<destinationType<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OSG_INFO<<"PropertyInterface::copyPropertyObjectToObject() no serializer available."<<std::endl;
|
OSG_INFO<<"ClassInterface::copyPropertyObjectToObject() no serializer available."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ public:
|
|||||||
virtual void apply(const osg::BoundingSphered& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGSPHERED; }
|
virtual void apply(const osg::BoundingSphered& /*value*/) { type = osgDB::BaseSerializer::RW_BOUNDINGSPHERED; }
|
||||||
};
|
};
|
||||||
|
|
||||||
bool PropertyInterface::getPropertyType(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const
|
bool ClassInterface::getPropertyType(const osg::Object* object, const std::string& propertyName, osgDB::BaseSerializer::Type& type) const
|
||||||
{
|
{
|
||||||
if (getSerializer(object, propertyName, type)!=0) return true;
|
if (getSerializer(object, propertyName, type)!=0) return true;
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ bool PropertyInterface::getPropertyType(const osg::Object* object, const std::st
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PropertyInterface::getSupportedProperties(const osg::Object* object, PropertyMap& properties, bool searchAssociates) const
|
bool ClassInterface::getSupportedProperties(const osg::Object* object, PropertyMap& properties, bool searchAssociates) const
|
||||||
{
|
{
|
||||||
osgDB::ObjectWrapper* ow = getObjectWrapper(object);
|
osgDB::ObjectWrapper* ow = getObjectWrapper(object);
|
||||||
if (!ow)
|
if (!ow)
|
||||||
@ -548,7 +548,7 @@ bool PropertyInterface::getSupportedProperties(const osg::Object* object, Proper
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyInterface::isObjectOfType(const osg::Object* object, const std::string& compoundClassName) const
|
bool ClassInterface::isObjectOfType(const osg::Object* object, const std::string& compoundClassName) const
|
||||||
{
|
{
|
||||||
if (!object) return false;
|
if (!object) return false;
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ bool PropertyInterface::isObjectOfType(const osg::Object* object, const std::str
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyInterface::run(void* objectPtr, const std::string& compoundClassName, const std::string& methodName, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
|
bool ClassInterface::run(void* objectPtr, const std::string& compoundClassName, const std::string& methodName, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
|
||||||
{
|
{
|
||||||
ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
|
ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
|
||||||
if (!ow) return false;
|
if (!ow) return false;
|
||||||
@ -606,12 +606,12 @@ bool PropertyInterface::run(void* objectPtr, const std::string& compoundClassNam
|
|||||||
return false;
|
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);
|
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);
|
ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName);
|
||||||
if (!ow) return false;
|
if (!ow) return false;
|
||||||
@ -637,7 +637,7 @@ bool PropertyInterface::hasMethod(const std::string& compoundClassName, const st
|
|||||||
return false;
|
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);
|
return hasMethod(object->getCompoundClassName(), methodName);
|
||||||
}
|
}
|
@ -135,7 +135,7 @@ static int getContainerProperty(lua_State * _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -183,7 +183,7 @@ static int setContainerProperty(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ static int getContainerSize(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -234,7 +234,7 @@ static int callVectorClear(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ static int callVectorResize(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ static int callVectorReserve(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -301,7 +301,7 @@ static int callVectorAdd(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
@ -348,7 +348,7 @@ static int getMapProperty(lua_State * _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
|
|
||||||
if (ms)
|
if (ms)
|
||||||
@ -403,7 +403,7 @@ static int setMapProperty(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
|
|
||||||
if (ms)
|
if (ms)
|
||||||
@ -443,7 +443,7 @@ static int callMapClear(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
if (ms)
|
if (ms)
|
||||||
{
|
{
|
||||||
@ -465,7 +465,7 @@ static int getMapSize(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
if (ms)
|
if (ms)
|
||||||
{
|
{
|
||||||
@ -488,7 +488,7 @@ static int createMapIterator(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
if (ms)
|
if (ms)
|
||||||
{
|
{
|
||||||
@ -510,7 +510,7 @@ static int createMapReverseIterator(lua_State* _lua)
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
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<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
if (ms)
|
if (ms)
|
||||||
{
|
{
|
||||||
@ -1629,7 +1629,7 @@ static int callClassMethod(lua_State* _lua)
|
|||||||
inputParameters.insert(inputParameters.begin(), lse->popParameterObject());
|
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();
|
for(osg::Parameters::iterator itr = outputParameters.begin();
|
||||||
itr != outputParameters.end();
|
itr != outputParameters.end();
|
||||||
@ -2071,9 +2071,9 @@ public:
|
|||||||
int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& propertyName) const
|
int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string& propertyName) const
|
||||||
{
|
{
|
||||||
osgDB::BaseSerializer::Type type;
|
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<LuaScriptEngine*>(this));
|
lua_pushlightuserdata(_lua, const_cast<LuaScriptEngine*>(this));
|
||||||
lua_pushstring(_lua, propertyName.c_str());
|
lua_pushstring(_lua, propertyName.c_str());
|
||||||
@ -2104,7 +2104,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_BOOL):
|
case(osgDB::BaseSerializer::RW_BOOL):
|
||||||
{
|
{
|
||||||
bool value;
|
bool value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushboolean(_lua, value ? 1 : 0);
|
lua_pushboolean(_lua, value ? 1 : 0);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2114,7 +2114,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_STRING):
|
case(osgDB::BaseSerializer::RW_STRING):
|
||||||
{
|
{
|
||||||
std::string value;
|
std::string value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushstring(_lua, value.c_str());
|
lua_pushstring(_lua, value.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
@ -2124,7 +2124,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_GLENUM):
|
case(osgDB::BaseSerializer::RW_GLENUM):
|
||||||
{
|
{
|
||||||
GLenum value;
|
GLenum value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
std::string enumString = lookUpGLenumString(value);
|
std::string enumString = lookUpGLenumString(value);
|
||||||
lua_pushstring(_lua, enumString.c_str());
|
lua_pushstring(_lua, enumString.c_str());
|
||||||
@ -2135,9 +2135,9 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_ENUM):
|
case(osgDB::BaseSerializer::RW_ENUM):
|
||||||
{
|
{
|
||||||
int value;
|
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;
|
osgDB::IntLookup* lookup = serializer ? serializer->getIntLookup() : 0;
|
||||||
if (lookup)
|
if (lookup)
|
||||||
{
|
{
|
||||||
@ -2155,7 +2155,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_SHORT):
|
case(osgDB::BaseSerializer::RW_SHORT):
|
||||||
{
|
{
|
||||||
short value;
|
short value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushinteger(_lua, value);
|
lua_pushinteger(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2165,7 +2165,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_USHORT):
|
case(osgDB::BaseSerializer::RW_USHORT):
|
||||||
{
|
{
|
||||||
unsigned short value;
|
unsigned short value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushinteger(_lua, value);
|
lua_pushinteger(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2175,7 +2175,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_INT):
|
case(osgDB::BaseSerializer::RW_INT):
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushinteger(_lua, value);
|
lua_pushinteger(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2185,7 +2185,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_UINT):
|
case(osgDB::BaseSerializer::RW_UINT):
|
||||||
{
|
{
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushinteger(_lua, value);
|
lua_pushinteger(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2195,7 +2195,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_FLOAT):
|
case(osgDB::BaseSerializer::RW_FLOAT):
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushnumber(_lua, value);
|
lua_pushnumber(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2205,7 +2205,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_DOUBLE):
|
case(osgDB::BaseSerializer::RW_DOUBLE):
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
lua_pushnumber(_lua, value);
|
lua_pushnumber(_lua, value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2215,7 +2215,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC2F):
|
case(osgDB::BaseSerializer::RW_VEC2F):
|
||||||
{
|
{
|
||||||
osg::Vec2f value;
|
osg::Vec2f value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2225,7 +2225,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC3F):
|
case(osgDB::BaseSerializer::RW_VEC3F):
|
||||||
{
|
{
|
||||||
osg::Vec3f value;
|
osg::Vec3f value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2235,7 +2235,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC4F):
|
case(osgDB::BaseSerializer::RW_VEC4F):
|
||||||
{
|
{
|
||||||
osg::Vec4f value;
|
osg::Vec4f value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2245,7 +2245,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC2D):
|
case(osgDB::BaseSerializer::RW_VEC2D):
|
||||||
{
|
{
|
||||||
osg::Vec2d value;
|
osg::Vec2d value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2255,7 +2255,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC3D):
|
case(osgDB::BaseSerializer::RW_VEC3D):
|
||||||
{
|
{
|
||||||
osg::Vec3d value;
|
osg::Vec3d value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2265,7 +2265,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_VEC4D):
|
case(osgDB::BaseSerializer::RW_VEC4D):
|
||||||
{
|
{
|
||||||
osg::Vec4d value;
|
osg::Vec4d value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2278,7 +2278,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_MATRIXF):
|
case(osgDB::BaseSerializer::RW_MATRIXF):
|
||||||
{
|
{
|
||||||
osg::Matrixf value;
|
osg::Matrixf value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2291,7 +2291,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_MATRIXD):
|
case(osgDB::BaseSerializer::RW_MATRIXD):
|
||||||
{
|
{
|
||||||
osg::Matrixd value;
|
osg::Matrixd value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2301,7 +2301,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_BOUNDINGBOXF):
|
case(osgDB::BaseSerializer::RW_BOUNDINGBOXF):
|
||||||
{
|
{
|
||||||
osg::BoundingBoxf value;
|
osg::BoundingBoxf value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2311,7 +2311,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_BOUNDINGBOXD):
|
case(osgDB::BaseSerializer::RW_BOUNDINGBOXD):
|
||||||
{
|
{
|
||||||
osg::BoundingBoxd value;
|
osg::BoundingBoxd value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2321,7 +2321,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_BOUNDINGSPHEREF):
|
case(osgDB::BaseSerializer::RW_BOUNDINGSPHEREF):
|
||||||
{
|
{
|
||||||
osg::BoundingSpheref value;
|
osg::BoundingSpheref value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2331,7 +2331,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_BOUNDINGSPHERED):
|
case(osgDB::BaseSerializer::RW_BOUNDINGSPHERED):
|
||||||
{
|
{
|
||||||
osg::BoundingSphered value;
|
osg::BoundingSphered value;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushValue(value);
|
pushValue(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2347,7 +2347,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
case(osgDB::BaseSerializer::RW_OBJECT):
|
case(osgDB::BaseSerializer::RW_OBJECT):
|
||||||
{
|
{
|
||||||
osg::Object* value = 0;
|
osg::Object* value = 0;
|
||||||
if (_pi.getProperty(object, propertyName, value))
|
if (_ci.getProperty(object, propertyName, value))
|
||||||
{
|
{
|
||||||
pushObject(value);
|
pushObject(value);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2364,7 +2364,7 @@ int LuaScriptEngine::pushPropertyToStack(osg::Object* object, const std::string&
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSG_NOTICE<<"LuaScriptEngine::pushPropertyToStack("<<object<<", "<<propertyName<<") property of type = "<<_pi.getTypeName(type)<<" error, not supported."<<std::endl;
|
OSG_NOTICE<<"LuaScriptEngine::pushPropertyToStack("<<object<<", "<<propertyName<<") property of type = "<<_ci.getTypeName(type)<<" error, not supported."<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2669,7 +2669,7 @@ int LuaScriptEngine::pushDataToStack(SerializerScratchPad* ssp) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSG_NOTICE<<"LuaScriptEngine::pushDataToStack() property of type = "<<_pi.getTypeName(ssp->dataType)<<" error, not supported."<<std::endl;
|
OSG_NOTICE<<"LuaScriptEngine::pushDataToStack() property of type = "<<_ci.getTypeName(ssp->dataType)<<" error, not supported."<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2979,7 +2979,7 @@ int LuaScriptEngine::getDataFromStack(SerializerScratchPad* ssp, osgDB::BaseSeri
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OSG_NOTICE<<"LuaScriptEngine::getDataFromStack() property of type = "<<_pi.getTypeName(type)<<" not matched"<<std::endl;
|
OSG_NOTICE<<"LuaScriptEngine::getDataFromStack() property of type = "<<_ci.getTypeName(type)<<" not matched"<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2988,7 +2988,7 @@ int LuaScriptEngine::getDataFromStack(SerializerScratchPad* ssp, osgDB::BaseSeri
|
|||||||
int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string& propertyName) const
|
int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string& propertyName) const
|
||||||
{
|
{
|
||||||
osgDB::BaseSerializer::Type type;
|
osgDB::BaseSerializer::Type type;
|
||||||
if (!_pi.getPropertyType(object, propertyName, type))
|
if (!_ci.getPropertyType(object, propertyName, type))
|
||||||
{
|
{
|
||||||
if (lua_type(_lua,-1)==LUA_TFUNCTION)
|
if (lua_type(_lua,-1)==LUA_TFUNCTION)
|
||||||
{
|
{
|
||||||
@ -3023,12 +3023,12 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isboolean(_lua, -1))
|
if (lua_isboolean(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<bool>(lua_toboolean(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<bool>(lua_toboolean(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (lua_isnumber(_lua, -1))
|
else if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<bool>(lua_tonumber(_lua, -1)!=0));
|
_ci.setProperty(object, propertyName, static_cast<bool>(lua_tonumber(_lua, -1)!=0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3037,7 +3037,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isstring(_lua, -1))
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3046,7 +3046,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<GLenum>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<GLenum>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (lua_isstring(_lua, -1))
|
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);
|
const char* enumString = lua_tostring(_lua, -1);
|
||||||
GLenum value = lookUpGLenumValue(enumString); //getValue("GL",enumString);
|
GLenum value = lookUpGLenumValue(enumString); //getValue("GL",enumString);
|
||||||
|
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("<<propertyName<<") osgDB::BaseSerializer::RW_GLENUM Failed"<<std::endl;
|
OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("<<propertyName<<") osgDB::BaseSerializer::RW_GLENUM Failed"<<std::endl;
|
||||||
@ -3064,18 +3064,18 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<int>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<int>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (lua_isstring(_lua, -1))
|
else if (lua_isstring(_lua, -1))
|
||||||
{
|
{
|
||||||
const char* enumString = lua_tostring(_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;
|
osgDB::IntLookup* lookup = serializer ? serializer->getIntLookup() : 0;
|
||||||
if (lookup)
|
if (lookup)
|
||||||
{
|
{
|
||||||
int value = lookup->getValue(enumString);
|
int value = lookup->getValue(enumString);
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3085,7 +3085,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<short>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<short>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3094,7 +3094,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<unsigned short>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<unsigned short>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3103,7 +3103,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<int>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<int>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3112,7 +3112,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<unsigned int>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<unsigned int>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3121,7 +3121,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<float>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<float>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3130,7 +3130,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
if (lua_isnumber(_lua, -1))
|
if (lua_isnumber(_lua, -1))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, static_cast<double>(lua_tonumber(_lua, -1)));
|
_ci.setProperty(object, propertyName, static_cast<double>(lua_tonumber(_lua, -1)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3140,7 +3140,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec2f value;
|
osg::Vec2f value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3150,7 +3150,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec3f value;
|
osg::Vec3f value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3160,7 +3160,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec4f value;
|
osg::Vec4f value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3170,7 +3170,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec2d value;
|
osg::Vec2d value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3180,7 +3180,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec3d value;
|
osg::Vec3d value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3190,7 +3190,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Vec4d value;
|
osg::Vec4d value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3200,7 +3200,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Quat value;
|
osg::Quat value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3210,7 +3210,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Plane value;
|
osg::Plane value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3223,7 +3223,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Matrixd value;
|
osg::Matrixd value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3236,7 +3236,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::Matrixd value;
|
osg::Matrixd value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3246,7 +3246,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::BoundingBoxf value;
|
osg::BoundingBoxf value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3256,7 +3256,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::BoundingBoxd value;
|
osg::BoundingBoxd value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3266,7 +3266,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::BoundingSpheref value;
|
osg::BoundingSpheref value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3276,7 +3276,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
osg::BoundingSphered value;
|
osg::BoundingSphered value;
|
||||||
if (getValue(-1, value))
|
if (getValue(-1, value))
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3294,7 +3294,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3306,7 +3306,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
{
|
{
|
||||||
OSG_NOTICE<<"Assigning property object (nil) to to object "<<object->className()<<"::"<<propertyName<<std::endl;
|
OSG_NOTICE<<"Assigning property object (nil) to to object "<<object->className()<<"::"<<propertyName<<std::endl;
|
||||||
osg::Object* value = 0;
|
osg::Object* value = 0;
|
||||||
_pi.setProperty(object, propertyName, value);
|
_ci.setProperty(object, propertyName, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3320,7 +3320,7 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("<<object<<", "<<propertyName<<") property of type = "<<_pi.getTypeName(type)<<" not implemented"<<std::endl;
|
OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("<<object<<", "<<propertyName<<") property of type = "<<_ci.getTypeName(type)<<" not implemented"<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4063,7 +4063,7 @@ void LuaScriptEngine::pushContainer(osg::Object* object, const std::string& prop
|
|||||||
lua_pushstring(_lua, "containerPropertyName"); lua_pushstring(_lua, propertyName.c_str()); lua_settable(_lua, -3);
|
lua_pushstring(_lua, "containerPropertyName"); lua_pushstring(_lua, propertyName.c_str()); lua_settable(_lua, -3);
|
||||||
|
|
||||||
osgDB::BaseSerializer::Type type;
|
osgDB::BaseSerializer::Type type;
|
||||||
osgDB::BaseSerializer* bs = _pi.getSerializer(object, propertyName, type);
|
osgDB::BaseSerializer* bs = _ci.getSerializer(object, propertyName, type);
|
||||||
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
osgDB::VectorBaseSerializer* vs = dynamic_cast<osgDB::VectorBaseSerializer*>(bs);
|
||||||
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
osgDB::MapBaseSerializer* ms = dynamic_cast<osgDB::MapBaseSerializer*>(bs);
|
||||||
if (vs)
|
if (vs)
|
||||||
@ -4101,7 +4101,7 @@ void LuaScriptEngine::pushContainer(osg::Object* object, const std::string& prop
|
|||||||
|
|
||||||
void LuaScriptEngine::createAndPushObject(const std::string& compoundName) const
|
void LuaScriptEngine::createAndPushObject(const std::string& compoundName) const
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Object> object = _pi.createObject(compoundName);
|
osg::ref_ptr<osg::Object> object = _ci.createObject(compoundName);
|
||||||
if (!object) OSG_NOTICE<<"Failed to create object "<<compoundName<<std::endl;
|
if (!object) OSG_NOTICE<<"Failed to create object "<<compoundName<<std::endl;
|
||||||
|
|
||||||
pushObject(object.get());
|
pushObject(object.get());
|
||||||
@ -4138,7 +4138,7 @@ void LuaScriptEngine::pushObject(osg::Object* object) const
|
|||||||
|
|
||||||
// check to see if Object "is a" vector
|
// check to see if Object "is a" vector
|
||||||
osgDB::BaseSerializer::Type type;
|
osgDB::BaseSerializer::Type type;
|
||||||
osgDB::BaseSerializer* vs = _pi.getSerializer(object, "vector", type);
|
osgDB::BaseSerializer* vs = _ci.getSerializer(object, "vector", type);
|
||||||
if (vs)
|
if (vs)
|
||||||
{
|
{
|
||||||
lua_pushstring(_lua, "containerPropertyName"); lua_pushstring(_lua, "vector"); lua_settable(_lua, -3);
|
lua_pushstring(_lua, "containerPropertyName"); lua_pushstring(_lua, "vector"); lua_settable(_lua, -3);
|
||||||
@ -4196,7 +4196,7 @@ void LuaScriptEngine::pushObject(osg::Object* object) const
|
|||||||
|
|
||||||
void LuaScriptEngine::pushAndCastObject(const std::string& compoundClassName, osg::Object* object) const
|
void LuaScriptEngine::pushAndCastObject(const std::string& compoundClassName, osg::Object* object) const
|
||||||
{
|
{
|
||||||
if (object && _pi.isObjectOfType(object, compoundClassName))
|
if (object && _ci.isObjectOfType(object, compoundClassName))
|
||||||
{
|
{
|
||||||
lua_newtable(_lua);
|
lua_newtable(_lua);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#define LUASCRIPTENGINE_H
|
#define LUASCRIPTENGINE_H
|
||||||
|
|
||||||
#include <osg/ScriptEngine>
|
#include <osg/ScriptEngine>
|
||||||
#include <osgDB/PropertyInterface>
|
#include <osgDB/ClassInterface>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
@ -98,7 +98,7 @@ class LuaScriptEngine : public osg::ScriptEngine
|
|||||||
/** get the lua_State object.*/
|
/** get the lua_State object.*/
|
||||||
lua_State* getLuaState() const { return _lua; }
|
lua_State* getLuaState() const { return _lua; }
|
||||||
|
|
||||||
osgDB::PropertyInterface& getPropertyInterface() const { return _pi; }
|
osgDB::ClassInterface& getClassInterface() const { return _ci; }
|
||||||
|
|
||||||
int pushDataToStack(SerializerScratchPad* ssp) const;
|
int pushDataToStack(SerializerScratchPad* ssp) const;
|
||||||
int getDataFromStack(SerializerScratchPad* ssp, osgDB::BaseSerializer::Type type, int pos) 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<osg::Script>, std::string> ScriptMap;
|
typedef std::map< osg::ref_ptr<osg::Script>, std::string> ScriptMap;
|
||||||
ScriptMap _loadedScripts;
|
ScriptMap _loadedScripts;
|
||||||
|
|
||||||
mutable osgDB::PropertyInterface _pi;
|
mutable osgDB::ClassInterface _ci;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user