Merge pull request #6257 from aws-lumberyard-dev/cgalvan/MoreReadOnlyPrefabChanges
Additional read-only prefab workflow changes.
This commit is contained in:
+15
-3
@@ -277,6 +277,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
bool itemWasShown = false;
|
||||
|
||||
// Create Prefab
|
||||
{
|
||||
if (!selectedEntities.empty())
|
||||
@@ -312,33 +314,43 @@ namespace AzToolsFramework
|
||||
QObject::connect(createAction, &QAction::triggered, createAction, [selectedEntities] {
|
||||
ContextMenu_CreatePrefab(selectedEntities);
|
||||
});
|
||||
|
||||
itemWasShown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate Prefab
|
||||
if (!readOnlyEntityInSelection)
|
||||
{
|
||||
QAction* instantiateAction = menu->addAction(QObject::tr("Instantiate Prefab..."));
|
||||
instantiateAction->setToolTip(QObject::tr("Instantiates a prefab file in the scene."));
|
||||
|
||||
QObject::connect(
|
||||
instantiateAction, &QAction::triggered, instantiateAction, [] { ContextMenu_InstantiatePrefab(); });
|
||||
|
||||
itemWasShown = true;
|
||||
}
|
||||
|
||||
// Instantiate Procedural Prefab
|
||||
if (AZ::Prefab::ProceduralPrefabAsset::UseProceduralPrefabs())
|
||||
if (AZ::Prefab::ProceduralPrefabAsset::UseProceduralPrefabs() && !readOnlyEntityInSelection)
|
||||
{
|
||||
QAction* action = menu->addAction(QObject::tr("Instantiate Procedural Prefab..."));
|
||||
action->setToolTip(QObject::tr("Instantiates a procedural prefab file in a prefab."));
|
||||
|
||||
QObject::connect(
|
||||
action, &QAction::triggered, action, [] { ContextMenu_InstantiateProceduralPrefab(); });
|
||||
|
||||
itemWasShown = true;
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
if (itemWasShown)
|
||||
{
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
bool itemWasShown = false;
|
||||
itemWasShown = false;
|
||||
|
||||
// Edit/Save Prefab
|
||||
{
|
||||
|
||||
+25
-4
@@ -3238,13 +3238,34 @@ namespace AzToolsFramework
|
||||
void EditorTransformComponentSelection::PopulateEditorGlobalContextMenu(
|
||||
QMenu* menu, [[maybe_unused]] const AZ::Vector2& point, [[maybe_unused]] int flags)
|
||||
{
|
||||
QAction* action = menu->addAction(QObject::tr(TogglePivotTitleRightClick));
|
||||
QObject::connect(
|
||||
action, &QAction::triggered, action,
|
||||
[this]
|
||||
// Don't show the Toggle Pivot option if any read-only entities are in the current selection
|
||||
// We need to request the selected entities instead of just using the m_selectedEntities variable
|
||||
// because we filter out any read-only entities from the m_selectedEntities so that the manipulators
|
||||
// will be hidden
|
||||
EntityIdList selectedEntityIds;
|
||||
ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
auto readOnlyEntityPublicInterface = AZ::Interface<ReadOnlyEntityPublicInterface>::Get();
|
||||
bool readOnlyEntityInSelection = false;
|
||||
for (const auto& entityId : selectedEntityIds)
|
||||
{
|
||||
if (readOnlyEntityPublicInterface->IsReadOnly(entityId))
|
||||
{
|
||||
readOnlyEntityInSelection = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!readOnlyEntityInSelection)
|
||||
{
|
||||
QAction* action = menu->addAction(QObject::tr(TogglePivotTitleRightClick));
|
||||
QObject::connect(
|
||||
action, &QAction::triggered, action,
|
||||
[this]
|
||||
{
|
||||
ToggleCenterPivotSelection();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::BeforeEntitySelectionChanged()
|
||||
|
||||
Reference in New Issue
Block a user