diff --git a/Source/Editor/CustomEditors/CustomEditorPresenter.cs b/Source/Editor/CustomEditors/CustomEditorPresenter.cs
index 73e2ede0f..927f1d7be 100644
--- a/Source/Editor/CustomEditors/CustomEditorPresenter.cs
+++ b/Source/Editor/CustomEditors/CustomEditorPresenter.cs
@@ -37,6 +37,23 @@ namespace FlaxEditor.CustomEditors
UseDefault = 1 << 2,
}
+ ///
+ /// The interface for Editor context that owns the presenter. Can be or or other window/panel - custom editor scan use it for more specific features.
+ ///
+ public interface IPresenterOwner
+ {
+ ///
+ /// Gets the viewport linked with properties presenter (optional, null if unused).
+ ///
+ public Viewport.EditorViewport PresenterViewport { get; }
+
+ ///
+ /// Selects the scene objects.
+ ///
+ /// The nodes to select
+ public void Select(List nodes);
+ }
+
///
/// Main class for Custom Editors used to present selected objects properties and allow to modify them.
///
@@ -254,7 +271,7 @@ namespace FlaxEditor.CustomEditors
///
/// The Editor context that owns this presenter. Can be or or other window/panel - custom editor scan use it for more specific features.
///
- public object Owner;
+ public IPresenterOwner Owner;
///
/// Gets or sets the text to show when no object is selected.
@@ -278,7 +295,7 @@ namespace FlaxEditor.CustomEditors
/// The undo. It's optional.
/// The custom text to display when no object is selected. Default is No selection.
/// The owner of the presenter.
- public CustomEditorPresenter(Undo undo, string noSelectionText = null, object owner = null)
+ public CustomEditorPresenter(Undo undo, string noSelectionText = null, IPresenterOwner owner = null)
{
Undo = undo;
Owner = owner;
diff --git a/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs b/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
index 5a10b9a52..c4b334b3a 100644
--- a/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
@@ -50,7 +50,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
grid.Button("Remove bone").Button.ButtonClicked += OnRemoveBone;
}
- if (Presenter.Owner is Windows.PropertiesWindow || Presenter.Owner is Windows.Assets.PrefabWindow)
+ if (Presenter.Owner != null)
{
// Selection
var grid = editorGroup.CustomContainer();
@@ -309,10 +309,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (node != null)
selection.Add(node);
}
- if (Presenter.Owner is Windows.PropertiesWindow propertiesWindow)
- propertiesWindow.Editor.SceneEditing.Select(selection);
- else if (Presenter.Owner is Windows.Assets.PrefabWindow prefabWindow)
- prefabWindow.Select(selection);
+ Presenter.Owner.Select(selection);
}
}
}
diff --git a/Source/Editor/Windows/Assets/PrefabWindow.cs b/Source/Editor/Windows/Assets/PrefabWindow.cs
index 659bab249..755bf4b1d 100644
--- a/Source/Editor/Windows/Assets/PrefabWindow.cs
+++ b/Source/Editor/Windows/Assets/PrefabWindow.cs
@@ -19,7 +19,7 @@ namespace FlaxEditor.Windows.Assets
///
///
///
- public sealed partial class PrefabWindow : AssetEditorWindowBase
+ public sealed partial class PrefabWindow : AssetEditorWindowBase, IPresenterOwner
{
private readonly SplitPanel _split1;
private readonly SplitPanel _split2;
@@ -520,5 +520,8 @@ namespace FlaxEditor.Windows.Assets
base.OnDestroy();
}
+
+ ///
+ public EditorViewport PresenterViewport => _viewport;
}
}
diff --git a/Source/Editor/Windows/PropertiesWindow.cs b/Source/Editor/Windows/PropertiesWindow.cs
index baa10f8b9..a7e6f6fe9 100644
--- a/Source/Editor/Windows/PropertiesWindow.cs
+++ b/Source/Editor/Windows/PropertiesWindow.cs
@@ -4,6 +4,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Xml;
using FlaxEditor.CustomEditors;
+using FlaxEditor.SceneGraph;
+using FlaxEditor.Viewport;
using FlaxEngine.GUI;
namespace FlaxEditor.Windows
@@ -13,7 +15,7 @@ namespace FlaxEditor.Windows
///
///
///
- public class PropertiesWindow : SceneEditorWindow
+ public class PropertiesWindow : SceneEditorWindow, IPresenterOwner
{
private IEnumerable