UpdateInstance

This function prepares the content to be ready without filling the buffers as done within CalculateInstance(). CalculateInstance calls this function as a start.
This function will also set the 'derived' values for the instance passed as argument. For example the coordinates values of a MultiplicationMatrix will be set if the array is defined.

Syntax

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

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t UpdateInstance(
            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 UpdateInstance can be used.

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classInverseMatrix = GetClassByName(model, "InverseMatrix"),
            classMatrix = GetClassByName(model, "Matrix");

    //
    //  Object Properties (relations)
    //
    int64_t propertyMatrix = GetPropertyByName(model, "matrix");

    //
    //  Datatype Properties (attributes)
    //
    int64_t property_21 = GetPropertyByName(model, "_21"),
            property_33 = GetPropertyByName(model, "_33"),
            property_42 = GetPropertyByName(model, "_42");

    //
    //  Instances (creating)
    //
    int64_t instanceInverseMatrix = CreateInstance(classInverseMatrix, nullptr),
            instanceMatrix = CreateInstance(classMatrix, nullptr);

    SetObjectProperty(instanceInverseMatrix, propertyMatrix, &instanceMatrix, 1);

    double  translationY = 2.8;

    SetDatatypeProperty(instanceMatrix, property_42, &translationY, 1);

    int64_t card = 0;
    double  * values = nullptr;
    GetDatatypeProperty(instanceMatrix, property_21, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceMatrix, property_33, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceInverseMatrix, property_42, (void**) &values, &card);
    assert(card == 0);

    GetDatatypeProperty(instanceInverseMatrix, property_33, (void**) &values, &card);
    assert(card == 0);

    //
    //  Force to apply a calculation of the tree,
    //  CalculateInstance without further non-zero arguments has the same effect.
    //
    UpdateInstance(instanceInverseMatrix);

    //
    //  Assign all implicitely known values
    //
    InferenceInstance(instanceInverseMatrix);

    GetDatatypeProperty(instanceMatrix, property_21, (void**) &values, &card);
    assert(card == 1 && values[0] == 0.);

    GetDatatypeProperty(instanceMatrix, property_33, (void**) &values, &card);
    assert(card == 1 && values[0] == 1.);

    GetDatatypeProperty(instanceInverseMatrix, property_42, (void**) &values, &card);
    assert(card == 1 && values[0] == -translationY);

    GetDatatypeProperty(instanceInverseMatrix, property_33, (void**) &values, &card);
    assert(card == 1 && values[0] == 1.);

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