How I can create a 3dObject componet inside a plugin


Recommended Posts

I create a plugin where I want to include a new 3d object. For my 3dObject I inherited from ObjectExternBase

class My3dObject: public Unigine::ObjectExternBase
	template <class> friend class Unigine::Ptr;
	static void release_ptr(My3dObject *p);
		delete p; 

	static Unigine::Ptr<My3dObject> create();
		Unigine::Ptr<My3dObject> ptr = Unigine::Ptr<My3dObject>(new My3dObject());
		return ptr;

	virtual int getClassID() override;
	virtual int getNumSurfaces() override;
	virtual const char *getSurfaceName(int surface) override;
	virtual const ::Unigine::BoundBox &getBoundBox(int surface) override;
	virtual const ::Unigine::BoundSphere &getBoundSphere(int surface) override;
	virtual const ::Unigine::BoundBox& getBoundBox() override;
	virtual const ::Unigine::BoundSphere& getBoundSphere() override;
int MyPlugin::init()

	int id = Unigine::Interpreter::addGroup("MyGroup");

	Unigine::ExternClass<My3dObject> *My3dObj = Unigine::MakeExternClass<My3dObject>();
	Unigine::Interpreter::addExternClass("My3dObject", My3dObj, id);

    this->my3dObj = My3dObject::create();
    Unigine::Editor::get()->addNode(this->my3dObj.get()->getNode(), true);

After load the plugin in the "word tree" appear the node "ObjectExtern", but if I select this raise an exception

        Unhandled exception at 0x00007FF88046E91E (ucrtbase.dll) in Editor_x64d.exe: Fatal program exit requested.

Exist some sample that show how I can add My3dObject to the editor from a plugin.





Edited by roberto.voxelfarm
Link to post

Hello Roberto,

At the moment Editor can't work with custom plugins. We're already developing this feature and plan to release it with SDK 2.10 (October 2019).


How to submit a good bug report
FTP server for test scenes and user uploads:

Link to post