mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
new method from JeffH and Marauder: getClassHierarchy(classname). dumps a list of the class inhericance in reverse ancestor order (so that class first, next parent, *it's* parent, ect
This commit is contained in:
parent
3e131f5b8e
commit
313466f57c
|
|
@ -3185,6 +3185,31 @@ DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),,
|
|||
return "";
|
||||
}
|
||||
|
||||
DefineEngineFunction(getClassHierarchy, const char*, (const char* name), ,
|
||||
"Returns the inheritance hierarchy for a given class.")
|
||||
{
|
||||
AbstractClassRep* pRep = AbstractClassRep::findClassRep(name);
|
||||
if (!pRep)
|
||||
{
|
||||
//Con::errorf("%s does not exist", name);
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
StringBuilder buffer;
|
||||
|
||||
while (pRep != NULL)
|
||||
{
|
||||
StringTableEntry className = pRep->getClassName();
|
||||
buffer.append(className);
|
||||
buffer.append(" ");
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
|
||||
String result = buffer.end().trim();
|
||||
//Con::printf("getClassHierarchy for %s=%s", name, result.c_str());
|
||||
return Con::getReturnBuffer(result.c_str());
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
|
|
|
|||
Loading…
Reference in a new issue