Add play/pause widget and keybind for particles preview in asset Editor

This commit is contained in:
Wojtek Figat
2023-02-02 13:05:54 +01:00
parent baabc5d16f
commit 36ba1d9953
3 changed files with 62 additions and 8 deletions

View File

@@ -258,7 +258,7 @@ void ParticleEffect::ResetSimulation()
Instance.ClearState();
}
void ParticleEffect::UpdateSimulation()
void ParticleEffect::UpdateSimulation(bool singleFrame)
{
// Skip if need to
if (!IsActiveInHierarchy()
@@ -270,6 +270,8 @@ void ParticleEffect::UpdateSimulation()
// Request update
_lastUpdateFrame = Engine::FrameCount;
_lastMinDstSqr = MAX_Real;
if (singleFrame)
Instance.LastUpdateTime = (UseTimeScale ? Time::Update.Time : Time::Update.UnscaledTime).GetTotalSeconds();
Particles::UpdateEffect(this);
}

View File

@@ -334,7 +334,8 @@ public:
/// <summary>
/// Performs the full particles simulation update (postponed for the next particle manager update).
/// </summary>
API_FUNCTION() void UpdateSimulation();
/// <param name="singleFrame">True if update animation by a single frame only (time time since last engine update), otherwise will update simulation with delta time since last update.</param>
API_FUNCTION() void UpdateSimulation(bool singleFrame = false);
/// <summary>
/// Updates the actor bounds.