Comments (4)
Could you post a little more sample code and which assets you use? Need a full reproduction case to test and fix on our end.
from torque2d.
The issue is here in ParticlePlayer.cc:
void ParticlePlayer::stop( const bool waitForParticles, const bool killEffect )
{
// Finish if we're not playing and there's no kill command.
if ( !mPlaying && !killEffect )
return;
// Fetch emitter count.
const U32 emitterCount = mEmitters.size();
// Are we waiting for particles to end?
if ( waitForParticles )
{
// Yes, so pause all the emitters.
for ( U32 emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex )
{
// Fetch the emitter.
mEmitters[emitterIndex]->setPaused( true );
}
// Set waiting for particles.
mWaitingForParticles = true;
// Flag as waiting for deletion if killing effect.
if ( killEffect )
mWaitingForDelete = true;
return;
}
// No, so free all particles.
for ( U32 emitterIndex = 0; emitterIndex < emitterCount; ++emitterIndex )
{
mEmitters[emitterIndex]->freeAllParticles();
}
// Reset the age.
mAge = 0.0f;
// Flag as stopped and not waiting.
mPlaying = mWaitingForParticles = mWaitingForDelete = false;
// Turn off paused.
mPaused = false;
// Set safe deletion.
setSafeDelete(true);
// Perform the callback.
if( isMethod( "onStopParticlePlayer" ) )
Con::executef( this, 1, "onStopParticlePlayer" );
// Flag for immediate deletion if killing.
if ( killEffect )
safeDelete();
}
The waitForParticles bool needs to be handled differently, when it is true the return is skipping half the function. If this was TorqueScript I would have provided a solution, but I am not yet comfortable tinkering with C++ source.
from torque2d.
Sorry, forgot to include a sample test case. Here is a really quick toy. You can use the reset button in the sandbox to start and stop the player.
function TestToy::create( %this )
{
// Load the particle.
TestToy.Player = new ParticlePlayer();
TestToy.Player.Particle = "ToyAssets:bonfire";
// Add the player to the scene.
SandboxScene.add(TestToy.Player);
}
//-----------------------------------------------------------------------------
function TestToy::destroy( %this )
{
}
//-----------------------------------------------------------------------------
function TestToy::reset( %this )
{
// Toggle the player play/stop state.
echo(TestToy.Player.getIsPlaying());
if (TestToy.Player.getIsPlaying())
{
TestToy.Player.stop(true, true);
echo("stopped");
}else
{
TestToy.Player.play();
echo("playing");
}
}
With full metrics on, you can see the player is stopped but not deleted. Plus it will not play again.
from torque2d.
Fixed in #84
The problem was relatively simple.
ParticlePlayer.stop(), when called with the 'WaitforParticles' argument set to true, paused each emitter.
This was fixed by unpausing all Emitters when ParticlePlayer.play() is called.
As for the ParticlePlayer's stop issue which was happening when both 'WaitforParticles' and 'KillEffect' were set to true, the problem was that if a ParticleEmitter's lifemode was set to INFINITE (the default), it never got to the part of code which handled the deletion of the emitter.
from torque2d.
Related Issues (20)
- Finger touch in android not work correct when gui in other gui container HOT 2
- High frame rate consume battery life on mobile device
- Skeletal Animation HOT 7
- Tooltip timer does not reset between GUI controls HOT 3
- Pickpoint Results Become Innaccurate If Resize Fails HOT 4
- TextSprite does not support escape characters
- After merge IPv6, naming lookup not run in multi-threads. HOT 1
- Cannot compile the code in Ubuntu 16.04 - AudioDescription::AudioDescription() HOT 4
- wiki pics issue
- Normals of collision shapes appear to be inverse when created after player object added to scene HOT 12
- Compiling Dev branch on Android HOT 8
- Static fields not validated correctly HOT 8
- ConsoleObject::addField ignores element count HOT 1
- No good array support HOT 2
- Objects sometimes appearing multiple times and/or not being removed from GatherContacts HOT 4
- OSX Build crashes immediately HOT 2
- cling based C++ as scripting language / hot code reload
- Black screen on Win 10 1903 HOT 5
- Compile gtest-all.cc failed to build on Windows with MSVC "error C2888: 'std::tuple_size<std::tr1::tuple<void,void,void,void,void,void,void,void,void,void>>': symbol cannot be defined within namespace 'tr1'" HOT 2
- Build fails with Ubuntu / gcc 9.3.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torque2d.