BETA 1.1 Datablock not transfered
by Michael Woerister · in Torque Game Builder · 02/04/2006 (12:45 pm) · 2 replies
I have a t2dAnimatedSpriteDatablock and a t2dAnimatedSprite but the size-field does not get transfered. Firing up the debugger brings that everytime the t2dBaseDatablock::isSpecified() methods runs, it exits at
the datablock is created like this:
Ok, i have now followed the whole startup process. The mSize field in the datablock has the correct value. There seems to be a bug in the t2dBaseDatablock::onStaticModified() method or I am doing something terribly wrong..
Ok, now I see. This line
I'll play a round on my SNES now. Maybe that helps. :)
-Michael
if( mSpecifiedFields.empty() )
the datablock is created like this:
datablock t2dAnimatedSpriteDatablock( xyz )
{
size = "16 16";
startAnimation = animXYZ;
};Ok, i have now followed the whole startup process. The mSize field in the datablock has the correct value. There seems to be a bug in the t2dBaseDatablock::onStaticModified() method or I am doing something terribly wrong..
Ok, now I see. This line
if( obj && obj->mConfigDataBlock == this )says a field can only be marked as specified if it is already set as a config datablock. Why?? Isn't this a condition that is pretty impossible to satisfy?
I'll play a round on my SNES now. Maybe that helps. :)
-Michael
Torque Owner Adam Larson
Two problems actually. You pretty much solved one of them. t2dBaseDatablock::onStaticModified should be changed to look like this:
if (!isSpecified(slotName)) mSpecifiedFields.push_back(StringTable->insert(slotName)); SimSet* set = static_cast<SimSet*>(Sim::getRootGroup()); SimSet::iterator i; for( i = set->begin(); i != set->end(); i++ ) { t2dSceneObject *obj = dynamic_cast<t2dSceneObject*>(*i); if( obj && obj->mConfigDataBlock == this ) { // Update Object Datablock obj->onDataBlockUpdate(); } }And, in t2dBaseDatablock::onAdd(), these two lines:
mSpecifiedFields.clear(); mSpecifiedFields.reserve( 16 );need to be removed. onAdd gets called after all the calls to onStaticModified and thus clears the list of specified fields.