SetNameOfPropertyWEx
Error return codes:
0 successful
1 argument model or rdfProperty is incorrect (not a proper handle to an active property)
2 argument name is incorrect (nullptr or zero length name)
3 the name of rdfProperty is locked
4 name is already used by another class
5 name is already used by a property
6 name is already used by an instance
7 undefined error
This call has the same behavior as SetNameOfPropertyW, however needs to be
used in case properties are exchanged as a successive series of integers.
Syntax
// // Strong typing definition // int64_t SetNameOfPropertyWEx( OwlModel model, RdfProperty rdfProperty, const wchar_t * name ); static inline int64_t SetNameOfPropertyWEx( OwlModel model, RdfProperty rdfProperty, wchar_t * name ) { return SetNameOfPropertyWEx( model, rdfProperty, (const wchar_t*) name ); } // // Weak typing definition // int64_t __declspec(dllexport) __stdcall SetNameOfPropertyWEx( int64_t model, int64_t rdfProperty, const wchar_t * name ); static inline int64_t SetNameOfPropertyWEx( int64_t model, int64_t rdfProperty, wchar_t * name ) { return SetNameOfPropertyWEx( model, rdfProperty, (const wchar_t*) name ); }
Property model
Size: 64 bit / 8 byte (value)Property rdfProperty
Size: 64 bit / 8 byte (value)Property name
Size: 64 bit / 8 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call SetNameOfPropertyWEx can be used.
#include "./include/engine.h" #include <cmath> int64_t model = CreateModel(); if (model) { // // The following setting makes sure all properties 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. // int64_t propertyCnt = 0; OrderedHandles(model, nullptr, &propertyCnt, nullptr, 2, 2); // // Classes // int64_t classCollection = GetClassByNameW(model, L"Collection"), classCube = GetClassByNameW(model, L"Cube"); // // Object Properties (relations) // int64_t propertyAbcd = CreatePropertyW(model, OBJECTPROPERTY_TYPE, L"abcd"), propertyObjects = GetPropertyByNameW(model, L"objects"); assert(propertyAbcd == propertyCnt + 1); assert(propertyObjects > 0 && propertyObjects <= propertyCnt); // // Datatype Properties (attributes) // int64_t propertyLength = GetPropertyByNameW(model, L"length"), propertyEfgh = CreatePropertyW(model, DATATYPEPROPERTY_TYPE_DOUBLE, L"efgh"); assert(propertyLength > 0 && propertyLength <= propertyCnt); assert(propertyEfgh == propertyCnt + 2); // // Instances (creating) // int64_t instanceCollection = CreateInstance(classCollection, nullptr), instanceCube = CreateInstance(classCube, nullptr); double length = 2., efgh = 1.7; SetDatatypeProperty(instanceCube, propertyLength, &length, 1); SetDatatypeProperty(instanceCollection, propertyEfgh, &efgh, 1); assert(GetVolume(instanceCollection, 0, 0) == 0.); wchar_t * propertyNameI = nullptr; GetNameOfPropertyWEx(model, propertyAbcd, &propertyNameI); wchar_t * propertyNameII = nullptr; GetNameOfPropertyWEx(model, propertyEfgh, &propertyNameII); SetNameOfPropertyWEx(model, propertyAbcd, L"InverseRelationControledByThirdParty"); SetObjectProperty(instanceCube, propertyAbcd, &instanceCollection, 1); SetObjectProperty(instanceCollection, propertyObjects, &instanceCube, 1); assert(GetVolume(instanceCollection, 0, 0) == 8.); wchar_t * propertyNameIII = nullptr; GetNameOfPropertyWEx(model, propertyAbcd, &propertyNameIII); // // The retrieved property names have the following values // propertyNameI : 'abcd' // propertyNameII : 'efgh' // propertyNameIII : 'InverseRelationControledByThirdParty' // // // The resulting model can be viewed in 3D-Editor.exe // SaveModelW(model, L"c:\\created\\myFile.bin"); CloseModel(model); }