GetInstanceClassEx

Returns the handle to the class of which the instance is instantiated. In case the instance is instantiated on more than one class it will return 0.

Syntax

//
//   Strong typing definition
//
OwlClass        GetInstanceClassEx(
                        OwlModel                model,
                        OwlInstance             owlInstance
                    );


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall GetInstanceClassEx(
                                                int64_t                 model,
                                                int64_t                 owlInstance
                                            );
    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Example (based on pure API calls)

Here you can find code snippits that show how the API call GetInstanceClassEx can be used.

#include    "./include/engine.h"

int64_t model = CreateModel();

if (model) {
    //
    //  The following setting makes sure all class handled are in an ordered list
    //  In certain cases where several models are open or in case of conversion
    //  between formats this can be handy and / or time efficient.
    //
    OrderedHandles(model, nullptr, nullptr, nullptr, 1 + 2 + 4, 1 + 2 + 4);

    //
    //  Classes
    //
    int64_t classAbcd = CreateClass(model, "ABCD"),
            classCube = CreateClass(model, "Cube"),
            classMatrix = CreateClass(model, "Matrix");

    //
    //  Instances
    //
    int64_t instanceAbcd = CreateInstanceEx(model, classAbcd, nullptr),
            instanceCube = CreateInstanceEx(model, classCube, nullptr),
            instanceMatrixI = CreateInstanceEx(model, classMatrix, nullptr),
            instanceMatrixII = CreateInstanceEx(model, classMatrix, nullptr);

    assert(GetInstanceClassEx(model, instanceAbcd) == classAbcd);
    assert(GetInstanceClassEx(model, instanceCube) == classCube);
    assert(GetInstanceClassEx(model, instanceMatrixI) == GetInstanceClassEx(model, instanceMatrixII));

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModel(model, "c:\\created\\myFile.bin");
    CloseModel(model);
}