diff --git a/Source/Editor/CustomEditors/LayoutElementsContainer.cs b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
index 9df2de8be..59058056d 100644
--- a/Source/Editor/CustomEditors/LayoutElementsContainer.cs
+++ b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using FlaxEditor.CustomEditors.Elements;
using FlaxEditor.CustomEditors.GUI;
using FlaxEditor.GUI;
+using FlaxEditor.GUI.ContextMenu;
using FlaxEngine;
using FlaxEngine.Assertions;
using FlaxEngine.GUI;
@@ -553,6 +554,8 @@ namespace FlaxEditor.CustomEditors
var group = Group(name, true);
group.Panel.Close(false);
group.Panel.TooltipText = tooltip;
+ group.Panel.Tag = editor;
+ group.Panel.MouseButtonRightClicked += OnGroupPanelMouseButtonRightClicked;
return group.Object(values, editor);
}
@@ -560,6 +563,23 @@ namespace FlaxEditor.CustomEditors
return property.Object(values, editor);
}
+ private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Vector2 location)
+ {
+ var linkedEditor = (CustomEditor)groupPanel.Tag;
+ var menu = new ContextMenu();
+
+ var revertToPrefab = menu.AddButton("Revert to Prefab", linkedEditor.RevertToReferenceValue);
+ revertToPrefab.Enabled = linkedEditor.CanRevertReferenceValue;
+ var resetToDefault = menu.AddButton("Reset to default", linkedEditor.RevertToDefaultValue);
+ resetToDefault.Enabled = linkedEditor.CanRevertDefaultValue;
+ menu.AddSeparator();
+ menu.AddButton("Copy", linkedEditor.Copy);
+ var paste = menu.AddButton("Paste", linkedEditor.Paste);
+ paste.Enabled = linkedEditor.CanPaste;
+
+ menu.Show(groupPanel, location);
+ }
+
///
/// Adds object property editor. Selects proper based on overrides.
///
diff --git a/Source/Engine/UI/GUI/Panels/DropPanel.cs b/Source/Engine/UI/GUI/Panels/DropPanel.cs
index fa5ff7f59..04493c7ef 100644
--- a/Source/Engine/UI/GUI/Panels/DropPanel.cs
+++ b/Source/Engine/UI/GUI/Panels/DropPanel.cs
@@ -31,9 +31,14 @@ namespace FlaxEngine.GUI
protected bool _mouseOverHeader;
///
- /// The 'mouse down' flag (over header).
+ /// The 'mouse down' flag (over header) for the left mouse button.
///
- protected bool _mouseDown;
+ protected bool _mouseButtonLeftDown;
+
+ ///
+ /// The 'mouse down' flag (over header) for the right mouse button.
+ ///
+ protected bool _mouseButtonRightDown;
///
/// The animation progress (normalized).
@@ -126,6 +131,11 @@ namespace FlaxEngine.GUI
[EditorDisplay("Style"), EditorOrder(2000)]
public bool EnableDropDownIcon { get; set; }
+ ///
+ /// Occurs when mouse right-clicks over the header.
+ ///
+ public event Action MouseButtonRightClicked;
+
///
/// Occurs when drop panel is opened or closed.
///
@@ -430,10 +440,14 @@ namespace FlaxEngine.GUI
return true;
_mouseOverHeader = HeaderRectangle.Contains(location);
-
if (button == MouseButton.Left && _mouseOverHeader)
{
- _mouseDown = true;
+ _mouseButtonLeftDown = true;
+ return true;
+ }
+ if (button == MouseButton.Right && _mouseOverHeader)
+ {
+ _mouseButtonRightDown = true;
return true;
}
@@ -455,16 +469,17 @@ namespace FlaxEngine.GUI
return true;
_mouseOverHeader = HeaderRectangle.Contains(location);
-
- if (button == MouseButton.Left && _mouseDown)
+ if (button == MouseButton.Left && _mouseButtonLeftDown)
{
- _mouseDown = false;
-
+ _mouseButtonLeftDown = false;
if (_mouseOverHeader)
- {
Toggle();
- }
-
+ return true;
+ }
+ if (button == MouseButton.Right && _mouseButtonRightDown)
+ {
+ _mouseButtonRightDown = false;
+ MouseButtonRightClicked?.Invoke(this, location);
return true;
}
@@ -474,7 +489,8 @@ namespace FlaxEngine.GUI
///
public override void OnMouseLeave()
{
- _mouseDown = false;
+ _mouseButtonLeftDown = false;
+ _mouseButtonRightDown = false;
_mouseOverHeader = false;
base.OnMouseLeave();