add ScriptNodeCallback serializer
This commit is contained in:
parent
eb59590d77
commit
9d490bbf1c
@ -36,7 +36,7 @@ class Script : public osg::Object
|
||||
META_Object(osg, Script)
|
||||
|
||||
void setLanguage(const std::string& language) { _language = language; dirty(); }
|
||||
const std::string& getLanguage() { return _language; }
|
||||
const std::string& getLanguage() const{ return _language; }
|
||||
|
||||
void setScript(const std::string& str) { _script = str; dirty(); }
|
||||
const std::string& getScript() const { return _script; }
|
||||
@ -75,6 +75,12 @@ class OSG_EXPORT ScriptNodeCallback : public osg::NodeCallback
|
||||
/** Get the script to call.*/
|
||||
const osg::Script* getScript() const { return _script.get(); }
|
||||
|
||||
/** Set the entry point to call.*/
|
||||
void setEntryPoint(const std::string& script) { _entryPoint = script; }
|
||||
|
||||
/** Get the script to call.*/
|
||||
const std::string& getEntryPoint() const { return _entryPoint; }
|
||||
|
||||
/** find the ScriptEngine from looking at the UserDataContainers of nodes in scene graph above the ScriptCallback.*/
|
||||
osg::ScriptEngine* getScriptEngine(osg::NodePath& nodePath);
|
||||
|
||||
|
20
src/osgWrappers/serializers/osg/Script.cpp
Normal file
20
src/osgWrappers/serializers/osg/Script.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#include <osg/ScriptEngine>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Script,
|
||||
new osg::Script,
|
||||
osg::Script,
|
||||
"osg::Object osg::Script" )
|
||||
{
|
||||
ADD_STRING_SERIALIZER( Script, "" ); // _script
|
||||
ADD_STRING_SERIALIZER( Language, "" ); // _script
|
||||
}
|
||||
|
||||
|
||||
|
23
src/osgWrappers/serializers/osg/ScriptNodeCallback.cpp
Normal file
23
src/osgWrappers/serializers/osg/ScriptNodeCallback.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#include <osg/ScriptEngine>
|
||||
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ScriptNodeCallback,
|
||||
new osg::ScriptNodeCallback,
|
||||
osg::ScriptNodeCallback,
|
||||
"osg::Object osg::Callback osg::CallbackObject osg::ScriptNodeCallback" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( Script, osg::Script, NULL ); // _script
|
||||
ADD_STRING_SERIALIZER( EntryPoint, "" ); // _entrypoint
|
||||
}
|
||||
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
|
Loading…
Reference in New Issue
Block a user