Add option to disable particles preview in scene view and play only looping effects

#1767
This commit is contained in:
Wojtek Figat
2024-06-11 11:37:49 +02:00
parent 4dabf4bf01
commit 5b71591998
5 changed files with 17 additions and 1 deletions

View File

@@ -1364,6 +1364,7 @@ namespace FlaxEditor
public byte AutoReloadScriptsOnMainWindowFocus;
public byte ForceScriptCompilationOnStartup;
public byte UseAssetImportPathRelative;
public byte EnableParticlesPreview;
public byte AutoRebuildCSG;
public float AutoRebuildCSGTimeoutMs;
public byte AutoRebuildNavMesh;

View File

@@ -27,6 +27,7 @@ API_CLASS(Namespace="FlaxEditor", Name="Editor", NoSpawn, NoConstructor) class M
byte AutoReloadScriptsOnMainWindowFocus = 1;
byte ForceScriptCompilationOnStartup = 1;
byte UseAssetImportPathRelative = 1;
byte EnableParticlesPreview = 1;
byte AutoRebuildCSG = 1;
float AutoRebuildCSGTimeoutMs = 50;
byte AutoRebuildNavMesh = 1;

View File

@@ -192,6 +192,7 @@ namespace FlaxEditor.Options
internalOptions.AutoReloadScriptsOnMainWindowFocus = (byte)(Options.General.AutoReloadScriptsOnMainWindowFocus ? 1 : 0);
internalOptions.ForceScriptCompilationOnStartup = (byte)(Options.General.ForceScriptCompilationOnStartup ? 1 : 0);
internalOptions.UseAssetImportPathRelative = (byte)(Options.General.UseAssetImportPathRelative ? 1 : 0);
internalOptions.EnableParticlesPreview = (byte)(Options.Visual.EnableParticlesPreview ? 1 : 0);
internalOptions.AutoRebuildCSG = (byte)(Options.General.AutoRebuildCSG ? 1 : 0);
internalOptions.AutoRebuildCSGTimeoutMs = Options.General.AutoRebuildCSGTimeoutMs;
internalOptions.AutoRebuildNavMesh = (byte)(Options.General.AutoRebuildNavMesh ? 1 : 0);

View File

@@ -59,5 +59,12 @@ namespace FlaxEditor.Options
[DefaultValue(true)]
[EditorDisplay("Quality", "Enable MSAA For Debug Draw"), EditorOrder(500), Tooltip("Determines whether enable MSAA for DebugDraw primitives rendering. Helps with pixel aliasing but reduces performance.")]
public bool EnableMSAAForDebugDraw { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether show looping particle effects in Editor viewport to simulate in-game look.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Preview"), EditorOrder(1000)]
public bool EnableParticlesPreview { get; set; } = true;
}
}

View File

@@ -446,15 +446,21 @@ void ParticleEffect::Update()
#if USE_EDITOR
#include "Editor/Editor.h"
#include "Editor/Managed/ManagedEditor.h"
void ParticleEffect::UpdateExecuteInEditor()
{
// Auto-play in Editor
if (!Editor::IsPlayMode && !_isStopped)
if (!Editor::IsPlayMode && !_isStopped && IsLooping && PlayOnStart && Editor::Managed->ManagedEditorOptions.EnableParticlesPreview)
{
_isPlaying = true;
Update();
}
else if (!Editor::IsPlayMode && _isPlaying)
{
_isPlaying = false;
ResetSimulation();
}
}
#endif