T2dSceneObjectDatablock edit: (not a bug)
by Alex Rice · in Torque Game Builder · 10/06/2006 (1:51 am) · 3 replies
The TGB reference says that among the allowed fields for a t2dSceneDatablock are class and superclass
However calling setConfigDatablock() does not link the class and superclass namespace member functions to be used by the object.
example %tNewEgg will not respond to member functions that are defined in namespaces MyClass and MyOtherClass!
the workaround is to specify the class and superclass in the t2dSceneObject's constructor instead of the config datablock:
The docs leads me to think it should have worked because class and superclass are listed on p.178 and 179 of TGB Reference.pdf.
However calling setConfigDatablock() does not link the class and superclass namespace member functions to be used by the object.
example %tNewEgg will not respond to member functions that are defined in namespaces MyClass and MyOtherClass!
datablock t2dSceneObjectDatablock(My_ConfigDB)
{
superclass = "MyClass";
class = "MyOtherClass";
// etc... other fields
};
%tNewEgg = new t2dAnimatedSprite()
{
sceneGraph = SCENEGRAPH;
animationName = ANIM:
};
%tNewEgg.setConfigDatablock( My_ConfigDB );the workaround is to specify the class and superclass in the t2dSceneObject's constructor instead of the config datablock:
%tNewEgg = new t2dAnimatedSprite()
{
superclass = "MyClass";
class = "MyOtherClass";
sceneGraph = SCENE;
animationName = ANIM;
};
%tNewEgg.setConfigDatablock( MLEggsSolidEgg_ConfigDB );The docs leads me to think it should have worked because class and superclass are listed on p.178 and 179 of TGB Reference.pdf.
About the author
#2
10/06/2006 (8:23 am)
Ben is correct--namespace linking is done on object creation (specifically, the t2dSceneObject::onAdd() c++ method, which is a chained call from the new operation), and cannot be changed afterwards.
#3
10/06/2006 (10:36 am)
Thanks Ben and Stephen, I didnt realize you could set the config datalock in the new() like that.
Torque Owner Ben R Vesco
datablock t2dSceneObjectDatablock(My_ConfigDB) { superclass = "MyClass"; class = "MyOtherClass"; // etc... other fields }; %tNewEgg = new t2dAnimatedSprite() { config = "My_ConfigDB"; sceneGraph = SCENEGRAPH; animationName = ANIM: };