Merge branch 'development' into cmake/warn_virtual

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-09-09 11:50:40 -07:00
248 changed files with 9491 additions and 10706 deletions
+75 -18
View File
@@ -33,6 +33,7 @@ AZ_POP_DISABLE_WARNING
#include <QScopedValueRollback>
#include <QClipboard>
#include <QMenuBar>
#include <QDialogButtonBox>
// Aws Native SDK
#include <aws/sts/STSClient.h>
@@ -716,8 +717,24 @@ void CCryEditApp::OnFileSave()
}
const QScopedValueRollback<bool> rollback(m_savingLevel, true);
bool usePrefabSystemForLevels = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
GetIEditor()->GetDocument()->DoFileSave();
if (!usePrefabSystemForLevels)
{
GetIEditor()->GetDocument()->DoFileSave();
}
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);
}
}
@@ -3128,29 +3145,69 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
{
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
int result = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Save Level"), str, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
if (QMessageBox::Yes == result)
bool usePrefabSystemForLevels = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
if (!usePrefabSystemForLevels)
{
if (!GetIEditor()->GetDocument()->DoFileSave())
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
int result = QMessageBox::question(
AzToolsFramework::GetActiveWindow(), QObject::tr("Save Level"), str,
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
if (QMessageBox::Yes == result)
{
if (!GetIEditor()->GetDocument()->DoFileSave())
{
// if the file save operation failed, assume that the user was informed of why
// already and treat it as a cancel
wasCreateLevelOperationCancelled = true;
return false;
}
bIsDocModified = false;
}
else if (QMessageBox::No == result)
{
// Set Modified flag to false to prevent show Save unchanged dialog again
GetIEditor()->GetDocument()->SetModifiedFlag(false);
}
else if (QMessageBox::Cancel == result)
{
// if the file save operation failed, assume that the user was informed of why
// already and treat it as a cancel
wasCreateLevelOperationCancelled = true;
return false;
}
}
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.");
bIsDocModified = false;
}
else if (QMessageBox::No == result)
{
// Set Modified flag to false to prevent show Save unchanged dialog again
GetIEditor()->GetDocument()->SetModifiedFlag(false);
}
else if (QMessageBox::Cancel == result)
{
wasCreateLevelOperationCancelled = true;
return false;
if (prefabEditorEntityOwnershipInterface == nullptr || prefabIntegrationInterface == nullptr)
{
return false;
}
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
int prefabSaveSelection = prefabIntegrationInterface->ExecuteClosePrefabDialog(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
// QDialogButtonBox::AcceptRole(0).
switch (1 - prefabSaveSelection)
{
case QDialogButtonBox::AcceptRole:
bIsDocModified = false;
break;
case QDialogButtonBox::RejectRole:
wasCreateLevelOperationCancelled = true;
return false;
case QDialogButtonBox::InvalidRole:
// Set Modified flag to false to prevent show Save unchanged dialog again
GetIEditor()->GetDocument()->SetModifiedFlag(false);
break;
}
}
}
+73 -15
View File
@@ -13,6 +13,7 @@
// Qt
#include <QDateTime>
#include <QDialogButtonBox>
// AzCore
#include <AzCore/Component/TransformBus.h>
@@ -30,7 +31,6 @@
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzToolsFramework/UI/Layer/NameConflictWarning.hxx>
#include <AzToolsFramework/API/EditorLevelNotificationBus.h>
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
// Editor
#include "Settings.h"
@@ -132,6 +132,19 @@ CCryEditDoc::CCryEditDoc()
RegisterConsoleVariables();
MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_FILE_SAVE_AS, this, &CCryEditDoc::OnFileSaveAs);
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (isPrefabSystemEnabled)
{
m_prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found.");
m_prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found.");
m_prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found.");
m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found.");
}
}
CCryEditDoc::~CCryEditDoc()
@@ -664,19 +677,56 @@ bool CCryEditDoc::SaveModified()
return true;
}
auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (button)
bool usePrefabSystemForLevels = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
if (!usePrefabSystemForLevels)
{
case QMessageBox::Cancel:
return false;
case QMessageBox::Yes:
return DoFileSave();
case QMessageBox::No:
SetModifiedFlag(false);
return true;
QMessageBox saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
saveModifiedMessageBox.setText(QString("Save changes to %1?").arg(GetTitle()));
saveModifiedMessageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
saveModifiedMessageBox.setIcon(QMessageBox::Icon::Question);
auto button = QMessageBox::question(
AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (button)
{
case QMessageBox::Cancel:
return false;
case QMessageBox::Yes:
return DoFileSave();
case QMessageBox::No:
SetModifiedFlag(false);
return true;
}
Q_UNREACHABLE();
}
else
{
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId = m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
if (!m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId))
{
return true;
}
int prefabSaveSelection = m_prefabIntegrationInterface->ExecuteClosePrefabDialog(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
// QDialogButtonBox::AcceptRole(0).
switch (1 - prefabSaveSelection)
{
case QDialogButtonBox::AcceptRole:
return true;
case QDialogButtonBox::RejectRole:
return false;
case QDialogButtonBox::InvalidRole:
SetModifiedFlag(false);
return true;
}
Q_UNREACHABLE();
}
Q_UNREACHABLE();
}
void CCryEditDoc::OnFileSaveAs()
@@ -690,6 +740,15 @@ void CCryEditDoc::OnFileSaveAs()
if (OnSaveDocument(levelFileDialog.GetFileName()))
{
CCryEditApp::instance()->AddToRecentFileList(levelFileDialog.GetFileName());
bool usePrefabSystemForLevels = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
if (usePrefabSystemForLevels)
{
AzToolsFramework::Prefab::TemplateId rootPrefabTemplateId =
m_prefabEditorEntityOwnershipInterface->GetRootPrefabTemplateId();
SetModifiedFlag(m_prefabSystemComponentInterface->AreDirtyTemplatesPresent(rootPrefabTemplateId));
}
}
}
}
@@ -1238,8 +1297,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
}
else
{
auto prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
if (prefabEditorEntityOwnershipInterface)
if (m_prefabEditorEntityOwnershipInterface)
{
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
AZ_Assert(fileIO, "No File IO implementation available");
@@ -1250,7 +1308,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
if (openResult)
{
AZ::IO::FileIOStream stream(tempSaveFileHandle, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, false);
contentsAllSaved = prefabEditorEntityOwnershipInterface->SaveToStream(stream, AZStd::string_view(filenameStrData.data(), filenameStrData.size()));
contentsAllSaved = m_prefabEditorEntityOwnershipInterface->SaveToStream(stream, AZStd::string_view(filenameStrData.data(), filenameStrData.size()));
stream.Close();
}
}
+9
View File
@@ -13,8 +13,13 @@
#if !defined(Q_MOC_RUN)
#include "DocMultiArchive.h"
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
#include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
#include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationInterface.h>
#include <AzCore/Component/Component.h>
#include <AzQtComponents/Components/Widgets/Card.h>
#include <TimeValue.h>
#include <IEditor.h>
#endif
@@ -207,6 +212,10 @@ protected:
const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
const float m_envProbeHeight = 200.0f;
bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
AzToolsFramework::Prefab::PrefabSystemComponentInterface* m_prefabSystemComponentInterface = nullptr;
AzToolsFramework::PrefabEditorEntityOwnershipInterface* m_prefabEditorEntityOwnershipInterface = nullptr;
AzToolsFramework::Prefab::PrefabLoaderInterface* m_prefabLoaderInterface = nullptr;
AzToolsFramework::Prefab::PrefabIntegrationInterface* m_prefabIntegrationInterface = nullptr;
};
class CAutoDocNotReady
@@ -42,6 +42,10 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->Field("EnableSceneInspector", &GeneralSettings::m_enableSceneInspector)
->Field("RestoreViewportCamera", &GeneralSettings::m_restoreViewportCamera);
serialize.Class<LevelSaveSettings>()
->Version(1)
->Field("SaveAllPrefabsPreference", &LevelSaveSettings::m_saveAllPrefabsPreference);
serialize.Class<Messaging>()
->Version(2)
->Field("ShowDashboard", &Messaging::m_showDashboard)
@@ -64,6 +68,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
serialize.Class<CEditorPreferencesPage_General>()
->Version(1)
->Field("General Settings", &CEditorPreferencesPage_General::m_generalSettings)
->Field("Level Save Settings", &CEditorPreferencesPage_General::m_levelSaveSettings)
->Field("Messaging", &CEditorPreferencesPage_General::m_messaging)
->Field("Undo", &CEditorPreferencesPage_General::m_undo)
->Field("Deep Selection", &CEditorPreferencesPage_General::m_deepSelection)
@@ -92,6 +97,14 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_restoreViewportCamera, EditorPreferencesGeneralRestoreViewportCameraSettingName, "Keep the original editor viewport transform when exiting game mode.")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSceneInspector, "Enable Scene Inspector (EXPERIMENTAL)", "Enable the option to inspect the internal data loaded from scene files like .fbx. This is an experimental feature. Restart the Scene Settings if the option is not visible under the Help menu.");
editContext->Class<LevelSaveSettings>("Level Save Settings", "")
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &LevelSaveSettings::m_saveAllPrefabsPreference, "Save All Prefabs Preference",
"This option controls whether prefabs should be saved along with the level")
->EnumAttribute(AzToolsFramework::Prefab::SaveAllPrefabsPreference::AskEveryTime, "Ask every time")
->EnumAttribute(AzToolsFramework::Prefab::SaveAllPrefabsPreference::SaveAll, "Save all")
->EnumAttribute(AzToolsFramework::Prefab::SaveAllPrefabsPreference::SaveNone, "Save none");
editContext->Class<Messaging>("Messaging", "")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Messaging::m_showDashboard, "Show Welcome to Open 3D Engine at startup", "Show Welcome to Open 3D Engine at startup")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Messaging::m_showCircularDependencyError, "Show Error: Circular dependency", "Show an error message when adding a slice instance to the target slice would create a cyclic asset dependency. All other valid overrides will be saved even if this is turned off.");
@@ -115,6 +128,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_General::m_generalSettings, "General Settings", "General Editor Preferences")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_General::m_levelSaveSettings, "Level Save Settings", "File>Save")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_General::m_messaging, "Messaging", "Messaging")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_General::m_undo, "Undo", "Undo Preferences")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_General::m_deepSelection, "Selection", "Selection")
@@ -161,6 +175,9 @@ void CEditorPreferencesPage_General::OnApply()
MainWindow::instance()->AdjustToolBarIconSize(m_generalSettings.m_toolbarIconSize);
}
//prefabs
gSettings.levelSaveSettings.saveAllPrefabsPreference = m_levelSaveSettings.m_saveAllPrefabsPreference;
//undo
gSettings.undoLevels = m_undo.m_undoLevels;
@@ -190,6 +207,9 @@ void CEditorPreferencesPage_General::InitializeSettings()
m_generalSettings.m_toolbarIconSize = static_cast<AzQtComponents::ToolBar::ToolBarIconSize>(gSettings.gui.nToolbarIconSize);
//prefabs
m_levelSaveSettings.m_saveAllPrefabsPreference = gSettings.levelSaveSettings.saveAllPrefabsPreference;
//Messaging
m_messaging.m_showDashboard = gSettings.bShowDashboardAtStartup;
m_messaging.m_showCircularDependencyError = gSettings.m_showCircularDependencyError;
@@ -14,6 +14,7 @@
#include <AzCore/Math/Vector3.h>
#include <AzQtComponents/Components/Widgets/ToolBar.h>
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
#include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
#include <QIcon>
#include "Settings.h"
@@ -57,6 +58,12 @@ private:
bool m_enableSceneInspector;
};
struct LevelSaveSettings
{
AZ_TYPE_INFO(LevelSaveSettings, "{E297DAE3-3985-4BC2-8B43-45F3B1522F6B}");
AzToolsFramework::Prefab::SaveAllPrefabsPreference m_saveAllPrefabsPreference;
};
struct Messaging
{
AZ_TYPE_INFO(Messaging, "{A6AD87CB-E905-409B-A2BF-C43CDCE63B0C}")
@@ -89,6 +96,7 @@ private:
};
GeneralSettings m_generalSettings;
LevelSaveSettings m_levelSaveSettings;
Messaging m_messaging;
Undo m_undo;
DeepSelection m_deepSelection;
+2
View File
@@ -1087,6 +1087,7 @@ void EditorViewportWidget::ConnectViewportInteractionRequestBus()
{
AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusConnect(GetViewportId());
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
m_viewportUi.ConnectViewportUiBus(GetViewportId());
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusConnect();
@@ -1097,6 +1098,7 @@ void EditorViewportWidget::DisconnectViewportInteractionRequestBus()
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusDisconnect();
m_viewportUi.DisconnectViewportUiBus();
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusDisconnect();
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusDisconnect();
AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler::BusDisconnect();
}
+17 -11
View File
@@ -91,6 +91,7 @@ class SANDBOX_API EditorViewportWidget final
, private AzFramework::InputSystemCursorConstraintRequestBus::Handler
, private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
, private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
, private AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler
, private AzFramework::AssetCatalogEventBus::Handler
, private AZ::RPI::SceneNotificationBus::Handler
{
@@ -128,10 +129,12 @@ private:
CameraComponent,
ViewSourceTypesCount,
};
enum class PlayInEditorState
{
Editor, Starting, Started
};
enum class KeyPressedState
{
AllUp,
@@ -142,7 +145,7 @@ private:
////////////////////////////////////////////////////////////////////////
// Method overrides ...
// QWidget
// QWidget overrides ...
void focusOutEvent(QFocusEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
bool event(QEvent* event) override;
@@ -150,7 +153,7 @@ private:
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
// QtViewport/IDisplayViewport/CViewport
// QtViewport/IDisplayViewport/CViewport overrides ...
EViewportType GetType() const override { return ET_ViewportCamera; }
void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
@@ -176,16 +179,17 @@ private:
void Update() override;
void UpdateContent(int flags) override;
// SceneNotificationBus
// SceneNotificationBus overrides ...
void OnBeginPrepareRender() override;
// Camera::CameraNotificationBus
// Camera::CameraNotificationBus overrides ...
void OnActiveViewChanged(const AZ::EntityId&) override;
// IEditorEventListener
// IEditorEventListener overrides ...
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
// AzToolsFramework::EditorEntityContextNotificationBus overrides ...
// note: handler moved to cpp to resolve link issues in unity builds
void OnStartPlayInEditor();
void OnStopPlayInEditor();
void OnStartPlayInEditorBegin();
@@ -194,10 +198,10 @@ private:
void BeginUndoTransaction() override;
void EndUndoTransaction() override;
// AzFramework::InputSystemCursorConstraintRequestBus
// AzFramework::InputSystemCursorConstraintRequestBus overrides ...
void* GetSystemCursorConstraintWindow() const override;
// AzToolsFramework::ViewportFreezeRequestBus
// AzToolsFramework::ViewportFreezeRequestBus overrides ...
bool IsViewportInputFrozen() override;
void FreezeViewportInput(bool freeze) override;
@@ -205,13 +209,15 @@ private:
AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
float TerrainHeight(const AZ::Vector2& position) override;
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
bool ShowingWorldSpace() override;
QWidget* GetWidgetForViewportContextMenu() override;
void BeginWidgetContext() override;
void EndWidgetContext() override;
// Camera::EditorCameraRequestBus
// EditorEntityViewportInteractionRequestBus overrides ...
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntities) override;
// Camera::EditorCameraRequestBus overrides ...
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
AZ::EntityId GetCurrentViewEntityId() override;
@@ -327,7 +333,7 @@ private:
// Determines also if the current camera for this viewport is default editor camera
ViewSourceType m_viewSourceType = ViewSourceType::None;
// During play game in editor, holds the editor entity ID of the last
// During play game in editor, holds the editor entity ID of the last
AZ::EntityId m_viewEntityIdCachedForEditMode;
// The editor camera TM before switching to game mode
-1
View File
@@ -27,7 +27,6 @@ enum ObjectEvent
EVENT_OUTOFGAME, //!< Signals that editor is switching out of the game mode.
EVENT_REFRESH, //!< Signals that editor is refreshing level.
EVENT_DBLCLICK, //!< Signals that object have been double clicked.
EVENT_KEEP_HEIGHT, //!< Signals that object must preserve its height over changed terrain.
EVENT_RELOAD_ENTITY,//!< Signals that entities scripts must be reloaded.
EVENT_RELOAD_GEOM, //!< Signals that all possible geometries should be reloaded.
EVENT_UNLOAD_GEOM, //!< Signals that all possible geometries should be unloaded.
-14
View File
@@ -618,12 +618,6 @@ bool CBaseObject::SetPos(const Vec3& pos, int flags)
StoreUndo("Position", true, flags);
}
float terrainElevation = AzFramework::Terrain::TerrainDataRequests::GetDefaultTerrainHeight();
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainElevation
, &AzFramework::Terrain::TerrainDataRequests::GetHeightFromFloats
, pos.x, pos.y, AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR, nullptr);
m_height = pos.z - terrainElevation;
if (!bPositionDelegated)
{
m_pos = pos;
@@ -1275,14 +1269,6 @@ void CBaseObject::OnEvent(ObjectEvent event)
{
switch (event)
{
case EVENT_KEEP_HEIGHT:
{
float h = m_height;
float newz = GetIEditor()->GetTerrainElevation(m_pos.x, m_pos.y) + m_height;
SetPos(Vec3(m_pos.x, m_pos.y, newz));
m_height = h;
}
break;
case EVENT_CONFIG_SPEC_CHANGE:
UpdateVisibility(!IsHidden());
break;
-2
View File
@@ -795,8 +795,6 @@ private:
//////////////////////////////////////////////////////////////////////////
//! Area radius around object, where terrain is flatten and static objects removed.
float m_flattenArea;
//! Every object keeps for itself height above terrain.
float m_height;
//! Object's name.
QString m_name;
//! Class description for this object.
+17 -2
View File
@@ -241,6 +241,7 @@ SEditorSettings::SEditorSettings()
g_TemporaryLevelName = nullptr;
sliceSettings.dynamicByDefault = false;
levelSaveSettings.saveAllPrefabsPreference = AzToolsFramework::Prefab::SaveAllPrefabsPreference::AskEveryTime;
}
void SEditorSettings::Connect()
@@ -643,12 +644,20 @@ void SEditorSettings::Save()
AzFramework::ApplicationRequests::Bus::Broadcast(
&AzFramework::ApplicationRequests::SetPrefabSystemEnabled, prefabSystem);
AzToolsFramework::Prefab::PrefabLoaderInterface* prefabLoaderInterface =
AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
prefabLoaderInterface->SetSaveAllPrefabsPreference(levelSaveSettings.saveAllPrefabsPreference);
SaveSettingsRegistryFile();
}
//////////////////////////////////////////////////////////////////////////
void SEditorSettings::Load()
{
AzToolsFramework::Prefab::PrefabLoaderInterface* prefabLoaderInterface =
AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
levelSaveSettings.saveAllPrefabsPreference = prefabLoaderInterface->GetSaveAllPrefabsPreference();
// Load from Settings Registry
AzFramework::ApplicationRequests::Bus::BroadcastResult(
prefabSystem, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
@@ -1110,11 +1119,17 @@ void SEditorSettings::SaveSettingsRegistryFile()
AZ::SettingsRegistryMergeUtils::DumperSettings dumperSettings;
dumperSettings.m_prettifyOutput = true;
dumperSettings.m_jsonPointerPrefix = "/Amazon/Preferences";
dumperSettings.m_includeFilter = [](AZStd::string_view path)
{
AZStd::string_view amazonPrefixPath("/Amazon/Preferences");
AZStd::string_view o3dePrefixPath("/O3DE/Preferences");
return amazonPrefixPath.starts_with(path.substr(0, amazonPrefixPath.size())) ||
o3dePrefixPath.starts_with(path.substr(0, o3dePrefixPath.size()));
};
AZStd::string stringBuffer;
AZ::IO::ByteContainerStream stringStream(&stringBuffer);
if (!AZ::SettingsRegistryMergeUtils::DumpSettingsRegistryToStream(*registry, "/Amazon/Preferences", stringStream, dumperSettings))
if (!AZ::SettingsRegistryMergeUtils::DumpSettingsRegistryToStream(*registry, "", stringStream, dumperSettings))
{
AZ_Warning("SEditorSettings", false, R"(Unable to save changes to the Editor Preferences registry file at "%s"\n)",
editorPreferencesFilePath.c_str());
+8
View File
@@ -18,6 +18,7 @@
#include <QSettings>
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
#include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
#include <AzCore/JSON/document.h>
#include <AzQtComponents/Components/Widgets/ToolBar.h>
@@ -214,6 +215,11 @@ struct SSliceSettings
bool dynamicByDefault;
};
struct SLevelSaveSettings
{
AzToolsFramework::Prefab::SaveAllPrefabsPreference saveAllPrefabsPreference;
};
//////////////////////////////////////////////////////////////////////////
struct SAssetBrowserSettings
{
@@ -448,6 +454,8 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
SSliceSettings sliceSettings;
SLevelSaveSettings levelSaveSettings;
bool prefabSystem = true; ///< Toggle to enable/disable the Prefab system for level entities.
private:
+38
View File
@@ -244,3 +244,41 @@ QTableWidget#recentLevelTable::item {
max-height: 16px;
qproperty-iconSize: 16px 16px;
}
#ClosePrefabDialog, #SavePrefabDialog
{
min-width : 640px;
}
#SaveDependentPrefabsCard
{
margin: 0px 15px 10px 15px;
}
#PrefabSavedMessageFrame{
border: 1px solid green;
margin: 10px 15px 10px 15px;
border-radius: 2px;
padding: 5px 2px 5px 2px;
}
#ClosePrefabDialog #PrefabSaveWarningFrame
{
border: 1px solid orange;
margin: 10px 15px 10px 15px;
border-radius: 2px;
padding: 5px 2px 5px 2px;
color : white;
}
#SavePrefabDialog #FooterSeparatorLine
{
color: gray;
}
#SavePrefabDialog #PrefabSavePreferenceHint
{
font: italic;
color: #999999;
}
+2 -3
View File
@@ -1092,9 +1092,8 @@ bool QtViewport::HitTest(const QPoint& point, HitContext& hitInfo)
const int viewportId = GetViewportId();
AzToolsFramework::EntityIdList visibleEntityIds;
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Event(
viewportId,
&AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequests::FindVisibleEntities,
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Event(
viewportId, &AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Events::FindVisibleEntities,
visibleEntityIds);
// Look through all visible entities to find the closest one to the specified mouse point