Focus Mode | Make Ctrl+S shortcut contextual to Prefab Focus (#7649)

* Change the Ctrl+S flow to save the currently focused prefab instead of the root.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Ensure the Outliner is refreshed on save

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Rename ExecuteClosePrefabDialog to be more accurate (the function also does the saving, it's not just creating the dialog).

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Minor changes to labeling.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Adjust labeling to reflect changes in behavior.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Revert labeling changes

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Additional checks to guarantee the system works in test mode

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Additional check to prevent crashes when the editor somehow triggers save during automated tests.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Simplify checks

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Update preferences and dialog labels to reflect new behavior.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
Danilo Aimini
2022-02-17 15:26:10 -08:00
committed by GitHub
parent 322a6c495a
commit 6fe2664b68
10 changed files with 54 additions and 25 deletions
+3 -5
View File
@@ -714,12 +714,10 @@ void CCryEditApp::OnFileSave()
}
else
{
auto* prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
auto* prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
AZ_Assert(prefabEditorEntityOwnershipInterface != nullptr, "PrefabEditorEntityOwnershipInterface is not found.");
AZ_Assert(prefabIntegrationInterface != nullptr, "PrefabIntegrationInterface is not found.");
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
prefabIntegrationInterface->ExecuteSavePrefabDialog(rootPrefabTemplateId, true);
prefabIntegrationInterface->SaveCurrentPrefab();
}
}
@@ -3154,7 +3152,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
}
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
int prefabSaveSelection = prefabIntegrationInterface->ExecuteClosePrefabDialog(rootPrefabTemplateId);
int prefabSaveSelection = prefabIntegrationInterface->HandleRootPrefabClosure(rootPrefabTemplateId);
// In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
// For example, QDialog::Rejected(0) is emitted when dialog is closed. But the int value corresponds to