SetNameOfClassW
Error return codes:
0 successful
1 argument owlClass is incorrect (not a proper handle to an active class)
2 argument name is incorrect (nullptr or zero length name)
3 the name of owlClass 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
Syntax
// // Strong typing definition // int64_t SetNameOfClassW( OwlClass owlClass, const wchar_t * name ); static inline int64_t SetNameOfClassW( OwlClass owlClass, wchar_t * name ) { return SetNameOfClassW( owlClass, (const wchar_t*) name ); } // // Weak typing definition // int64_t __declspec(dllexport) __stdcall SetNameOfClassW( int64_t owlClass, const wchar_t * name ); static inline int64_t SetNameOfClassW( int64_t owlClass, wchar_t * name ) { return SetNameOfClassW( owlClass, (const wchar_t*) name ); }
Property owlClass
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 SetNameOfClassW can be used.
#include "./include/engine.h" #include <cmath> int64_t model = CreateModel(); if (model) { // // Classes // int64_t myClass = CreateClassW(model, L"MyCreatedClass"); // // Datatype Properties (attributes) // int64_t propertyLength = GetPropertyByNameW(model, L"length"); // // Instances (creating) // int64_t myInstance = CreateInstanceW(myClass, nullptr); double length = 2.; SetDatatypeProperty(myInstance, propertyLength, &length, 1); assert(GetVolume(myInstance, 0, 0) == 0.); wchar_t * classNameI = nullptr; GetNameOfClassW(myClass, &classNameI); SetNameOfClassW(myClass, L"OtherClassName"); wchar_t * classNameII = nullptr; GetNameOfClassW(myClass, &classNameII); SetClassParent(myClass, GetClassByNameW(model, L"Cube"), 1); assert(GetVolume(myInstance, 0, 0) == 8.); SetNameOfClassW(myClass, L"OutOfIdeasForClassName"); wchar_t * classNameIII = nullptr; GetNameOfClassW(myClass, &classNameIII); // // The retrieved class names have the following values // classNameI : 'MyCreatedClass' // classNameII : 'OtherClassName' // classNameIII : 'OutOfIdeasForClassName' // // // The resulting model can be viewed in 3D-Editor.exe // SaveModelW(model, L"c:\\created\\myFile.bin"); CloseModel(model); }