From 90ef2ba13f2f0704fbf6575c488de08892829ca6 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 22 Jul 2021 15:21:08 -0500 Subject: [PATCH] Removed slice based context menu options from the RPE when prefabs are enabled. Signed-off-by: Chris Galvan --- .../UI/PropertyEditor/EntityPropertyEditor.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 319307009c..17155076ec 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -1951,12 +1951,13 @@ namespace AzToolsFramework return; } + // If prefabs are enabled, there will be no root slice so bail out here since we don't need + // to show any slice options in the menu AZ::SliceComponent* rootSlice = nullptr; AzFramework::SliceEntityOwnershipServiceRequestBus::EventResult(rootSlice, contextId, &AzFramework::SliceEntityOwnershipServiceRequestBus::Events::GetRootSlice); if (!rootSlice) { - AZ_Error("PropertyEditor", false, "Entity context has no root slice"); return; } @@ -2105,10 +2106,6 @@ namespace AzToolsFramework { QMenu* revertMenu = nullptr; - revertMenu = menu.addMenu(tr("Revert overrides")); - revertMenu->setToolTipsVisible(true); - revertMenu->setEnabled(false); - //check for changes on selected property if (componentClassData) { @@ -2128,6 +2125,11 @@ namespace AzToolsFramework return; } + // Only add the "Revert overrides" menu option if it belongs to a slice + revertMenu = menu.addMenu(tr("Revert overrides")); + revertMenu->setToolTipsVisible(true); + revertMenu->setEnabled(false); + if (fieldNode) { bool hasChanges = fieldNode->HasChangesVersusComparison(false);