Added some comments and some minor fixes

Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
srikappa-amzn
2021-08-24 19:21:06 -07:00
parent 1ca67cad80
commit a13fb3c13a
8 changed files with 175 additions and 4 deletions
+6 -1
View File
@@ -736,7 +736,11 @@ void CCryEditApp::OnFileSave()
if (usePrefabSystemForLevels)
{
GetIEditor()->GetDocument()->ExecuteSavePrefabsDialog();
auto prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
if (prefabSystemComponentInterface->AreDirtyTemplatesPresent())
{
GetIEditor()->GetDocument()->ExecuteSavePrefabsDialog();
}
}
}
@@ -3195,6 +3199,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
? SavePrefabsPreference::SaveAll
: SavePrefabsPreference::SaveNone;
// In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
switch (1 - prefabSaveSelection)
{
case QDialogButtonBox::AcceptRole:
+2 -1
View File
@@ -707,7 +707,8 @@ bool CCryEditDoc::SaveModified()
QCheckBox* saveAllPrefabsCheckBox = prefabSaveSelectionDialog->findChild<QCheckBox*>("SaveAllPrefabsCheckbox");
SavePrefabsPreference savePrefabsPreference =
saveAllPrefabsCheckBox->isChecked() ? SavePrefabsPreference::SaveAll : SavePrefabsPreference::SaveNone;
// In order to get the accept and reject codes of QDialog and QDialogButtonBox aligned, we do (1-prefabSaveSelection) here.
switch (1 - prefabSaveSelection)
{
case QDialogButtonBox::AcceptRole:
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/PlatformDef.h>
#include "SaveAllPrefabsDialog.h"
#include <AzQtComponents/Components/Widgets/CheckBox.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_SaveAllPrefabsDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
SaveAllPrefabsDialog::SaveAllPrefabsDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SaveAllPrefabsDialog)
{
ui->setupUi(this);
AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->saveAllPrefabsCheckBox);
AzQtComponents::CheckBox::applyToggleSwitchStyle(ui->rememberPrefabSavePreferenceCheckBox);
}
SaveAllPrefabsDialog::~SaveAllPrefabsDialog()
{
delete ui;
}
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <QDialog>
#include <QScopedPointer>
namespace Ui
{
class SaveAllPrefabsDialog;
}
class SaveAllPrefabsDialog : public QDialog
{
public:
SaveAllPrefabsDialog(QWidget* pParent = nullptr);
~SaveAllPrefabsDialog();
private:
Ui::SaveAllPrefabsDialog* ui;
};
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SaveAllPrefabsDialog</class>
<widget class="QDialog" name="SaveAllPrefabsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Changes in level saved successfully</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Second text</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="saveAllPrefabsCheckBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="rememberPrefabSavePreferenceCheckBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -18,6 +18,7 @@
namespace AzToolsFramework
{
class PrefabEditorEntityOwnershipInterface
{
public:
@@ -10,7 +10,6 @@
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Script/ScriptSystemBus.h>
#include <AzCore/Serialization/Utils.h>
#include <AzCore/Settings/SettingsRegistry.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/Entity/GameEntityContextBus.h>
@@ -676,7 +676,7 @@ namespace AzToolsFramework
{
registry->GetObject(savePrefabsPreference, s_savePrefabsKey);
}
return static_cast<SavePrefabsPreference>(savePrefabsPreference);
return savePrefabsPreference;
}
void PrefabLoader::SetSavePrefabsPreference(SavePrefabsPreference savePrefabsPreference)