Instance Creation And Destruction

Registers and unregisters instances.


XPLMInstanceRef

typedef

An opaque handle to an instance.

typedef void * XPLMInstanceRef;

XPLMCreateInstance

function

XPLMCreateInstance creates a new instance, managed by your plug-in, and returns a handle to the instance. A few important requirements:

XPLM_API XPLMInstanceRefXPLMCreateInstance(
                         XPLMObjectRef        obj,
                         char const* *        datarefs
                    );

XPLMInstanceSetAutoShift

function XPLM420

XPLMInstanceSetAutoShift tells X-Plane to move the location of your instance every time the sim\'s local coordinate sytem changes, so that a static instance does not have to be moved. Without this, a plugin is responsible for updating an instance's local position when the coordinate system shifts. Use this for static instances that you would not otherwise have to move.

XPLM_API void       XPLMInstanceSetAutoShift(
                         XPLMInstanceRef      instance
                    );

XPLMDestroyInstance

function

XPLMDestroyInstance destroys and deallocates your instance; once called, you are still responsible for releasing the OBJ ref.

Tip: you can release your OBJ ref after you call XPLMCreateInstance as long as you never use it again; the instance will maintain its own reference to the OBJ and the object OBJ be deallocated when the instance is destroyed.

XPLM_API void       XPLMDestroyInstance(
                         XPLMInstanceRef      instance
                    );