GetClassParentsByIterator
If input parent is zero, the handle will point to the first relevant parent.
If all parent are past (or no relevant parent are found), the function will return 0.
Syntax
// // Strong typing definition // OwlClass GetClassParentsByIterator( OwlClass owlClass, OwlClass parentOwlClass ); // // Weak typing definition // int64_t __declspec(dllexport) __stdcall GetClassParentsByIterator( int64_t owlClass, int64_t parentOwlClass );
Property owlClass
Size: 64 bit / 8 byte (value)Property parentOwlClass
Size: 64 bit / 8 byte (value)
Example (based on pure API calls)
Here you can find code snippits that show how the API call GetClassParentsByIterator can be used.
#include "./include/engine.h" bool ClassHasClassAsParent(int64_t childClass, int64_t parentClass) { // // This function checks recursively if a child class has a parent class as parent // if (childClass == parentClass) { return true; } int64_t directParentClass = GetClassParentsByIterator(childClass, 0); while (directParentClass) { if (ClassHasClassAsParent(directParentClass, parentClass)) { return true; } directParentClass = GetClassParentsByIterator(childClass, directParentClass); } return false; } int _tmain(int argc, _TCHAR* argv[]) { int64_t model = CreateModel(); if (model) { // // Classes // int64_t classGeometricItem = GetClassByName(model, "GeometricItem"), classMaterial = GetClassByName(model, "Material"), classSurface = GetClassByName(model, "Surface"), classNURBSSurface = GetClassByName(model, "NURBSSurface"); bool NURBSSurface_is_A_Surface = ClassHasClassAsParent(classNURBSSurface, classSurface), NURBSSurface_is_A_Material = ClassHasClassAsParent(classNURBSSurface, classMaterial), Surface_is_A_GeometricItem = ClassHasClassAsParent(classSurface, classGeometricItem), NURBSSurface_is_A_GeometricItem = ClassHasClassAsParent(classNURBSSurface, classGeometricItem), Surface_is_A_NURBSSurface = ClassHasClassAsParent(classSurface, classNURBSSurface), GeometricItem_is_A_Surface = ClassHasClassAsParent(classGeometricItem, classSurface); assert(NURBSSurface_is_A_Surface == true); assert(NURBSSurface_is_A_Material == false); assert(Surface_is_A_GeometricItem == true); assert(NURBSSurface_is_A_GeometricItem == true); assert(Surface_is_A_NURBSSurface == false); assert(GeometricItem_is_A_Surface == false); int64_t myOwnClass = CreateClass(model, "MyOwnClass"); assert(ClassHasClassAsParent(myOwnClass, classNURBSSurface) == false); assert(ClassHasClassAsParent(myOwnClass, classGeometricItem) == false); SetClassParent(myOwnClass, classSurface, 1); assert(ClassHasClassAsParent(myOwnClass, classNURBSSurface) == false); assert(ClassHasClassAsParent(myOwnClass, classGeometricItem) == true); CloseModel(model); } return 0; }