Script help on Particle Editor?
by Eric Forhan · in Technical Issues · 02/12/2003 (10:05 pm) · 2 replies
If someone could help on this, I'd be very happy--and it would help out those others that have said they've had problems with it.
There's a bug in the Particle Editor that won't allow custom particles to be easily placed within the game level at the touch of a button. I'm pretty sure it's because the editor isn't preloading the saved particle datablocks. A given is that one would have to create the new particle, save it, and restart the game. From there it should load it and be easier to put directly in the level.
$PE::SaveFilePath = "fps/ParticleEditor/Saves/"; is where the datablock is saved as a .cs file ( ie: fooParticleEmitter.cs ). If I could just get it to load everything in that /Saves/ directory I believe it would do the trick.
The problem area is under "//executes all custom datablocks". I just don't have the programming knowledge to get this one.
There's a bug in the Particle Editor that won't allow custom particles to be easily placed within the game level at the touch of a button. I'm pretty sure it's because the editor isn't preloading the saved particle datablocks. A given is that one would have to create the new particle, save it, and restart the game. From there it should load it and be easier to put directly in the level.
$PE::SaveFilePath = "fps/ParticleEditor/Saves/"; is where the datablock is saved as a .cs file ( ie: fooParticleEmitter.cs ). If I could just get it to load everything in that /Saves/ directory I believe it would do the trick.
The problem area is under "//executes all custom datablocks". I just don't have the programming knowledge to get this one.
//------------Path Settings--------------------------------------
// I hope to eliminate the need for these soon
// Path to exported particle datablocks
$PE::SaveFilePath = "fps/ParticleEditor/Saves/";
//This loads the editor into Torque on startup so that it will work
package particleEditorSetup {
//This function adds the Particle Editor to the Controls option screen so it can be easily rebound
function OptionsDlg::onWake( %this ) {
if($YourKeyRemap !$= "true") {
$RemapName[$RemapCount]="Toggle Particle Editor";
$RemapCmd[$RemapCount]="toggleParticleEditor";
$RemapCount++;
$YourKeyRemap = "true";
}
parent::onWake(%this);
}
//executes all custom datablocks
function DefaultGame::activatePackages(%game)
{
%fileSpec = $PE::SaveFilePath @ "*.cs";
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
{
exec( %file );
echo( %file SPC "Custom Particle Information Was Loaded." );
}
Parent::activatePackages( %game );
}
};
activatepackage( particleEditorSetup );
//This launches all of the above.About the author
#2
Check out the particle editor resource for more info. :-)
-Eric
02/04/2004 (10:15 am)
Labrat has updated the particle editor, and it's now much easier to install.Check out the particle editor resource for more info. :-)
-Eric
Torque Owner Charles Savage
function DefaultGame::activatePackages(%game) { %fileSpec = $PE::SaveFilePath @ "*.cs"; for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) ) { exec( %file ); echo( %file SPC "Custom Particle Information Was Loaded." ); } Parent::activatePackages( %game ); }I'm just curious why this is in a function that may [or may not be called].
Why not just strip the code out of the function and put it by itself, even outside the package. You don't need code inside a function to run it.
Or you could rename it
function PELoadParticles() { %fileSpec = $PE::SaveFilePath @ "*.cs"; for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) ) { exec( %file ); echo( %file SPC "Custom Particle Information Was Loaded." ); } } PELoadParticles();That way you could call PELoadParticles again from someplace in your code, to reload them. (not sure what the effect of loading/compiling and exec()'ing .cs files multiple times has.)