From 6d72bfe1490b671c745c403e2e57ea179cfa22ea Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 6 Oct 2021 10:13:01 +0200 Subject: [PATCH] Add `ContentItem.OnContextMenu` --- Source/Editor/Content/Items/ContentItem.cs | 8 ++++++++ Source/Editor/Windows/ContentWindow.ContextMenu.cs | 1 + 2 files changed, 9 insertions(+) diff --git a/Source/Editor/Content/Items/ContentItem.cs b/Source/Editor/Content/Items/ContentItem.cs index 9813cd44e..8f97a9330 100644 --- a/Source/Editor/Content/Items/ContentItem.cs +++ b/Source/Editor/Content/Items/ContentItem.cs @@ -505,6 +505,14 @@ namespace FlaxEditor.Content } } + /// + /// Called when context menu is being prepared to show. Can be used to add custom options. + /// + /// The menu. + public virtual void OnContextMenu(FlaxEditor.GUI.ContextMenu.ContextMenu menu) + { + } + /// /// Called when item gets renamed or location gets changed (path modification). /// diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index cded93cc0..541517254 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -123,6 +123,7 @@ namespace FlaxEditor.Windows // Custom options ContextMenuShow?.Invoke(cm, item); proxy?.OnContentWindowContextMenu(cm, item); + item.OnContextMenu(cm); cm.AddButton("Copy name to Clipboard", () => Clipboard.Text = item.NamePath);