Custom class emitter wont delete
by Lukas Joergensen · in Torque 3D Professional · 05/30/2012 (3:38 am) · 3 replies
I have a problem with a custom class emitter I have called Graphemitter.
Usually it works fine, but on my latest emitter datablocks the emitter is not deleted, and I can't delete it from the world editor because it's id is 0.
Made a video which shows the problem:
I had this problem once before, but then i fixed it in the code. At that time i had an error message to work with, this time I get nothing.
The delete function is called properly and the emitter calls onRemove aswell.
A working emitter
Bugged emitter
I have wondered if it is the Twillex resource that does it, but i can't imagine how.
Usually it works fine, but on my latest emitter datablocks the emitter is not deleted, and I can't delete it from the world editor because it's id is 0.
Made a video which shows the problem:
I had this problem once before, but then i fixed it in the code. At that time i had an error message to work with, this time I get nothing.
The delete function is called properly and the emitter calls onRemove aswell.
A working emitter
%flame = new GraphEmitterNode(){
position = %pos;
rotation = "1 0 0 0";
scale = "1 1 1 1";
dataBlock = flameSpiralSpellNode;
emitter = g_sampleEmitter;
velocity = 1;
standAloneEmitter = 1;
};
/*...*/
datablock GraphEmitterNodeData(flameSpiralNode : g_downSpiralNode){};
datablock GraphEmitterNodeData(flameSpiralSpellNode : g_downSpiralNode){ };
datablock GraphEmitterNodeData(spellWave : g_wavesNode){ Loop = false; };
function flameSpiralNode::onBoundaryLimit(%this, %node, %Max)
{
if(%Max)
%node.Reverse = true;
else
%node.Reverse = false;
}
function flameSpiralSpellNode::onBoundaryLimit(%this, %node, %Max)
{
echo("node Datablock should change now!");
if(!%Max)
{
echo("node Datablock should change now!");
%node.setDatablock(spellWave);
}
}
function spellWave::onBoundaryLimit(%this, %node, %Max)
{
if(%Max)
{
%node.delete();
}
}Bugged emitter
%newEmitter = new GraphEmitterNode(){
position = %pos;
rotation = "1 0 0 0";
scale = "1 1 1 1";
dataBlock = advSp_1;
emitter = g_burnerEmitter;
velocity = 1;
standAloneEmitter = 1;
xVar1r = 2;
yVar1r = 2;
xVar2o = 1;
yVar2o = 1;
zVar1h = 0;
};
%p1 = MyTweenEngine.to(1000, %newEmitter, "xVar1r:0, yVar1r:0, zVar1h:2.5, xVar2o:10, yVar2o:10", "ease:circ_out", %this@".stageTwo("@%newEmitter@");");
%p1.play();
/* ... */
datablock GraphEmitterNodeData(adv_splash : g_wavesNode){ Loop = false; };
function voidSphere::stageTwo(%this, %emitter)
{
%p2 = MyTweenEngine.to(500, %emitter, "zVar1h:0", "ease:circ_in", %this@".stageThree("@%emitter@");");
%p2.play();
}
function voidSphere::stageThree(%this, %emitter)
{
%emitter.setDataBlock(adv_splash);
//%p2 = MyTweenEngine.to(1000, %emitter, "zVar1h:0", "", %this@".stageThree("@%emitter@");");
//%p2.play();
}
function adv_splash::onBoundaryLimit(%this, %node, %Max)
{
if(%Max)
{
MyTweenEngine.deleteAllFor(%node);
%node.delete();
}
}I have wondered if it is the Twillex resource that does it, but i can't imagine how.
About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx
#2
Oh look at the pidgeon over there! Wush now your memory is gone and you will leave this thread..
I created 2 emitters at a time so when one was deleted the other was still there and i was like hurr durr why it not go away?
Furthermore i instantiated them with the same ID therefore i could not delete the one that was left properly.
05/30/2012 (1:21 pm)
Please don't look at me.. I am so embarrassed xD Just look the other way, forget that you have seen this thread!Oh look at the pidgeon over there! Wush now your memory is gone and you will leave this thread..
I created 2 emitters at a time so when one was deleted the other was still there and i was like hurr durr why it not go away?
Furthermore i instantiated them with the same ID therefore i could not delete the one that was left properly.
#3
05/30/2012 (11:23 pm)
I have the strangest feeling...it is like when you walk into a room and forget why you are there...
Torque Owner Lukas Joergensen
WinterLeaf Entertainment
GameBase* GB = dynamic_cast<GameBase*>(Sim::findObject(attractedObjectID[i])); if(GB){I had the gamebase stored in a variable.