diff --git a/Source/Editor/Content/Proxy/CubeTextureProxy.cs b/Source/Editor/Content/Proxy/CubeTextureProxy.cs
index ce9a9e4ce..38d603086 100644
--- a/Source/Editor/Content/Proxy/CubeTextureProxy.cs
+++ b/Source/Editor/Content/Proxy/CubeTextureProxy.cs
@@ -47,6 +47,7 @@ namespace FlaxEditor.Content
_preview = new CubeTexturePreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs
index 2a4423e55..d2d3c023b 100644
--- a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs
+++ b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs
@@ -54,6 +54,7 @@ namespace FlaxEditor.Content
_preview = new MaterialPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/MaterialProxy.cs b/Source/Editor/Content/Proxy/MaterialProxy.cs
index dd1befb0a..0f86160c9 100644
--- a/Source/Editor/Content/Proxy/MaterialProxy.cs
+++ b/Source/Editor/Content/Proxy/MaterialProxy.cs
@@ -100,6 +100,7 @@ namespace FlaxEditor.Content
_preview = new MaterialPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/ModelProxy.cs b/Source/Editor/Content/Proxy/ModelProxy.cs
index 00caa1f07..a28a022a8 100644
--- a/Source/Editor/Content/Proxy/ModelProxy.cs
+++ b/Source/Editor/Content/Proxy/ModelProxy.cs
@@ -61,6 +61,7 @@ namespace FlaxEditor.Content
_preview = new ModelPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs
index f714b3af0..8dfa08f5b 100644
--- a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs
+++ b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs
@@ -55,6 +55,7 @@ namespace FlaxEditor.Content
_preview = new ParticleEmitterPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs
index 4e9b3edbe..f3b2eb67a 100644
--- a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs
+++ b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs
@@ -55,6 +55,7 @@ namespace FlaxEditor.Content
_preview = new ParticleEmitterPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/PrefabProxy.cs b/Source/Editor/Content/Proxy/PrefabProxy.cs
index 0c4c2de6b..d597919ff 100644
--- a/Source/Editor/Content/Proxy/PrefabProxy.cs
+++ b/Source/Editor/Content/Proxy/PrefabProxy.cs
@@ -97,6 +97,7 @@ namespace FlaxEditor.Content
_preview = new PrefabPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs
index f56f0e3a7..08aabb9d3 100644
--- a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs
+++ b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs
@@ -47,6 +47,7 @@ namespace FlaxEditor.Content
_preview = new AnimatedModelPreview(false)
{
RenderOnlyWithWindow = false,
+ UseAutomaticTaskManagement = false,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
};
diff --git a/Source/Editor/Viewport/Previews/MaterialPreview.cs b/Source/Editor/Viewport/Previews/MaterialPreview.cs
index c120531e8..0afe059e8 100644
--- a/Source/Editor/Viewport/Previews/MaterialPreview.cs
+++ b/Source/Editor/Viewport/Previews/MaterialPreview.cs
@@ -306,6 +306,7 @@ namespace FlaxEditor.Viewport.Previews
}
if (_splineModel != null)
{
+ _particleEffect.IsActive = deformableMaterial != null;
_splineModel.Model = _previewModel.Model;
_splineModel.SetMaterial(0, deformableMaterial);
}
diff --git a/Source/Engine/Graphics/RenderTask.cpp b/Source/Engine/Graphics/RenderTask.cpp
index 45375a579..b4da776d7 100644
--- a/Source/Engine/Graphics/RenderTask.cpp
+++ b/Source/Engine/Graphics/RenderTask.cpp
@@ -227,6 +227,21 @@ void SceneRenderTask::CameraCut()
IsCameraCut = true;
}
+void SceneRenderTask::AddCustomActor(Actor* actor)
+{
+ CustomActors.Add(actor);
+}
+
+void SceneRenderTask::RemoveCustomActor(Actor* actor)
+{
+ CustomActors.Remove(actor);
+}
+
+void SceneRenderTask::ClearCustomActors()
+{
+ CustomActors.Clear();
+}
+
void SceneRenderTask::CollectPostFxVolumes(RenderContext& renderContext)
{
if ((ActorsSource & ActorsSources::Scenes) != 0)
diff --git a/Source/Engine/Graphics/RenderTask.h b/Source/Engine/Graphics/RenderTask.h
index 3f4a9f58c..5d6a47861 100644
--- a/Source/Engine/Graphics/RenderTask.h
+++ b/Source/Engine/Graphics/RenderTask.h
@@ -272,19 +272,18 @@ public:
/// Adds the custom actor to the rendering.
///
/// The actor.
- API_FUNCTION() void AddCustomActor(Actor* actor)
- {
- CustomActors.Add(actor);
- }
+ API_FUNCTION() void AddCustomActor(Actor* actor);
///
/// Removes the custom actor from the rendering.
///
/// The actor.
- API_FUNCTION() void RemoveCustomActor(Actor* actor)
- {
- CustomActors.Remove(actor);
- }
+ API_FUNCTION() void RemoveCustomActor(Actor* actor);
+
+ ///
+ /// Removes all the custom actors from the rendering.
+ ///
+ API_FUNCTION() void ClearCustomActors();
///
/// The custom post fx to render (managed).
diff --git a/Source/Engine/UI/GUI/RenderOutputControl.cs b/Source/Engine/UI/GUI/RenderOutputControl.cs
index be0c300fe..b840e0be8 100644
--- a/Source/Engine/UI/GUI/RenderOutputControl.cs
+++ b/Source/Engine/UI/GUI/RenderOutputControl.cs
@@ -42,10 +42,15 @@ namespace FlaxEngine.GUI
public SceneRenderTask Task => _task;
///
- /// Gets a value indicating whether render to that output only if parent window exists, otherwise false.
+ /// Gets or sets a value indicating whether render to that output only if parent window exists, otherwise false.
///
public bool RenderOnlyWithWindow { get; set; } = true;
+ ///
+ /// Gets or sets a value indicating whether use automatic task rendering skipping if output is too small or window is missing. Disable it to manually control .
+ ///
+ public bool UseAutomaticTaskManagement { get; set; } = true;
+
///
/// Gets a value indicating whether keep aspect ratio of the backbuffer image, otherwise false.
///
@@ -153,7 +158,7 @@ namespace FlaxEngine.GUI
private void OnUpdate()
{
- if (_task == null)
+ if (_task == null || !UseAutomaticTaskManagement)
return;
var deltaTime = Time.UnscaledDeltaTime;
@@ -168,7 +173,7 @@ namespace FlaxEngine.GUI
// Check if skip rendering
var wasEnabled = _task.Enabled;
_task.Enabled = !CanSkipRendering();
- if (wasEnabled != _task.Enabled)
+ if (!wasEnabled && _task.Enabled)
{
SyncBackbufferSize();
}
@@ -263,6 +268,7 @@ namespace FlaxEngine.GUI
if (_task != null)
{
_task.Enabled = false;
+ _task.ClearCustomActors();
//_task.CustomPostFx.Clear();
}
Object.Destroy(ref _backBuffer);