Merge branch 'development' into Prefab/DestroyGameEntitySupport
Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
+17
-17
@@ -35,32 +35,32 @@ public:
|
||||
Q2DViewport(QWidget* parent = nullptr);
|
||||
virtual ~Q2DViewport();
|
||||
|
||||
virtual void SetType(EViewportType type);
|
||||
virtual EViewportType GetType() const { return m_viewType; }
|
||||
virtual float GetAspectRatio() const { return 1.0f; };
|
||||
void SetType(EViewportType type) override;
|
||||
EViewportType GetType() const override { return m_viewType; }
|
||||
float GetAspectRatio() const override { return 1.0f; };
|
||||
|
||||
virtual void ResetContent();
|
||||
virtual void UpdateContent(int flags);
|
||||
void ResetContent() override;
|
||||
void UpdateContent(int flags) override;
|
||||
|
||||
public slots:
|
||||
// Called every frame to update viewport.
|
||||
virtual void Update();
|
||||
void Update() override;
|
||||
|
||||
public:
|
||||
//! Map world space position to viewport position.
|
||||
virtual QPoint WorldToView(const Vec3& wp) const;
|
||||
QPoint WorldToView(const Vec3& wp) const override;
|
||||
|
||||
virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const; //Eric@conffx
|
||||
QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const override; //Eric@conffx
|
||||
|
||||
//! Map viewport position to world space position.
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
//! Map viewport position to world space ray from camera.
|
||||
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const;
|
||||
void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
|
||||
|
||||
void OnTitleMenu(QMenu* menu) override;
|
||||
|
||||
virtual bool HitTest(const QPoint& point, HitContext& hitInfo) override;
|
||||
virtual bool IsBoundsVisible(const AABB& box) const;
|
||||
bool HitTest(const QPoint& point, HitContext& hitInfo) override;
|
||||
bool IsBoundsVisible(const AABB& box) const override;
|
||||
|
||||
// ovverided from CViewport.
|
||||
float GetScreenScaleFactor(const Vec3& worldPoint) const override;
|
||||
@@ -111,8 +111,8 @@ protected:
|
||||
virtual void SetZoom(float fZoomFactor, const QPoint& center);
|
||||
|
||||
// overrides from CViewport.
|
||||
virtual void MakeConstructionPlane(int axis);
|
||||
virtual const Matrix34& GetConstructionMatrix(RefCoordSys coordSys);
|
||||
void MakeConstructionPlane(int axis) override;
|
||||
const Matrix34& GetConstructionMatrix(RefCoordSys coordSys) override;
|
||||
|
||||
//! Calculate view transformation matrix.
|
||||
virtual void CalculateViewTM();
|
||||
@@ -146,9 +146,9 @@ protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
int OnCreate();
|
||||
void OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point);
|
||||
void OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point);
|
||||
void OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& pt);
|
||||
void OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
void OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
void OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& pt) override;
|
||||
void OnDestroy();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
m_actionHandlers[id] = std::bind(method, object, id);
|
||||
}
|
||||
|
||||
bool eventFilter(QObject* watched, QEvent* event);
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
// returns false if the action was already inserted, indicating that the action should not be processed again
|
||||
bool InsertActionExecuting(int id);
|
||||
|
||||
@@ -197,7 +197,7 @@ private:
|
||||
|
||||
virtual void OnSequenceRemoved(CTrackViewSequence* pSequence) override;
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
void AnimateActiveSequence();
|
||||
|
||||
|
||||
@@ -141,6 +141,10 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
|
||||
m_ui->m_assetBrowserTreeViewWidget, &AzAssetBrowser::AssetBrowserTreeView::ClearTypeFilter, m_ui->m_searchWidget,
|
||||
&AzAssetBrowser::SearchWidget::ClearTypeFilter);
|
||||
|
||||
connect(
|
||||
this, &AzAssetBrowserWindow::SizeChangedSignal, m_ui->m_assetBrowserTableViewWidget,
|
||||
&AzAssetBrowser::AssetBrowserTableView::UpdateSizeSlot);
|
||||
|
||||
m_ui->m_assetBrowserTreeViewWidget->SetName("AssetBrowserTreeView_main");
|
||||
}
|
||||
|
||||
@@ -164,6 +168,25 @@ QObject* AzAssetBrowserWindow::createListenerForShowAssetEditorEvent(QObject* pa
|
||||
return listener;
|
||||
}
|
||||
|
||||
void AzAssetBrowserWindow::resizeEvent(QResizeEvent* resizeEvent)
|
||||
{
|
||||
// leftLayout is the parent of the tableView
|
||||
// rightLayout is the parent of the preview window.
|
||||
// Workaround: When docking windows this event keeps holding the old size of the widgets instead of the new one
|
||||
// but the resizeEvent holds the new size of the whole widget
|
||||
// So we have to save the proportions somehow
|
||||
const QWidget* leftLayout = m_ui->m_leftLayout;
|
||||
const QVBoxLayout* rightLayout = m_ui->m_rightLayout;
|
||||
|
||||
const float oldLeftLayoutWidth = aznumeric_cast<float>(leftLayout->geometry().width());
|
||||
const float oldWidth = aznumeric_cast<float>(leftLayout->geometry().width() + rightLayout->geometry().width());
|
||||
|
||||
const float newWidth = oldLeftLayoutWidth * aznumeric_cast<float>(resizeEvent->size().width()) / oldWidth;
|
||||
|
||||
emit SizeChangedSignal(aznumeric_cast<int>(newWidth));
|
||||
QWidget::resizeEvent(resizeEvent);
|
||||
}
|
||||
|
||||
void AzAssetBrowserWindow::OnInitViewToggleButton()
|
||||
{
|
||||
CreateSwitchViewMenu();
|
||||
|
||||
@@ -53,9 +53,17 @@ public:
|
||||
|
||||
static QObject* createListenerForShowAssetEditorEvent(QObject* parent);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void SizeChangedSignal(int newWidth);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* resizeEvent) override;
|
||||
|
||||
private:
|
||||
void OnInitViewToggleButton();
|
||||
void UpdateDisplayInfo();
|
||||
|
||||
protected slots:
|
||||
void CreateSwitchViewMenu();
|
||||
void SetExpandedAssetBrowserMode();
|
||||
|
||||
@@ -140,9 +140,6 @@
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -201,6 +198,11 @@
|
||||
<header>AzToolsFramework/AssetBrowser/Search/SearchWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzQtComponents::TableView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>AzQtComponents/Components/Widgets/TableView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzToolsFramework::AssetBrowser::AssetBrowserTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
@@ -214,7 +216,7 @@
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzToolsFramework::AssetBrowser::AssetBrowserTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<extends>AzQtComponents::TableView</extends>
|
||||
<header>AzToolsFramework/AssetBrowser/Views/AssetBrowserTableView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
||||
+17
-17
@@ -40,57 +40,57 @@ public:
|
||||
//! Set library name.
|
||||
virtual void SetName(const QString& name);
|
||||
//! Get library name.
|
||||
const QString& GetName() const;
|
||||
const QString& GetName() const override;
|
||||
|
||||
//! Set new filename for this library.
|
||||
virtual bool SetFilename(const QString& filename, [[maybe_unused]] bool checkForUnique = true) { m_filename = filename.toLower(); return true; };
|
||||
const QString& GetFilename() const { return m_filename; };
|
||||
const QString& GetFilename() const override { return m_filename; };
|
||||
|
||||
virtual bool Save() = 0;
|
||||
virtual bool Load(const QString& filename) = 0;
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
bool Save() override = 0;
|
||||
bool Load(const QString& filename) override = 0;
|
||||
void Serialize(XmlNodeRef& node, bool bLoading) override = 0;
|
||||
|
||||
//! Mark library as modified.
|
||||
void SetModified(bool bModified = true);
|
||||
void SetModified(bool bModified = true) override;
|
||||
//! Check if library was modified.
|
||||
bool IsModified() const { return m_bModified; };
|
||||
bool IsModified() const override { return m_bModified; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Working with items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add a new prototype to library.
|
||||
void AddItem(IDataBaseItem* item, bool bRegister = true);
|
||||
void AddItem(IDataBaseItem* item, bool bRegister = true) override;
|
||||
//! Get number of known prototypes.
|
||||
int GetItemCount() const { return static_cast<int>(m_items.size()); }
|
||||
int GetItemCount() const override { return static_cast<int>(m_items.size()); }
|
||||
//! Get prototype by index.
|
||||
IDataBaseItem* GetItem(int index);
|
||||
IDataBaseItem* GetItem(int index) override;
|
||||
|
||||
//! Delete item by pointer of item.
|
||||
void RemoveItem(IDataBaseItem* item);
|
||||
void RemoveItem(IDataBaseItem* item) override;
|
||||
|
||||
//! Delete all items from library.
|
||||
void RemoveAllItems();
|
||||
void RemoveAllItems() override;
|
||||
|
||||
//! Find library item by name.
|
||||
//! Using linear search.
|
||||
IDataBaseItem* FindItem(const QString& name);
|
||||
IDataBaseItem* FindItem(const QString& name) override;
|
||||
|
||||
//! Check if this library is local level library.
|
||||
bool IsLevelLibrary() const { return m_bLevelLib; };
|
||||
bool IsLevelLibrary() const override { return m_bLevelLib; };
|
||||
|
||||
//! Set library to be level library.
|
||||
void SetLevelLibrary(bool bEnable) { m_bLevelLib = bEnable; };
|
||||
void SetLevelLibrary(bool bEnable) override { m_bLevelLib = bEnable; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Return manager for this library.
|
||||
IBaseLibraryManager* GetManager();
|
||||
IBaseLibraryManager* GetManager() override;
|
||||
|
||||
// Saves the library with the main tag defined by the parameter name
|
||||
bool SaveLibrary(const char* name, bool saveEmptyLibrary = false);
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation) override;
|
||||
void ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation) override;
|
||||
//CONFETTI END
|
||||
|
||||
signals:
|
||||
|
||||
@@ -35,112 +35,112 @@ public:
|
||||
~CBaseLibraryManager();
|
||||
|
||||
//! Clear all libraries.
|
||||
virtual void ClearAll() override;
|
||||
void ClearAll() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IDocListener implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
virtual IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) override;
|
||||
IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) override;
|
||||
//! Delete item from library and manager.
|
||||
virtual void DeleteItem(IDataBaseItem* pItem) override;
|
||||
void DeleteItem(IDataBaseItem* pItem) override;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
virtual IDataBaseItem* FindItem(REFGUID guid) const;
|
||||
virtual IDataBaseItem* FindItemByName(const QString& fullItemName);
|
||||
virtual IDataBaseItem* LoadItemByName(const QString& fullItemName);
|
||||
IDataBaseItem* FindItem(REFGUID guid) const override;
|
||||
IDataBaseItem* FindItemByName(const QString& fullItemName) override;
|
||||
IDataBaseItem* LoadItemByName(const QString& fullItemName) override;
|
||||
virtual IDataBaseItem* FindItemByName(const char* fullItemName);
|
||||
virtual IDataBaseItem* LoadItemByName(const char* fullItemName);
|
||||
|
||||
virtual IDataBaseItemEnumerator* GetItemEnumerator() override;
|
||||
IDataBaseItemEnumerator* GetItemEnumerator() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set item currently selected.
|
||||
virtual void SetSelectedItem(IDataBaseItem* pItem) override;
|
||||
void SetSelectedItem(IDataBaseItem* pItem) override;
|
||||
// Get currently selected item.
|
||||
virtual IDataBaseItem* GetSelectedItem() const override;
|
||||
virtual IDataBaseItem* GetSelectedParentItem() const override;
|
||||
IDataBaseItem* GetSelectedItem() const override;
|
||||
IDataBaseItem* GetSelectedParentItem() const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library.
|
||||
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override;
|
||||
virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override;
|
||||
IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override;
|
||||
void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override;
|
||||
//! Get number of libraries.
|
||||
virtual int GetLibraryCount() const override { return static_cast<int>(m_libs.size()); };
|
||||
int GetLibraryCount() const override { return static_cast<int>(m_libs.size()); };
|
||||
//! Get number of modified libraries.
|
||||
virtual int GetModifiedLibraryCount() const override;
|
||||
int GetModifiedLibraryCount() const override;
|
||||
|
||||
//! Get Item library by index.
|
||||
virtual IDataBaseLibrary* GetLibrary(int index) const override;
|
||||
IDataBaseLibrary* GetLibrary(int index) const override;
|
||||
|
||||
//! Get Level Item library.
|
||||
virtual IDataBaseLibrary* GetLevelLibrary() const override;
|
||||
IDataBaseLibrary* GetLevelLibrary() const override;
|
||||
|
||||
//! Find Items Library by name.
|
||||
virtual IDataBaseLibrary* FindLibrary(const QString& library) override;
|
||||
IDataBaseLibrary* FindLibrary(const QString& library) override;
|
||||
|
||||
//! Find Items Library's index by name.
|
||||
int FindLibraryIndex(const QString& library) override;
|
||||
|
||||
//! Load Items library.
|
||||
virtual IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) override;
|
||||
IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) override;
|
||||
|
||||
//! Save all modified libraries.
|
||||
virtual void SaveAllLibs() override;
|
||||
void SaveAllLibs() override;
|
||||
|
||||
//! Serialize property manager.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) override;
|
||||
void Serialize(XmlNodeRef& node, bool bLoading) override;
|
||||
|
||||
//! Export items to game.
|
||||
virtual void Export([[maybe_unused]] XmlNodeRef& node) override {};
|
||||
void Export([[maybe_unused]] XmlNodeRef& node) override {};
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
virtual QString MakeUniqueItemName(const QString& name, const QString& libName = "") override;
|
||||
virtual QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) override;
|
||||
QString MakeUniqueItemName(const QString& name, const QString& libName = "") override;
|
||||
QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) override;
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
virtual QString GetRootNodeName() override = 0;
|
||||
QString GetRootNodeName() override = 0;
|
||||
//! Path to libraries in this manager.
|
||||
virtual QString GetLibsPath() override = 0;
|
||||
QString GetLibsPath() override = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
virtual void Validate() override;
|
||||
void Validate() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GatherUsedResources(CUsedResources& resources) override;
|
||||
void GatherUsedResources(CUsedResources& resources) override;
|
||||
|
||||
virtual void AddListener(IDataBaseManagerListener* pListener) override;
|
||||
virtual void RemoveListener(IDataBaseManagerListener* pListener) override;
|
||||
void AddListener(IDataBaseManagerListener* pListener) override;
|
||||
void RemoveListener(IDataBaseManagerListener* pListener) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid) override;
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem) override;
|
||||
virtual void UnregisterItem(CBaseLibraryItem* pItem) override;
|
||||
void RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid) override;
|
||||
void RegisterItem(CBaseLibraryItem* pItem) override;
|
||||
void UnregisterItem(CBaseLibraryItem* pItem) override;
|
||||
|
||||
// Only Used internally.
|
||||
virtual void OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName) override;
|
||||
void OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName) override;
|
||||
|
||||
// Called by items to indicated that they have been modified.
|
||||
// Sends item changed event to listeners.
|
||||
virtual void OnItemChanged(IDataBaseItem* pItem) override;
|
||||
virtual void OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh) override;
|
||||
void OnItemChanged(IDataBaseItem* pItem) override;
|
||||
void OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh) override;
|
||||
|
||||
QString MakeFilename(const QString& library);
|
||||
virtual bool IsUniqueFilename(const QString& library) override;
|
||||
bool IsUniqueFilename(const QString& library) override;
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation) override;
|
||||
void ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation) override;
|
||||
|
||||
virtual bool SetLibraryName(CBaseLibrary* lib, const QString& name) override;
|
||||
bool SetLibraryName(CBaseLibrary* lib, const QString& name) override;
|
||||
|
||||
protected:
|
||||
void SplitFullItemName(const QString& fullItemName, QString& libraryName, QString& itemName);
|
||||
@@ -199,8 +199,8 @@ public:
|
||||
m_pMap = pMap;
|
||||
m_iterator = m_pMap->begin();
|
||||
}
|
||||
virtual void Release() { delete this; };
|
||||
virtual IDataBaseItem* GetFirst()
|
||||
void Release() override { delete this; };
|
||||
IDataBaseItem* GetFirst() override
|
||||
{
|
||||
m_iterator = m_pMap->begin();
|
||||
if (m_iterator == m_pMap->end())
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
}
|
||||
return m_iterator->second;
|
||||
}
|
||||
virtual IDataBaseItem* GetNext()
|
||||
IDataBaseItem* GetNext() override
|
||||
{
|
||||
if (m_iterator != m_pMap->end())
|
||||
{
|
||||
|
||||
@@ -254,4 +254,35 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
ly_add_googletest(
|
||||
NAME Legacy::EditorLib.Tests
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME EditorLib.Camera.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
Lib/Tests/Camera/editor_lib_camera_test_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PRIVATE
|
||||
.
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
AZ::AzTest
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzTestShared
|
||||
Legacy::EditorLib
|
||||
Gem::Camera.Editor
|
||||
Gem::AtomToolsFramework.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::EditorLib
|
||||
)
|
||||
|
||||
ly_add_source_properties(
|
||||
SOURCES Lib/Tests/Camera/test_EditorCamera.cpp
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
VALUES CAMERA_EDITOR_MODULE="$<TARGET_FILE_BASE_NAME:Camera.Editor>"
|
||||
)
|
||||
|
||||
ly_add_googletest(
|
||||
NAME Legacy::EditorLib.Camera.Tests
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -81,7 +81,7 @@ protected:
|
||||
HIT_SPLINE,
|
||||
};
|
||||
|
||||
void paintEvent(QPaintEvent* e);
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
@@ -83,7 +83,7 @@ protected Q_SLOTS:
|
||||
void OnIndexDoubleClicked(const QModelIndex& index);
|
||||
|
||||
protected:
|
||||
virtual void OnFileMonitorChange(const SFileChangeInfo& rChange);
|
||||
void OnFileMonitorChange(const SFileChangeInfo& rChange) override;
|
||||
void contextMenuEvent(QContextMenuEvent* e) override;
|
||||
|
||||
void InitTree();
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
void SetVariable(IVariable* pVariable) override;
|
||||
void SyncReflectedVarToIVar(IVariable* pVariable) override;
|
||||
void SyncIVarToReflectedVar(IVariable* pVariable) override;
|
||||
virtual void OnVariableChange(IVariable* var);
|
||||
void OnVariableChange(IVariable* var) override;
|
||||
CReflectedVar* GetReflectedVar() override { return m_reflectedVar.data(); }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
m_splineEntries.resize(m_splineEntries.size() + 1);
|
||||
SplineEntry& entry = m_splineEntries.back();
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
|
||||
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : nullptr);
|
||||
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : AZStd::string{});
|
||||
entry.pSpline = pSpline;
|
||||
|
||||
const int numKeys = pSpline->GetKeyCount();
|
||||
|
||||
@@ -159,15 +159,15 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// IKeyTimeSet Implementation
|
||||
virtual int GetKeyTimeCount() const;
|
||||
virtual float GetKeyTime(int index) const;
|
||||
virtual void MoveKeyTimes(int numChanges, int* indices, float scale, float offset, bool copyKeys);
|
||||
virtual bool GetKeyTimeSelected(int index) const;
|
||||
virtual void SetKeyTimeSelected(int index, bool selected);
|
||||
virtual int GetKeyCount(int index) const;
|
||||
virtual int GetKeyCountBound() const;
|
||||
virtual void BeginEdittingKeyTimes();
|
||||
virtual void EndEdittingKeyTimes();
|
||||
int GetKeyTimeCount() const override;
|
||||
float GetKeyTime(int index) const override;
|
||||
void MoveKeyTimes(int numChanges, int* indices, float scale, float offset, bool copyKeys) override;
|
||||
bool GetKeyTimeSelected(int index) const override;
|
||||
void SetKeyTimeSelected(int index, bool selected) override;
|
||||
int GetKeyCount(int index) const override;
|
||||
int GetKeyCountBound() const override;
|
||||
void BeginEdittingKeyTimes() override;
|
||||
void EndEdittingKeyTimes() override;
|
||||
|
||||
void SetEditLock(bool bLock) { m_bEditLock = bLock; }
|
||||
|
||||
@@ -361,8 +361,8 @@ public:
|
||||
SplineWidget(QWidget* parent);
|
||||
virtual ~SplineWidget();
|
||||
|
||||
void update() { QWidget::update(); }
|
||||
void update(const QRect& rect) { QWidget::update(rect); }
|
||||
void update() override { QWidget::update(); }
|
||||
void update(const QRect& rect) override { QWidget::update(rect); }
|
||||
|
||||
QPoint mapFromGlobal(const QPoint& point) const override { return QWidget::mapFromGlobal(point); }
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void setGeometry(const QRect& r) override { QWidget::setGeometry(r); }
|
||||
|
||||
void SetTimeRange(const Range& r) { m_timeRange = r; }
|
||||
void SetTimeMarker(float fTime);
|
||||
void SetTimeMarker(float fTime) override;
|
||||
float GetTimeMarker() const { return m_fTimeMarker; }
|
||||
|
||||
void SetZoom(float fZoom);
|
||||
@@ -113,7 +113,7 @@ protected:
|
||||
void OnLButtonUp(const QPoint& point, Qt::KeyboardModifiers modifiers);
|
||||
void OnRButtonDown(const QPoint& point, Qt::KeyboardModifiers modifiers);
|
||||
void OnRButtonUp(const QPoint& point, Qt::KeyboardModifiers modifiers);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
// Drawing functions
|
||||
float ClientToTime(int x);
|
||||
|
||||
@@ -8,11 +8,21 @@
|
||||
|
||||
#include "QtEditorApplication.h"
|
||||
|
||||
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
#include <AzFramework/XcbEventHandler.h>
|
||||
#endif
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
bool EditorQtApplication::nativeEventFilter(const QByteArray& , void* , long* )
|
||||
bool EditorQtApplication::nativeEventFilter([[maybe_unused]] const QByteArray& eventType, void* message, long*)
|
||||
{
|
||||
// TODO_KDAB_LINUX
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
AzFramework::XcbEventHandlerBus::Broadcast(&AzFramework::XcbEventHandler::HandleXcbEvent, static_cast<xcb_generic_event_t*>(message));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,6 +462,7 @@ class CCryDocManager
|
||||
CCrySingleDocTemplate* m_pDefTemplate = nullptr;
|
||||
public:
|
||||
CCryDocManager();
|
||||
virtual ~CCryDocManager() = default;
|
||||
CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
|
||||
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
|
||||
virtual void OnFileNew();
|
||||
|
||||
@@ -1135,7 +1135,6 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
{
|
||||
// if we're saving to a new folder, we need to copy the old folder tree.
|
||||
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
|
||||
pIPak->Lock();
|
||||
|
||||
const QString oldLevelPattern = QDir(oldLevelFolder).absoluteFilePath("*.*");
|
||||
const QString oldLevelName = Path::GetFile(GetLevelPathName());
|
||||
@@ -1199,7 +1198,6 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
QFile(filePath).setPermissions(QFile::ReadOther | QFile::WriteOther);
|
||||
});
|
||||
|
||||
pIPak->Unlock();
|
||||
}
|
||||
|
||||
// Save level to XML archive.
|
||||
@@ -1813,8 +1811,8 @@ bool CCryEditDoc::BackupBeforeSave(bool force)
|
||||
QString subFolder = theTime.toString("yyyy-MM-dd [HH.mm.ss]");
|
||||
|
||||
QString levelName = GetIEditor()->GetGameEngine()->GetLevelName();
|
||||
QString backupPath = saveBackupPath + "/" + subFolder + "/";
|
||||
gEnv->pCryPak->MakeDir(backupPath.toUtf8().data());
|
||||
QString backupPath = saveBackupPath + "/" + subFolder;
|
||||
AZ::IO::FileIOBase::GetDirectInstance()->CreatePath(backupPath.toUtf8().data());
|
||||
|
||||
QString sourcePath = QString::fromUtf8(resolvedLevelPath) + "/";
|
||||
|
||||
@@ -2028,7 +2026,7 @@ const char* CCryEditDoc::GetTemporaryLevelName() const
|
||||
void CCryEditDoc::DeleteTemporaryLevel()
|
||||
{
|
||||
QString tempLevelPath = (Path::GetEditingGameDataFolder() + "/Levels/" + GetTemporaryLevelName()).c_str();
|
||||
GetIEditor()->GetSystem()->GetIPak()->ClosePacks(tempLevelPath.toUtf8().data(), AZ::IO::IArchive::EPathResolutionRules::FLAGS_ADD_TRAILING_SLASH);
|
||||
GetIEditor()->GetSystem()->GetIPak()->ClosePacks(tempLevelPath.toUtf8().data());
|
||||
CFileUtil::Deltree(tempLevelPath.toUtf8().data(), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ CPythonScriptsDialog::CPythonScriptsDialog(QWidget* parent)
|
||||
GetGemSourcePathsVisitor(AZ::SettingsRegistryInterface& settingsRegistry)
|
||||
: m_settingsRegistry(settingsRegistry)
|
||||
{}
|
||||
|
||||
using AZ::SettingsRegistryInterface::Visitor::Visit;
|
||||
void Visit(AZStd::string_view path, AZStd::string_view, AZ::SettingsRegistryInterface::Type,
|
||||
AZStd::string_view value) override
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <EditorModularViewportCameraComposer.h>
|
||||
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraControllerRequestBus.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzFramework/Render/IntersectorInterface.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
@@ -34,10 +35,12 @@ namespace SandboxEditor
|
||||
: m_viewportId(viewportId)
|
||||
{
|
||||
EditorModularViewportCameraComposerNotificationBus::Handler::BusConnect(viewportId);
|
||||
Camera::EditorCameraNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
EditorModularViewportCameraComposer::~EditorModularViewportCameraComposer()
|
||||
{
|
||||
Camera::EditorCameraNotificationBus::Handler::BusDisconnect();
|
||||
EditorModularViewportCameraComposerNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -283,4 +286,22 @@ namespace SandboxEditor
|
||||
m_orbitCamera->SetOrbitInputChannelId(SandboxEditor::CameraOrbitChannelId());
|
||||
m_orbitDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraOrbitDollyChannelId());
|
||||
}
|
||||
|
||||
void EditorModularViewportCameraComposer::OnViewportViewEntityChanged(const AZ::EntityId& viewEntityId)
|
||||
{
|
||||
if (viewEntityId.IsValid())
|
||||
{
|
||||
AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity();
|
||||
AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM);
|
||||
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame,
|
||||
worldFromLocal);
|
||||
}
|
||||
else
|
||||
{
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::ClearReferenceFrame);
|
||||
}
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
|
||||
#include <AzFramework/Viewport/CameraInput.h>
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include <EditorModularViewportCameraComposerBus.h>
|
||||
#include <SandboxAPI.h>
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
//! Type responsible for building the editor's modular viewport camera controller.
|
||||
class EditorModularViewportCameraComposer : private EditorModularViewportCameraComposerNotificationBus::Handler
|
||||
class EditorModularViewportCameraComposer
|
||||
: private EditorModularViewportCameraComposerNotificationBus::Handler
|
||||
, private Camera::EditorCameraNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
SANDBOX_API explicit EditorModularViewportCameraComposer(AzFramework::ViewportId viewportId);
|
||||
@@ -32,6 +35,9 @@ namespace SandboxEditor
|
||||
// EditorModularViewportCameraComposerNotificationBus overrides ...
|
||||
void OnEditorModularViewportCameraComposerSettingsChanged() override;
|
||||
|
||||
// EditorCameraNotificationBus overrides ...
|
||||
void OnViewportViewEntityChanged(const AZ::EntityId& viewEntityId) override;
|
||||
|
||||
AZStd::shared_ptr<AzFramework::RotateCameraInput> m_firstPersonRotateCamera;
|
||||
AZStd::shared_ptr<AzFramework::PanCameraInput> m_firstPersonPanCamera;
|
||||
AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_firstPersonTranslateCamera;
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "EditorPreferencesPageViewportGeneral.h"
|
||||
#include "EditorViewportSettings.h"
|
||||
|
||||
#include <AzQtComponents/Components/StyleManager.h>
|
||||
|
||||
@@ -15,7 +17,6 @@
|
||||
#include "DisplaySettings.h"
|
||||
#include "Settings.h"
|
||||
|
||||
|
||||
void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& serialize)
|
||||
{
|
||||
serialize.Class<General>()
|
||||
@@ -23,7 +24,8 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
->Field("Sync2DViews", &General::m_sync2DViews)
|
||||
->Field("DefaultFOV", &General::m_defaultFOV)
|
||||
->Field("DefaultAspectRatio", &General::m_defaultAspectRatio)
|
||||
->Field("EnableContextMenu", &General::m_enableContextMenu);
|
||||
->Field("EnableContextMenu", &General::m_contextMenuEnabled)
|
||||
->Field("StickySelect", &General::m_stickySelectEnabled);
|
||||
|
||||
serialize.Class<Display>()
|
||||
->Version(1)
|
||||
@@ -46,10 +48,12 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
->Field("ShowGridGuide", &Display::m_showGridGuide)
|
||||
->Field("DisplayDimensions", &Display::m_displayDimension);
|
||||
|
||||
// clang-format off
|
||||
serialize.Class<MapViewport>()
|
||||
->Version(1)
|
||||
->Field("SwapXY", &MapViewport::m_swapXY)
|
||||
->Field("Resolution", &MapViewport::m_resolution);
|
||||
// clang-format on
|
||||
|
||||
serialize.Class<TextLabels>()
|
||||
->Version(1)
|
||||
@@ -80,31 +84,51 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
editContext->Class<General>("General Viewport Settings", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &General::m_sync2DViews, "Synchronize 2D Viewports", "Synchronize 2D Viewports")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &General::m_defaultFOV, "Perspective View FOV", "Perspective View FOV")
|
||||
->Attribute("Multiplier", RAD2DEG(1))
|
||||
->Attribute(AZ::Edit::Attributes::Min, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 120.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &General::m_defaultAspectRatio, "Perspective View Aspect Ratio", "Perspective View Aspect Ratio")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &General::m_enableContextMenu, "Enable Right-Click Context Menu", "Enable Right-Click Context Menu");
|
||||
->Attribute("Multiplier", RAD2DEG(1))
|
||||
->Attribute(AZ::Edit::Attributes::Min, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 120.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &General::m_defaultAspectRatio, "Perspective View Aspect Ratio",
|
||||
"Perspective View Aspect Ratio")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &General::m_contextMenuEnabled, "Enable Right-Click Context Menu",
|
||||
"Enable Right-Click Context Menu")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &General::m_stickySelectEnabled, "Enable Sticky Select", "Enable Sticky Select");
|
||||
|
||||
editContext->Class<Display>("Viewport Display Settings", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showSafeFrame, "Show 4:3 Aspect Ratio Frame", "Show 4:3 Aspect Ratio Frame")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightSelGeom, "Highlight Selected Geometry", "Highlight Selected Geometry")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightSelVegetation, "Highlight Selected Vegetation", "Highlight Selected Vegetation")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightOnMouseOver, "Highlight Geometry On Mouse Over", "Highlight Geometry On Mouse Over")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_hideMouseCursorWhenCaptured, "Hide Cursor When Captured", "Hide Mouse Cursor When Captured")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_showSafeFrame, "Show 4:3 Aspect Ratio Frame", "Show 4:3 Aspect Ratio Frame")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightSelGeom, "Highlight Selected Geometry", "Highlight Selected Geometry")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightSelVegetation, "Highlight Selected Vegetation",
|
||||
"Highlight Selected Vegetation")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_highlightOnMouseOver, "Highlight Geometry On Mouse Over",
|
||||
"Highlight Geometry On Mouse Over")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_hideMouseCursorWhenCaptured, "Hide Cursor When Captured",
|
||||
"Hide Mouse Cursor When Captured")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Display::m_dragSquareSize, "Drag Square Size", "Drag Square Size")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_displayLinks, "Display Object Links", "Display Object Links")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_displayTracks, "Display Animation Tracks", "Display Animation Tracks")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_alwaysShowRadii, "Always Show Radii", "Always Show Radii")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showBBoxes, "Show Bounding Boxes", "Show Bounding Boxes")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_drawEntityLabels, "Always Draw Entity Labels", "Always Draw Entity Labels")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showTriggerBounds, "Always Show Trigger Bounds", "Always Show Trigger Bounds")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_drawEntityLabels, "Always Draw Entity Labels", "Always Draw Entity Labels")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_showTriggerBounds, "Always Show Trigger Bounds", "Always Show Trigger Bounds")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showIcons, "Show Object Icons", "Show Object Icons")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_distanceScaleIcons, "Scale Object Icons with Distance", "Scale Object Icons with Distance")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showFrozenHelpers, "Show Helpers of Frozen Objects", "Show Helpers of Frozen Objects")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_distanceScaleIcons, "Scale Object Icons with Distance",
|
||||
"Scale Object Icons with Distance")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_showFrozenHelpers, "Show Helpers of Frozen Objects",
|
||||
"Show Helpers of Frozen Objects")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_fillSelectedShapes, "Fill Selected Shapes", "Fill Selected Shapes")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showGridGuide, "Show Snapping Grid Guide", "Show Snapping Grid Guide")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_displayDimension, "Display Dimension Figures", "Display Dimension Figures");
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &Display::m_displayDimension, "Display Dimension Figures", "Display Dimension Figures");
|
||||
|
||||
editContext->Class<MapViewport>("Map Viewport Settings", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &MapViewport::m_swapXY, "Swap X/Y Axis", "Swap X/Y Axis")
|
||||
@@ -113,42 +137,64 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
editContext->Class<TextLabels>("Text Label Settings", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &TextLabels::m_labelsOn, "Enabled", "Enabled")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &TextLabels::m_labelsDistance, "Distance", "Distance")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100000.f);
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100000.f);
|
||||
|
||||
editContext->Class<SelectionPreviewColor>("Selection Preview Color Settings", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_colorGroupBBox, "Group Bounding Box", "Group Bounding Box")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_colorEntityBBox, "Entity Bounding Box", "Entity Bounding Box")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_fBBoxAlpha, "Bounding Box Highlight Alpha", "Bounding Box Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_colorEntityBBox, "Entity Bounding Box", "Entity Bounding Box")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_fBBoxAlpha, "Bounding Box Highlight Alpha",
|
||||
"Bounding Box Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_geometryHighlightColor, "Geometry Color", "Geometry Color")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_solidBrushGeometryColor, "Solid Brush Geometry Color", "Solid Brush Geometry Color")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_fgeomAlpha, "Geometry Highlight Alpha", "Geometry Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_childObjectGeomAlpha, "Child Geometry Highlight Alpha", "Child Geometry Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f);
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Color, &SelectionPreviewColor::m_solidBrushGeometryColor, "Solid Brush Geometry Color",
|
||||
"Solid Brush Geometry Color")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_fgeomAlpha, "Geometry Highlight Alpha", "Geometry Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::SpinBox, &SelectionPreviewColor::m_childObjectGeomAlpha, "Child Geometry Highlight Alpha",
|
||||
"Child Geometry Highlight Alpha")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f);
|
||||
|
||||
editContext->Class<CEditorPreferencesPage_ViewportGeneral>("General Viewport Preferences", "General Viewport Preferences")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_general, "General Viewport Settings", "General Viewport Settings")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_display, "Viewport Display Settings", "Viewport Display Settings")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_map, "Map Viewport Settings", "Map Viewport Settings")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_textLabels, "Text Label Settings", "Text Label Settings")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_selectionPreviewColor, "Selection Preview Color Settings", "Selection Preview Color Settings");
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_general, "General Viewport Settings",
|
||||
"General Viewport Settings")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_display, "Viewport Display Settings",
|
||||
"Viewport Display Settings")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_map, "Map Viewport Settings",
|
||||
"Map Viewport Settings")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_textLabels, "Text Label Settings",
|
||||
"Text Label Settings")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGeneral::m_selectionPreviewColor,
|
||||
"Selection Preview Color Settings", "Selection Preview Color Settings");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CEditorPreferencesPage_ViewportGeneral::CEditorPreferencesPage_ViewportGeneral()
|
||||
{
|
||||
InitializeSettings();
|
||||
m_icon = QIcon(":/res/Viewport.svg");
|
||||
}
|
||||
|
||||
const char* CEditorPreferencesPage_ViewportGeneral::GetCategory()
|
||||
{
|
||||
return "Viewports";
|
||||
}
|
||||
|
||||
const char* CEditorPreferencesPage_ViewportGeneral::GetTitle()
|
||||
{
|
||||
return "Viewport";
|
||||
@@ -159,14 +205,25 @@ QIcon& CEditorPreferencesPage_ViewportGeneral::GetIcon()
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportGeneral::OnCancel()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
bool CEditorPreferencesPage_ViewportGeneral::OnQueryCancel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportGeneral::OnApply()
|
||||
{
|
||||
CDisplaySettings* ds = GetIEditor()->GetDisplaySettings();
|
||||
|
||||
gSettings.viewports.fDefaultAspectRatio = m_general.m_defaultAspectRatio;
|
||||
gSettings.viewports.fDefaultFov = m_general.m_defaultFOV;
|
||||
gSettings.viewports.bEnableContextMenu = m_general.m_enableContextMenu;
|
||||
gSettings.viewports.bEnableContextMenu = m_general.m_contextMenuEnabled;
|
||||
gSettings.viewports.bSync2DViews = m_general.m_sync2DViews;
|
||||
SandboxEditor::SetStickySelectEnabled(m_general.m_stickySelectEnabled);
|
||||
|
||||
gSettings.viewports.bShowSafeFrame = m_display.m_showSafeFrame;
|
||||
gSettings.viewports.bHighlightSelectedGeometry = m_display.m_highlightSelGeom;
|
||||
@@ -202,19 +259,19 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
|
||||
|
||||
gSettings.objectColorSettings.fChildGeomAlpha = m_selectionPreviewColor.m_childObjectGeomAlpha;
|
||||
gSettings.objectColorSettings.entityHighlight = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f));
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.groupHighlight = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f));
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.fBBoxAlpha = m_selectionPreviewColor.m_fBBoxAlpha;
|
||||
gSettings.objectColorSettings.fGeomAlpha = m_selectionPreviewColor.m_fgeomAlpha;
|
||||
gSettings.objectColorSettings.geometryHighlightColor = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f));
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f));
|
||||
gSettings.objectColorSettings.solidBrushGeometryColor = QColor(
|
||||
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f),
|
||||
static_cast<int>(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f),
|
||||
@@ -227,8 +284,9 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
|
||||
|
||||
m_general.m_defaultAspectRatio = gSettings.viewports.fDefaultAspectRatio;
|
||||
m_general.m_defaultFOV = gSettings.viewports.fDefaultFov;
|
||||
m_general.m_enableContextMenu = gSettings.viewports.bEnableContextMenu;
|
||||
m_general.m_contextMenuEnabled = gSettings.viewports.bEnableContextMenu;
|
||||
m_general.m_sync2DViews = gSettings.viewports.bSync2DViews;
|
||||
m_general.m_stickySelectEnabled = SandboxEditor::StickySelectEnabled();
|
||||
|
||||
m_display.m_showSafeFrame = gSettings.viewports.bShowSafeFrame;
|
||||
m_display.m_highlightSelGeom = gSettings.viewports.bHighlightSelectedGeometry;
|
||||
@@ -256,10 +314,22 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
|
||||
m_textLabels.m_labelsDistance = ds->GetLabelsDistance();
|
||||
|
||||
m_selectionPreviewColor.m_childObjectGeomAlpha = gSettings.objectColorSettings.fChildGeomAlpha;
|
||||
m_selectionPreviewColor.m_colorEntityBBox.Set(static_cast<float>(gSettings.objectColorSettings.entityHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast<float>(gSettings.objectColorSettings.groupHighlight.redF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast<float>(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_colorEntityBBox.Set(
|
||||
static_cast<float>(gSettings.objectColorSettings.entityHighlight.redF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.entityHighlight.greenF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_colorGroupBBox.Set(
|
||||
static_cast<float>(gSettings.objectColorSettings.groupHighlight.redF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.groupHighlight.greenF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_fBBoxAlpha = gSettings.objectColorSettings.fBBoxAlpha;
|
||||
m_selectionPreviewColor.m_fgeomAlpha = gSettings.objectColorSettings.fGeomAlpha;
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.Set(static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_geometryHighlightColor.Set(
|
||||
static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.redF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.greenF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f);
|
||||
m_selectionPreviewColor.m_solidBrushGeometryColor.Set(
|
||||
static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.redF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()),
|
||||
static_cast<float>(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f);
|
||||
}
|
||||
|
||||
@@ -5,18 +5,17 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Include/IPreferencesPage.h"
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <QIcon>
|
||||
|
||||
|
||||
class CEditorPreferencesPage_ViewportGeneral
|
||||
: public IPreferencesPage
|
||||
class CEditorPreferencesPage_ViewportGeneral : public IPreferencesPage
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(CEditorPreferencesPage_ViewportGeneral, "{8511FF7F-F774-47E1-A99B-3DE3A867E403}", IPreferencesPage)
|
||||
@@ -26,12 +25,12 @@ public:
|
||||
CEditorPreferencesPage_ViewportGeneral();
|
||||
virtual ~CEditorPreferencesPage_ViewportGeneral() = default;
|
||||
|
||||
virtual const char* GetCategory() override { return "Viewports"; }
|
||||
virtual const char* GetCategory() override;
|
||||
virtual const char* GetTitle() override;
|
||||
virtual QIcon& GetIcon() override;
|
||||
virtual void OnApply() override;
|
||||
virtual void OnCancel() override {}
|
||||
virtual bool OnQueryCancel() override { return true; }
|
||||
virtual void OnCancel() override;
|
||||
virtual bool OnQueryCancel() override;
|
||||
|
||||
private:
|
||||
void InitializeSettings();
|
||||
@@ -43,7 +42,8 @@ private:
|
||||
bool m_sync2DViews;
|
||||
float m_defaultFOV;
|
||||
float m_defaultAspectRatio;
|
||||
bool m_enableContextMenu;
|
||||
bool m_contextMenuEnabled;
|
||||
bool m_stickySelectEnabled;
|
||||
};
|
||||
|
||||
struct Display
|
||||
@@ -106,5 +106,3 @@ private:
|
||||
SelectionPreviewColor m_selectionPreviewColor;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -34,10 +34,14 @@ namespace EditorInternal
|
||||
: ToolsApplication(argc, argv)
|
||||
{
|
||||
EditorToolsApplicationRequests::Bus::Handler::BusConnect();
|
||||
AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler::BusConnect();
|
||||
AzToolsFramework::ViewportInteraction::EditorViewportInputTimeNowRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
EditorToolsApplication::~EditorToolsApplication()
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::EditorViewportInputTimeNowRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler::BusDisconnect();
|
||||
EditorToolsApplicationRequests::Bus::Handler::BusDisconnect();
|
||||
Stop();
|
||||
}
|
||||
@@ -48,7 +52,6 @@ namespace EditorInternal
|
||||
return m_StartupAborted;
|
||||
}
|
||||
|
||||
|
||||
void EditorToolsApplication::RegisterCoreComponents()
|
||||
{
|
||||
AzToolsFramework::ToolsApplication::RegisterCoreComponents();
|
||||
@@ -274,5 +277,14 @@ namespace EditorInternal
|
||||
Exit();
|
||||
}
|
||||
|
||||
}
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers EditorToolsApplication::QueryKeyboardModifiers()
|
||||
{
|
||||
return AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
AZStd::chrono::milliseconds EditorToolsApplication::EditorViewportInputTimeNow()
|
||||
{
|
||||
const auto now = AZStd::chrono::high_resolution_clock::now();
|
||||
return AZStd::chrono::time_point_cast<AZStd::chrono::milliseconds>(now).time_since_epoch();
|
||||
}
|
||||
} // namespace EditorInternal
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
#include "Core/EditorMetricsPlainTextNameRegistration.h"
|
||||
#include "EditorToolsApplicationAPI.h"
|
||||
@@ -19,6 +21,8 @@ namespace EditorInternal
|
||||
class EditorToolsApplication
|
||||
: public AzToolsFramework::ToolsApplication
|
||||
, public EditorToolsApplicationRequests::Bus::Handler
|
||||
, public AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler
|
||||
, public AzToolsFramework::ViewportInteraction::EditorViewportInputTimeNowRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
EditorToolsApplication(int* argc, char*** argv);
|
||||
@@ -28,7 +32,7 @@ namespace EditorInternal
|
||||
|
||||
void RegisterCoreComponents() override;
|
||||
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const;
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
|
||||
|
||||
void StartCommon(AZ::Entity* systemEntity) override;
|
||||
|
||||
@@ -44,6 +48,12 @@ namespace EditorInternal
|
||||
void CreateReflectionManager() override;
|
||||
void Reflect(AZ::ReflectContext* context) override;
|
||||
|
||||
// EditorModifierKeyRequestBus overrides ...
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers QueryKeyboardModifiers() override;
|
||||
|
||||
// EditorViewportInputTimeNowRequestBus overrides ...
|
||||
AZStd::chrono::milliseconds EditorViewportInputTimeNow() override;
|
||||
|
||||
protected:
|
||||
// From EditorToolsApplicationRequests
|
||||
bool OpenLevel(AZStd::string_view levelName) override;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace SandboxEditor
|
||||
constexpr AZStd::string_view AngleSnappingSetting = "/Amazon/Preferences/Editor/AngleSnapping";
|
||||
constexpr AZStd::string_view AngleSizeSetting = "/Amazon/Preferences/Editor/AngleSize";
|
||||
constexpr AZStd::string_view ShowGridSetting = "/Amazon/Preferences/Editor/ShowGrid";
|
||||
constexpr AZStd::string_view StickySelectSetting = "/Amazon/Preferences/Editor/StickySelect";
|
||||
constexpr AZStd::string_view ManipulatorLineBoundWidthSetting = "/Amazon/Preferences/Editor/Manipulator/LineBoundWidth";
|
||||
constexpr AZStd::string_view ManipulatorCircleBoundWidthSetting = "/Amazon/Preferences/Editor/Manipulator/CircleBoundWidth";
|
||||
constexpr AZStd::string_view CameraTranslateSpeedSetting = "/Amazon/Preferences/Editor/Camera/TranslateSpeed";
|
||||
@@ -158,6 +159,16 @@ namespace SandboxEditor
|
||||
SetRegistry(ShowGridSetting, showing);
|
||||
}
|
||||
|
||||
bool StickySelectEnabled()
|
||||
{
|
||||
return GetRegistry(StickySelectSetting, false);
|
||||
}
|
||||
|
||||
void SetStickySelectEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(StickySelectSetting, enabled);
|
||||
}
|
||||
|
||||
float ManipulatorLineBoundWidth()
|
||||
{
|
||||
return aznumeric_cast<float>(GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace SandboxEditor
|
||||
SANDBOX_API bool ShowingGrid();
|
||||
SANDBOX_API void SetShowingGrid(bool showing);
|
||||
|
||||
SANDBOX_API bool StickySelectEnabled();
|
||||
SANDBOX_API void SetStickySelectEnabled(bool enabled);
|
||||
|
||||
SANDBOX_API float ManipulatorLineBoundWidth();
|
||||
SANDBOX_API void SetManipulatorLineBoundWidth(float lineBoundWidth);
|
||||
|
||||
|
||||
@@ -744,11 +744,15 @@ void EditorViewportWidget::RenderAll()
|
||||
{
|
||||
namespace AztfVi = AzToolsFramework::ViewportInteraction;
|
||||
|
||||
AztfVi::KeyboardModifiers keyboardModifiers;
|
||||
AztfVi::EditorModifierKeyRequestBus::BroadcastResult(
|
||||
keyboardModifiers, &AztfVi::EditorModifierKeyRequestBus::Events::QueryKeyboardModifiers);
|
||||
|
||||
m_debugDisplay->DepthTestOff();
|
||||
m_manipulatorManager->DrawManipulators(
|
||||
*m_debugDisplay, GetCameraState(),
|
||||
BuildMouseInteractionInternal(
|
||||
AztfVi::MouseButtons(AztfVi::TranslateMouseButtons(QGuiApplication::mouseButtons())), QueryKeyboardModifiers(),
|
||||
AztfVi::MouseButtons(AztfVi::TranslateMouseButtons(QGuiApplication::mouseButtons())), keyboardModifiers,
|
||||
BuildMousePick(WidgetToViewport(mapFromGlobal(QCursor::pos())))));
|
||||
m_debugDisplay->DepthTestOn();
|
||||
}
|
||||
@@ -959,12 +963,13 @@ QWidget* EditorViewportWidget::GetWidgetForViewportContextMenu()
|
||||
|
||||
bool EditorViewportWidget::ShowingWorldSpace()
|
||||
{
|
||||
return QueryKeyboardModifiers().Shift();
|
||||
}
|
||||
namespace AztfVi = AzToolsFramework::ViewportInteraction;
|
||||
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers EditorViewportWidget::QueryKeyboardModifiers()
|
||||
{
|
||||
return AzToolsFramework::ViewportInteraction::BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
AztfVi::KeyboardModifiers keyboardModifiers;
|
||||
AztfVi::EditorModifierKeyRequestBus::BroadcastResult(
|
||||
keyboardModifiers, &AztfVi::EditorModifierKeyRequestBus::Events::QueryKeyboardModifiers);
|
||||
|
||||
return keyboardModifiers.Shift();
|
||||
}
|
||||
|
||||
void EditorViewportWidget::SetViewportId(int id)
|
||||
@@ -1039,7 +1044,6 @@ void EditorViewportWidget::ConnectViewportInteractionRequestBus()
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
|
||||
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusConnect(GetViewportId());
|
||||
AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler::BusConnect();
|
||||
m_viewportUi.ConnectViewportUiBus(GetViewportId());
|
||||
|
||||
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusConnect();
|
||||
@@ -1050,7 +1054,6 @@ void EditorViewportWidget::DisconnectViewportInteractionRequestBus()
|
||||
AzFramework::InputSystemCursorConstraintRequestBus::Handler::BusDisconnect();
|
||||
|
||||
m_viewportUi.DisconnectViewportUiBus();
|
||||
AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -2425,7 +2428,7 @@ void EditorViewportWidget::RestoreViewportAfterGameMode()
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("CryLegacy", false, "Not restoring the editor viewport camera is currently unsupported");
|
||||
AZ_Warning("CryLegacy", false, "Not restoring the editor viewport camera is currently unsupported");
|
||||
SetViewTM(preGameModeViewTM);
|
||||
}
|
||||
}
|
||||
@@ -2522,6 +2525,11 @@ float EditorViewportSettings::ManipulatorCircleBoundWidth() const
|
||||
return SandboxEditor::ManipulatorCircleBoundWidth();
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::StickySelectEnabled() const
|
||||
{
|
||||
return SandboxEditor::StickySelectEnabled();
|
||||
}
|
||||
|
||||
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
|
||||
|
||||
bool EditorViewportWidget::ShouldPreviewFullscreen() const
|
||||
|
||||
@@ -77,6 +77,7 @@ struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::Vi
|
||||
float AngleStep() const override;
|
||||
float ManipulatorLineBoundWidth() const override;
|
||||
float ManipulatorCircleBoundWidth() const override;
|
||||
bool StickySelectEnabled() const override;
|
||||
};
|
||||
|
||||
// EditorViewportWidget window
|
||||
@@ -91,7 +92,6 @@ class SANDBOX_API EditorViewportWidget final
|
||||
, private AzFramework::InputSystemCursorConstraintRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::EditorEntityViewportInteractionRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::EditorModifierKeyRequestBus::Handler
|
||||
, private AzFramework::AssetCatalogEventBus::Handler
|
||||
, private AZ::RPI::SceneNotificationBus::Handler
|
||||
{
|
||||
@@ -211,9 +211,6 @@ private:
|
||||
// EditorEntityViewportInteractionRequestBus overrides ...
|
||||
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntities) override;
|
||||
|
||||
// EditorModifierKeyRequestBus overrides ...
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers QueryKeyboardModifiers() override;
|
||||
|
||||
// Camera::EditorCameraRequestBus overrides ...
|
||||
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
|
||||
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace Export
|
||||
public:
|
||||
CMesh();
|
||||
|
||||
virtual int GetFaceCount() const { return static_cast<int>(m_faces.size()); }
|
||||
virtual const Face* GetFaceBuffer() const { return m_faces.size() ? &m_faces[0] : 0; }
|
||||
int GetFaceCount() const override { return static_cast<int>(m_faces.size()); }
|
||||
const Face* GetFaceBuffer() const override { return !m_faces.empty() ? &m_faces[0] : nullptr; }
|
||||
|
||||
private:
|
||||
std::vector<Face> m_faces;
|
||||
@@ -54,13 +54,13 @@ namespace Export
|
||||
CObject(const char* pName);
|
||||
|
||||
int GetVertexCount() const override { return static_cast<int>(m_vertices.size()); }
|
||||
const Vector3D* GetVertexBuffer() const override { return m_vertices.size() ? &m_vertices[0] : nullptr; }
|
||||
const Vector3D* GetVertexBuffer() const override { return !m_vertices.empty() ? &m_vertices[0] : nullptr; }
|
||||
|
||||
int GetNormalCount() const override { return static_cast<int>(m_normals.size()); }
|
||||
const Vector3D* GetNormalBuffer() const override { return m_normals.size() ? &m_normals[0] : nullptr; }
|
||||
const Vector3D* GetNormalBuffer() const override { return !m_normals.empty() ? &m_normals[0] : nullptr; }
|
||||
|
||||
int GetTexCoordCount() const override { return static_cast<int>(m_texCoords.size()); }
|
||||
const UV* GetTexCoordBuffer() const override { return m_texCoords.size() ? &m_texCoords[0] : nullptr; }
|
||||
const UV* GetTexCoordBuffer() const override { return !m_texCoords.empty() ? &m_texCoords[0] : nullptr; }
|
||||
|
||||
int GetMeshCount() const override { return static_cast<int>(m_meshes.size()); }
|
||||
Mesh* GetMesh(int index) const override { return m_meshes[index]; }
|
||||
@@ -68,9 +68,9 @@ namespace Export
|
||||
size_t MeshHash() const override{return m_MeshHash; }
|
||||
|
||||
void SetMaterialName(const char* pName);
|
||||
virtual int GetEntityAnimationDataCount() const {return static_cast<int>(m_entityAnimData.size()); }
|
||||
virtual const EntityAnimData* GetEntityAnimationData(int index) const {return &m_entityAnimData[index]; }
|
||||
virtual void SetEntityAnimationData(EntityAnimData entityData){ m_entityAnimData.push_back(entityData); };
|
||||
int GetEntityAnimationDataCount() const override {return static_cast<int>(m_entityAnimData.size()); }
|
||||
const EntityAnimData* GetEntityAnimationData(int index) const override {return &m_entityAnimData[index]; }
|
||||
void SetEntityAnimationData(EntityAnimData entityData) override{ m_entityAnimData.push_back(entityData); };
|
||||
void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; };
|
||||
CBaseObject* GetLastObjectPtr(){return m_pLastObject; };
|
||||
|
||||
@@ -92,9 +92,11 @@ namespace Export
|
||||
: public IData
|
||||
{
|
||||
public:
|
||||
virtual int GetObjectCount() const { return static_cast<int>(m_objects.size()); }
|
||||
virtual Object* GetObject(int index) const { return m_objects[index]; }
|
||||
virtual Object* AddObject(const char* objectName);
|
||||
virtual ~CData() = default;
|
||||
|
||||
int GetObjectCount() const override { return static_cast<int>(m_objects.size()); }
|
||||
Object* GetObject(int index) const override { return m_objects[index]; }
|
||||
Object* AddObject(const char* objectName) override;
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
@@ -117,7 +119,7 @@ public:
|
||||
|
||||
//! Register exporter
|
||||
//! return true if succeed, otherwise false
|
||||
virtual bool RegisterExporter(IExporter* pExporter);
|
||||
bool RegisterExporter(IExporter* pExporter) override;
|
||||
|
||||
//! Export specified geometry
|
||||
//! return true if succeed, otherwise false
|
||||
@@ -139,15 +141,15 @@ public:
|
||||
|
||||
//! Exports the stat obj to the obj file specified
|
||||
//! returns true if succeeded, otherwise false
|
||||
virtual bool ExportSingleStatObj(IStatObj* pStatObj, const char* filename);
|
||||
bool ExportSingleStatObj(IStatObj* pStatObj, const char* filename) override;
|
||||
|
||||
void SetBakedKeysSequenceExport(bool bBaked){m_bBakedKeysSequenceExport = bBaked; };
|
||||
|
||||
void SaveNodeKeysTimeToXML();
|
||||
|
||||
private:
|
||||
void AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh, Matrix34A* pTm = 0);
|
||||
bool AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm = 0);
|
||||
void AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh, Matrix34A* pTm = nullptr);
|
||||
bool AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm = nullptr);
|
||||
bool AddMeshes(Export::CObject* pObj);
|
||||
bool AddObject(CBaseObject* pBaseObj);
|
||||
void SolveHierarchy();
|
||||
|
||||
@@ -432,25 +432,6 @@ void CGameExporter::ExportFileList(const QString& path, const QString& levelName
|
||||
newFileNode->setAttr("src", handle.m_filename.data());
|
||||
newFileNode->setAttr("dest", handle.m_filename.data());
|
||||
newFileNode->setAttr("size", handle.m_fileDesc.nSize);
|
||||
|
||||
unsigned char md5[16];
|
||||
AZStd::string filenameToHash = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data();
|
||||
filenameToHash += "/";
|
||||
filenameToHash += AZStd::string{ handle.m_filename.data(), handle.m_filename.size() };
|
||||
if (gEnv->pCryPak->ComputeMD5(filenameToHash.data(), md5))
|
||||
{
|
||||
char md5string[33];
|
||||
sprintf_s(md5string, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
md5[0], md5[1], md5[2], md5[3],
|
||||
md5[4], md5[5], md5[6], md5[7],
|
||||
md5[8], md5[9], md5[10], md5[11],
|
||||
md5[12], md5[13], md5[14], md5[15]);
|
||||
newFileNode->setAttr("md5", md5string);
|
||||
}
|
||||
else
|
||||
{
|
||||
newFileNode->setAttr("md5", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (handle = gEnv->pCryPak->FindNext(handle));
|
||||
|
||||
+141
-141
@@ -79,70 +79,70 @@ public:
|
||||
|
||||
|
||||
void SetGameEngine(CGameEngine* ge);
|
||||
void DeleteThis() { delete this; };
|
||||
IEditorClassFactory* GetClassFactory();
|
||||
CEditorCommandManager* GetCommandManager() { return m_pCommandManager; };
|
||||
ICommandManager* GetICommandManager() { return m_pCommandManager; }
|
||||
void ExecuteCommand(const char* sCommand, ...);
|
||||
void ExecuteCommand(const QString& command);
|
||||
void SetDocument(CCryEditDoc* pDoc);
|
||||
CCryEditDoc* GetDocument() const;
|
||||
void DeleteThis() override { delete this; };
|
||||
IEditorClassFactory* GetClassFactory() override;
|
||||
CEditorCommandManager* GetCommandManager() override { return m_pCommandManager; };
|
||||
ICommandManager* GetICommandManager() override { return m_pCommandManager; }
|
||||
void ExecuteCommand(const char* sCommand, ...) override;
|
||||
void ExecuteCommand(const QString& command) override;
|
||||
void SetDocument(CCryEditDoc* pDoc) override;
|
||||
CCryEditDoc* GetDocument() const override;
|
||||
bool IsLevelLoaded() const override;
|
||||
void SetModifiedFlag(bool modified = true);
|
||||
void SetModifiedModule(EModifiedModule eModifiedModule, bool boSet = true);
|
||||
bool IsLevelExported() const;
|
||||
bool SetLevelExported(bool boExported = true);
|
||||
void SetModifiedFlag(bool modified = true) override;
|
||||
void SetModifiedModule(EModifiedModule eModifiedModule, bool boSet = true) override;
|
||||
bool IsLevelExported() const override;
|
||||
bool SetLevelExported(bool boExported = true) override;
|
||||
void InitFinished();
|
||||
bool IsModified();
|
||||
bool IsInitialized() const{ return m_bInitialized; }
|
||||
bool SaveDocument();
|
||||
ISystem* GetSystem();
|
||||
void WriteToConsole(const char* string) { CLogFile::WriteLine(string); };
|
||||
void WriteToConsole(const QString& string) { CLogFile::WriteLine(string); };
|
||||
bool IsModified() override;
|
||||
bool IsInitialized() const override{ return m_bInitialized; }
|
||||
bool SaveDocument() override;
|
||||
ISystem* GetSystem() override;
|
||||
void WriteToConsole(const char* string) override { CLogFile::WriteLine(string); };
|
||||
void WriteToConsole(const QString& string) override { CLogFile::WriteLine(string); };
|
||||
// Change the message in the status bar
|
||||
void SetStatusText(const QString& pszString);
|
||||
virtual IMainStatusBar* GetMainStatusBar() override;
|
||||
bool ShowConsole([[maybe_unused]] bool show)
|
||||
void SetStatusText(const QString& pszString) override;
|
||||
IMainStatusBar* GetMainStatusBar() override;
|
||||
bool ShowConsole([[maybe_unused]] bool show) override
|
||||
{
|
||||
//if (AfxGetMainWnd())return ((CMainFrame *) (AfxGetMainWnd()))->ShowConsole(show);
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetConsoleVar(const char* var, float value);
|
||||
float GetConsoleVar(const char* var);
|
||||
void SetConsoleVar(const char* var, float value) override;
|
||||
float GetConsoleVar(const char* var) override;
|
||||
//! Query main window of the editor
|
||||
QMainWindow* GetEditorMainWindow() const override
|
||||
{
|
||||
return MainWindow::instance();
|
||||
};
|
||||
|
||||
QString GetPrimaryCDFolder();
|
||||
QString GetPrimaryCDFolder() override;
|
||||
QString GetLevelName() override;
|
||||
QString GetLevelFolder();
|
||||
QString GetLevelDataFolder();
|
||||
QString GetSearchPath(EEditorPathName path);
|
||||
QString GetResolvedUserFolder();
|
||||
bool ExecuteConsoleApp(const QString& CommandLine, QString& OutputText, bool bNoTimeOut = false, bool bShowWindow = false);
|
||||
virtual bool IsInGameMode() override;
|
||||
virtual void SetInGameMode(bool inGame) override;
|
||||
virtual bool IsInSimulationMode() override;
|
||||
virtual bool IsInTestMode() override;
|
||||
virtual bool IsInPreviewMode() override;
|
||||
virtual bool IsInConsolewMode() override;
|
||||
virtual bool IsInLevelLoadTestMode() override;
|
||||
virtual bool IsInMatEditMode() override { return m_bMatEditMode; }
|
||||
QString GetLevelFolder() override;
|
||||
QString GetLevelDataFolder() override;
|
||||
QString GetSearchPath(EEditorPathName path) override;
|
||||
QString GetResolvedUserFolder() override;
|
||||
bool ExecuteConsoleApp(const QString& CommandLine, QString& OutputText, bool bNoTimeOut = false, bool bShowWindow = false) override;
|
||||
bool IsInGameMode() override;
|
||||
void SetInGameMode(bool inGame) override;
|
||||
bool IsInSimulationMode() override;
|
||||
bool IsInTestMode() override;
|
||||
bool IsInPreviewMode() override;
|
||||
bool IsInConsolewMode() override;
|
||||
bool IsInLevelLoadTestMode() override;
|
||||
bool IsInMatEditMode() override { return m_bMatEditMode; }
|
||||
|
||||
//! Enables/Disable updates of editor.
|
||||
void EnableUpdate(bool enable) { m_bUpdates = enable; };
|
||||
void EnableUpdate(bool enable) override { m_bUpdates = enable; };
|
||||
//! Enable/Disable accelerator table, (Enabled by default).
|
||||
void EnableAcceleratos(bool bEnable);
|
||||
CGameEngine* GetGameEngine() { return m_pGameEngine; };
|
||||
CDisplaySettings* GetDisplaySettings() { return m_pDisplaySettings; };
|
||||
const SGizmoParameters& GetGlobalGizmoParameters();
|
||||
CBaseObject* NewObject(const char* typeName, const char* fileName = "", const char* name = "", float x = 0.0f, float y = 0.0f, float z = 0.0f, bool modifyDoc = true);
|
||||
void DeleteObject(CBaseObject* obj);
|
||||
CBaseObject* CloneObject(CBaseObject* obj);
|
||||
IObjectManager* GetObjectManager();
|
||||
void EnableAcceleratos(bool bEnable) override;
|
||||
CGameEngine* GetGameEngine() override { return m_pGameEngine; };
|
||||
CDisplaySettings* GetDisplaySettings() override { return m_pDisplaySettings; };
|
||||
const SGizmoParameters& GetGlobalGizmoParameters() override;
|
||||
CBaseObject* NewObject(const char* typeName, const char* fileName = "", const char* name = "", float x = 0.0f, float y = 0.0f, float z = 0.0f, bool modifyDoc = true) override;
|
||||
void DeleteObject(CBaseObject* obj) override;
|
||||
CBaseObject* CloneObject(CBaseObject* obj) override;
|
||||
IObjectManager* GetObjectManager() override;
|
||||
// This will return a null pointer if CrySystem is not loaded before
|
||||
// Global Sandbox Settings are loaded from the registry before CrySystem
|
||||
// At that stage GetSettingsManager will return null and xml node in
|
||||
@@ -150,27 +150,27 @@ public:
|
||||
// After m_IEditor is created and CrySystem loaded, it is possible
|
||||
// to feed memory node with all necessary data needed for export
|
||||
// (gSettings.Load() and CXTPDockingPaneManager/CXTPDockingPaneLayout Sandbox layout management)
|
||||
CSettingsManager* GetSettingsManager();
|
||||
CSelectionGroup* GetSelection();
|
||||
int ClearSelection();
|
||||
CBaseObject* GetSelectedObject();
|
||||
void SelectObject(CBaseObject* obj);
|
||||
void LockSelection(bool bLock);
|
||||
bool IsSelectionLocked();
|
||||
CSettingsManager* GetSettingsManager() override;
|
||||
CSelectionGroup* GetSelection() override;
|
||||
int ClearSelection() override;
|
||||
CBaseObject* GetSelectedObject() override;
|
||||
void SelectObject(CBaseObject* obj) override;
|
||||
void LockSelection(bool bLock) override;
|
||||
bool IsSelectionLocked() override;
|
||||
|
||||
IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType);
|
||||
CMusicManager* GetMusicManager() { return m_pMusicManager; };
|
||||
IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType) override;
|
||||
CMusicManager* GetMusicManager() override { return m_pMusicManager; };
|
||||
|
||||
IEditorFileMonitor* GetFileMonitor() override;
|
||||
void RegisterEventLoopHook(IEventLoopHook* pHook) override;
|
||||
void UnregisterEventLoopHook(IEventLoopHook* pHook) override;
|
||||
IIconManager* GetIconManager();
|
||||
float GetTerrainElevation(float x, float y);
|
||||
Editor::EditorQtApplication* GetEditorQtApplication() { return m_QtApplication; }
|
||||
IIconManager* GetIconManager() override;
|
||||
float GetTerrainElevation(float x, float y) override;
|
||||
Editor::EditorQtApplication* GetEditorQtApplication() override { return m_QtApplication; }
|
||||
const QColor& GetColorByName(const QString& name) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IMovieSystem* GetMovieSystem()
|
||||
IMovieSystem* GetMovieSystem() override
|
||||
{
|
||||
if (m_pSystem)
|
||||
{
|
||||
@@ -179,37 +179,37 @@ public:
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
CPluginManager* GetPluginManager() { return m_pPluginManager; }
|
||||
CViewManager* GetViewManager();
|
||||
CViewport* GetActiveView();
|
||||
void SetActiveView(CViewport* viewport);
|
||||
CPluginManager* GetPluginManager() override { return m_pPluginManager; }
|
||||
CViewManager* GetViewManager() override;
|
||||
CViewport* GetActiveView() override;
|
||||
void SetActiveView(CViewport* viewport) override;
|
||||
|
||||
CLevelIndependentFileMan* GetLevelIndependentFileMan() { return m_pLevelIndependentFileMan; }
|
||||
CLevelIndependentFileMan* GetLevelIndependentFileMan() override { return m_pLevelIndependentFileMan; }
|
||||
|
||||
void UpdateViews(int flags, const AABB* updateRegion);
|
||||
void ResetViews();
|
||||
void ReloadTrackView();
|
||||
Vec3 GetMarkerPosition() { return m_marker; };
|
||||
void SetMarkerPosition(const Vec3& pos) { m_marker = pos; };
|
||||
void SetSelectedRegion(const AABB& box);
|
||||
void GetSelectedRegion(AABB& box);
|
||||
void UpdateViews(int flags, const AABB* updateRegion) override;
|
||||
void ResetViews() override;
|
||||
void ReloadTrackView() override;
|
||||
Vec3 GetMarkerPosition() override { return m_marker; };
|
||||
void SetMarkerPosition(const Vec3& pos) override { m_marker = pos; };
|
||||
void SetSelectedRegion(const AABB& box) override;
|
||||
void GetSelectedRegion(AABB& box) override;
|
||||
bool AddToolbarItem(uint8 iId, IUIEvent* pIHandler);
|
||||
void SetDataModified();
|
||||
void SetOperationMode(EOperationMode mode);
|
||||
EOperationMode GetOperationMode();
|
||||
void SetDataModified() override;
|
||||
void SetOperationMode(EOperationMode mode) override;
|
||||
EOperationMode GetOperationMode() override;
|
||||
|
||||
ITransformManipulator* ShowTransformManipulator(bool bShow);
|
||||
ITransformManipulator* GetTransformManipulator();
|
||||
void SetAxisConstraints(AxisConstrains axis);
|
||||
AxisConstrains GetAxisConstrains();
|
||||
void SetAxisVectorLock(bool bAxisVectorLock) { m_bAxisVectorLock = bAxisVectorLock; }
|
||||
bool IsAxisVectorLocked() { return m_bAxisVectorLock; }
|
||||
void SetTerrainAxisIgnoreObjects(bool bIgnore);
|
||||
bool IsTerrainAxisIgnoreObjects();
|
||||
void SetReferenceCoordSys(RefCoordSys refCoords);
|
||||
RefCoordSys GetReferenceCoordSys();
|
||||
XmlNodeRef FindTemplate(const QString& templateName);
|
||||
void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
|
||||
ITransformManipulator* ShowTransformManipulator(bool bShow) override;
|
||||
ITransformManipulator* GetTransformManipulator() override;
|
||||
void SetAxisConstraints(AxisConstrains axis) override;
|
||||
AxisConstrains GetAxisConstrains() override;
|
||||
void SetAxisVectorLock(bool bAxisVectorLock) override { m_bAxisVectorLock = bAxisVectorLock; }
|
||||
bool IsAxisVectorLocked() override { return m_bAxisVectorLock; }
|
||||
void SetTerrainAxisIgnoreObjects(bool bIgnore) override;
|
||||
bool IsTerrainAxisIgnoreObjects() override;
|
||||
void SetReferenceCoordSys(RefCoordSys refCoords) override;
|
||||
RefCoordSys GetReferenceCoordSys() override;
|
||||
XmlNodeRef FindTemplate(const QString& templateName) override;
|
||||
void AddTemplate(const QString& templateName, XmlNodeRef& tmpl) override;
|
||||
|
||||
const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
|
||||
|
||||
@@ -220,87 +220,87 @@ public:
|
||||
*/
|
||||
QWidget* FindView(QString viewClassName) override;
|
||||
|
||||
bool CloseView(const char* sViewClassName);
|
||||
bool SetViewFocus(const char* sViewClassName);
|
||||
bool CloseView(const char* sViewClassName) override;
|
||||
bool SetViewFocus(const char* sViewClassName) override;
|
||||
|
||||
virtual QWidget* OpenWinWidget(WinWidgetId openId) override;
|
||||
virtual WinWidget::WinWidgetManager* GetWinWidgetManager() const override;
|
||||
QWidget* OpenWinWidget(WinWidgetId openId) override;
|
||||
WinWidget::WinWidgetManager* GetWinWidgetManager() const override;
|
||||
|
||||
// close ALL panels related to classId, used when unloading plugins.
|
||||
void CloseView(const GUID& classId);
|
||||
void CloseView(const GUID& classId) override;
|
||||
bool SelectColor(QColor &color, QWidget *parent = 0) override;
|
||||
void Update();
|
||||
SFileVersion GetFileVersion() { return m_fileVersion; };
|
||||
SFileVersion GetProductVersion() { return m_productVersion; };
|
||||
SFileVersion GetFileVersion() override { return m_fileVersion; };
|
||||
SFileVersion GetProductVersion() override { return m_productVersion; };
|
||||
//! Get shader enumerator.
|
||||
CUndoManager* GetUndoManager() { return m_pUndoManager; };
|
||||
void BeginUndo();
|
||||
void RestoreUndo(bool undo);
|
||||
void AcceptUndo(const QString& name);
|
||||
void CancelUndo();
|
||||
void SuperBeginUndo();
|
||||
void SuperAcceptUndo(const QString& name);
|
||||
void SuperCancelUndo();
|
||||
void SuspendUndo();
|
||||
void ResumeUndo();
|
||||
void Undo();
|
||||
void Redo();
|
||||
bool IsUndoRecording();
|
||||
bool IsUndoSuspended();
|
||||
void RecordUndo(IUndoObject* obj);
|
||||
bool FlushUndo(bool isShowMessage = false);
|
||||
bool ClearLastUndoSteps(int steps);
|
||||
bool ClearRedoStack();
|
||||
CUndoManager* GetUndoManager() override { return m_pUndoManager; };
|
||||
void BeginUndo() override;
|
||||
void RestoreUndo(bool undo) override;
|
||||
void AcceptUndo(const QString& name) override;
|
||||
void CancelUndo() override;
|
||||
void SuperBeginUndo() override;
|
||||
void SuperAcceptUndo(const QString& name) override;
|
||||
void SuperCancelUndo() override;
|
||||
void SuspendUndo() override;
|
||||
void ResumeUndo() override;
|
||||
void Undo() override;
|
||||
void Redo() override;
|
||||
bool IsUndoRecording() override;
|
||||
bool IsUndoSuspended() override;
|
||||
void RecordUndo(IUndoObject* obj) override;
|
||||
bool FlushUndo(bool isShowMessage = false) override;
|
||||
bool ClearLastUndoSteps(int steps) override;
|
||||
bool ClearRedoStack() override;
|
||||
//! Retrieve current animation context.
|
||||
CAnimationContext* GetAnimation();
|
||||
CAnimationContext* GetAnimation() override;
|
||||
CTrackViewSequenceManager* GetSequenceManager() override;
|
||||
ITrackViewSequenceManager* GetSequenceManagerInterface() override;
|
||||
|
||||
CToolBoxManager* GetToolBoxManager() { return m_pToolBoxManager; };
|
||||
IErrorReport* GetErrorReport() { return m_pErrorReport; }
|
||||
IErrorReport* GetLastLoadedLevelErrorReport() { return m_pLasLoadedLevelErrorReport; }
|
||||
CToolBoxManager* GetToolBoxManager() override { return m_pToolBoxManager; };
|
||||
IErrorReport* GetErrorReport() override { return m_pErrorReport; }
|
||||
IErrorReport* GetLastLoadedLevelErrorReport() override { return m_pLasLoadedLevelErrorReport; }
|
||||
void StartLevelErrorReportRecording() override;
|
||||
void CommitLevelErrorReport() {SAFE_DELETE(m_pLasLoadedLevelErrorReport); m_pLasLoadedLevelErrorReport = new CErrorReport(*m_pErrorReport); }
|
||||
virtual IFileUtil* GetFileUtil() override { return m_pFileUtil; }
|
||||
void Notify(EEditorNotifyEvent event);
|
||||
void NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener* listener);
|
||||
void RegisterNotifyListener(IEditorNotifyListener* listener);
|
||||
void UnregisterNotifyListener(IEditorNotifyListener* listener);
|
||||
void CommitLevelErrorReport() override {SAFE_DELETE(m_pLasLoadedLevelErrorReport); m_pLasLoadedLevelErrorReport = new CErrorReport(*m_pErrorReport); }
|
||||
IFileUtil* GetFileUtil() override { return m_pFileUtil; }
|
||||
void Notify(EEditorNotifyEvent event) override;
|
||||
void NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener* listener) override;
|
||||
void RegisterNotifyListener(IEditorNotifyListener* listener) override;
|
||||
void UnregisterNotifyListener(IEditorNotifyListener* listener) override;
|
||||
//! Register document notifications listener.
|
||||
void RegisterDocListener(IDocListener* listener);
|
||||
void RegisterDocListener(IDocListener* listener) override;
|
||||
//! Unregister document notifications listener.
|
||||
void UnregisterDocListener(IDocListener* listener);
|
||||
void UnregisterDocListener(IDocListener* listener) override;
|
||||
//! Retrieve interface to the source control.
|
||||
ISourceControl* GetSourceControl();
|
||||
ISourceControl* GetSourceControl() override;
|
||||
//! Retrieve true if source control is provided and enabled in settings
|
||||
bool IsSourceControlAvailable() override;
|
||||
//! Only returns true if source control is both available AND currently connected and functioning
|
||||
bool IsSourceControlConnected() override;
|
||||
//! Setup Material Editor mode
|
||||
void SetMatEditMode(bool bIsMatEditMode);
|
||||
CUIEnumsDatabase* GetUIEnumsDatabase() { return m_pUIEnumsDatabase; };
|
||||
void AddUIEnums();
|
||||
void ReduceMemory();
|
||||
CUIEnumsDatabase* GetUIEnumsDatabase() override { return m_pUIEnumsDatabase; };
|
||||
void AddUIEnums() override;
|
||||
void ReduceMemory() override;
|
||||
// Get Export manager
|
||||
IExportManager* GetExportManager();
|
||||
IExportManager* GetExportManager() override;
|
||||
// Set current configuration spec of the editor.
|
||||
void SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform);
|
||||
ESystemConfigSpec GetEditorConfigSpec() const;
|
||||
ESystemConfigPlatform GetEditorConfigPlatform() const;
|
||||
void ReloadTemplates();
|
||||
void SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform) override;
|
||||
ESystemConfigSpec GetEditorConfigSpec() const override;
|
||||
ESystemConfigPlatform GetEditorConfigPlatform() const override;
|
||||
void ReloadTemplates() override;
|
||||
void AddErrorMessage(const QString& text, const QString& caption);
|
||||
virtual void ShowStatusText(bool bEnable);
|
||||
void ShowStatusText(bool bEnable) override;
|
||||
|
||||
void OnObjectContextMenuOpened(QMenu* pMenu, const CBaseObject* pObject);
|
||||
virtual void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) override;
|
||||
void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) override;
|
||||
|
||||
virtual SSystemGlobalEnvironment* GetEnv() override;
|
||||
virtual IBaseLibraryManager* GetMaterialManagerLibrary() override; // Vladimir@Conffx
|
||||
virtual IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx
|
||||
virtual IImageUtil* GetImageUtil() override; // Vladimir@conffx
|
||||
virtual SEditorSettings* GetEditorSettings() override;
|
||||
virtual IEditorPanelUtils* GetEditorPanelUtils() override;
|
||||
virtual ILogFile* GetLogFile() override { return m_pLogFile; }
|
||||
SSystemGlobalEnvironment* GetEnv() override;
|
||||
IBaseLibraryManager* GetMaterialManagerLibrary() override; // Vladimir@Conffx
|
||||
IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx
|
||||
IImageUtil* GetImageUtil() override; // Vladimir@conffx
|
||||
SEditorSettings* GetEditorSettings() override;
|
||||
IEditorPanelUtils* GetEditorPanelUtils() override;
|
||||
ILogFile* GetLogFile() override { return m_pLogFile; }
|
||||
|
||||
void UnloadPlugins() override;
|
||||
void LoadPlugins() override;
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
|
||||
#pragma once
|
||||
|
||||
#include <CryCommon/platform.h>
|
||||
#include <vector>
|
||||
#include <QtCore/QString>
|
||||
#include <AzCore/Math/Guid.h>
|
||||
|
||||
#define DEFINE_UUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
static const GUID uuid() { return { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; }
|
||||
@@ -34,7 +36,7 @@ struct IUnknown
|
||||
#endif
|
||||
#define __uuidof(T) T::uuid()
|
||||
|
||||
#if defined(AZ_PLATFORM_LINUX)
|
||||
#if defined(AZ_PLATFORM_LINUX) || defined(AZ_PLATFORM_MAC)
|
||||
|
||||
# ifndef _REFGUID_DEFINED
|
||||
# define _REFGUID_DEFINED
|
||||
@@ -65,7 +67,7 @@ enum
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // defined(AZ_PLATFORM_LINUX)
|
||||
#endif // defined(AZ_PLATFORM_LINUX) || defined(AZ_PLATFORM_MAC)
|
||||
|
||||
#include "SandboxAPI.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class LevelTreeModelFilter
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LevelTreeModelFilter(QObject* parent = nullptr);
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
|
||||
void setFilterText(const QString&);
|
||||
QVariant data(const QModelIndex& index, int role) const override;
|
||||
private:
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
|
||||
set(FILES
|
||||
test_EditorCamera.cpp
|
||||
)
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* 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 <AZTestShared/Math/MathTestHelpers.h>
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzFramework/Viewport/ViewportControllerList.h>
|
||||
#include <AzTest/GemTestEnvironment.h>
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <EditorModularViewportCameraComposer.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
class EditorCameraTestEnvironment : public AZ::Test::GemTestEnvironment
|
||||
{
|
||||
// AZ::Test::GemTestEnvironment overrides ...
|
||||
void AddGemsAndComponents() override;
|
||||
};
|
||||
|
||||
void EditorCameraTestEnvironment::AddGemsAndComponents()
|
||||
{
|
||||
AddDynamicModulePaths({ CAMERA_EDITOR_MODULE });
|
||||
AddComponentDescriptors({ AzToolsFramework::Components::TransformComponent::CreateDescriptor() });
|
||||
}
|
||||
|
||||
class EditorCameraFixture : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
AtomToolsFramework::ModularCameraViewportContext* m_cameraViewportContextView = nullptr;
|
||||
AZStd::unique_ptr<SandboxEditor::EditorModularViewportCameraComposer> m_editorModularViewportCameraComposer;
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> m_editorLibHandle;
|
||||
AzFramework::ViewportControllerListPtr m_controllerList;
|
||||
AZStd::unique_ptr<AZ::Entity> m_entity;
|
||||
|
||||
static const AzFramework::ViewportId TestViewportId;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
m_editorLibHandle = AZ::DynamicModuleHandle::Create("EditorLib");
|
||||
[[maybe_unused]] const bool loaded = m_editorLibHandle->Load(true);
|
||||
AZ_Assert(loaded, "EditorLib could not be loaded");
|
||||
|
||||
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
|
||||
m_controllerList->RegisterViewportContext(TestViewportId);
|
||||
|
||||
m_entity = AZStd::make_unique<AZ::Entity>();
|
||||
m_entity->Init();
|
||||
m_entity->CreateComponent<AzToolsFramework::Components::TransformComponent>();
|
||||
m_entity->Activate();
|
||||
|
||||
m_editorModularViewportCameraComposer = AZStd::make_unique<SandboxEditor::EditorModularViewportCameraComposer>(TestViewportId);
|
||||
|
||||
auto controller = m_editorModularViewportCameraComposer->CreateModularViewportCameraController();
|
||||
// set some overrides for the test
|
||||
controller->SetCameraViewportContextBuilderCallback(
|
||||
[this](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext) mutable
|
||||
{
|
||||
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::PlaceholderModularCameraViewportContextImpl>();
|
||||
m_cameraViewportContextView = cameraViewportContext.get();
|
||||
});
|
||||
|
||||
m_controllerList->Add(controller);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
m_editorModularViewportCameraComposer.reset();
|
||||
m_cameraViewportContextView = nullptr;
|
||||
m_entity.reset();
|
||||
m_editorLibHandle = {};
|
||||
}
|
||||
};
|
||||
|
||||
const AzFramework::ViewportId EditorCameraFixture::TestViewportId = AzFramework::ViewportId(1337);
|
||||
|
||||
TEST_F(EditorCameraFixture, ModularViewportCameraControllerReferenceFrameUpdatedWhenViewportEntityisChanged)
|
||||
{
|
||||
// Given
|
||||
const auto entityTransform = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)), AZ::Vector3(10.0f, 5.0f, -2.0f));
|
||||
AZ::TransformBus::Event(m_entity->GetId(), &AZ::TransformBus::Events::SetWorldTM, entityTransform);
|
||||
|
||||
// When
|
||||
// imitate viewport entity changing
|
||||
Camera::EditorCameraNotificationBus::Broadcast(
|
||||
&Camera::EditorCameraNotificationBus::Events::OnViewportViewEntityChanged, m_entity->GetId());
|
||||
|
||||
// ensure the viewport updates after the viewport view entity change
|
||||
const float deltaTime = 1.0f / 60.0f;
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
|
||||
|
||||
// retrieve updated camera transform
|
||||
const AZ::Transform cameraTransform = m_cameraViewportContextView->GetCameraTransform();
|
||||
|
||||
// Then
|
||||
// camera transform matches that of the entity
|
||||
EXPECT_THAT(cameraTransform, IsClose(entityTransform));
|
||||
}
|
||||
|
||||
TEST_F(EditorCameraFixture, ReferenceFrameRemainsIdentityAfterExternalCameraTransformChangeWhenNotSet)
|
||||
{
|
||||
// Given
|
||||
m_cameraViewportContextView->SetCameraTransform(AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 20.0f, 30.0f)));
|
||||
|
||||
// When
|
||||
AZ::Transform referenceFrame = AZ::Transform::CreateTranslation(AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
|
||||
referenceFrame, TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::GetReferenceFrame);
|
||||
|
||||
// Then
|
||||
// reference frame is still the identity
|
||||
EXPECT_THAT(referenceFrame, IsClose(AZ::Transform::CreateIdentity()));
|
||||
}
|
||||
|
||||
TEST_F(EditorCameraFixture, ExternalCameraTransformChangeWhenReferenceFrameIsSetUpdatesReferenceFrame)
|
||||
{
|
||||
// Given
|
||||
const AZ::Transform referenceFrame = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)), AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, referenceFrame);
|
||||
|
||||
const AZ::Transform nextTransform = AZ::Transform::CreateTranslation(AZ::Vector3(10.0f, 20.0f, 30.0f));
|
||||
m_cameraViewportContextView->SetCameraTransform(nextTransform);
|
||||
|
||||
// When
|
||||
AZ::Transform currentReferenceFrame = AZ::Transform::CreateTranslation(AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
|
||||
currentReferenceFrame, TestViewportId,
|
||||
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::GetReferenceFrame);
|
||||
|
||||
// Then
|
||||
EXPECT_THAT(currentReferenceFrame, IsClose(nextTransform));
|
||||
}
|
||||
|
||||
TEST_F(EditorCameraFixture, ReferenceFrameReturnedToIdentityAfterClear)
|
||||
{
|
||||
// Given
|
||||
const AZ::Transform referenceFrame = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)), AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, referenceFrame);
|
||||
|
||||
// When
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::ClearReferenceFrame);
|
||||
|
||||
AZ::Transform currentReferenceFrame = AZ::Transform::CreateTranslation(AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
|
||||
currentReferenceFrame, TestViewportId,
|
||||
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::GetReferenceFrame);
|
||||
|
||||
// Then
|
||||
EXPECT_THAT(currentReferenceFrame, IsClose(AZ::Transform::CreateIdentity()));
|
||||
}
|
||||
|
||||
TEST_F(EditorCameraFixture, InterpolateToTransform)
|
||||
{
|
||||
// When
|
||||
AZ::Transform transformToInterpolateTo = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationZ(AZ::DegToRad(90.0f)), AZ::Vector3(20.0f, 40.0f, 60.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
|
||||
transformToInterpolateTo, 0.0f);
|
||||
|
||||
// simulate interpolation
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
|
||||
|
||||
const auto finalTransform = m_cameraViewportContextView->GetCameraTransform();
|
||||
|
||||
// Then
|
||||
EXPECT_THAT(finalTransform, IsClose(transformToInterpolateTo));
|
||||
}
|
||||
|
||||
TEST_F(EditorCameraFixture, InterpolateToTransformWithReferenceSpaceSet)
|
||||
{
|
||||
// Given
|
||||
const AZ::Transform referenceFrame = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationX(AZ::DegToRad(90.0f)), AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, referenceFrame);
|
||||
|
||||
AZ::Transform transformToInterpolateTo = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
AZ::Quaternion::CreateRotationZ(AZ::DegToRad(90.0f)), AZ::Vector3(20.0f, 40.0f, 60.0f));
|
||||
|
||||
// When
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
|
||||
transformToInterpolateTo, 0.0f);
|
||||
|
||||
// simulate interpolation
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
|
||||
|
||||
AZ::Transform currentReferenceFrame = AZ::Transform::CreateTranslation(AZ::Vector3(1.0f, 2.0f, 3.0f));
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
|
||||
currentReferenceFrame, TestViewportId,
|
||||
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::GetReferenceFrame);
|
||||
|
||||
const auto finalTransform = m_cameraViewportContextView->GetCameraTransform();
|
||||
|
||||
// Then
|
||||
EXPECT_THAT(finalTransform, IsClose(transformToInterpolateTo));
|
||||
EXPECT_THAT(currentReferenceFrame, IsClose(AZ::Transform::CreateIdentity()));
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
// required to support running integration tests with the Camera Gem
|
||||
AZTEST_EXPORT int AZ_UNIT_TEST_HOOK_NAME(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleMock(&argc, argv);
|
||||
AZ::Test::printUnusedParametersWarning(argc, argv);
|
||||
AZ::Test::addTestEnvironments({ new UnitTest::EditorCameraTestEnvironment() });
|
||||
int result = RUN_ALL_TESTS();
|
||||
return result;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEST_EXECUTABLE_MAIN();
|
||||
@@ -25,6 +25,8 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~CEditorMock() = default;
|
||||
|
||||
MOCK_METHOD0(DeleteThis, void());
|
||||
MOCK_METHOD0(GetSystem, ISystem*());
|
||||
MOCK_METHOD0(GetClassFactory, IEditorClassFactory* ());
|
||||
|
||||
@@ -58,28 +58,6 @@ namespace UnitTest
|
||||
return true;
|
||||
}
|
||||
|
||||
class TestModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext
|
||||
{
|
||||
public:
|
||||
AZ::Transform GetCameraTransform() const override
|
||||
{
|
||||
return m_cameraTransform;
|
||||
}
|
||||
|
||||
void SetCameraTransform(const AZ::Transform& transform) override
|
||||
{
|
||||
m_cameraTransform = transform;
|
||||
}
|
||||
|
||||
void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler&) override
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private:
|
||||
AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity();
|
||||
};
|
||||
|
||||
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
|
||||
{
|
||||
public:
|
||||
@@ -146,7 +124,7 @@ namespace UnitTest
|
||||
controller->SetCameraViewportContextBuilderCallback(
|
||||
[this](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
|
||||
{
|
||||
cameraViewportContext = AZStd::make_unique<TestModularCameraViewportContextImpl>();
|
||||
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::PlaceholderModularCameraViewportContextImpl>();
|
||||
m_cameraViewportContextView = cameraViewportContext.get();
|
||||
});
|
||||
|
||||
|
||||
@@ -35,21 +35,21 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Ovverides from CGizmo
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GetWorldBounds(AABB& bbox);
|
||||
virtual void Display(DisplayContext& dc);
|
||||
virtual bool HitTest(HitContext& hc);
|
||||
virtual const Matrix34& GetMatrix() const;
|
||||
void GetWorldBounds(AABB& bbox) override;
|
||||
void Display(DisplayContext& dc) override;
|
||||
bool HitTest(HitContext& hc) override;
|
||||
const Matrix34& GetMatrix() const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ITransformManipulator implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual Matrix34 GetTransformation(RefCoordSys coordSys, IDisplayViewport* view = nullptr) const;
|
||||
virtual void SetTransformation(RefCoordSys coordSys, const Matrix34& tm);
|
||||
virtual bool HitTestManipulator(HitContext& hc);
|
||||
virtual bool MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int nFlags);
|
||||
virtual void SetAlwaysUseLocal(bool on)
|
||||
Matrix34 GetTransformation(RefCoordSys coordSys, IDisplayViewport* view = nullptr) const override;
|
||||
void SetTransformation(RefCoordSys coordSys, const Matrix34& tm) override;
|
||||
bool HitTestManipulator(HitContext& hc) override;
|
||||
bool MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int nFlags) override;
|
||||
void SetAlwaysUseLocal(bool on) override
|
||||
{ m_bAlwaysUseLocal = on; }
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -712,7 +712,7 @@ protected:
|
||||
// May be overridden in derived classes to handle helpers scaling.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetHelperScale([[maybe_unused]] float scale) {};
|
||||
virtual float GetHelperScale() { return 1; };
|
||||
virtual float GetHelperScale() { return 1.0f; };
|
||||
|
||||
void SetNameInternal(const QString& name) { m_name = name; }
|
||||
|
||||
@@ -743,9 +743,6 @@ private:
|
||||
//! Only called once after creation by ObjectManager.
|
||||
void SetClassDesc(CObjectClassDesc* classDesc);
|
||||
|
||||
// From CObject, (not implemented)
|
||||
virtual void Serialize([[maybe_unused]] CArchive& ar) {};
|
||||
|
||||
EScaleWarningLevel GetScaleWarningLevel() const;
|
||||
ERotationWarningLevel GetRotationWarningLevel() const;
|
||||
|
||||
|
||||
@@ -82,14 +82,14 @@ public:
|
||||
// Overrides from CBaseObject.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Return type name of Entity.
|
||||
QString GetTypeDescription() const { return GetEntityClass(); };
|
||||
QString GetTypeDescription() const override { return GetEntityClass(); };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool IsSameClass(CBaseObject* obj);
|
||||
bool IsSameClass(CBaseObject* obj) override;
|
||||
|
||||
virtual bool Init(IEditor* ie, CBaseObject* prev, const QString& file);
|
||||
virtual void InitVariables();
|
||||
virtual void Done();
|
||||
bool Init(IEditor* ie, CBaseObject* prev, const QString& file) override;
|
||||
void InitVariables() override;
|
||||
void Done() override;
|
||||
|
||||
void DrawExtraLightInfo (DisplayContext& disp);
|
||||
|
||||
@@ -102,29 +102,30 @@ public:
|
||||
void SetEntityPropertyFloat(const char* name, float value);
|
||||
void SetEntityPropertyString(const char* name, const QString& value);
|
||||
|
||||
virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
|
||||
virtual void OnContextMenu(QMenu* menu);
|
||||
int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags) override;
|
||||
void OnContextMenu(QMenu* menu) override;
|
||||
|
||||
void SetName(const QString& name);
|
||||
void SetSelected(bool bSelect);
|
||||
void SetName(const QString& name) override;
|
||||
void SetSelected(bool bSelect) override;
|
||||
|
||||
virtual void GetLocalBounds(AABB& box);
|
||||
void GetLocalBounds(AABB& box) override;
|
||||
|
||||
virtual bool HitTest(HitContext& hc);
|
||||
virtual bool HitHelperTest(HitContext& hc);
|
||||
virtual bool HitTestRect(HitContext& hc);
|
||||
void UpdateVisibility(bool bVisible);
|
||||
bool ConvertFromObject(CBaseObject* object);
|
||||
bool HitTest(HitContext& hc) override;
|
||||
bool HitHelperTest(HitContext& hc) override;
|
||||
bool HitTestRect(HitContext& hc) override;
|
||||
void UpdateVisibility(bool bVisible) override;
|
||||
bool ConvertFromObject(CBaseObject* object) override;
|
||||
|
||||
virtual void Serialize(CObjectArchive& ar);
|
||||
virtual void PostLoad(CObjectArchive& ar);
|
||||
using CBaseObject::Serialize;
|
||||
void Serialize(CObjectArchive& ar) override;
|
||||
void PostLoad(CObjectArchive& ar) override;
|
||||
|
||||
XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode);
|
||||
XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void OnEvent(ObjectEvent event);
|
||||
void OnEvent(ObjectEvent event) override;
|
||||
|
||||
virtual void SetTransformDelegate(ITransformDelegate* pTransformDelegate) override;
|
||||
void SetTransformDelegate(ITransformDelegate* pTransformDelegate) override;
|
||||
|
||||
// Set attach flags and target
|
||||
enum EAttachmentType
|
||||
@@ -139,15 +140,15 @@ public:
|
||||
EAttachmentType GetAttachType() const { return m_attachmentType; }
|
||||
QString GetAttachTarget() const { return m_attachmentTarget; }
|
||||
|
||||
virtual void SetHelperScale(float scale);
|
||||
virtual float GetHelperScale();
|
||||
void SetHelperScale(float scale) override;
|
||||
float GetHelperScale() override;
|
||||
|
||||
virtual void GatherUsedResources(CUsedResources& resources);
|
||||
virtual bool IsSimilarObject(CBaseObject* pObject);
|
||||
void GatherUsedResources(CUsedResources& resources) override;
|
||||
bool IsSimilarObject(CBaseObject* pObject) override;
|
||||
|
||||
virtual bool HasMeasurementAxis() const { return false; }
|
||||
bool HasMeasurementAxis() const override { return false; }
|
||||
|
||||
virtual bool IsIsolated() const { return false; }
|
||||
bool IsIsolated() const override { return false; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// END CBaseObject
|
||||
@@ -232,7 +233,7 @@ protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Must be called after cloning the object on clone of object.
|
||||
//! This will make sure object references are cloned correctly.
|
||||
virtual void PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx);
|
||||
void PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx) override;
|
||||
|
||||
//! Draw default object items.
|
||||
void DrawProjectorPyramid(DisplayContext& dc, float dist);
|
||||
@@ -264,7 +265,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void DeleteThis() { delete this; };
|
||||
void DeleteThis() override { delete this; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Radius callbacks.
|
||||
|
||||
@@ -23,14 +23,14 @@ class CGizmoManager
|
||||
: public IGizmoManager
|
||||
{
|
||||
public:
|
||||
void AddGizmo(CGizmo* gizmo);
|
||||
void RemoveGizmo(CGizmo* gizmo);
|
||||
void AddGizmo(CGizmo* gizmo) override;
|
||||
void RemoveGizmo(CGizmo* gizmo) override;
|
||||
|
||||
int GetGizmoCount() const override;
|
||||
CGizmo* GetGizmoByIndex(int nIndex) const override;
|
||||
|
||||
void Display(DisplayContext& dc);
|
||||
bool HitTest(HitContext& hc);
|
||||
void Display(DisplayContext& dc) override;
|
||||
bool HitTest(HitContext& hc) override;
|
||||
|
||||
void DeleteAllTransformManipulators();
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Ovverides from CGizmo
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetName(const char* sName);
|
||||
virtual void GetWorldBounds(AABB& bbox);
|
||||
virtual void Display(DisplayContext& dc);
|
||||
virtual bool HitTest(HitContext& hc);
|
||||
void SetName(const char* sName) override;
|
||||
void GetWorldBounds(AABB& bbox) override;
|
||||
void Display(DisplayContext& dc) override;
|
||||
bool HitTest(HitContext& hc) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetObjects(CBaseObject* pObject1, CBaseObject* pObject2, const QString& boneName = "");
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
GUID guid;
|
||||
|
||||
public:
|
||||
virtual ~CXMLObjectClassDesc() = default;
|
||||
REFGUID ClassID() override
|
||||
{
|
||||
return guid;
|
||||
|
||||
@@ -103,142 +103,142 @@ public:
|
||||
|
||||
void RegisterObjectClasses();
|
||||
|
||||
CBaseObject* NewObject(CObjectClassDesc* cls, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr);
|
||||
CBaseObject* NewObject(const QString& typeName, CBaseObject* prev = 0, const QString& file = "", const char* newEntityName = nullptr);
|
||||
CBaseObject* NewObject(CObjectClassDesc* cls, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) override;
|
||||
CBaseObject* NewObject(const QString& typeName, CBaseObject* prev = 0, const QString& file = "", const char* newEntityName = nullptr) override;
|
||||
|
||||
void DeleteObject(CBaseObject* obj);
|
||||
void DeleteSelection(CSelectionGroup* pSelection);
|
||||
void DeleteAllObjects();
|
||||
CBaseObject* CloneObject(CBaseObject* obj);
|
||||
void DeleteObject(CBaseObject* obj) override;
|
||||
void DeleteSelection(CSelectionGroup* pSelection) override;
|
||||
void DeleteAllObjects() override;
|
||||
CBaseObject* CloneObject(CBaseObject* obj) override;
|
||||
|
||||
void BeginEditParams(CBaseObject* obj, int flags);
|
||||
void EndEditParams(int flags = 0);
|
||||
void BeginEditParams(CBaseObject* obj, int flags) override;
|
||||
void EndEditParams(int flags = 0) override;
|
||||
// Hides all transform manipulators.
|
||||
void HideTransformManipulators();
|
||||
|
||||
//! Get number of objects manager by ObjectManager (not contain sub objects of groups).
|
||||
int GetObjectCount() const;
|
||||
int GetObjectCount() const override;
|
||||
|
||||
//! Get array of objects, managed by manager (not contain sub objects of groups).
|
||||
//! @param layer if 0 get objects for all layers, or layer to get objects from.
|
||||
void GetObjects(CBaseObjectsArray& objects) const;
|
||||
void GetObjects(CBaseObjectsArray& objects) const override;
|
||||
|
||||
//! Get array of objects that pass the filter.
|
||||
//! @param filter The filter functor, return true if you want to get the certain obj, return false if want to skip it.
|
||||
void GetObjects(CBaseObjectsArray& objects, BaseObjectFilterFunctor const& filter) const;
|
||||
void GetObjects(CBaseObjectsArray& objects, BaseObjectFilterFunctor const& filter) const override;
|
||||
|
||||
//! Update objects.
|
||||
void Update();
|
||||
|
||||
//! Display objects on display context.
|
||||
void Display(DisplayContext& dc);
|
||||
void Display(DisplayContext& dc) override;
|
||||
|
||||
//! Called when selecting without selection helpers - this is needed since
|
||||
//! the visible object cache is normally not updated when not displaying helpers.
|
||||
void ForceUpdateVisibleObjectCache(DisplayContext& dc);
|
||||
void ForceUpdateVisibleObjectCache(DisplayContext& dc) override;
|
||||
|
||||
//! Check intersection with objects.
|
||||
//! Find intersection with nearest to ray origin object hit by ray.
|
||||
//! If distance tollerance is specified certain relaxation applied on collision test.
|
||||
//! @return true if hit any object, and fills hitInfo structure.
|
||||
bool HitTest(HitContext& hitInfo);
|
||||
bool HitTest(HitContext& hitInfo) override;
|
||||
|
||||
//! Check intersection with an object.
|
||||
//! @return true if hit, and fills hitInfo structure.
|
||||
bool HitTestObject(CBaseObject* obj, HitContext& hc);
|
||||
bool HitTestObject(CBaseObject* obj, HitContext& hc) override;
|
||||
|
||||
//! Send event to all objects.
|
||||
//! Will cause OnEvent handler to be called on all objects.
|
||||
void SendEvent(ObjectEvent event);
|
||||
void SendEvent(ObjectEvent event) override;
|
||||
|
||||
//! Send event to all objects within given bounding box.
|
||||
//! Will cause OnEvent handler to be called on objects within bounding box.
|
||||
void SendEvent(ObjectEvent event, const AABB& bounds);
|
||||
void SendEvent(ObjectEvent event, const AABB& bounds) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find object by ID.
|
||||
CBaseObject* FindObject(REFGUID guid) const;
|
||||
CBaseObject* FindObject(REFGUID guid) const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find object by name.
|
||||
CBaseObject* FindObject(const QString& sName) const;
|
||||
CBaseObject* FindObject(const QString& sName) const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find objects of given type.
|
||||
void FindObjectsOfType(const QMetaObject* pClass, std::vector<CBaseObject*>& result) override;
|
||||
void FindObjectsOfType(ObjectType type, std::vector<CBaseObject*>& result) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find objects which intersect with a given AABB.
|
||||
virtual void FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const;
|
||||
void FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Operations on objects.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Makes object visible or invisible.
|
||||
void HideObject(CBaseObject* obj, bool hide);
|
||||
void HideObject(CBaseObject* obj, bool hide) override;
|
||||
//! Shows the last hidden object based on hidden ID
|
||||
void ShowLastHiddenObject();
|
||||
void ShowLastHiddenObject() override;
|
||||
//! Freeze object, making it unselectable.
|
||||
void FreezeObject(CBaseObject* obj, bool freeze);
|
||||
void FreezeObject(CBaseObject* obj, bool freeze) override;
|
||||
//! Unhide all hidden objects.
|
||||
void UnhideAll();
|
||||
void UnhideAll() override;
|
||||
//! Unfreeze all frozen objects.
|
||||
void UnfreezeAll();
|
||||
void UnfreezeAll() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Object Selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool SelectObject(CBaseObject* obj, bool bUseMask = true);
|
||||
void UnselectObject(CBaseObject* obj);
|
||||
bool SelectObject(CBaseObject* obj, bool bUseMask = true) override;
|
||||
void UnselectObject(CBaseObject* obj) override;
|
||||
|
||||
//! Select objects within specified distance from given position.
|
||||
//! Return number of selected objects.
|
||||
int SelectObjects(const AABB& box, bool bUnselect = false);
|
||||
int SelectObjects(const AABB& box, bool bUnselect = false) override;
|
||||
|
||||
virtual void SelectEntities(std::set<CEntityObject*>& s);
|
||||
void SelectEntities(std::set<CEntityObject*>& s) override;
|
||||
|
||||
int MoveObjects(const AABB& box, const Vec3& offset, ImageRotationDegrees rotation, bool bIsCopy = false);
|
||||
int MoveObjects(const AABB& box, const Vec3& offset, ImageRotationDegrees rotation, bool bIsCopy = false) override;
|
||||
|
||||
//! Selects/Unselects all objects within 2d rectangle in given viewport.
|
||||
void SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect);
|
||||
void FindObjectsInRect(CViewport* view, const QRect& rect, std::vector<GUID>& guids);
|
||||
void SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect) override;
|
||||
void FindObjectsInRect(CViewport* view, const QRect& rect, std::vector<GUID>& guids) override;
|
||||
|
||||
//! Clear default selection set.
|
||||
//! @Return number of objects removed from selection.
|
||||
int ClearSelection();
|
||||
int ClearSelection() override;
|
||||
|
||||
//! Deselect all current selected objects and selects object that were unselected.
|
||||
//! @Return number of selected objects.
|
||||
int InvertSelection();
|
||||
int InvertSelection() override;
|
||||
|
||||
//! Get current selection.
|
||||
CSelectionGroup* GetSelection() const { return m_currSelection; };
|
||||
CSelectionGroup* GetSelection() const override { return m_currSelection; };
|
||||
//! Get named selection.
|
||||
CSelectionGroup* GetSelection(const QString& name) const;
|
||||
CSelectionGroup* GetSelection(const QString& name) const override;
|
||||
// Get selection group names
|
||||
void GetNameSelectionStrings(QStringList& names);
|
||||
void GetNameSelectionStrings(QStringList& names) override;
|
||||
//! Change name of current selection group.
|
||||
//! And store it in list.
|
||||
void NameSelection(const QString& name);
|
||||
void NameSelection(const QString& name) override;
|
||||
//! Set one of name selections as current selection.
|
||||
void SetSelection(const QString& name);
|
||||
void RemoveSelection(const QString& name);
|
||||
void SetSelection(const QString& name) override;
|
||||
void RemoveSelection(const QString& name) override;
|
||||
|
||||
bool IsObjectDeletionAllowed(CBaseObject* pObject);
|
||||
|
||||
//! Delete all objects in selection group.
|
||||
void DeleteSelection();
|
||||
void DeleteSelection() override;
|
||||
|
||||
uint32 ForceID() const{return m_ForceID; }
|
||||
void ForceID(uint32 FID){m_ForceID = FID; }
|
||||
uint32 ForceID() const override{return m_ForceID; }
|
||||
void ForceID(uint32 FID) override{m_ForceID = FID; }
|
||||
|
||||
//! Generates uniq name base on type name of object.
|
||||
QString GenerateUniqueObjectName(const QString& typeName);
|
||||
QString GenerateUniqueObjectName(const QString& typeName) override;
|
||||
//! Register object name in object manager, needed for generating uniq names.
|
||||
void RegisterObjectName(const QString& name);
|
||||
void RegisterObjectName(const QString& name) override;
|
||||
//! Decrease name number and remove if it was last in object manager, needed for generating uniq names.
|
||||
void UpdateRegisterObjectName(const QString& name);
|
||||
//! Enable/Disable generating of unique object names (Enabled by default).
|
||||
//! Return previous value.
|
||||
bool EnableUniqObjectNames(bool bEnable);
|
||||
bool EnableUniqObjectNames(bool bEnable) override;
|
||||
|
||||
//! Register XML template of runtime class.
|
||||
void RegisterClassTemplate(const XmlNodeRef& templ);
|
||||
@@ -249,25 +249,25 @@ public:
|
||||
void RegisterCVars();
|
||||
|
||||
//! Find object class by name.
|
||||
CObjectClassDesc* FindClass(const QString& className);
|
||||
void GetClassCategories(QStringList& categories);
|
||||
CObjectClassDesc* FindClass(const QString& className) override;
|
||||
void GetClassCategories(QStringList& categories) override;
|
||||
void GetClassCategoryToolClassNamePairs(std::vector< std::pair<QString, QString> >& categoryToolClassNamePairs) override;
|
||||
void GetClassTypes(const QString& category, QStringList& types);
|
||||
void GetClassTypes(const QString& category, QStringList& types) override;
|
||||
|
||||
//! Export objects to xml.
|
||||
//! When onlyShared is true ony objects with shared flags exported, overwise only not shared object exported.
|
||||
void Export(const QString& levelPath, XmlNodeRef& rootNode, bool onlyShared);
|
||||
void ExportEntities(XmlNodeRef& rootNode);
|
||||
void Export(const QString& levelPath, XmlNodeRef& rootNode, bool onlyShared) override;
|
||||
void ExportEntities(XmlNodeRef& rootNode) override;
|
||||
|
||||
//! Serialize Objects in manager to specified XML Node.
|
||||
//! @param flags Can be one of SerializeFlags.
|
||||
void Serialize(XmlNodeRef& rootNode, bool bLoading, int flags = SERIALIZE_ALL);
|
||||
void Serialize(XmlNodeRef& rootNode, bool bLoading, int flags = SERIALIZE_ALL) override;
|
||||
|
||||
void SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading);
|
||||
void SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading) override;
|
||||
|
||||
//! Load objects from object archive.
|
||||
//! @param bSelect if set newly loaded object will be selected.
|
||||
void LoadObjects(CObjectArchive& ar, bool bSelect);
|
||||
void LoadObjects(CObjectArchive& ar, bool bSelect) override;
|
||||
|
||||
//! Delete from Object manager all objects without SHARED flag.
|
||||
void DeleteNotSharedObjects();
|
||||
@@ -276,57 +276,57 @@ public:
|
||||
|
||||
bool AddObject(CBaseObject* obj);
|
||||
void RemoveObject(CBaseObject* obj);
|
||||
void ChangeObjectId(REFGUID oldId, REFGUID newId);
|
||||
bool IsDuplicateObjectName(const QString& newName) const
|
||||
void ChangeObjectId(REFGUID oldId, REFGUID newId) override;
|
||||
bool IsDuplicateObjectName(const QString& newName) const override
|
||||
{
|
||||
return FindObject(newName) ? true : false;
|
||||
}
|
||||
void ShowDuplicationMsgWarning(CBaseObject* obj, const QString& newName, bool bShowMsgBox) const;
|
||||
void ChangeObjectName(CBaseObject* obj, const QString& newName);
|
||||
void ShowDuplicationMsgWarning(CBaseObject* obj, const QString& newName, bool bShowMsgBox) const override;
|
||||
void ChangeObjectName(CBaseObject* obj, const QString& newName) override;
|
||||
|
||||
//! Convert object of one type to object of another type.
|
||||
//! Original object is deleted.
|
||||
bool ConvertToType(CBaseObject* pObject, const QString& typeName);
|
||||
bool ConvertToType(CBaseObject* pObject, const QString& typeName) override;
|
||||
|
||||
//! Set new selection callback.
|
||||
//! @return previous selection callback.
|
||||
IObjectSelectCallback* SetSelectCallback(IObjectSelectCallback* callback);
|
||||
IObjectSelectCallback* SetSelectCallback(IObjectSelectCallback* callback) override;
|
||||
|
||||
// Enables/Disables creating of game objects.
|
||||
void SetCreateGameObject(bool enable) { m_createGameObjects = enable; };
|
||||
void SetCreateGameObject(bool enable) override { m_createGameObjects = enable; };
|
||||
//! Return true if objects loaded from xml should immidiatly create game objects associated with them.
|
||||
bool IsCreateGameObjects() const { return m_createGameObjects; };
|
||||
bool IsCreateGameObjects() const override { return m_createGameObjects; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Get access to gizmo manager.
|
||||
IGizmoManager* GetGizmoManager();
|
||||
IGizmoManager* GetGizmoManager() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Invalidate visibily settings of objects.
|
||||
void InvalidateVisibleList();
|
||||
void InvalidateVisibleList() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ObjectManager notification Callbacks.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AddObjectEventListener(EventListener* listener);
|
||||
void RemoveObjectEventListener(EventListener* listener);
|
||||
void AddObjectEventListener(EventListener* listener) override;
|
||||
void RemoveObjectEventListener(EventListener* listener) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Used to indicate starting and ending of objects loading.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void StartObjectsLoading(int numObjects);
|
||||
void EndObjectsLoading();
|
||||
void StartObjectsLoading(int numObjects) override;
|
||||
void EndObjectsLoading() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Gathers all resources used by all objects.
|
||||
void GatherUsedResources(CUsedResources& resources);
|
||||
void GatherUsedResources(CUsedResources& resources) override;
|
||||
|
||||
virtual bool IsLightClass(CBaseObject* pObject);
|
||||
bool IsLightClass(CBaseObject* pObject) override;
|
||||
|
||||
virtual void FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue);
|
||||
virtual void FindAndRenameProperty2If(const char* property2Name, const QString& oldValue, const QString& newValue, const char* otherProperty2Name, const QString& otherValue);
|
||||
virtual void FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue) override;
|
||||
virtual void FindAndRenameProperty2If(const char* property2Name, const QString& oldValue, const QString& newValue, const char* otherProperty2Name, const QString& otherValue) override;
|
||||
|
||||
bool IsReloading() const { return m_bInReloading; }
|
||||
bool IsReloading() const override { return m_bInReloading; }
|
||||
void SetSkipUpdate(bool bSkipUpdate) override { m_bSkipObjectUpdate = bSkipUpdate; }
|
||||
|
||||
void SetExportingLevel(bool bExporting) override { m_bLevelExporting = bExporting; }
|
||||
@@ -341,7 +341,7 @@ private:
|
||||
@param objectNode Xml node to serialize object info from.
|
||||
@param pUndoObject Pointer to deleted object for undo.
|
||||
*/
|
||||
CBaseObject* NewObject(CObjectArchive& archive, CBaseObject* pUndoObject, bool bMakeNewId);
|
||||
CBaseObject* NewObject(CObjectArchive& archive, CBaseObject* pUndoObject, bool bMakeNewId) override;
|
||||
|
||||
//! Update visibility of all objects.
|
||||
void UpdateVisibilityList();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -12,28 +12,5 @@ set_target_properties(Editor PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_LIST_DIR}/gui_info.plist
|
||||
RESOURCE ${CMAKE_CURRENT_LIST_DIR}/Images.xcassets
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME EditorAppIcon
|
||||
ENTITLEMENT_FILE_PATH ${CMAKE_CURRENT_LIST_DIR}/EditorEntitlements.plist
|
||||
)
|
||||
|
||||
# We cannot use ly_add_target here because we're already including this file from inside ly_add_target
|
||||
# So we need to setup target, dependencies and install logic manually.
|
||||
add_executable(EditorDummy Platform/Mac/main_dummy.cpp)
|
||||
add_executable(AZ::EditorDummy ALIAS EditorDummy)
|
||||
|
||||
ly_target_link_libraries(EditorDummy
|
||||
PRIVATE
|
||||
AZ::AzCore
|
||||
AZ::AzFramework)
|
||||
|
||||
ly_add_dependencies(Editor EditorDummy)
|
||||
|
||||
# Store the aliased target into a DIRECTORY property
|
||||
set_property(DIRECTORY APPEND PROPERTY LY_DIRECTORY_TARGETS AZ::EditorDummy)
|
||||
|
||||
# Store the directory path in a GLOBAL property so that it can be accessed
|
||||
# in the layout install logic. Skip if the directory has already been added
|
||||
get_property(ly_all_target_directories GLOBAL PROPERTY LY_ALL_TARGET_DIRECTORIES)
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR IN_LIST ly_all_target_directories)
|
||||
set_property(GLOBAL APPEND PROPERTY LY_ALL_TARGET_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
ly_install_add_install_path_setreg(Editor)
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>EditorDummy</string>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.O3DE.Editor</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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/Component/ComponentApplication.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/Process/ProcessWatcher.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Create a ComponentApplication to initialize the AZ::SystemAllocator and initialize the SettingsRegistry
|
||||
AZ::ComponentApplication::Descriptor desc;
|
||||
AZ::ComponentApplication application;
|
||||
application.Create(desc);
|
||||
|
||||
AZStd::vector<AZStd::string> envVars;
|
||||
|
||||
const char* homePath = std::getenv("HOME");
|
||||
envVars.push_back(AZStd::string::format("HOME=%s", homePath));
|
||||
|
||||
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
const char* dyldLibPathOrig = std::getenv("DYLD_LIBRARY_PATH");
|
||||
AZStd::string dyldSearchPath = AZStd::string::format("DYLD_LIBRARY_PATH=%s", dyldLibPathOrig);
|
||||
if (AZ::IO::FixedMaxPath projectModulePath;
|
||||
settingsRegistry->Get(projectModulePath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectConfigurationBinPath))
|
||||
{
|
||||
dyldSearchPath.append(":");
|
||||
dyldSearchPath.append(projectModulePath.c_str());
|
||||
}
|
||||
|
||||
if (AZ::IO::FixedMaxPath installedBinariesFolder;
|
||||
settingsRegistry->Get(installedBinariesFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
|
||||
{
|
||||
if (AZ::IO::FixedMaxPath engineRootFolder;
|
||||
settingsRegistry->Get(engineRootFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
|
||||
{
|
||||
installedBinariesFolder = engineRootFolder / installedBinariesFolder;
|
||||
dyldSearchPath.append(":");
|
||||
dyldSearchPath.append(installedBinariesFolder.c_str());
|
||||
}
|
||||
}
|
||||
envVars.push_back(dyldSearchPath);
|
||||
}
|
||||
|
||||
AZStd::string commandArgs;
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
commandArgs.append(argv[i]);
|
||||
commandArgs.append(" ");
|
||||
}
|
||||
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
AZ::IO::Path processPath{ AZ::IO::PathView(AZ::Utils::GetExecutableDirectory()) };
|
||||
processPath /= "Editor";
|
||||
processLaunchInfo.m_processExecutableString = AZStd::move(processPath.Native());
|
||||
processLaunchInfo.m_commandlineParameters = commandArgs;
|
||||
processLaunchInfo.m_environmentVariables = &envVars;
|
||||
processLaunchInfo.m_showWindow = true;
|
||||
|
||||
AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
|
||||
|
||||
application.Destroy();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// Always returns false as Component entity highlighting (accenting) is taken care of elsewhere
|
||||
bool IsHighlighted() { return false; }
|
||||
// Component entity highlighting (accenting) is taken care of elsewhere
|
||||
void DrawHighlight(DisplayContext& /*dc*/) {};
|
||||
void DrawHighlight(DisplayContext& /*dc*/) override {};
|
||||
|
||||
// Don't auto-clone children. Cloning happens in groups with reference fixups,
|
||||
// and individually selected objercts should be cloned as individuals.
|
||||
@@ -164,7 +164,7 @@ protected:
|
||||
|
||||
float GetRadius();
|
||||
|
||||
void DeleteThis() { delete this; };
|
||||
void DeleteThis() override { delete this; };
|
||||
|
||||
bool IsNonLayerAncestorSelected() const;
|
||||
bool IsLayer() const;
|
||||
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::EditorContextMenu::Bus::Handler overrides
|
||||
void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override;
|
||||
int GetMenuPosition() const;
|
||||
int GetMenuPosition() const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ protected:
|
||||
void AddFavorites(const AZStd::vector<const AZ::SerializeContext::ClassData*>& classDataContainer) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void rowsInserted(const QModelIndex& parent, int start, int end);
|
||||
void rowsInserted(const QModelIndex& parent, int start, int end) override;
|
||||
|
||||
// Context menu handlers
|
||||
void ShowContextMenu(const QPoint&);
|
||||
|
||||
@@ -255,7 +255,7 @@ protected:
|
||||
bool DropMimeDataAssets(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
|
||||
bool CanDropMimeDataAssets(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const;
|
||||
|
||||
QMap<int, QVariant> itemData(const QModelIndex &index) const;
|
||||
QMap<int, QVariant> itemData(const QModelIndex &index) const override;
|
||||
QVariant dataForAll(const QModelIndex& index, int role) const;
|
||||
QVariant dataForName(const QModelIndex& index, int role) const;
|
||||
QVariant dataForVisibility(const QModelIndex& index, int role) const;
|
||||
|
||||
@@ -51,4 +51,5 @@ ly_add_target(
|
||||
AZ::AzCore
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzQtComponents
|
||||
Legacy::EditorCore
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include "CryFile.h"
|
||||
#include "PerforceSourceControl.h"
|
||||
#include "PasswordDlg.h"
|
||||
|
||||
@@ -28,16 +28,16 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnkown implementation.
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObj);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObj) override;
|
||||
ULONG STDMETHODCALLTYPE AddRef() override;
|
||||
ULONG STDMETHODCALLTYPE Release() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual REFGUID ClassID();
|
||||
REFGUID ClassID() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetPagesCount();
|
||||
virtual IPreferencesPage* CreateEditorPreferencesPage(int index) override;
|
||||
int GetPagesCount() override;
|
||||
IPreferencesPage* CreateEditorPreferencesPage(int index) override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_PREFERENCESSTDPAGES_H
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/std/any.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -138,7 +139,7 @@ namespace AzToolsFramework
|
||||
/*
|
||||
* Finds a pak file name for a given file.
|
||||
*/
|
||||
virtual const char* GetPakFromFile(const char* filename) = 0;
|
||||
virtual AZ::IO::Path GetPakFromFile(const char* filename) = 0;
|
||||
|
||||
/*
|
||||
* Prints the message to the editor console window.
|
||||
|
||||
@@ -625,7 +625,7 @@ namespace
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* PyGetPakFromFile(const char* filename)
|
||||
AZ::IO::Path PyGetPakFromFile(const char* filename)
|
||||
{
|
||||
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
|
||||
AZ::IO::HandleType fileHandle = pIPak->FOpen(filename, "rb");
|
||||
@@ -633,8 +633,9 @@ namespace
|
||||
{
|
||||
throw std::logic_error("Invalid file name.");
|
||||
}
|
||||
const char* pArchPath = pIPak->GetFileArchivePath(fileHandle);
|
||||
AZ::IO::Path pArchPath = pIPak->GetFileArchivePath(fileHandle);
|
||||
pIPak->FClose(fileHandle);
|
||||
|
||||
return pArchPath;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1041,7 @@ namespace AzToolsFramework
|
||||
return PySetAxisConstraint(pConstrain);
|
||||
}
|
||||
|
||||
const char* PythonEditorComponent::GetPakFromFile(const char* filename)
|
||||
AZ::IO::Path PythonEditorComponent::GetPakFromFile(const char* filename)
|
||||
{
|
||||
return PyGetPakFromFile(filename);
|
||||
}
|
||||
@@ -1114,7 +1115,7 @@ namespace AzToolsFramework
|
||||
addLegacyGeneral(behaviorContext->Method("get_axis_constraint", PyGetAxisConstraint, nullptr, "Gets axis."));
|
||||
addLegacyGeneral(behaviorContext->Method("set_axis_constraint", PySetAxisConstraint, nullptr, "Sets axis."));
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("get_pak_from_file", PyGetPakFromFile, nullptr, "Finds a pak file name for a given file."));
|
||||
addLegacyGeneral(behaviorContext->Method("get_pak_from_file", [](const char* filename) -> AZStd::string { return PyGetPakFromFile(filename).Native(); }, nullptr, "Finds a pak file name for a given file."));
|
||||
|
||||
addLegacyGeneral(behaviorContext->Method("log", PyLog, nullptr, "Prints the message to the editor console window."));
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace AzToolsFramework
|
||||
|
||||
void SetAxisConstraint(AZStd::string_view pConstrain) override;
|
||||
|
||||
const char* GetPakFromFile(const char* filename) override;
|
||||
AZ::IO::Path GetPakFromFile(const char* filename) override;
|
||||
|
||||
void Log(const char* pMessage) override;
|
||||
|
||||
|
||||
@@ -123,18 +123,18 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ESystemClassID SystemClassID() { return m_classId; };
|
||||
ESystemClassID SystemClassID() override { return m_classId; };
|
||||
static const GUID& GetClassID()
|
||||
{
|
||||
return TWidget::GetClassID();
|
||||
}
|
||||
|
||||
virtual const GUID& ClassID()
|
||||
const GUID& ClassID() override
|
||||
{
|
||||
return GetClassID();
|
||||
}
|
||||
virtual QString ClassName() { return m_name; };
|
||||
virtual QString Category() { return m_category; };
|
||||
QString ClassName() override { return m_name; };
|
||||
QString Category() override { return m_category; };
|
||||
|
||||
QObject* CreateQObject() const override { return new TWidget(); };
|
||||
QString GetPaneTitle() override { return m_name; };
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
void OnInitDialog() override;
|
||||
|
||||
// Derived Dialogs should override this
|
||||
virtual void GetItems(std::vector<SItem>& outItems);
|
||||
void GetItems(std::vector<SItem>& outItems) override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_SELECTSEQUENCEDIALOG_H
|
||||
|
||||
@@ -171,7 +171,6 @@ SEditorSettings::SEditorSettings()
|
||||
bBackupOnSave = true;
|
||||
backupOnSaveMaxCount = 3;
|
||||
bApplyConfigSpecInEditor = true;
|
||||
useLowercasePaths = 0;
|
||||
showErrorDialogOnLoad = 1;
|
||||
|
||||
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
|
||||
@@ -887,6 +886,7 @@ void SEditorSettings::Load()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AZ_CVAR(bool, ed_previewGameInFullscreen_once, false, nullptr, AZ::ConsoleFunctorFlags::IsInvisible, "Preview the game (Ctrl+G, \"Play Game\", etc.) in fullscreen once");
|
||||
AZ_CVAR(bool, ed_lowercasepaths, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Convert CCryFile paths to lowercase on Open");
|
||||
|
||||
void SEditorSettings::PostInitApply()
|
||||
{
|
||||
@@ -898,7 +898,6 @@ void SEditorSettings::PostInitApply()
|
||||
// Create CVars.
|
||||
REGISTER_CVAR2("ed_highlightGeometry", &viewports.bHighlightMouseOverGeometry, viewports.bHighlightMouseOverGeometry, 0, "Highlight geometry when mouse over it");
|
||||
REGISTER_CVAR2("ed_showFrozenHelpers", &viewports.nShowFrozenHelpers, viewports.nShowFrozenHelpers, 0, "Show helpers of frozen objects");
|
||||
REGISTER_CVAR2("ed_lowercasepaths", &useLowercasePaths, useLowercasePaths, 0, "generate paths in lowercase");
|
||||
gEnv->pConsole->RegisterInt("fe_fbx_savetempfile", 0, 0, "When importing an FBX file into Facial Editor, this will save out a conversion FSQ to the Animations/temp folder for trouble shooting");
|
||||
|
||||
REGISTER_CVAR2_CB("ed_toolbarIconSize", &gui.nToolbarIconSize, gui.nToolbarIconSize, VF_NULL, "Override size of the toolbar icons 0-default, 16,32,...", ToolbarIconSizeChanged);
|
||||
|
||||
@@ -340,8 +340,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
//! how many save backups to keep
|
||||
int backupOnSaveMaxCount;
|
||||
|
||||
int useLowercasePaths;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Autobackup.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
protected:
|
||||
void dragMoveEvent(QDragMoveEvent* ev) override;
|
||||
void dragEnterEvent(QDragEnterEvent* ev) override;
|
||||
void dropEvent(QDropEvent* ev);
|
||||
void dropEvent(QDropEvent* ev) override;
|
||||
|
||||
private:
|
||||
void OnTabChanged(int index);
|
||||
|
||||
@@ -35,11 +35,11 @@ public:
|
||||
|
||||
/** Get type of this viewport.
|
||||
*/
|
||||
virtual EViewportType GetType() const { return ET_ViewportMap; }
|
||||
virtual void SetType(EViewportType type);
|
||||
EViewportType GetType() const override { return ET_ViewportMap; }
|
||||
void SetType(EViewportType type) override;
|
||||
|
||||
virtual void ResetContent();
|
||||
virtual void UpdateContent(int flags);
|
||||
void ResetContent() override;
|
||||
void UpdateContent(int flags) override;
|
||||
|
||||
//! Map viewport position to world space position.
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
protected:
|
||||
// Draw everything.
|
||||
virtual void Draw(DisplayContext& dc);
|
||||
void Draw(DisplayContext& dc) override;
|
||||
|
||||
private:
|
||||
bool m_bContentsUpdated;
|
||||
|
||||
@@ -187,7 +187,7 @@ protected:
|
||||
int m_customFPS;
|
||||
|
||||
void InitializeContext();
|
||||
virtual void OnMovieEvent(IMovieListener::EMovieEvent event, IAnimSequence* pSequence);
|
||||
void OnMovieEvent(IMovieListener::EMovieEvent event, IAnimSequence* pSequence) override;
|
||||
|
||||
void CaptureItemStart();
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
void SetPlayCallback(const std::function<void()>& callback);
|
||||
|
||||
// IAnimationContextListener
|
||||
virtual void OnSequenceChanged(CTrackViewSequence* pNewSequence);
|
||||
virtual void OnTimeChanged(float newTime);
|
||||
void OnSequenceChanged(CTrackViewSequence* pNewSequence) override;
|
||||
void OnTimeChanged(float newTime) override;
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
void OnSplineTimeMarkerChange();
|
||||
|
||||
// IEditorNotifyListener
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
//ITrackViewSequenceListener
|
||||
void OnKeysChanged(CTrackViewSequence* pSequence) override;
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
float GetFPS() const { return m_widget->GetFPS(); }
|
||||
void SetTickDisplayMode(ETVTickMode mode) { m_widget->SetTickDisplayMode(mode); }
|
||||
|
||||
virtual void OnSequenceChanged(CTrackViewSequence* pNewSequence) { m_widget->OnSequenceChanged(pNewSequence); }
|
||||
virtual void OnTimeChanged(float newTime) { m_widget->OnTimeChanged(newTime); }
|
||||
void OnSequenceChanged(CTrackViewSequence* pNewSequence) override { m_widget->OnSequenceChanged(pNewSequence); }
|
||||
void OnTimeChanged(float newTime) override { m_widget->OnTimeChanged(newTime); }
|
||||
|
||||
// ITrackViewSequenceListener delegation to m_widget
|
||||
void OnKeysChanged(CTrackViewSequence* pSequence) override { m_widget->OnKeysChanged(pSequence); }
|
||||
|
||||
@@ -69,10 +69,10 @@ public:
|
||||
void UpdateSequenceLockStatus();
|
||||
|
||||
// IAnimationContextListener
|
||||
virtual void OnSequenceChanged(CTrackViewSequence* pNewSequence) override;
|
||||
void OnSequenceChanged(CTrackViewSequence* pNewSequence) override;
|
||||
|
||||
// ITrackViewSequenceListener
|
||||
virtual void OnSequenceSettingsChanged(CTrackViewSequence* pSequence) override;
|
||||
void OnSequenceSettingsChanged(CTrackViewSequence* pSequence) override;
|
||||
|
||||
void UpdateDopeSheetTime(CTrackViewSequence* pSequence);
|
||||
|
||||
@@ -197,8 +197,8 @@ private:
|
||||
bool processRawInput(MSG* pMsg);
|
||||
#endif
|
||||
|
||||
virtual void OnNodeSelectionChanged(CTrackViewSequence* pSequence) override;
|
||||
virtual void OnNodeRenamed(CTrackViewNode* pNode, const char* pOldName) override;
|
||||
void OnNodeSelectionChanged(CTrackViewSequence* pSequence) override;
|
||||
void OnNodeRenamed(CTrackViewNode* pNode, const char* pOldName) override;
|
||||
|
||||
void OnSequenceAdded(CTrackViewSequence* pSequence) override;
|
||||
void OnSequenceRemoved(CTrackViewSequence* pSequence) override;
|
||||
@@ -209,8 +209,8 @@ private:
|
||||
void AddDialogListeners();
|
||||
void RemoveDialogListeners();
|
||||
|
||||
virtual void BeginUndoTransaction();
|
||||
virtual void EndUndoTransaction();
|
||||
void BeginUndoTransaction() override;
|
||||
void EndUndoTransaction() override;
|
||||
void SaveCurrentSequenceToFBX();
|
||||
void SaveSequenceTimingToXML();
|
||||
|
||||
|
||||
@@ -117,13 +117,14 @@ class CTrackViewKeyBundle
|
||||
public:
|
||||
CTrackViewKeyBundle()
|
||||
: m_bAllOfSameType(true) {}
|
||||
virtual ~CTrackViewKeyBundle() = default;
|
||||
|
||||
virtual bool AreAllKeysOfSameType() const override { return m_bAllOfSameType; }
|
||||
bool AreAllKeysOfSameType() const override { return m_bAllOfSameType; }
|
||||
|
||||
virtual unsigned int GetKeyCount() const override { return static_cast<unsigned int>(m_keys.size()); }
|
||||
virtual CTrackViewKeyHandle GetKey(unsigned int index) override { return m_keys[index]; }
|
||||
unsigned int GetKeyCount() const override { return static_cast<unsigned int>(m_keys.size()); }
|
||||
CTrackViewKeyHandle GetKey(unsigned int index) override { return m_keys[index]; }
|
||||
|
||||
virtual void SelectKeys(const bool bSelected) override;
|
||||
void SelectKeys(const bool bSelected) override;
|
||||
|
||||
CTrackViewKeyHandle GetSingleSelectedKey();
|
||||
|
||||
|
||||
@@ -100,16 +100,16 @@ public:
|
||||
void Load() override;
|
||||
|
||||
// ITrackViewNode
|
||||
virtual ETrackViewNodeType GetNodeType() const override { return eTVNT_Sequence; }
|
||||
ETrackViewNodeType GetNodeType() const override { return eTVNT_Sequence; }
|
||||
|
||||
virtual AZStd::string GetName() const override { return m_pAnimSequence->GetName(); }
|
||||
virtual bool SetName(const char* pName) override;
|
||||
virtual bool CanBeRenamed() const override { return true; }
|
||||
AZStd::string GetName() const override { return m_pAnimSequence->GetName(); }
|
||||
bool SetName(const char* pName) override;
|
||||
bool CanBeRenamed() const override { return true; }
|
||||
|
||||
// Binding/Unbinding
|
||||
virtual void BindToEditorObjects() override;
|
||||
virtual void UnBindFromEditorObjects() override;
|
||||
virtual bool IsBoundToEditorObjects() const override;
|
||||
void BindToEditorObjects() override;
|
||||
void UnBindFromEditorObjects() override;
|
||||
bool IsBoundToEditorObjects() const override;
|
||||
|
||||
// Time range
|
||||
void SetTimeRange(Range timeRange);
|
||||
@@ -136,10 +136,10 @@ public:
|
||||
uint32 GetCryMovieId() const { return m_pAnimSequence->GetId(); }
|
||||
|
||||
// Rendering
|
||||
virtual void Render(const SAnimContext& animContext) override;
|
||||
void Render(const SAnimContext& animContext) override;
|
||||
|
||||
// Playback control
|
||||
virtual void Animate(const SAnimContext& animContext) override;
|
||||
void Animate(const SAnimContext& animContext) override;
|
||||
void Resume() { m_pAnimSequence->Resume(); }
|
||||
void Pause() { m_pAnimSequence->Pause(); }
|
||||
void StillUpdate() { m_pAnimSequence->StillUpdate(); }
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
void TimeChanged(float newTime) { m_pAnimSequence->TimeChanged(newTime); }
|
||||
|
||||
// Check if it's a group node
|
||||
virtual bool IsGroupNode() const override { return true; }
|
||||
bool IsGroupNode() const override { return true; }
|
||||
|
||||
// Track Events (TODO: Undo?)
|
||||
int GetTrackEventsCount() const { return m_pAnimSequence->GetTrackEventsCount(); }
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
bool IsActiveSequence() const;
|
||||
|
||||
// The root sequence node is always an active director
|
||||
virtual bool IsActiveDirector() const override { return true; }
|
||||
bool IsActiveDirector() const override { return true; }
|
||||
|
||||
// Copy keys to clipboard (in XML form)
|
||||
void CopyKeysToClipboard(const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks);
|
||||
@@ -306,15 +306,15 @@ private:
|
||||
// Called when an animation updates needs to be schedules
|
||||
void ForceAnimation();
|
||||
|
||||
virtual void CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) override;
|
||||
void CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) override;
|
||||
|
||||
std::deque<CTrackViewTrack*> GetMatchingTracks(CTrackViewAnimNode* pAnimNode, XmlNodeRef trackNode);
|
||||
void GetMatchedPasteLocationsRec(std::vector<TMatchedTrackLocation>& locations, CTrackViewNode* pCurrentNode, XmlNodeRef clipboardNode);
|
||||
|
||||
virtual void BeginUndoTransaction();
|
||||
virtual void EndUndoTransaction();
|
||||
virtual void BeginRestoreTransaction();
|
||||
virtual void EndRestoreTransaction();
|
||||
void BeginUndoTransaction() override;
|
||||
void EndUndoTransaction() override;
|
||||
void BeginRestoreTransaction() override;
|
||||
void EndRestoreTransaction() override;
|
||||
|
||||
// For record mode on AZ::Entities - connect (or disconnect) to buses for notification of property changes
|
||||
void ConnectToBusesForRecording(const AZ::EntityId& entityIdForBus, bool enableConnection);
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
CTrackViewSequenceManager();
|
||||
~CTrackViewSequenceManager();
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
unsigned int GetCount() const { return static_cast<int>(m_sequences.size()); }
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
void OnSequenceAdded(CTrackViewSequence* pSequence);
|
||||
void OnSequenceRemoved(CTrackViewSequence* pSequence);
|
||||
|
||||
virtual void OnDataBaseItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event);
|
||||
void OnDataBaseItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event) override;
|
||||
|
||||
// AZ::EntitySystemBus
|
||||
void OnEntityNameChanged(const AZ::EntityId& entityId, const AZStd::string& name) override;
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
CTrackViewSplineCtrl(QWidget* parent);
|
||||
virtual ~CTrackViewSplineCtrl();
|
||||
|
||||
virtual void ClearSelection();
|
||||
void ClearSelection() override;
|
||||
|
||||
void AddSpline(ISplineInterpolator* pSpline, CTrackViewTrack* pTrack, const QColor& color);
|
||||
void AddSpline(ISplineInterpolator * pSpline, CTrackViewTrack * pTrack, QColor anColorArray[4]);
|
||||
@@ -53,12 +53,12 @@ protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
private:
|
||||
virtual void SelectKey(ISplineInterpolator* pSpline, int nKey, int nDimension, bool bSelect) override;
|
||||
virtual void SelectRectangle(const QRect& rc, bool bSelect) override;
|
||||
void SelectKey(ISplineInterpolator* pSpline, int nKey, int nDimension, bool bSelect) override;
|
||||
void SelectRectangle(const QRect& rc, bool bSelect) override;
|
||||
|
||||
std::vector<CTrackViewTrack*> m_tracks;
|
||||
|
||||
virtual bool GetTangentHandlePts(QPoint& inTangentPt, QPoint& pt, QPoint& outTangentPt,
|
||||
bool GetTangentHandlePts(QPoint& inTangentPt, QPoint& pt, QPoint& outTangentPt,
|
||||
int nSpline, int nKey, int nDimension) override;
|
||||
void ComputeIncomingTangentAndEaseTo(float& ds, float& easeTo, QPoint inTangentPt,
|
||||
int nSpline, int nKey, int nDimension);
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
void AdjustTCB(float d_tension, float d_continuity, float d_bias);
|
||||
void MoveSelectedTangentHandleTo(const QPoint& point);
|
||||
|
||||
virtual ISplineCtrlUndo* CreateSplineCtrlUndoObject(std::vector<ISplineInterpolator*>& splineContainer);
|
||||
ISplineCtrlUndo* CreateSplineCtrlUndoObject(std::vector<ISplineInterpolator*>& splineContainer) override;
|
||||
|
||||
bool m_bKeysFreeze;
|
||||
bool m_bTangentsFreeze;
|
||||
|
||||
@@ -44,7 +44,7 @@ public slots:
|
||||
QVector<int> Groups() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event)
|
||||
void paintEvent(QPaintEvent* event) override
|
||||
{
|
||||
if (model() && model()->rowCount() > 0)
|
||||
{
|
||||
|
||||
@@ -149,12 +149,13 @@ bool CFileUtil::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const c
|
||||
// Check if in pack.
|
||||
if (cryfile.IsInPak())
|
||||
{
|
||||
const char* sPakName = cryfile.GetPakPath();
|
||||
|
||||
if (bMsgBoxAskForExtraction)
|
||||
{
|
||||
AZ::IO::FixedMaxPath sPakName{ cryfile.GetPakPath() };
|
||||
// Cannot edit file in pack, suggest to extract it for editing.
|
||||
if (QMessageBox::critical(QApplication::activeWindow(), QString(), QObject::tr("File %1 is inside a PAK file %2\r\nDo you want it to be extracted for editing ?").arg(file, sPakName), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
if (QMessageBox::critical(QApplication::activeWindow(), QString(),
|
||||
QObject::tr("File %1 is inside a PAK file %2\r\nDo you want it to be extracted for editing ?").arg(file, sPakName.c_str()),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -173,10 +174,9 @@ bool CFileUtil::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const c
|
||||
if (diskFile.open(QFile::WriteOnly))
|
||||
{
|
||||
// Copy data from packed file to disk file.
|
||||
char* data = new char[cryfile.GetLength()];
|
||||
cryfile.ReadRaw(data, cryfile.GetLength());
|
||||
diskFile.write(data, cryfile.GetLength());
|
||||
delete []data;
|
||||
auto data = AZStd::make_unique<char[]>(cryfile.GetLength());
|
||||
cryfile.ReadRaw(data.get(), cryfile.GetLength());
|
||||
diskFile.write(data.get(), cryfile.GetLength());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -185,7 +185,14 @@ bool CFileUtil::ExtractFile(QString& file, bool bMsgBoxAskForExtraction, const c
|
||||
}
|
||||
else
|
||||
{
|
||||
file = cryfile.GetAdjustedFilename();
|
||||
|
||||
if (auto fileIoBase = AZ::IO::FileIOBase::GetInstance(); fileIoBase != nullptr)
|
||||
{
|
||||
if (AZ::IO::FixedMaxPath resolvedFilePath; fileIoBase->ResolvePath(resolvedFilePath, cryfile.GetFilename()))
|
||||
{
|
||||
file = QString::fromUtf8(resolvedFilePath.c_str(), static_cast<int>(resolvedFilePath.Native().size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2157,13 +2164,13 @@ uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*=
|
||||
return SCC_FILE_ATTRIBUTE_READONLY | SCC_FILE_ATTRIBUTE_INPAK;
|
||||
}
|
||||
|
||||
const char* adjustedFile = file.GetAdjustedFilename();
|
||||
if (!AZ::IO::SystemFile::Exists(adjustedFile))
|
||||
auto fileIoBase = AZ::IO::FileIOBase::GetInstance();
|
||||
if (!fileIoBase->Exists(file.GetFilename()))
|
||||
{
|
||||
return SCC_FILE_ATTRIBUTE_INVALID;
|
||||
}
|
||||
|
||||
if (!AZ::IO::SystemFile::IsWritable(adjustedFile))
|
||||
if (fileIoBase->IsReadOnly(file.GetFilename()))
|
||||
{
|
||||
return SCC_FILE_ATTRIBUTE_NORMAL | SCC_FILE_ATTRIBUTE_READONLY;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ bool CPakFile::Open(const char* filename, bool bAbsolutePath)
|
||||
|
||||
if (bAbsolutePath)
|
||||
{
|
||||
m_pArchive = pCryPak->OpenArchive(filename, nullptr, AZ::IO::INestedArchive::FLAGS_ABSOLUTE_PATHS);
|
||||
m_pArchive = pCryPak->OpenArchive(filename, {}, AZ::IO::INestedArchive::FLAGS_ABSOLUTE_PATHS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,7 +93,7 @@ bool CPakFile::OpenForRead(const char* filename)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_pArchive = pCryPak->OpenArchive(filename, nullptr, AZ::IO::INestedArchive::FLAGS_OPTIMIZED_READ_ONLY | AZ::IO::INestedArchive::FLAGS_ABSOLUTE_PATHS);
|
||||
m_pArchive = pCryPak->OpenArchive(filename, {}, AZ::IO::INestedArchive::FLAGS_OPTIMIZED_READ_ONLY | AZ::IO::INestedArchive::FLAGS_ABSOLUTE_PATHS);
|
||||
if (m_pArchive)
|
||||
{
|
||||
return true;
|
||||
|
||||
+122
-120
@@ -379,11 +379,11 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
public:
|
||||
virtual ~CVariableBase() {}
|
||||
|
||||
void SetName(const QString& name) { m_name = name; };
|
||||
void SetName(const QString& name) override { m_name = name; };
|
||||
//! Get name of parameter.
|
||||
QString GetName() const { return m_name; };
|
||||
QString GetName() const override { return m_name; };
|
||||
|
||||
QString GetHumanName() const
|
||||
QString GetHumanName() const override
|
||||
{
|
||||
if (!m_humanName.isEmpty())
|
||||
{
|
||||
@@ -391,82 +391,82 @@ public:
|
||||
}
|
||||
return m_name;
|
||||
}
|
||||
void SetHumanName(const QString& name) { m_humanName = name; }
|
||||
void SetHumanName(const QString& name) override { m_humanName = name; }
|
||||
|
||||
void SetDescription(const char* desc) { m_description = desc; };
|
||||
void SetDescription(const QString& desc) { m_description = desc; };
|
||||
void SetDescription(const char* desc) override { m_description = desc; };
|
||||
void SetDescription(const QString& desc) override { m_description = desc; };
|
||||
|
||||
//! Get name of parameter.
|
||||
QString GetDescription() const { return m_description; };
|
||||
QString GetDescription() const override { return m_description; };
|
||||
|
||||
EType GetType() const { return IVariable::UNKNOWN; };
|
||||
int GetSize() const { return sizeof(*this); };
|
||||
EType GetType() const override { return IVariable::UNKNOWN; };
|
||||
int GetSize() const override { return sizeof(*this); };
|
||||
|
||||
unsigned char GetDataType() const { return m_dataType; };
|
||||
void SetDataType(unsigned char dataType) { m_dataType = dataType; }
|
||||
unsigned char GetDataType() const override { return m_dataType; };
|
||||
void SetDataType(unsigned char dataType) override { m_dataType = dataType; }
|
||||
|
||||
void SetFlags(int flags) { m_flags = static_cast<uint16>(flags); }
|
||||
int GetFlags() const { return m_flags; }
|
||||
void SetFlagRecursive(EFlags flag) { m_flags |= flag; }
|
||||
void SetFlags(int flags) override { m_flags = static_cast<uint16>(flags); }
|
||||
int GetFlags() const override { return m_flags; }
|
||||
void SetFlagRecursive(EFlags flag) override { m_flags |= flag; }
|
||||
|
||||
void SetUserData(const QVariant &data){ m_userData = data; };
|
||||
QVariant GetUserData() const { return m_userData; }
|
||||
void SetUserData(const QVariant &data) override { m_userData = data; };
|
||||
QVariant GetUserData() const override { return m_userData; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Set([[maybe_unused]] int value) { assert(0); }
|
||||
void Set([[maybe_unused]] bool value) { assert(0); }
|
||||
void Set([[maybe_unused]] float value) { assert(0); }
|
||||
void Set([[maybe_unused]] double value) { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec2& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec3& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec4& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const Ang3& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const Quat& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const QString& value) { assert(0); }
|
||||
void Set([[maybe_unused]] const char* value) { assert(0); }
|
||||
void SetDisplayValue(const QString& value) { Set(value); }
|
||||
void Set([[maybe_unused]] int value) override { assert(0); }
|
||||
void Set([[maybe_unused]] bool value) override { assert(0); }
|
||||
void Set([[maybe_unused]] float value) override { assert(0); }
|
||||
void Set([[maybe_unused]] double value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec2& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec3& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const Vec4& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const Ang3& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const Quat& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const QString& value) override { assert(0); }
|
||||
void Set([[maybe_unused]] const char* value) override { assert(0); }
|
||||
void SetDisplayValue(const QString& value) override { Set(value); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Get methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Get([[maybe_unused]] int& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] bool& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] float& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] double& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] Vec2& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] Vec3& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] Vec4& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] Ang3& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] Quat& value) const { assert(0); }
|
||||
void Get([[maybe_unused]] QString& value) const { assert(0); }
|
||||
QString GetDisplayValue() const { QString val; Get(val); return val; }
|
||||
void Get([[maybe_unused]] int& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] bool& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] float& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] double& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] Vec2& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] Vec3& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] Vec4& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] Ang3& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] Quat& value) const override { assert(0); }
|
||||
void Get([[maybe_unused]] QString& value) const override { assert(0); }
|
||||
QString GetDisplayValue() const override { QString val; Get(val); return val; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IVariableContainer functions
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void AddVariable([[maybe_unused]] IVariable* var) { assert(0); }
|
||||
void AddVariable([[maybe_unused]] IVariable* var) override { assert(0); }
|
||||
|
||||
virtual bool DeleteVariable([[maybe_unused]] IVariable* var, [[maybe_unused]] bool recursive = false) { return false; }
|
||||
virtual void DeleteAllVariables() {}
|
||||
bool DeleteVariable([[maybe_unused]] IVariable* var, [[maybe_unused]] bool recursive = false) override { return false; }
|
||||
void DeleteAllVariables() override {}
|
||||
|
||||
virtual int GetNumVariables() const { return 0; }
|
||||
virtual IVariable* GetVariable([[maybe_unused]] int index) const { return nullptr; }
|
||||
int GetNumVariables() const override { return 0; }
|
||||
IVariable* GetVariable([[maybe_unused]] int index) const override { return nullptr; }
|
||||
|
||||
virtual bool IsContainsVariable([[maybe_unused]] IVariable* pVar, [[maybe_unused]] bool bRecursive = false) const { return false; }
|
||||
bool IsContainsVariable([[maybe_unused]] IVariable* pVar, [[maybe_unused]] bool bRecursive = false) const override { return false; }
|
||||
|
||||
virtual IVariable* FindVariable([[maybe_unused]] const char* name, [[maybe_unused]] bool bRecursive = false, [[maybe_unused]] bool bHumanName = false) const { return nullptr; }
|
||||
IVariable* FindVariable([[maybe_unused]] const char* name, [[maybe_unused]] bool bRecursive = false, [[maybe_unused]] bool bHumanName = false) const override { return nullptr; }
|
||||
|
||||
virtual bool IsEmpty() const { return true; }
|
||||
bool IsEmpty() const override { return true; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Wire(IVariable* var)
|
||||
void Wire(IVariable* var) override
|
||||
{
|
||||
m_wiredVars.push_back(var);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Unwire(IVariable* var)
|
||||
void Unwire(IVariable* var) override
|
||||
{
|
||||
if (!var)
|
||||
{
|
||||
@@ -480,7 +480,7 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AddOnSetCallback(OnSetCallback* func)
|
||||
void AddOnSetCallback(OnSetCallback* func) override
|
||||
{
|
||||
if (!stl::find(m_onSetFuncs, func))
|
||||
{
|
||||
@@ -489,13 +489,13 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RemoveOnSetCallback(OnSetCallback* func)
|
||||
void RemoveOnSetCallback(OnSetCallback* func) override
|
||||
{
|
||||
stl::find_and_erase(m_onSetFuncs, func);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ClearOnSetCallbacks()
|
||||
void ClearOnSetCallbacks() override
|
||||
{
|
||||
m_onSetFuncs.clear();
|
||||
}
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RemoveOnSetEnumCallback(OnSetCallback* func)
|
||||
void RemoveOnSetEnumCallback(OnSetCallback* func) override
|
||||
{
|
||||
stl::find_and_erase(m_onSetEnumFuncs, func);
|
||||
}
|
||||
@@ -520,7 +520,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnSetValue([[maybe_unused]] bool bRecursive)
|
||||
void OnSetValue([[maybe_unused]] bool bRecursive) override
|
||||
{
|
||||
// If have wired variables or OnSet callback, process them.
|
||||
// Send value to wired variable.
|
||||
@@ -549,7 +549,8 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Serialize(XmlNodeRef node, bool load)
|
||||
using IVariable::Serialize;
|
||||
void Serialize(XmlNodeRef node, bool load) override
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
@@ -567,8 +568,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void EnableUpdateCallbacks(bool boEnable){m_boUpdateCallbacksEnabled = boEnable; };
|
||||
virtual void SetForceModified(bool bForceModified) { m_bForceModified = bForceModified; }
|
||||
void EnableUpdateCallbacks(bool boEnable) override{m_boUpdateCallbacksEnabled = boEnable; };
|
||||
void SetForceModified(bool bForceModified) override { m_bForceModified = bForceModified; }
|
||||
protected:
|
||||
// Constructor.
|
||||
CVariableBase()
|
||||
@@ -641,13 +642,13 @@ public:
|
||||
CVariableArray(){}
|
||||
|
||||
//! Get name of parameter.
|
||||
virtual EType GetType() const { return IVariable::ARRAY; };
|
||||
virtual int GetSize() const { return sizeof(CVariableArray); };
|
||||
EType GetType() const override { return IVariable::ARRAY; };
|
||||
int GetSize() const override { return sizeof(CVariableArray); };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Set(const QString& value)
|
||||
void Set(const QString& value) override
|
||||
{
|
||||
if (m_strValue != value)
|
||||
{
|
||||
@@ -655,7 +656,7 @@ public:
|
||||
OnSetValue(false);
|
||||
}
|
||||
}
|
||||
void OnSetValue(bool bRecursive)
|
||||
void OnSetValue(bool bRecursive) override
|
||||
{
|
||||
CVariableBase::OnSetValue(bRecursive);
|
||||
if (bRecursive)
|
||||
@@ -666,7 +667,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
void SetFlagRecursive(EFlags flag)
|
||||
void SetFlagRecursive(EFlags flag) override
|
||||
{
|
||||
CVariableBase::SetFlagRecursive(flag);
|
||||
for (Variables::iterator it = m_vars.begin(); it != m_vars.end(); ++it)
|
||||
@@ -677,9 +678,9 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Get methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Get(QString& value) const { value = m_strValue; }
|
||||
void Get(QString& value) const override { value = m_strValue; }
|
||||
|
||||
virtual bool HasDefaultValue() const
|
||||
bool HasDefaultValue() const override
|
||||
{
|
||||
for (Variables::const_iterator it = m_vars.begin(); it != m_vars.end(); ++it)
|
||||
{
|
||||
@@ -691,7 +692,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void ResetToDefault()
|
||||
void ResetToDefault() override
|
||||
{
|
||||
for (Variables::const_iterator it = m_vars.begin(); it != m_vars.end(); ++it)
|
||||
{
|
||||
@@ -700,7 +701,7 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IVariable* Clone(bool bRecursive) const
|
||||
IVariable* Clone(bool bRecursive) const override
|
||||
{
|
||||
CVariableArray* var = new CVariableArray(*this);
|
||||
|
||||
@@ -713,7 +714,7 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CopyValue(IVariable* fromVar)
|
||||
void CopyValue(IVariable* fromVar) override
|
||||
{
|
||||
assert(fromVar);
|
||||
if (fromVar->GetType() != IVariable::ARRAY)
|
||||
@@ -733,20 +734,20 @@ public:
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetNumVariables() const { return static_cast<int>(m_vars.size()); }
|
||||
int GetNumVariables() const override { return static_cast<int>(m_vars.size()); }
|
||||
|
||||
virtual IVariable* GetVariable(int index) const
|
||||
IVariable* GetVariable(int index) const override
|
||||
{
|
||||
assert(index >= 0 && index < (int)m_vars.size());
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
virtual void AddVariable(IVariable* var)
|
||||
void AddVariable(IVariable* var) override
|
||||
{
|
||||
m_vars.push_back(var);
|
||||
}
|
||||
|
||||
virtual bool DeleteVariable(IVariable* var, bool recursive /*=false*/)
|
||||
bool DeleteVariable(IVariable* var, bool recursive /*=false*/) override
|
||||
{
|
||||
bool found = stl::find_and_erase(m_vars, var);
|
||||
if (!found && recursive)
|
||||
@@ -762,12 +763,12 @@ public:
|
||||
return found;
|
||||
}
|
||||
|
||||
virtual void DeleteAllVariables()
|
||||
void DeleteAllVariables() override
|
||||
{
|
||||
m_vars.clear();
|
||||
}
|
||||
|
||||
virtual bool IsContainsVariable(IVariable* pVar, bool bRecursive) const
|
||||
bool IsContainsVariable(IVariable* pVar, bool bRecursive) const override
|
||||
{
|
||||
for (Variables::const_iterator it = m_vars.begin(); it != m_vars.end(); ++it)
|
||||
{
|
||||
@@ -793,14 +794,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual IVariable* FindVariable(const char* name, bool bRecursive, bool bHumanName) const;
|
||||
IVariable* FindVariable(const char* name, bool bRecursive, bool bHumanName) const override;
|
||||
|
||||
virtual bool IsEmpty() const
|
||||
bool IsEmpty() const override
|
||||
{
|
||||
return m_vars.empty();
|
||||
}
|
||||
|
||||
void Serialize(XmlNodeRef node, bool load)
|
||||
using IVariable::Serialize;
|
||||
void Serialize(XmlNodeRef node, bool load) override
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
@@ -1074,11 +1076,11 @@ class CVariableVoid
|
||||
{
|
||||
public:
|
||||
CVariableVoid(){};
|
||||
virtual EType GetType() const { return IVariable::UNKNOWN; };
|
||||
virtual IVariable* Clone([[maybe_unused]] bool bRecursive) const { return new CVariableVoid(*this); }
|
||||
virtual void CopyValue([[maybe_unused]] IVariable* fromVar) {};
|
||||
virtual bool HasDefaultValue() const { return true; }
|
||||
virtual void ResetToDefault() {};
|
||||
EType GetType() const override { return IVariable::UNKNOWN; };
|
||||
IVariable* Clone([[maybe_unused]] bool bRecursive) const override { return new CVariableVoid(*this); }
|
||||
void CopyValue([[maybe_unused]] IVariable* fromVar) override {};
|
||||
bool HasDefaultValue() const override { return true; }
|
||||
void ResetToDefault() override {};
|
||||
protected:
|
||||
CVariableVoid(const CVariableVoid& v)
|
||||
: CVariableBase(v) {};
|
||||
@@ -1112,44 +1114,44 @@ public:
|
||||
}
|
||||
|
||||
//! Get name of parameter.
|
||||
virtual EType GetType() const { return (EType)var_type::type_traits<T>::type(); };
|
||||
virtual int GetSize() const { return sizeof(T); };
|
||||
EType GetType() const override { return (EType)var_type::type_traits<T>::type(); };
|
||||
int GetSize() const override { return sizeof(T); };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Set(int value) { SetValue(value); }
|
||||
virtual void Set(bool value) { SetValue(value); }
|
||||
virtual void Set(float value) { SetValue(value); }
|
||||
virtual void Set(double value) { SetValue(value); }
|
||||
virtual void Set(const Vec2& value) { SetValue(value); }
|
||||
virtual void Set(const Vec3& value) { SetValue(value); }
|
||||
virtual void Set(const Vec4& value) { SetValue(value); }
|
||||
virtual void Set(const Ang3& value) { SetValue(value); }
|
||||
virtual void Set(const Quat& value) { SetValue(value); }
|
||||
virtual void Set(const QString& value) { SetValue(value); }
|
||||
virtual void Set(const char* value) { SetValue(QString(value)); }
|
||||
void Set(int value) override { SetValue(value); }
|
||||
void Set(bool value) override { SetValue(value); }
|
||||
void Set(float value) override { SetValue(value); }
|
||||
void Set(double value) override { SetValue(value); }
|
||||
void Set(const Vec2& value) override { SetValue(value); }
|
||||
void Set(const Vec3& value) override { SetValue(value); }
|
||||
void Set(const Vec4& value) override { SetValue(value); }
|
||||
void Set(const Ang3& value) override { SetValue(value); }
|
||||
void Set(const Quat& value) override { SetValue(value); }
|
||||
void Set(const QString& value) override { SetValue(value); }
|
||||
void Set(const char* value) override { SetValue(QString(value)); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Get methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Get(int& value) const { GetValue(value); }
|
||||
virtual void Get(bool& value) const { GetValue(value); }
|
||||
virtual void Get(float& value) const { GetValue(value); }
|
||||
virtual void Get(double& value) const { GetValue(value); }
|
||||
virtual void Get(Vec2& value) const { GetValue(value); }
|
||||
virtual void Get(Vec3& value) const { GetValue(value); }
|
||||
virtual void Get(Vec4& value) const { GetValue(value); }
|
||||
virtual void Get(Quat& value) const { GetValue(value); }
|
||||
virtual void Get(QString& value) const { GetValue(value); }
|
||||
virtual bool HasDefaultValue() const
|
||||
void Get(int& value) const override { GetValue(value); }
|
||||
void Get(bool& value) const override { GetValue(value); }
|
||||
void Get(float& value) const override { GetValue(value); }
|
||||
void Get(double& value) const override { GetValue(value); }
|
||||
void Get(Vec2& value) const override { GetValue(value); }
|
||||
void Get(Vec3& value) const override { GetValue(value); }
|
||||
void Get(Vec4& value) const override { GetValue(value); }
|
||||
void Get(Quat& value) const override { GetValue(value); }
|
||||
void Get(QString& value) const override { GetValue(value); }
|
||||
bool HasDefaultValue() const override
|
||||
{
|
||||
T defval;
|
||||
var_type::init(defval);
|
||||
return m_valueDef == defval;
|
||||
}
|
||||
|
||||
virtual void ResetToDefault()
|
||||
void ResetToDefault() override
|
||||
{
|
||||
T defval;
|
||||
var_type::init(defval);
|
||||
@@ -1159,7 +1161,7 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Limits.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetLimits(float fMin, float fMax, float fStep = 0.f, bool bHardMin = true, bool bHardMax = true)
|
||||
void SetLimits(float fMin, float fMax, float fStep = 0.f, bool bHardMin = true, bool bHardMax = true) override
|
||||
{
|
||||
m_valueMin = fMin;
|
||||
m_valueMax = fMax;
|
||||
@@ -1171,7 +1173,7 @@ public:
|
||||
m_customLimits = true;
|
||||
}
|
||||
|
||||
virtual void GetLimits(float& fMin, float& fMax, float& fStep, bool& bHardMin, bool& bHardMax)
|
||||
void GetLimits(float& fMin, float& fMax, float& fStep, bool& bHardMin, bool& bHardMax) override
|
||||
{
|
||||
if (!m_customLimits && var_type::type_traits<T>::supports_range())
|
||||
{
|
||||
@@ -1199,7 +1201,7 @@ public:
|
||||
m_customLimits = false;
|
||||
}
|
||||
|
||||
virtual bool HasCustomLimits()
|
||||
bool HasCustomLimits() override
|
||||
{
|
||||
return m_customLimits;
|
||||
}
|
||||
@@ -1217,14 +1219,14 @@ public:
|
||||
void operator=(const T& value) { SetValue(value); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IVariable* Clone([[maybe_unused]] bool bRecursive) const
|
||||
IVariable* Clone([[maybe_unused]] bool bRecursive) const override
|
||||
{
|
||||
Self* var = new Self(*this);
|
||||
return var;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CopyValue(IVariable* fromVar)
|
||||
void CopyValue(IVariable* fromVar) override
|
||||
{
|
||||
assert(fromVar);
|
||||
T val;
|
||||
@@ -1668,7 +1670,7 @@ struct CSmartVariableBase
|
||||
return *pV;
|
||||
} // Cast to CVariableBase&
|
||||
VarType& operator*() const { return *pVar; }
|
||||
VarType* operator->(void) const { return pVar; }
|
||||
VarType* operator->() const { return pVar; }
|
||||
|
||||
VarType* GetVar() const { return pVar; };
|
||||
|
||||
@@ -1730,7 +1732,7 @@ struct CSmartVariableArray
|
||||
}
|
||||
|
||||
VarType& operator*() const { return *pVar; }
|
||||
VarType* operator->(void) const { return pVar; }
|
||||
VarType* operator->() const { return pVar; }
|
||||
|
||||
VarType* GetVar() const { return pVar; };
|
||||
|
||||
@@ -1752,35 +1754,35 @@ public:
|
||||
// Dtor.
|
||||
virtual ~CVarBlock() {}
|
||||
//! Add variable to block.
|
||||
virtual void AddVariable(IVariable* var);
|
||||
void AddVariable(IVariable* var) override;
|
||||
//! Remove variable from block
|
||||
virtual bool DeleteVariable(IVariable* var, bool bRecursive = false);
|
||||
bool DeleteVariable(IVariable* var, bool bRecursive = false) override;
|
||||
|
||||
void AddVariable(IVariable* pVar, const char* varName, unsigned char dataType = IVariable::DT_SIMPLE);
|
||||
// This used from smart variable pointer.
|
||||
void AddVariable(CVariableBase& var, const char* varName, unsigned char dataType = IVariable::DT_SIMPLE);
|
||||
|
||||
//! Returns number of variables in block.
|
||||
virtual int GetNumVariables() const { return static_cast<int>(m_vars.size()); }
|
||||
int GetNumVariables() const override { return static_cast<int>(m_vars.size()); }
|
||||
|
||||
//! Get pointer to stored variable by index.
|
||||
virtual IVariable* GetVariable(int index) const
|
||||
IVariable* GetVariable(int index) const override
|
||||
{
|
||||
assert(index >= 0 && index < m_vars.size());
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
// Clear all vars from VarBlock.
|
||||
virtual void DeleteAllVariables() { m_vars.clear(); };
|
||||
void DeleteAllVariables() override { m_vars.clear(); };
|
||||
|
||||
//! Return true if variable block is empty (Does not have any vars).
|
||||
virtual bool IsEmpty() const { return m_vars.empty(); }
|
||||
bool IsEmpty() const override { return m_vars.empty(); }
|
||||
|
||||
// Returns true if var block contains specified variable.
|
||||
virtual bool IsContainsVariable(IVariable* pVar, bool bRecursive = true) const;
|
||||
bool IsContainsVariable(IVariable* pVar, bool bRecursive = true) const override;
|
||||
|
||||
//! Find variable by name.
|
||||
virtual IVariable* FindVariable(const char* name, bool bRecursive = true, bool bHumanName = false) const;
|
||||
IVariable* FindVariable(const char* name, bool bRecursive = true, bool bHumanName = false) const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Clone var block.
|
||||
|
||||
@@ -124,7 +124,7 @@ bool CXmlArchive::SaveToPak([[maybe_unused]] const QString& levelPath, CPakFile&
|
||||
|
||||
if (pakFile.GetArchive())
|
||||
{
|
||||
CLogFile::FormatLine("Saving pak file %s", (const char*)pakFile.GetArchive()->GetFullPath());
|
||||
CLogFile::FormatLine("Saving pak file %.*s", AZ_STRING_ARG(pakFile.GetArchive()->GetFullPath().Native()));
|
||||
}
|
||||
|
||||
pNamedData->Save(pakFile);
|
||||
|
||||
+51
-50
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
//! Get current view matrix.
|
||||
//! This is a matrix that transforms from world space to view space.
|
||||
virtual const Matrix34& GetViewTM() const
|
||||
const Matrix34& GetViewTM() const override
|
||||
{
|
||||
AZ_Error("CryLegacy", false, "QtViewport::GetViewTM not implemented");
|
||||
static const Matrix34 m;
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Get current screen matrix.
|
||||
//! Screen matrix transform from World space to Screen space.
|
||||
virtual const Matrix34& GetScreenTM() const
|
||||
const Matrix34& GetScreenTM() const override
|
||||
{
|
||||
return m_screenTM;
|
||||
}
|
||||
@@ -190,9 +190,9 @@ public:
|
||||
virtual Vec3 MapViewToCP(const QPoint& point) = 0;
|
||||
|
||||
//! Map viewport position to world space position.
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const = 0;
|
||||
Vec3 ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override = 0;
|
||||
//! Convert point on screen to world ray.
|
||||
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const = 0;
|
||||
void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override = 0;
|
||||
//! Get normal for viewport position
|
||||
virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) = 0;
|
||||
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
virtual void SetCursorString(const QString& str) = 0;
|
||||
|
||||
virtual void SetFocus() = 0;
|
||||
virtual void Invalidate(bool bErase = 1) = 0;
|
||||
virtual void Invalidate(bool bErase = true) = 0;
|
||||
|
||||
// Is overridden by RenderViewport
|
||||
virtual void SetFOV([[maybe_unused]] float fov) {}
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
|
||||
void SetViewPane(CLayoutViewPane* viewPane) { m_viewPane = viewPane; }
|
||||
|
||||
virtual CViewport *asCViewport() { return this; }
|
||||
CViewport *asCViewport() override { return this; }
|
||||
|
||||
protected:
|
||||
CLayoutViewPane* m_viewPane = nullptr;
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
void SetActiveWindow() override { activateWindow(); }
|
||||
|
||||
//! Called while window is idle.
|
||||
virtual void Update();
|
||||
void Update() override;
|
||||
|
||||
/** Set name of this viewport.
|
||||
*/
|
||||
@@ -344,24 +344,24 @@ public:
|
||||
|
||||
/** Get name of viewport
|
||||
*/
|
||||
QString GetName() const;
|
||||
QString GetName() const override;
|
||||
|
||||
virtual void SetFocus() { setFocus(); }
|
||||
virtual void Invalidate([[maybe_unused]] bool bErase = 1) { update(); }
|
||||
void SetFocus() override { setFocus(); }
|
||||
void Invalidate([[maybe_unused]] bool bErase = 1) override { update(); }
|
||||
|
||||
// Is overridden by RenderViewport
|
||||
virtual void SetFOV([[maybe_unused]] float fov) {}
|
||||
virtual float GetFOV() const;
|
||||
void SetFOV([[maybe_unused]] float fov) override {}
|
||||
float GetFOV() const override;
|
||||
|
||||
// Must be overridden in derived classes.
|
||||
// Returns:
|
||||
// e.g. 4.0/3.0
|
||||
virtual float GetAspectRatio() const = 0;
|
||||
virtual void GetDimensions(int* pWidth, int* pHeight) const;
|
||||
virtual void ScreenToClient(QPoint& pPoint) const override;
|
||||
float GetAspectRatio() const override = 0;
|
||||
void GetDimensions(int* pWidth, int* pHeight) const override;
|
||||
void ScreenToClient(QPoint& pPoint) const override;
|
||||
|
||||
virtual void ResetContent();
|
||||
virtual void UpdateContent(int flags);
|
||||
void ResetContent() override;
|
||||
void UpdateContent(int flags) override;
|
||||
|
||||
//! Set current zoom factor for this viewport.
|
||||
virtual void SetZoomFactor(float fZoomFactor);
|
||||
@@ -373,10 +373,10 @@ public:
|
||||
virtual void OnDeactivate();
|
||||
|
||||
//! Map world space position to viewport position.
|
||||
virtual QPoint WorldToView(const Vec3& wp) const override;
|
||||
QPoint WorldToView(const Vec3& wp) const override;
|
||||
|
||||
//! Map world space position to 3D viewport position.
|
||||
virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
|
||||
Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
|
||||
|
||||
//! Map viewport position to world space position.
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
@@ -391,17 +391,18 @@ public:
|
||||
|
||||
//! This method return a vector (p2-p1) in world space alligned to construction plane and restriction axises.
|
||||
//! p1 and p2 must be given in world space and lie on construction plane.
|
||||
virtual Vec3 GetCPVector(const Vec3& p1, const Vec3& p2, int axis);
|
||||
using CViewport::GetCPVector;
|
||||
Vec3 GetCPVector(const Vec3& p1, const Vec3& p2, int axis) override;
|
||||
|
||||
//! Snap any given 3D world position to grid lines if snap is enabled.
|
||||
Vec3 SnapToGrid(const Vec3& vec) override;
|
||||
virtual float GetGridStep() const;
|
||||
float GetGridStep() const override;
|
||||
|
||||
//! Returns the screen scale factor for a point given in world coordinates.
|
||||
//! This factor gives the width in world-space units at the point's distance of the viewport.
|
||||
virtual float GetScreenScaleFactor([[maybe_unused]] const Vec3& worldPoint) const { return 1; };
|
||||
float GetScreenScaleFactor([[maybe_unused]] const Vec3& worldPoint) const override { return 1; };
|
||||
|
||||
void SetAxisConstrain(int axis);
|
||||
void SetAxisConstrain(int axis) override;
|
||||
|
||||
/// Take raw input and create a final mouse interaction.
|
||||
/// @attention Do not map **point** from widget to viewport explicitly,
|
||||
@@ -413,7 +414,7 @@ public:
|
||||
// Selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Resets current selection region.
|
||||
virtual void ResetSelectionRegion();
|
||||
void ResetSelectionRegion() override;
|
||||
//! Set 2D selection rectangle.
|
||||
void SetSelectionRectangle(const QRect& rect) override;
|
||||
|
||||
@@ -422,12 +423,12 @@ public:
|
||||
//! Called when dragging selection rectangle.
|
||||
void OnDragSelectRectangle(const QRect& rect, bool bNormalizeRect = false) override;
|
||||
//! Get selection precision tolerance.
|
||||
float GetSelectionTolerance() const { return m_selectionTolerance; }
|
||||
float GetSelectionTolerance() const override { return m_selectionTolerance; }
|
||||
//! Center viewport on selection.
|
||||
void CenterOnSelection() override {}
|
||||
void CenterOnAABB([[maybe_unused]] const AABB& aabb) override {}
|
||||
|
||||
virtual void CenterOnSliceInstance() {}
|
||||
void CenterOnSliceInstance() override {}
|
||||
|
||||
//! Performs hit testing of 2d point in view to find which object hit.
|
||||
bool HitTest(const QPoint& point, HitContext& hitInfo) override;
|
||||
@@ -440,10 +441,10 @@ public:
|
||||
float GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, const QPoint& point) const override;
|
||||
|
||||
// Access to the member m_bAdvancedSelectMode so interested modules can know its value.
|
||||
bool GetAdvancedSelectModeFlag();
|
||||
bool GetAdvancedSelectModeFlag() override;
|
||||
|
||||
virtual void GetPerpendicularAxis(EAxis* pAxis, bool* pIs2D) const;
|
||||
virtual const ::Plane* GetConstructionPlane() const { return &m_constructionPlane; }
|
||||
void GetPerpendicularAxis(EAxis* pAxis, bool* pIs2D) const override;
|
||||
const ::Plane* GetConstructionPlane() const override { return &m_constructionPlane; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -451,7 +452,7 @@ public:
|
||||
//! Set construction plane from given position construction matrix refrence coord system and axis settings.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void MakeConstructionPlane(int axis) override;
|
||||
virtual void SetConstructionMatrix(RefCoordSys coordSys, const Matrix34& xform);
|
||||
void SetConstructionMatrix(RefCoordSys coordSys, const Matrix34& xform) override;
|
||||
virtual const Matrix34& GetConstructionMatrix(RefCoordSys coordSys);
|
||||
// Set simple construction plane origin.
|
||||
void SetConstructionOrigin(const Vec3& worldPos);
|
||||
@@ -461,11 +462,11 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Undo for viewpot operations.
|
||||
void BeginUndo();
|
||||
void AcceptUndo(const QString& undoDescription);
|
||||
void CancelUndo();
|
||||
void RestoreUndo();
|
||||
bool IsUndoRecording() const;
|
||||
void BeginUndo() override;
|
||||
void AcceptUndo(const QString& undoDescription) override;
|
||||
void CancelUndo() override;
|
||||
void RestoreUndo() override;
|
||||
bool IsUndoRecording() const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get prefered original size for this viewport.
|
||||
@@ -473,39 +474,39 @@ public:
|
||||
virtual QSize GetIdealSize() const;
|
||||
|
||||
//! Check if world space bounding box is visible in this view.
|
||||
virtual bool IsBoundsVisible(const AABB& box) const;
|
||||
bool IsBoundsVisible(const AABB& box) const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SetCursor(const QCursor& cursor)
|
||||
void SetCursor(const QCursor& cursor) override
|
||||
{
|
||||
setCursor(cursor);
|
||||
}
|
||||
|
||||
// Set`s current cursor string.
|
||||
void SetCurrentCursor(const QCursor& hCursor, const QString& cursorString);
|
||||
virtual void SetCurrentCursor(EStdCursor stdCursor, const QString& cursorString);
|
||||
void SetCurrentCursor(EStdCursor stdCursor);
|
||||
virtual void SetCursorString(const QString& cursorString);
|
||||
void ResetCursor();
|
||||
void SetSupplementaryCursorStr(const QString& str);
|
||||
void SetCurrentCursor(EStdCursor stdCursor, const QString& cursorString) override;
|
||||
void SetCurrentCursor(EStdCursor stdCursor) override;
|
||||
void SetCursorString(const QString& cursorString) override;
|
||||
void ResetCursor() override;
|
||||
void SetSupplementaryCursorStr(const QString& str) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Return visble objects cache.
|
||||
CBaseObjectsCache* GetVisibleObjectsCache() { return m_pVisibleObjectsCache; };
|
||||
CBaseObjectsCache* GetVisibleObjectsCache() override { return m_pVisibleObjectsCache; };
|
||||
|
||||
void RegisterRenderListener(IRenderListener* piListener);
|
||||
bool UnregisterRenderListener(IRenderListener* piListener);
|
||||
bool IsRenderListenerRegistered(IRenderListener* piListener);
|
||||
void RegisterRenderListener(IRenderListener* piListener) override;
|
||||
bool UnregisterRenderListener(IRenderListener* piListener) override;
|
||||
bool IsRenderListenerRegistered(IRenderListener* piListener) override;
|
||||
|
||||
void AddPostRenderer(IPostRenderer* pPostRenderer);
|
||||
bool RemovePostRenderer(IPostRenderer* pPostRenderer);
|
||||
void AddPostRenderer(IPostRenderer* pPostRenderer) override;
|
||||
bool RemovePostRenderer(IPostRenderer* pPostRenderer) override;
|
||||
|
||||
void CaptureMouse() override { m_mouseCaptured = true; QWidget::grabMouse(); }
|
||||
void ReleaseMouse() override { m_mouseCaptured = false; QWidget::releaseMouse(); }
|
||||
|
||||
virtual void setRay(QPoint& vp, Vec3& raySrc, Vec3& rayDir);
|
||||
virtual void setHitcontext(QPoint& vp, Vec3& raySrc, Vec3& rayDir);
|
||||
void setRay(QPoint& vp, Vec3& raySrc, Vec3& rayDir) override;
|
||||
void setHitcontext(QPoint& vp, Vec3& raySrc, Vec3& rayDir) override;
|
||||
QPoint m_vp;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
Vec3 m_raySrc;
|
||||
|
||||
@@ -154,6 +154,8 @@ void CViewportTitleDlg::SetupCameraDropdownMenu()
|
||||
cameraMenu->addMenu(GetFovMenu());
|
||||
m_ui->m_cameraMenu->setMenu(cameraMenu);
|
||||
m_ui->m_cameraMenu->setPopupMode(QToolButton::InstantPopup);
|
||||
QObject::connect(cameraMenu, &QMenu::aboutToShow, this, &CViewportTitleDlg::CheckForCameraSpeedUpdate);
|
||||
|
||||
QAction* gotoPositionAction = new QAction("Go to position", cameraMenu);
|
||||
connect(gotoPositionAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedGotoPosition);
|
||||
cameraMenu->addAction(gotoPositionAction);
|
||||
|
||||
@@ -77,7 +77,7 @@ Q_SIGNALS:
|
||||
protected:
|
||||
virtual void OnInitDialog();
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
|
||||
|
||||
void OnMaximize();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 <AzCore/std/functional.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
//! Sets a variable upon construction and again when the object goes out of scope.
|
||||
template<typename T>
|
||||
class ScopedValue
|
||||
{
|
||||
private:
|
||||
T* m_ptr;
|
||||
T m_finalValue;
|
||||
|
||||
public:
|
||||
ScopedValue(T* ptr, T initialValue, T finalValue) :
|
||||
m_ptr(ptr), m_finalValue(finalValue)
|
||||
{
|
||||
AZ_Assert(m_ptr, "ScopedValue::m_ptr is null");
|
||||
*m_ptr = initialValue;
|
||||
}
|
||||
|
||||
~ScopedValue()
|
||||
{
|
||||
*m_ptr = m_finalValue;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace AZ
|
||||
@@ -19,4 +19,5 @@ set(FILES
|
||||
std/containers/vector_set.h
|
||||
std/containers/vector_set_base.h
|
||||
std/parallel/concurrency_checker.h
|
||||
Utils/ScopedValue.h
|
||||
)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 <AtomCore/Utils/ScopedValue.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
TEST(ScopedValueTest, TestBoolValue)
|
||||
{
|
||||
bool localValue = false;
|
||||
|
||||
{
|
||||
AZ::ScopedValue<bool> scopedValue(&localValue, true, false);
|
||||
EXPECT_EQ(true, localValue);
|
||||
}
|
||||
|
||||
EXPECT_EQ(false, localValue);
|
||||
}
|
||||
|
||||
TEST(ScopedValueTest, TestIntValue)
|
||||
{
|
||||
int localValue = 0;
|
||||
|
||||
{
|
||||
AZ::ScopedValue<int> scopedValue(&localValue, 1, 2);
|
||||
EXPECT_EQ(1, localValue);
|
||||
}
|
||||
|
||||
EXPECT_EQ(2, localValue);
|
||||
}
|
||||
}
|
||||
@@ -12,5 +12,6 @@ set(FILES
|
||||
InstanceDatabase.cpp
|
||||
lru_cache.cpp
|
||||
Main.cpp
|
||||
ScopedValueTest.cpp
|
||||
vector_set.cpp
|
||||
)
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace AZ
|
||||
_ComponentClass::RTTI_Type().ToString<AZStd::string>().c_str(), descriptor->GetName(), _ComponentClass::RTTI_TypeName()); \
|
||||
return nullptr; \
|
||||
} \
|
||||
else if (descriptor->GetName() != _ComponentClass::RTTI_TypeName()) \
|
||||
if (descriptor->GetName() != _ComponentClass::RTTI_TypeName()) \
|
||||
{ \
|
||||
AZ_Error("Component", false, "The same component UUID (%s) / name (%s) was registered twice. This isn't allowed, " \
|
||||
"it can cause lifetime management issues / crashes.\nThis situation can happen by declaring a component " \
|
||||
|
||||
@@ -1251,6 +1251,8 @@ namespace AZ
|
||||
|
||||
return AZ::SettingsRegistryInterface::VisitResponse::Continue;
|
||||
}
|
||||
|
||||
using SettingsRegistryInterface::Visitor::Visit;
|
||||
void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, bool value) override
|
||||
{
|
||||
// By default the auto load option is true
|
||||
|
||||
@@ -196,14 +196,14 @@ namespace AZ
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ComponentApplicationRequests
|
||||
void RegisterComponentDescriptor(const ComponentDescriptor* descriptor) override final;
|
||||
void UnregisterComponentDescriptor(const ComponentDescriptor* descriptor) override final;
|
||||
void RegisterEntityAddedEventHandler(EntityAddedEvent::Handler& handler) override final;
|
||||
void RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler& handler) override final;
|
||||
void RegisterEntityActivatedEventHandler(EntityActivatedEvent::Handler& handler) override final;
|
||||
void RegisterEntityDeactivatedEventHandler(EntityDeactivatedEvent::Handler& handler) override final;
|
||||
void SignalEntityActivated(Entity* entity) override final;
|
||||
void SignalEntityDeactivated(Entity* entity) override final;
|
||||
void RegisterComponentDescriptor(const ComponentDescriptor* descriptor) final;
|
||||
void UnregisterComponentDescriptor(const ComponentDescriptor* descriptor) final;
|
||||
void RegisterEntityAddedEventHandler(EntityAddedEvent::Handler& handler) final;
|
||||
void RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler& handler) final;
|
||||
void RegisterEntityActivatedEventHandler(EntityActivatedEvent::Handler& handler) final;
|
||||
void RegisterEntityDeactivatedEventHandler(EntityDeactivatedEvent::Handler& handler) final;
|
||||
void SignalEntityActivated(Entity* entity) final;
|
||||
void SignalEntityDeactivated(Entity* entity) final;
|
||||
bool AddEntity(Entity* entity) override;
|
||||
bool RemoveEntity(Entity* entity) override;
|
||||
bool DeleteEntity(const EntityId& id) override;
|
||||
|
||||
@@ -207,12 +207,6 @@ namespace AZ
|
||||
ActivateComponent(**it);
|
||||
}
|
||||
|
||||
// Cache the transform interface to the transform interface
|
||||
// Generally this pattern is not recommended unless for component event buses
|
||||
// As we have a guarantee (by design) that components can't change during active state)
|
||||
// Even though technically they can connect disconnect from the bus.
|
||||
m_transform = TransformBus::FindFirstHandler(m_id);
|
||||
|
||||
SetState(State::Active);
|
||||
|
||||
EBUS_EVENT_ID(m_id, EntityBus, OnEntityActivated, m_id);
|
||||
@@ -1330,6 +1324,19 @@ namespace AZ
|
||||
return *processSignature;
|
||||
}
|
||||
|
||||
AZ::TransformInterface* Entity::GetTransform() const
|
||||
{
|
||||
// Lazy evaluation of the cached entity transform.
|
||||
if(!m_transform)
|
||||
{
|
||||
// Generally this pattern is not recommended unless for component event buses
|
||||
// As we have a guarantee (by design) that components can't change during active state)
|
||||
// Even though technically they can connect disconnect from the bus.
|
||||
m_transform = TransformBus::FindFirstHandler(m_id);
|
||||
}
|
||||
return m_transform;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// MakeId
|
||||
// Ids must be unique across a project at authoring time. Runtime doesn't matter
|
||||
|
||||
@@ -362,10 +362,9 @@ namespace AZ
|
||||
//! @return The Process Signature of the local machine.
|
||||
static AZ::u32 GetProcessSignature();
|
||||
|
||||
/// @cond EXCLUDE_DOCS
|
||||
//! @deprecated Use the TransformBus to communicate with the TransformInterface.
|
||||
inline TransformInterface* GetTransform() const { return m_transform; }
|
||||
/// @endcond
|
||||
//! Gets the TransformInterface for the entity.
|
||||
//! @return The TransformInterface for the entity.
|
||||
TransformInterface* GetTransform() const;
|
||||
|
||||
//! Sorts an entity's components based on the dependencies between components.
|
||||
//! If all dependencies are met, the required services can be activated
|
||||
@@ -414,7 +413,7 @@ namespace AZ
|
||||
//! A cached pointer to the transform interface.
|
||||
//! We recommend using AZ::TransformBus and caching locally instead of accessing
|
||||
//! the transform interface directly through this pointer.
|
||||
TransformInterface* m_transform;
|
||||
mutable TransformInterface* m_transform;
|
||||
|
||||
//! A user-friendly name for the entity. This makes error messages easier to read.
|
||||
AZStd::string m_name;
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace AZ
|
||||
class AssetTreeNodeBase
|
||||
{
|
||||
public:
|
||||
virtual ~AssetTreeNodeBase() = default;
|
||||
virtual const AssetPrimaryInfo* GetAssetPrimaryInfo() const = 0;
|
||||
virtual AssetTreeNodeBase* FindOrAddChild(const AssetTrackingId& id, const AssetPrimaryInfo* info) = 0;
|
||||
};
|
||||
@@ -94,6 +95,7 @@ namespace AZ
|
||||
class AssetTreeBase
|
||||
{
|
||||
public:
|
||||
virtual ~AssetTreeBase() = default;
|
||||
virtual AssetTreeNodeBase& GetRoot() = 0;
|
||||
};
|
||||
|
||||
@@ -101,6 +103,7 @@ namespace AZ
|
||||
class AssetAllocationTableBase
|
||||
{
|
||||
public:
|
||||
virtual ~AssetAllocationTableBase() = default;
|
||||
virtual AssetTreeNodeBase* FindAllocation(void* ptr) const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
~AssetTreeNode() override = default;
|
||||
|
||||
const AssetPrimaryInfo* GetAssetPrimaryInfo() const override
|
||||
{
|
||||
return m_primaryinfo;
|
||||
@@ -67,6 +69,8 @@ namespace AZ
|
||||
class AssetTree : public AssetTreeBase
|
||||
{
|
||||
public:
|
||||
~AssetTree() override = default;
|
||||
|
||||
AssetTreeNodeBase& GetRoot() override
|
||||
{
|
||||
return m_rootAssets;
|
||||
@@ -99,6 +103,7 @@ namespace AZ
|
||||
AllocationTable(mutex_type& mutex) : m_mutex(mutex)
|
||||
{
|
||||
}
|
||||
~AllocationTable() override = default;
|
||||
|
||||
AssetTreeNodeBase* FindAllocation(void* ptr) const override
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace AZ::Debug
|
||||
class BudgetTracker
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(BudgetTracker, "{E14A746D-BFFE-4C02-90FB-4699B79864A5}");
|
||||
AZ_TYPE_INFO(BudgetTracker, "{E14A746D-BFFE-4C02-90FB-4699B79864A5}");
|
||||
static Budget* GetBudgetFromEnvironment(const char* budgetName, uint32_t crc);
|
||||
|
||||
~BudgetTracker();
|
||||
|
||||
@@ -59,6 +59,20 @@ namespace AZStd
|
||||
|
||||
namespace AZ::Debug
|
||||
{
|
||||
// interface for externally defined profiler systems
|
||||
class Profiler
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(Profiler, "{3E5D6329-72D1-41BA-9158-68A349D1A4D5}");
|
||||
|
||||
Profiler() = default;
|
||||
virtual ~Profiler() = default;
|
||||
|
||||
// support for the extra macro args (e.g. format strings) will come in a later PR
|
||||
virtual void BeginRegion(const Budget* budget, const char* eventName) = 0;
|
||||
virtual void EndRegion(const Budget* budget) = 0;
|
||||
};
|
||||
|
||||
class ProfileScope
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
namespace AZ::Debug
|
||||
{
|
||||
template<typename... T>
|
||||
@@ -22,9 +24,11 @@ namespace AZ::Debug
|
||||
PIXBeginEvent(PIX_COLOR_INDEX(budget->Crc() & 0xff), eventName, args...);
|
||||
#endif
|
||||
budget->BeginProfileRegion();
|
||||
// TODO: injecting instrumentation for other profilers
|
||||
// NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism
|
||||
// will be introduced in a future PR
|
||||
|
||||
if (auto profiler = AZ::Interface<Profiler>::Get(); profiler)
|
||||
{
|
||||
profiler->BeginRegion(budget, eventName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -39,6 +43,10 @@ namespace AZ::Debug
|
||||
#if defined(USE_PIX)
|
||||
PIXEndEvent();
|
||||
#endif
|
||||
if (auto profiler = AZ::Interface<Profiler>::Get(); profiler)
|
||||
{
|
||||
profiler->EndRegion(budget);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -28,21 +28,21 @@ namespace AZ
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Driller
|
||||
virtual const char* GroupName() const { return "SystemDrillers"; }
|
||||
virtual const char* GetName() const { return "TraceMessagesDriller"; }
|
||||
virtual const char* GetDescription() const { return "Handles all system messages like Assert, Exception, Error, Warning, Printf, etc."; }
|
||||
virtual void Start(const Param* params = NULL, int numParams = 0);
|
||||
virtual void Stop();
|
||||
const char* GroupName() const override { return "SystemDrillers"; }
|
||||
const char* GetName() const override { return "TraceMessagesDriller"; }
|
||||
const char* GetDescription() const override { return "Handles all system messages like Assert, Exception, Error, Warning, Printf, etc."; }
|
||||
void Start(const Param* params = NULL, int numParams = 0) override;
|
||||
void Stop() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TraceMessagesDrillerBus
|
||||
/// Triggered when a AZ_Assert failed. This is terminating event! (the code will break, crash).
|
||||
virtual void OnAssert(const char* message);
|
||||
virtual void OnException(const char* message);
|
||||
virtual void OnError(const char* window, const char* message);
|
||||
virtual void OnWarning(const char* window, const char* message);
|
||||
virtual void OnPrintf(const char* window, const char* message);
|
||||
void OnAssert(const char* message) override;
|
||||
void OnException(const char* message) override;
|
||||
void OnError(const char* window, const char* message) override;
|
||||
void OnWarning(const char* window, const char* message) override;
|
||||
void OnPrintf(const char* window, const char* message) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
} // namespace Debug
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace AZ
|
||||
const unsigned char* GetData() const { return m_data.data(); }
|
||||
unsigned int GetDataSize() const { return static_cast<unsigned int>(m_data.size()); }
|
||||
inline void Reset() { m_data.clear(); }
|
||||
virtual void WriteBinary(const void* data, unsigned int dataSize)
|
||||
void WriteBinary(const void* data, unsigned int dataSize) override
|
||||
{
|
||||
m_data.insert(m_data.end(), reinterpret_cast<const unsigned char*>(data), reinterpret_cast<const unsigned char*>(data) + dataSize);
|
||||
}
|
||||
@@ -489,7 +489,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
unsigned int GetDataLeft() const { return static_cast<unsigned int>(m_dataEnd - m_data); }
|
||||
virtual unsigned int ReadBinary(void* data, unsigned int maxDataSize)
|
||||
unsigned int ReadBinary(void* data, unsigned int maxDataSize) override
|
||||
{
|
||||
AZ_Assert(m_data != nullptr, "You must call SetData function, before you can read data!");
|
||||
AZ_Assert(data != nullptr && maxDataSize > 0, "We must have a valid pointer and max data size!");
|
||||
@@ -523,7 +523,7 @@ namespace AZ
|
||||
bool Open(const char* fileName, int mode, int platformFlags = 0);
|
||||
void Close();
|
||||
|
||||
virtual void WriteBinary(const void* data, unsigned int dataSize);
|
||||
void WriteBinary(const void* data, unsigned int dataSize) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -540,7 +540,7 @@ namespace AZ
|
||||
DrillerInputFileStream();
|
||||
~DrillerInputFileStream();
|
||||
bool Open(const char* fileName, int mode, int platformFlags = 0);
|
||||
virtual unsigned int ReadBinary(void* data, unsigned int maxDataSize);
|
||||
unsigned int ReadBinary(void* data, unsigned int maxDataSize) override;
|
||||
void Close();
|
||||
};
|
||||
|
||||
|
||||
@@ -1717,6 +1717,7 @@ AZ_POP_DISABLE_WARNING
|
||||
{
|
||||
EBusRouterNode<typename EBus::InterfaceType> m_routerNode;
|
||||
public:
|
||||
virtual ~EBusNestedVersionRouter() = default;
|
||||
template<class Container>
|
||||
void BusRouterConnect(Container& container, int order = 0);
|
||||
|
||||
|
||||
@@ -98,21 +98,21 @@ namespace AZ
|
||||
|
||||
/// Return compressor type id.
|
||||
static AZ::u32 TypeId();
|
||||
virtual AZ::u32 GetTypeId() const { return TypeId(); }
|
||||
AZ::u32 GetTypeId() const override { return TypeId(); }
|
||||
/// Called when we open a stream to Read for the first time. Data contains the first. dataSize <= m_maxHeaderSize.
|
||||
virtual bool ReadHeaderAndData(CompressorStream* stream, AZ::u8* data, unsigned int dataSize);
|
||||
bool ReadHeaderAndData(CompressorStream* stream, AZ::u8* data, unsigned int dataSize) override;
|
||||
/// Called when we are about to start writing to a compressed stream.
|
||||
virtual bool WriteHeaderAndData(CompressorStream* stream);
|
||||
bool WriteHeaderAndData(CompressorStream* stream) override;
|
||||
/// Forwarded function from the Device when we from a compressed stream.
|
||||
virtual SizeType Read(CompressorStream* stream, SizeType byteSize, SizeType offset, void* buffer);
|
||||
SizeType Read(CompressorStream* stream, SizeType byteSize, SizeType offset, void* buffer) override;
|
||||
/// Forwarded function from the Device when we write to a compressed stream.
|
||||
virtual SizeType Write(CompressorStream* stream, SizeType byteSize, const void* data, SizeType offset = SizeType(-1));
|
||||
SizeType Write(CompressorStream* stream, SizeType byteSize, const void* data, SizeType offset = SizeType(-1)) override;
|
||||
/// Write a seek point.
|
||||
virtual bool WriteSeekPoint(CompressorStream* stream);
|
||||
bool WriteSeekPoint(CompressorStream* stream) override;
|
||||
/// Set auto seek point even dataSize bytes.
|
||||
virtual bool StartCompressor(CompressorStream* stream, int compressionLevel, SizeType autoSeekDataSize);
|
||||
bool StartCompressor(CompressorStream* stream, int compressionLevel, SizeType autoSeekDataSize) override;
|
||||
/// Called just before we close the stream. All compression data will be flushed and finalized. (You can't add data afterwards).
|
||||
virtual bool Close(CompressorStream* stream);
|
||||
bool Close(CompressorStream* stream) override;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* 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/IO/FileReader.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
|
||||
namespace AZ::IO
|
||||
{
|
||||
FileReader::FileReader() = default;
|
||||
|
||||
FileReader::FileReader(AZ::IO::FileIOBase* fileIoBase, const char* filePath)
|
||||
{
|
||||
Open(fileIoBase, filePath);
|
||||
}
|
||||
|
||||
FileReader::~FileReader()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
FileReader::FileReader(FileReader&& other)
|
||||
{
|
||||
AZStd::swap(m_file, other.m_file);
|
||||
AZStd::swap(m_fileIoBase, other.m_fileIoBase);
|
||||
}
|
||||
|
||||
FileReader& FileReader::operator=(FileReader&& other)
|
||||
{
|
||||
// Close the current file and take over other file
|
||||
Close();
|
||||
m_file = AZStd::move(other.m_file);
|
||||
m_fileIoBase = AZStd::move(other.m_fileIoBase);
|
||||
other.m_file = AZStd::monostate{};
|
||||
other.m_fileIoBase = {};
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool FileReader::Open(AZ::IO::FileIOBase* fileIoBase, const char* filePath)
|
||||
{
|
||||
// Close file if the FileReader has an instance open
|
||||
Close();
|
||||
|
||||
if (fileIoBase != nullptr)
|
||||
{
|
||||
AZ::IO::HandleType fileHandle;
|
||||
if (fileIoBase->Open(filePath, IO::OpenMode::ModeRead, fileHandle))
|
||||
{
|
||||
m_file = fileHandle;
|
||||
m_fileIoBase = fileIoBase;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::IO::SystemFile file;
|
||||
if (file.Open(filePath, IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY))
|
||||
{
|
||||
m_file = AZStd::move(file);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileReader::IsOpen() const
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
return *fileHandle != AZ::IO::InvalidHandle;
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
return systemFile->IsOpen();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void FileReader::Close()
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
if (AZ::IO::FileIOBase* fileIo = m_fileIoBase; fileIo != nullptr)
|
||||
{
|
||||
fileIo->Close(*fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
m_file = AZStd::monostate{};
|
||||
m_fileIoBase = {};
|
||||
}
|
||||
|
||||
auto FileReader::Length() const -> SizeType
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
if (SizeType fileSize{}; m_fileIoBase->Size(*fileHandle, fileSize))
|
||||
{
|
||||
return fileSize;
|
||||
}
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
return systemFile->Length();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto FileReader::Read(SizeType byteSize, void* buffer) -> SizeType
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
if (SizeType bytesRead{}; m_fileIoBase->Read(*fileHandle, buffer, byteSize, false, &bytesRead))
|
||||
{
|
||||
return bytesRead;
|
||||
}
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
return systemFile->Read(byteSize, buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto FileReader::Tell() const -> SizeType
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
if (SizeType fileOffset{}; m_fileIoBase->Tell(*fileHandle, fileOffset))
|
||||
{
|
||||
return fileOffset;
|
||||
}
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
return systemFile->Tell();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool FileReader::Seek(AZ::s64 offset, SeekType type)
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
return m_fileIoBase->Seek(*fileHandle, offset, type);
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
systemFile->Seek(offset, static_cast<AZ::IO::SystemFile::SeekMode>(type));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileReader::Eof() const
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
return m_fileIoBase->Eof(*fileHandle);
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
return systemFile->Eof();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileReader::GetFilePath(AZ::IO::FixedMaxPath& filePath) const
|
||||
{
|
||||
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
|
||||
{
|
||||
AZ::IO::FixedMaxPathString& pathStringRef = filePath.Native();
|
||||
if (m_fileIoBase->GetFilename(*fileHandle, pathStringRef.data(), pathStringRef.capacity()))
|
||||
{
|
||||
pathStringRef.resize_no_construct(AZStd::char_traits<char>::length(pathStringRef.data()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
|
||||
{
|
||||
filePath = systemFile->Name();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 <AzCore/IO/Path/Path_fwd.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/containers/variant.h>
|
||||
|
||||
namespace AZ::IO
|
||||
{
|
||||
class FileIOBase;
|
||||
enum class SeekType : AZ::u32;
|
||||
|
||||
//! Structure which encapsulates delegates File Read operations
|
||||
//! to either the FileIOBase or SystemFile classes based if a FileIOBase* instance has been supplied
|
||||
//! to the FileSystemReader class
|
||||
//! the SettingsRegistry option to use FileIO
|
||||
class FileReader
|
||||
{
|
||||
using HandleType = AZ::u32;
|
||||
using FileHandleType = AZStd::variant<AZStd::monostate, AZ::IO::SystemFile, HandleType>;
|
||||
public:
|
||||
using SizeType = AZ::u64;
|
||||
|
||||
//! Creates FileReader instance in the default state with no file opend
|
||||
FileReader();
|
||||
~FileReader();
|
||||
|
||||
//! Creates a new FileReader instance and attempts to open the file at the supplied path
|
||||
//! Uses the FileIOBase instance if supplied
|
||||
//! @param fileIOBase pointer to fileIOBase instance
|
||||
//! @param null-terminated filePath to open
|
||||
FileReader(AZ::IO::FileIOBase* fileIoBase, const char* filePath);
|
||||
|
||||
//! Takes ownership of the supplied FileReader handle
|
||||
FileReader(FileReader&& other);
|
||||
|
||||
//! Moves ownership of FileReader handle to this instance
|
||||
FileReader& operator=(FileReader&& other);
|
||||
|
||||
//! Opens a File using the FileIOBase instance if non-nullptr
|
||||
//! Otherwise fall back to use SystemFile
|
||||
//! @param fileIOBase pointer to fileIOBase instance
|
||||
//! @param null-terminated filePath to open
|
||||
//! @return true if the File is opened successfully
|
||||
bool Open(AZ::IO::FileIOBase* fileIoBase, const char* filePath);
|
||||
|
||||
//! Returns true if a file is currently open
|
||||
//! @return true if the file is open
|
||||
bool IsOpen() const;
|
||||
|
||||
//! Closes the File
|
||||
void Close();
|
||||
|
||||
//! Retrieve the length of the OpenFile
|
||||
SizeType Length() const;
|
||||
|
||||
//! Attempts to read up to byte size bytes into the supplied buffer
|
||||
//! @param byteSize - Maximum number of bytes to read
|
||||
//! @param buffer - Buffer to read bytes into
|
||||
//! @returns the number of bytes read if the file is open, otherwise 0
|
||||
SizeType Read(SizeType byteSize, void* buffer);
|
||||
|
||||
//! Returns the current file offset
|
||||
//! @returns file offset if the file is open, otherwise 0
|
||||
SizeType Tell() const;
|
||||
|
||||
//! Seeks within the open file to the offset supplied
|
||||
//! @param offset File offset to seek to
|
||||
//! @param type parameter to indicate the reference point to start the seek from
|
||||
//! @returns true if the file is open and the seek succeeded
|
||||
bool Seek(AZ::s64 offset, SeekType type);
|
||||
|
||||
//! Returns true if the file is open and in the EOF state
|
||||
bool Eof() const;
|
||||
|
||||
//! Store the file path of the open file into the output file path parameter
|
||||
//! The filePath reference is left unmodified, if the path was not stored
|
||||
//! @return true if the filePath was stored
|
||||
bool GetFilePath(AZ::IO::FixedMaxPath& filePath) const;
|
||||
|
||||
private:
|
||||
|
||||
FileHandleType m_file;
|
||||
AZ::IO::FileIOBase* m_fileIoBase{};
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user