Display "Inheritance" from console?
by Jake Callery · in Torque Game Engine · 02/09/2008 (10:56 am) · 10 replies
Hey guys,
I vaguely remember that I could print to the console window through script where a particular
definition was being used. For instance:
Object (1539) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
So here this means that the player is part of shapeBase which is part of GameBase, etc...
Is there a good way to dump that info about a particular object in the world?
Thanks!
Jake
**Edited for Spelling**
I vaguely remember that I could print to the console window through script where a particular
definition was being used. For instance:
Object (1539) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
So here this means that the player is part of shapeBase which is part of GameBase, etc...
Is there a good way to dump that info about a particular object in the world?
Thanks!
Jake
**Edited for Spelling**
#2
and you'd get something like:
02/09/2008 (11:18 am)
In case it's not clear from the resource, in your case you would do 1539.dumpMethods(),and you'd get something like:
==>$player.dumpMethods(); 8942-Player--c-orion 33 Methods from SimObject: addToAVPlayerNameList () allowInstanceMethods () etc.. etc.. 10 Methods from NetObject: clearScopeToClient () getGhostID () etc.. 33 Methods from SceneObject: getDCObject () getForwardVector () etc.. 2 Methods from GameBase: getDataBlock () setDataBlock () 99 Methods from ShapeBase: AddInfectPoints () applyDamage () etc.. 235 Methods from Player: activeSkusCallback () addBuddy () etc..
#3
I am currently just looking for the inheritance w/o the methods, but this is sweet!
I'm sure I can manage modifying your resource to do just inheritance.
However if you have the time and motivation I'm not going to tell you to not add it :)
Thanks again!
Jake
02/09/2008 (11:39 am)
Oh excellent! Thanks very much!I am currently just looking for the inheritance w/o the methods, but this is sweet!
I'm sure I can manage modifying your resource to do just inheritance.
However if you have the time and motivation I'm not going to tell you to not add it :)
Thanks again!
Jake
#4
found the stock method you were originally thinking of:
02/09/2008 (12:03 pm)
Jake -found the stock method you were originally thinking of:
%simObject.getNamespaceList()
#5
it looks like that's not stock. :D
here's the code for it; i put it in simBase.cc, near the console method dump():
02/09/2008 (12:05 pm)
.. woops,it looks like that's not stock. :D
here's the code for it; i put it in simBase.cc, near the console method dump():
ConsoleMethod(SimObject, getNamespaceList, const char*, 2, 2, "obj.getNamespaceList()")
{
Namespace *ns = object->getNamespace();
if (!ns)
return "";
return getNamespaceList(ns);
}
#7
%obj.dumpClassHierarchy()
That seems to do exactly what I remembered:
==>1456.dumpClassHierarchy();
StaticShape ->
ShapeBase ->
GameBase ->
SceneObject ->
NetObject ->
SimObject ->
Thanks again for looking into this so much!
Jake
02/09/2008 (12:17 pm)
Well, after doing some more digging with what you have sent, it looks like there is more to getNameSpaceList than what you stated above. However I did find%obj.dumpClassHierarchy()
That seems to do exactly what I remembered:
==>1456.dumpClassHierarchy();
StaticShape ->
ShapeBase ->
GameBase ->
SceneObject ->
NetObject ->
SimObject ->
Thanks again for looking into this so much!
Jake
#8
will display the list of all parent classes.
Stock simobject method.
But Orion's function is a good alternative :)
edit: hehe :) a bit late, but anyway :)
02/09/2008 (12:18 pm)
%obj.dumpClassHierarchy();will display the list of all parent classes.
Stock simobject method.
But Orion's function is a good alternative :)
edit: hehe :) a bit late, but anyway :)
#9
but it sounds like you got what you need!
glad to have helped a bit.
02/09/2008 (12:22 pm)
Heh, sorry jake - it's difficult some times for me to post stuff from our codebase, as it's drifted fairly far from stock,but it sounds like you got what you need!
glad to have helped a bit.
#10
@Bank - Thanks much for the reply! Its crazy how much of a difference 1 minute makes :)
02/09/2008 (12:33 pm)
@Orion - not a problem at all I totally understand :) Thanks for the help!@Bank - Thanks much for the reply! Its crazy how much of a difference 1 minute makes :)
Associate Orion Elenzil
Real Life Plus
v. strange that you should ask this question,
as i just yesterday submitted a resource which does exactly that.
actually it does more than that,
it dumps the inheritance and the methods from each inherited class.
here is the pending-approval resource.
if you would like a function to just dump the inheritance w/o the methods,
that would be easy to write. let me know and i'll add it.