Can't see particle effects in behaviours
by Piotr Witkowski · in Torque Game Builder · 08/04/2010 (7:53 pm) · 4 replies
I created a couple of particle effects (which are visible the Create tab under Particle Effects section)
I also have "Collision particles" effect, which has single field implemented as follows:
%template.addBehaviorField(particleEffect, "The effect to use", object, "", t2dParticleEffect);
When I add "Collision particles" behaviour to a scene objects, all I see in the "particleEffect" dropdown list is "None".
Am I missing something?
I also have "Collision particles" effect, which has single field implemented as follows:
%template.addBehaviorField(particleEffect, "The effect to use", object, "", t2dParticleEffect);
When I add "Collision particles" behaviour to a scene objects, all I see in the "particleEffect" dropdown list is "None".
Am I missing something?
#2
Substituting "object" with "t2dParticleEffect" does not help. I debugged the addBehaviorField console method, and the list of arguments I am providing seems to be OK. The engine is not getting the list of particle effects tho.
The same syntax is provided in the torque\games\BehaviorPlayground\game\behavior\effects\collisionParticles.cs example.
08/04/2010 (8:58 pm)
Thanks for the swift reply.Substituting "object" with "t2dParticleEffect" does not help. I debugged the addBehaviorField console method, and the list of arguments I am providing seems to be OK. The engine is not getting the list of particle effects tho.
The same syntax is provided in the torque\games\BehaviorPlayground\game\behavior\effects\collisionParticles.cs example.
#3
Your attempt above was correct (mine was wrong). The code that fills in the pulldown list looks in two places: the currently loaded scene and the managed datablock set (found in game/managed/datablocks.cs). Since there are no t2dParticleEffects in your current scene and since particle effects are just files (and not datablocks), your list is empty. Ick!
There isn't an obvious solution. Particle effects are really just files. You could modify BehaviorFieldStack::createObjectGui in tgb/tools/behaviorEditor/Scripts/fieldTypes.ed.cs to provide a list of files (must like the editor already does in LBOParticleEffect::refresh in tgb/tools/levelEditor/scripts/forms/objectLibrary/particleEffects.ed.cs to create the particle effect buttons). But then you have to decide if you want the behavior to create t2dParticleEffect or to just provide a file name for the effect.
Think of it this way: it's one thing to give a behavior a t2dImageMapDatablock, it's a whole different thing to give it a t2dStaticSprite. Where do you place it? Where is it created? Is it visible? And so on.
Let me know if you have any questions about all of this. Later!
08/04/2010 (9:58 pm)
I've got an unsatisfactory answer, unfortunately.Your attempt above was correct (mine was wrong). The code that fills in the pulldown list looks in two places: the currently loaded scene and the managed datablock set (found in game/managed/datablocks.cs). Since there are no t2dParticleEffects in your current scene and since particle effects are just files (and not datablocks), your list is empty. Ick!
There isn't an obvious solution. Particle effects are really just files. You could modify BehaviorFieldStack::createObjectGui in tgb/tools/behaviorEditor/Scripts/fieldTypes.ed.cs to provide a list of files (must like the editor already does in LBOParticleEffect::refresh in tgb/tools/levelEditor/scripts/forms/objectLibrary/particleEffects.ed.cs to create the particle effect buttons). But then you have to decide if you want the behavior to create t2dParticleEffect or to just provide a file name for the effect.
Think of it this way: it's one thing to give a behavior a t2dImageMapDatablock, it's a whole different thing to give it a t2dStaticSprite. Where do you place it? Where is it created? Is it visible? And so on.
Let me know if you have any questions about all of this. Later!
#4
Thanks for the feedback. It helped! I already have this particle effect loaded into my level, but I was incorrectly assuming that it would use the particle effect's name as seen at the 'Create' tab (which I guess is just a file name).
Adding name to the Scripting section in Edit tab results in the drop-down list being populated.
Thanks!
08/06/2010 (7:52 pm)
Hi William,Thanks for the feedback. It helped! I already have this particle effect loaded into my level, but I was incorrectly assuming that it would use the particle effect's name as seen at the 'Create' tab (which I guess is just a file name).
Adding name to the Scripting section in Edit tab results in the drop-down list being populated.
Thanks!
Associate William Lee Sims
Machine Code Games