chao.zhang Posted July 11, 2012 Posted July 11, 2012 Hi all, In a C++ Plugin I generate a map or vector with different sizes. I want to export these variable to UnigineScript for later use in world Script, So how to export such user-defined data variables to UnigineScript? for example: I have the following data in a C++ plugin: typedef struct mydata { string name; int x; int y; int z; }mydata ; mydata data1[1024]; std::vector<mydata> data2; std::map<std::string, mydata> data3; how can i export data1, data2, data3 to UnigineScript and access them from world Script? Thank you!
chao.zhang Posted July 11, 2012 Author Posted July 11, 2012 Thanks you steve3d , The Variable class have only the inbuilt type constructor such as int float vec3 and so on How to use Variable to export my own datatype mydata data1[1024], for example?
chao.zhang Posted July 11, 2012 Author Posted July 11, 2012 And another question, How to export Class with private constructor, for example, some class use singleton mode: class singleton { public: static singleton* getInstance(); ~singleton(); private: singleton(); } how to export such class to Unigine Script? Thanks for help.
fonta.romain Posted July 11, 2012 Posted July 11, 2012 Another question : How to export abstract base class ? (could be useful in some cases)
frustum Posted July 19, 2012 Posted July 19, 2012 Here is an API sample for mydata struct export. MyData.zip
frustum Posted July 19, 2012 Posted July 19, 2012 You can declare Unigine::ExternClassConstructor template as a friend class. class MyClass { protected: template <class> friend class Unigine::ExternClassConstructor_0; MyClass() { Log::error("MyClass::MyClass(): called\n"); } }; Friend.zip
frustum Posted July 19, 2012 Posted July 19, 2012 Another question : How to export abstract base class ? (could be useful in some cases) Check this sample: source/samples/Api/Inheritance from SDK.
fonta.romain Posted July 19, 2012 Posted July 19, 2012 Looks like it was a mistake in my code as it perfectly works now ;) Sorry for silly question !
chao.zhang Posted July 24, 2012 Author Posted July 24, 2012 Thanks , why can not I download the attached files of frustum?
manguste Posted July 26, 2012 Posted July 26, 2012 What's the error when you cannot download the attachment?
chao.zhang Posted July 27, 2012 Author Posted July 27, 2012 Hi manguste, when i download the attachment, it pop out an error dialog with the message complaining as follows: can not download index.php (come from developer.unigine.com) can not open Internet site. Your requsrted site is unusable or cannot find, please try again later.
manguste Posted August 9, 2012 Posted August 9, 2012 Sorry, on our side everything seems to work fine, so please check for problems on your side (firewall, proxy server issues, etc).
Recommended Posts