GetInstanceClass

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        GetInstanceClass(
                        OwlInstance             owlInstance
                    );


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall GetInstanceClass(
                                                int64_t                 owlInstance
                                            );
    

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 GetInstanceClass can be used.

#include    "./include/engine.h"

int64_t model = CreateModel();

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

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

    assert(GetInstanceClass(instanceAbcd) == classAbcd);
    assert(GetInstanceClass(instanceCube) == classCube);
    assert(GetInstanceClass(instanceMatrixI) == GetInstanceClass(instanceMatrixII));

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