GetInstanceClass

Returns the handle to the class of which an instances is instantiated.

Note: internally this function is not rich enough as support for multiple inheritance
    is making it impossible to answer this request with always one class handle.
    Even in the case of pure single inheritance an instance of a class is also an instance of
    every parent classes in the inheritance tree. For now we expect single inheritance use
    and the returned class handle points to the 'lowest' class in the inheritance tree.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall GetInstanceClass(
            __int64             owlInstance
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t 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

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

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);
}