RemoveInstance
In case copies are created by the host this function checks if all
copies are removed otherwise the instance will stay available.
Return value is 0 if everything went ok and positive in case of an error
Syntax
// // Strong typing definition // int64_t RemoveInstance( OwlInstance owlInstance ); // // Weak typing definition // int64_t __declspec(dllexport) __stdcall RemoveInstance( int64_t owlInstance );
Property owlInstance
Size: 64 bit / 8 byte (value)
Example (based on pure API calls)
Here you can find code snippits that show how the API call RemoveInstance can be used.
#include "./include/engine.h" int64_t model = CreateModel(); if (model) { // // Classes // int64_t classCube = GetClassByName(model, "Cube"), classCylinder = GetClassByName(model, "Cylinder"), classMatrix = GetClassByName(model, "Matrix"), classTransformation = GetClassByName(model, "Transformation"); // // Object Properties (relations) // int64_t propertyMatrix = GetPropertyByName(model, "matrix"), propertyObject = GetPropertyByName(model, "object"); // // Datatype Properties (attributes) // int64_t property_42 = GetPropertyByName(model, "_42"), propertyLength = GetPropertyByName(model, "length"), propertyRadius = GetPropertyByName(model, "radius"); // // Instances (creating) // int64_t instanceCube = CreateInstance(classCube, nullptr), instanceCylinder = CreateInstance(classCylinder, nullptr), instanceMatrix = CreateInstance(classMatrix, nullptr), instanceTransformation = CreateInstance(classTransformation, nullptr); SetObjectProperty(instanceTransformation, propertyObject, &instanceCylinder, 1); SetObjectProperty(instanceTransformation, propertyMatrix, &instanceMatrix, 1); double lengthCube = 2.1, lengthCyl = 2.8, radiusCyl = 1.3, offsetY = -1.2; SetDatatypeProperty(instanceCube, propertyLength, &lengthCube, 1); SetDatatypeProperty(instanceCylinder, propertyLength, &lengthCyl, 1); SetDatatypeProperty(instanceCylinder, propertyRadius, &radiusCyl, 1); SetDatatypeProperty(instanceMatrix, property_42, &offsetY, 1); int64_t instanceCnt = 0; OrderedHandles(model, nullptr, nullptr, &instanceCnt, 0, 0); assert(instanceCnt == 4); RemoveInstance(instanceCylinder); // this will not remove the Cylinder instance as it is referenced RemoveInstance(instanceCube); RemoveInstance(instanceMatrix); // this will not remove the Cylinder instance as it is referenced OrderedHandles(model, nullptr, nullptr, &instanceCnt, 0, 0); assert(instanceCnt == 3); RemoveInstance(instanceTransformation); OrderedHandles(model, nullptr, nullptr, &instanceCnt, 0, 0); assert(instanceCnt == 2); // // The resulting model can be viewed in 3D-Editor.exe // SaveModel(model, "c:\\created\\myTransformation.bin"); CloseModel(model); }