Add support for updating particle effects in editor view when editing

This commit is contained in:
Wojtek Figat
2021-02-19 11:01:21 +01:00
parent c25abfda65
commit c86508ef57
5 changed files with 61 additions and 18 deletions

View File

@@ -17,6 +17,9 @@
#include "Engine/Profiler/ProfilerGPU.h"
#include "Engine/Renderer/Utils/BitonicSort.h"
#endif
#if USE_EDITOR
#include "Editor/Editor.h"
#endif
struct SpriteParticleVertex
{
@@ -1155,6 +1158,13 @@ void ParticleManagerService::Update()
// Simulation delta time can be based on a time since last update or the current delta time
float dt = effect->UseTimeScale ? deltaTime : deltaTimeUnscaled;
float t = effect->UseTimeScale ? time : timeUnscaled;
#if USE_EDITOR
if (!Editor::IsPlayMode)
{
dt = deltaTimeUnscaled;
t = timeUnscaled;
}
#endif
const float lastUpdateTime = instance.LastUpdateTime;
if (lastUpdateTime > 0 && t > lastUpdateTime)
{