Jump to content

[SOLVED] how to export user-defined data to UnigineScript?


photo

Recommended Posts

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!

Link to comment

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?

Link to comment

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.

Link to comment

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

Link to comment

Another question : How to export abstract base class ? (could be useful in some cases)

Check this sample: source/samples/Api/Inheritance from SDK.

Link to comment

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.

Link to comment
  • 2 weeks later...
×
×
  • Create New...