Merge branch 'development' into memory/overrideshim_removal
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -191,6 +191,7 @@ void AssetImporterManager::OnBrowseDestinationFilePath(QLineEdit* destinationLin
|
||||
fileDialog.setViewMode(QFileDialog::List);
|
||||
fileDialog.setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||
fileDialog.setWindowTitle(tr("Select import destination"));
|
||||
fileDialog.setFileMode(QFileDialog::Directory);
|
||||
|
||||
QSettings settings;
|
||||
QString currentDestination = settings.value(AssetImporterManagerPrivate::g_selectDestinationFilesPath).toString();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserTableModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.h>
|
||||
|
||||
// AzQtComponents
|
||||
#include <AzQtComponents/Utilities/QtWindowUtilities.h>
|
||||
@@ -31,6 +32,15 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
AZ_CVAR_EXTERNED(bool, ed_useNewAssetBrowserTableView);
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
static constexpr const char* CollapseAllIcon = "Assets/Editor/Icons/AssetBrowser/Collapse_All.svg";
|
||||
static constexpr const char* MenuIcon = ":/Menu/menu.svg";
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
class ListenerForShowAssetEditorEvent
|
||||
: public QObject
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
@@ -83,10 +93,24 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
|
||||
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(false);
|
||||
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
|
||||
|
||||
m_assetBrowserModel->SetFilterModel(m_filterModel.data());
|
||||
|
||||
m_ui->m_collapseAllButton->setAutoRaise(true); // hover highlight
|
||||
m_ui->m_collapseAllButton->setIcon(QIcon(AzAssetBrowser::CollapseAllIcon));
|
||||
|
||||
connect(
|
||||
m_ui->m_collapseAllButton, &QToolButton::clicked, this,
|
||||
[this]()
|
||||
{
|
||||
m_ui->m_assetBrowserTreeViewWidget->collapseAll();
|
||||
});
|
||||
|
||||
if (ed_useNewAssetBrowserTableView)
|
||||
{
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(true);
|
||||
m_ui->m_toggleDisplayViewBtn->setIcon(QIcon(":/Menu/menu.svg"));
|
||||
m_ui->m_toggleDisplayViewBtn->setAutoRaise(true);
|
||||
m_ui->m_toggleDisplayViewBtn->setIcon(QIcon(AzAssetBrowser::MenuIcon));
|
||||
|
||||
m_tableModel->setFilterRole(Qt::DisplayRole);
|
||||
m_tableModel->setSourceModel(m_filterModel.data());
|
||||
|
||||
@@ -72,6 +72,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_collapseAllButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="Collapse All"/>
|
||||
</property>
|
||||
<property name="toolTipDuration">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -143,15 +159,6 @@
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -1,232 +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 "EditorDefs.h"
|
||||
|
||||
#include "BaseLibrary.h"
|
||||
#include "BaseLibraryItem.h"
|
||||
#include "Include/IBaseLibraryManager.h"
|
||||
#include <Util/PathUtil.h>
|
||||
#include <IFileUtil.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CBaseLibrary implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibrary::CBaseLibrary(IBaseLibraryManager* pManager)
|
||||
: m_pManager(pManager)
|
||||
, m_bModified(false)
|
||||
, m_bLevelLib(false)
|
||||
, m_bNewLibrary(true)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibrary::~CBaseLibrary()
|
||||
{
|
||||
m_items.clear();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IBaseLibraryManager* CBaseLibrary::GetManager()
|
||||
{
|
||||
return m_pManager;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibrary::RemoveAllItems()
|
||||
{
|
||||
AddRef();
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
// Unregister item in case it was registered. It is ok if it wasn't. This is still safe to call.
|
||||
m_pManager->UnregisterItem(m_items[i]);
|
||||
// Clear library item.
|
||||
m_items[i]->m_library = nullptr;
|
||||
}
|
||||
m_items.clear();
|
||||
Release();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibrary::SetName(const QString& name)
|
||||
{
|
||||
//the fullname of the items in the library will be changed due to library's name change
|
||||
//so we need unregistered them and register them after their name changed.
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
m_pManager->UnregisterItem(m_items[i]);
|
||||
}
|
||||
|
||||
m_name = name;
|
||||
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
m_pManager->RegisterItem(m_items[i]);
|
||||
}
|
||||
|
||||
SetModified();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const QString& CBaseLibrary::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseLibrary::Save()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseLibrary::Load(const QString& filename)
|
||||
{
|
||||
m_filename = filename;
|
||||
SetModified(false);
|
||||
m_bNewLibrary = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibrary::SetModified(bool bModified)
|
||||
{
|
||||
if (bModified != m_bModified)
|
||||
{
|
||||
m_bModified = bModified;
|
||||
emit Modified(bModified);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibrary::AddItem(IDataBaseItem* item, bool bRegister)
|
||||
{
|
||||
|
||||
CBaseLibraryItem* pLibItem = (CBaseLibraryItem*)item;
|
||||
// Check if item is already assigned to this library.
|
||||
if (pLibItem->m_library != this)
|
||||
{
|
||||
pLibItem->m_library = this;
|
||||
m_items.push_back(pLibItem);
|
||||
SetModified();
|
||||
if (bRegister)
|
||||
{
|
||||
m_pManager->RegisterItem(pLibItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibrary::GetItem(int index)
|
||||
{
|
||||
assert(index >= 0 && index < m_items.size());
|
||||
return m_items[index];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibrary::RemoveItem(IDataBaseItem* item)
|
||||
{
|
||||
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
if (m_items[i] == item)
|
||||
{
|
||||
// Unregister item in case it was registered. It is ok if it wasn't. This is still safe to call.
|
||||
m_pManager->UnregisterItem(m_items[i]);
|
||||
m_items.erase(m_items.begin() + i);
|
||||
SetModified();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibrary::FindItem(const QString& name)
|
||||
{
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
if (QString::compare(m_items[i]->GetName(), name, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return m_items[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
|
||||
{
|
||||
IEditor* pEditor = GetIEditor();
|
||||
IFileUtil* pFileUtil = pEditor ? pEditor->GetFileUtil() : nullptr;
|
||||
if (pFileUtil)
|
||||
{
|
||||
return pFileUtil->CheckoutFile(fullPathName.toUtf8().data(), nullptr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
|
||||
{
|
||||
assert(name != nullptr);
|
||||
if (name == nullptr)
|
||||
{
|
||||
CryFatalError("The library you are attempting to save has no name specified.");
|
||||
return false;
|
||||
}
|
||||
|
||||
QString fileName(GetFilename());
|
||||
if (fileName.isEmpty() && !saveEmptyLibrary)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fileName = Path::GamePathToFullPath(fileName);
|
||||
|
||||
XmlNodeRef root = GetIEditor()->GetSystem()->CreateXmlNode(name);
|
||||
Serialize(root, false);
|
||||
bool bRes = XmlHelpers::SaveXmlNode(GetIEditor()->GetFileUtil(), root, fileName.toUtf8().data());
|
||||
if (m_bNewLibrary)
|
||||
{
|
||||
AddLibraryToSourceControl(fileName);
|
||||
m_bNewLibrary = false;
|
||||
}
|
||||
if (!bRes)
|
||||
{
|
||||
QByteArray filenameUtf8 = fileName.toUtf8();
|
||||
AZStd::string strMessage = AZStd::string::format("The file %s is read-only and the save of the library couldn't be performed. Try to remove the \"read-only\" flag or check-out the file and then try again.", filenameUtf8.data());
|
||||
CryMessageBox(strMessage.c_str(), "Saving Error", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
//CONFETTI BEGIN
|
||||
void CBaseLibrary::ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation)
|
||||
{
|
||||
std::vector<_smart_ptr<CBaseLibraryItem> > temp;
|
||||
for (unsigned int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
if (i == newLocation)
|
||||
{
|
||||
temp.push_back(_smart_ptr<CBaseLibraryItem>(item));
|
||||
}
|
||||
if (m_items[i] != item)
|
||||
{
|
||||
temp.push_back(m_items[i]);
|
||||
}
|
||||
}
|
||||
// If newLocation is greater than the original size, append the item to end of the list
|
||||
if (newLocation >= m_items.size())
|
||||
{
|
||||
temp.push_back(_smart_ptr<CBaseLibraryItem>(item));
|
||||
}
|
||||
m_items = temp;
|
||||
}
|
||||
//CONFETTI END
|
||||
|
||||
#include <moc_BaseLibrary.cpp>
|
||||
@@ -1,129 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_BASELIBRARY_H
|
||||
#define CRYINCLUDE_EDITOR_BASELIBRARY_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "Include/IDataBaseLibrary.h"
|
||||
#include "Include/IBaseLibraryManager.h"
|
||||
#include "Include/EditorCoreAPI.h"
|
||||
#include "Util/TRefCountBase.h"
|
||||
|
||||
#include <QObject>
|
||||
#endif
|
||||
|
||||
// Ensure we don't try to dllimport when moc includes us
|
||||
#if defined(Q_MOC_BUILD) && !defined(EDITOR_CORE)
|
||||
#define EDITOR_CORE
|
||||
#endif
|
||||
|
||||
/** This a base class for all Libraries used by Editor.
|
||||
*/
|
||||
class EDITOR_CORE_API CBaseLibrary
|
||||
: public QObject
|
||||
, public TRefCountBase<IDataBaseLibrary>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CBaseLibrary(IBaseLibraryManager* pManager);
|
||||
~CBaseLibrary();
|
||||
|
||||
//! Set library name.
|
||||
virtual void SetName(const QString& name);
|
||||
//! Get library name.
|
||||
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 override { return m_filename; };
|
||||
|
||||
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) override;
|
||||
//! Check if library was modified.
|
||||
bool IsModified() const override { return m_bModified; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Working with items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add a new prototype to library.
|
||||
void AddItem(IDataBaseItem* item, bool bRegister = true) override;
|
||||
//! Get number of known prototypes.
|
||||
int GetItemCount() const override { return static_cast<int>(m_items.size()); }
|
||||
//! Get prototype by index.
|
||||
IDataBaseItem* GetItem(int index) override;
|
||||
|
||||
//! Delete item by pointer of item.
|
||||
void RemoveItem(IDataBaseItem* item) override;
|
||||
|
||||
//! Delete all items from library.
|
||||
void RemoveAllItems() override;
|
||||
|
||||
//! Find library item by name.
|
||||
//! Using linear search.
|
||||
IDataBaseItem* FindItem(const QString& name) override;
|
||||
|
||||
//! Check if this library is local level library.
|
||||
bool IsLevelLibrary() const override { return m_bLevelLib; };
|
||||
|
||||
//! Set library to be level library.
|
||||
void SetLevelLibrary(bool bEnable) override { m_bLevelLib = bEnable; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Return manager for this library.
|
||||
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
|
||||
void ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation) override;
|
||||
//CONFETTI END
|
||||
|
||||
signals:
|
||||
void Modified(bool bModified);
|
||||
|
||||
private:
|
||||
// Add the library to the source control
|
||||
bool AddLibraryToSourceControl(const QString& fullPathName) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Name of the library.
|
||||
QString m_name;
|
||||
//! Filename of the library.
|
||||
QString m_filename;
|
||||
|
||||
//! Flag set when library was modified.
|
||||
bool m_bModified;
|
||||
|
||||
// Flag set when the library is just created and it's not yet saved for the first time.
|
||||
bool m_bNewLibrary;
|
||||
|
||||
//! Level library is saved within the level .ly file and is local for this level.
|
||||
bool m_bLevelLib;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Manager.
|
||||
IBaseLibraryManager* m_pManager;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
// Array of all our library items.
|
||||
std::vector<_smart_ptr<CBaseLibraryItem> > m_items;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_BASELIBRARY_H
|
||||
@@ -1,261 +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 "EditorDefs.h"
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
#include "BaseLibrary.h"
|
||||
#include "BaseLibraryManager.h"
|
||||
#include "Undo/IUndoObject.h"
|
||||
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
|
||||
//undo object for multi-changes inside library item. such as set all variables to default values.
|
||||
//For example: change particle emitter shape will lead to multiple variable changes
|
||||
class CUndoBaseLibraryItem
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoBaseLibraryItem(IBaseLibraryManager *libMgr, CBaseLibraryItem* libItem, bool ignoreChild)
|
||||
: m_libMgr(libMgr)
|
||||
{
|
||||
assert(libItem);
|
||||
assert(libMgr);
|
||||
|
||||
m_itemPath = libItem->GetFullName();
|
||||
|
||||
//serialize the lib item to undo
|
||||
m_undoCtx.node = GetIEditor()->GetSystem()->CreateXmlNode("Undo");
|
||||
m_undoCtx.bIgnoreChilds = ignoreChild;
|
||||
m_undoCtx.bLoading = false; //saving
|
||||
m_undoCtx.bUniqName = false; //don't generate new name
|
||||
m_undoCtx.bCopyPaste = true; //so it won't override guid
|
||||
m_undoCtx.bUndo = true;
|
||||
libItem->Serialize(m_undoCtx);
|
||||
|
||||
//evaluate size
|
||||
XmlString xmlStr = m_undoCtx.node->getXML();
|
||||
m_size = sizeof(CUndoBaseLibraryItem);
|
||||
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
|
||||
m_size += m_itemPath.length();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
int GetSize() override
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
//find the libItem
|
||||
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
|
||||
if (libItem == nullptr)
|
||||
{
|
||||
//the undo stack is not reliable any more..
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
//save for redo
|
||||
if (bUndo)
|
||||
{
|
||||
m_redoCtx.node = GetIEditor()->GetSystem()->CreateXmlNode("Redo");
|
||||
m_redoCtx.bIgnoreChilds = m_undoCtx.bIgnoreChilds;
|
||||
m_redoCtx.bLoading = false; //saving
|
||||
m_redoCtx.bUniqName = false;
|
||||
m_redoCtx.bCopyPaste = true;
|
||||
m_redoCtx.bUndo = true;
|
||||
libItem->Serialize(m_redoCtx);
|
||||
|
||||
XmlString xmlStr = m_redoCtx.node->getXML();
|
||||
m_size += static_cast<int>(xmlStr.GetAllocatedMemory());
|
||||
}
|
||||
|
||||
//load previous saved data
|
||||
m_undoCtx.bLoading = true;
|
||||
libItem->Serialize(m_undoCtx);
|
||||
}
|
||||
|
||||
void Redo() override
|
||||
{
|
||||
//find the libItem
|
||||
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
|
||||
if (libItem == nullptr || m_redoCtx.node == nullptr)
|
||||
{
|
||||
//the undo stack is not reliable any more..
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_redoCtx.bLoading = true;
|
||||
libItem->Serialize(m_redoCtx);
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_itemPath;
|
||||
IDataBaseItem::SerializeContext m_undoCtx; //saved before operation
|
||||
IDataBaseItem::SerializeContext m_redoCtx; //saved after operation so used for redo
|
||||
IBaseLibraryManager* m_libMgr;
|
||||
int m_size;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CBaseLibraryItem implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibraryItem::CBaseLibraryItem()
|
||||
{
|
||||
m_library = nullptr;
|
||||
GenerateId();
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
CBaseLibraryItem::~CBaseLibraryItem()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryItem::GetFullName() const
|
||||
{
|
||||
QString name;
|
||||
if (m_library)
|
||||
{
|
||||
name = m_library->GetName() + ".";
|
||||
}
|
||||
name += m_name;
|
||||
return name;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryItem::GetGroupName()
|
||||
{
|
||||
QString str = GetName();
|
||||
int p = str.lastIndexOf('.');
|
||||
if (p >= 0)
|
||||
{
|
||||
return str.mid(0, p);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryItem::GetShortName()
|
||||
{
|
||||
QString str = GetName();
|
||||
int p = str.lastIndexOf('.');
|
||||
if (p >= 0)
|
||||
{
|
||||
return str.mid(p + 1);
|
||||
}
|
||||
p = str.lastIndexOf('/');
|
||||
if (p >= 0)
|
||||
{
|
||||
return str.mid(p + 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryItem::SetName(const QString& name)
|
||||
{
|
||||
assert(m_library);
|
||||
if (name == m_name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QString oldName = GetFullName();
|
||||
m_name = name;
|
||||
((CBaseLibraryManager*)m_library->GetManager())->OnRenameItem(this, oldName);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const QString& CBaseLibraryItem::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryItem::GenerateId()
|
||||
{
|
||||
GUID guid = AZ::Uuid::CreateRandom();
|
||||
SetGUID(guid);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryItem::SetGUID(REFGUID guid)
|
||||
{
|
||||
if (m_library)
|
||||
{
|
||||
((CBaseLibraryManager*)m_library->GetManager())->RegisterItem(this, guid);
|
||||
}
|
||||
m_guid = guid;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryItem::Serialize(SerializeContext& ctx)
|
||||
{
|
||||
assert(m_library);
|
||||
|
||||
XmlNodeRef node = ctx.node;
|
||||
if (ctx.bLoading)
|
||||
{
|
||||
QString name = m_name;
|
||||
// Loading
|
||||
node->getAttr("Name", name);
|
||||
|
||||
if (!ctx.bUniqName)
|
||||
{
|
||||
SetName(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetName(GetLibrary()->GetManager()->MakeUniqueItemName(name));
|
||||
}
|
||||
|
||||
if (!ctx.bCopyPaste)
|
||||
{
|
||||
GUID guid;
|
||||
if (node->getAttr("Id", guid))
|
||||
{
|
||||
SetGUID(guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Saving.
|
||||
node->setAttr("Name", m_name.toUtf8().data());
|
||||
node->setAttr("Id", m_guid);
|
||||
node->setAttr("Library", GetLibrary()->GetName().toUtf8().data());
|
||||
}
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryItem::GetLibrary() const
|
||||
{
|
||||
return m_library;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryItem::SetLibrary(CBaseLibrary* pLibrary)
|
||||
{
|
||||
m_library = pLibrary;
|
||||
}
|
||||
|
||||
//! Mark library as modified.
|
||||
void CBaseLibraryItem::SetModified(bool bModified)
|
||||
{
|
||||
m_bModified = bModified;
|
||||
if (m_bModified && m_library != nullptr)
|
||||
{
|
||||
m_library->SetModified(bModified);
|
||||
}
|
||||
}
|
||||
@@ -1,114 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_BASELIBRARYITEM_H
|
||||
#define CRYINCLUDE_EDITOR_BASELIBRARYITEM_H
|
||||
#pragma once
|
||||
|
||||
#include "Include/IDataBaseItem.h"
|
||||
#include "BaseLibrary.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
class CBaseLibrary;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
/** Base class for all items contained in BaseLibraray.
|
||||
*/
|
||||
class EDITOR_CORE_API CBaseLibraryItem
|
||||
: public TRefCountBase<IDataBaseItem>
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
public:
|
||||
CBaseLibraryItem();
|
||||
~CBaseLibraryItem();
|
||||
|
||||
//! Set item name.
|
||||
//! Its virtual, in case you want to override it in derrived item.
|
||||
virtual void SetName(const QString& name);
|
||||
//! Get item name.
|
||||
const QString& GetName() const;
|
||||
|
||||
//! Get full item name, including name of library.
|
||||
//! Name formed by adding dot after name of library
|
||||
//! eg. library Pickup and item PickupRL form full item name: "Pickups.PickupRL".
|
||||
QString GetFullName() const;
|
||||
|
||||
//! Get only nameof group from prototype.
|
||||
QString GetGroupName();
|
||||
//! Get short name of prototype without group.
|
||||
QString GetShortName();
|
||||
|
||||
//! Return Library this item are contained in.
|
||||
//! Item can only be at one library.
|
||||
IDataBaseLibrary* GetLibrary() const;
|
||||
void SetLibrary(CBaseLibrary* pLibrary);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Serialize library item to archive.
|
||||
virtual void Serialize(SerializeContext& ctx);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Generate new unique id for this item.
|
||||
void GenerateId();
|
||||
//! Returns GUID of this material.
|
||||
const GUID& GetGUID() const { return m_guid; }
|
||||
|
||||
//! Mark library as modified.
|
||||
void SetModified(bool bModified = true);
|
||||
//! Check if library was modified.
|
||||
bool IsModified() const { return m_bModified; };
|
||||
|
||||
//! Returns true if the item is registered, otherwise false
|
||||
bool IsRegistered() const { return m_bRegistered; };
|
||||
|
||||
//! Validate item for errors.
|
||||
virtual void Validate() {};
|
||||
|
||||
//! Get number of sub childs.
|
||||
virtual int GetChildCount() const { return 0; }
|
||||
//! Get sub child by index.
|
||||
virtual CBaseLibraryItem* GetChild([[maybe_unused]] int index) const { return nullptr; }
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Gathers resources by this item.
|
||||
virtual void GatherUsedResources([[maybe_unused]] CUsedResources& resources) {};
|
||||
|
||||
//! Get if stored item is enabled
|
||||
virtual bool GetIsEnabled() { return true; };
|
||||
|
||||
|
||||
int IsParticleItem = -1;
|
||||
protected:
|
||||
void SetGUID(REFGUID guid);
|
||||
friend class CBaseLibrary;
|
||||
friend class CBaseLibraryManager;
|
||||
// Name of this prototype.
|
||||
QString m_name;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
//! Reference to prototype library who contains this prototype.
|
||||
_smart_ptr<CBaseLibrary> m_library;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
//! Every base library item have unique id.
|
||||
GUID m_guid;
|
||||
// True when item modified by editor.
|
||||
bool m_bModified;
|
||||
// True when item registered in manager.
|
||||
bool m_bRegistered = false;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(CBaseLibraryItem*);
|
||||
|
||||
TYPEDEF_AUTOPTR(CBaseLibraryItem);
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_BASELIBRARYITEM_H
|
||||
@@ -1,822 +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 "EditorDefs.h"
|
||||
|
||||
#include "BaseLibraryManager.h"
|
||||
|
||||
// Editor
|
||||
#include "BaseLibraryItem.h"
|
||||
#include "ErrorReport.h"
|
||||
#include "Undo/IUndoObject.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CBaseLibraryManager implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibraryManager::CBaseLibraryManager()
|
||||
{
|
||||
m_bUniqNameMap = false;
|
||||
m_bUniqGuidMap = true;
|
||||
GetIEditor()->RegisterNotifyListener(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibraryManager::~CBaseLibraryManager()
|
||||
{
|
||||
ClearAll();
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::ClearAll()
|
||||
{
|
||||
// Delete all items from all libraries.
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
m_libs[i]->RemoveAllItems();
|
||||
}
|
||||
|
||||
// if we will not copy maps locally then destructors of the elements of
|
||||
// the map will operate on the already invalid map object
|
||||
// see:
|
||||
// CBaseLibraryManager::UnregisterItem()
|
||||
// CBaseLibraryManager::DeleteItem()
|
||||
// CMaterial::~CMaterial()
|
||||
|
||||
ItemsGUIDMap itemsGuidMap;
|
||||
ItemsNameMap itemsNameMap;
|
||||
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
std::swap(itemsGuidMap, m_itemsGuidMap);
|
||||
std::swap(itemsNameMap, m_itemsNameMap);
|
||||
|
||||
m_libs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::FindLibrary(const QString& library)
|
||||
{
|
||||
const int index = FindLibraryIndex(library);
|
||||
return index == -1 ? nullptr : m_libs[index];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBaseLibraryManager::FindLibraryIndex(const QString& library)
|
||||
{
|
||||
QString lib = library;
|
||||
lib.replace('\\', '/');
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
QString _lib = m_libs[i]->GetFilename();
|
||||
_lib.replace('\\', '/');
|
||||
if (QString::compare(lib, m_libs[i]->GetName(), Qt::CaseInsensitive) == 0 || QString::compare(lib, _lib, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
|
||||
{
|
||||
CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, nullptr);
|
||||
return pMtl;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::SplitFullItemName(const QString& fullItemName, QString& libraryName, QString& itemName)
|
||||
{
|
||||
int p;
|
||||
p = fullItemName.indexOf('.');
|
||||
if (p < 0 || !QString::compare(fullItemName.mid(p + 1), "mtl", Qt::CaseInsensitive))
|
||||
{
|
||||
libraryName = "";
|
||||
itemName = fullItemName;
|
||||
return;
|
||||
}
|
||||
libraryName = fullItemName.mid(0, p);
|
||||
itemName = fullItemName.mid(p + 1);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
return stl::find_in_map(m_itemsNameMap, fullItemName, nullptr);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::LoadItemByName(const QString& fullItemName)
|
||||
{
|
||||
QString libraryName, itemName;
|
||||
SplitFullItemName(fullItemName, libraryName, itemName);
|
||||
|
||||
if (!FindLibrary(libraryName))
|
||||
{
|
||||
LoadLibrary(MakeFilename(libraryName));
|
||||
}
|
||||
|
||||
return FindItemByName(fullItemName);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::FindItemByName(const char* fullItemName)
|
||||
{
|
||||
return FindItemByName(QString(fullItemName));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::LoadItemByName(const char* fullItemName)
|
||||
{
|
||||
return LoadItemByName(QString(fullItemName));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::CreateItem(IDataBaseLibrary* pLibrary)
|
||||
{
|
||||
assert(pLibrary);
|
||||
|
||||
// Add item to this library.
|
||||
TSmartPtr<CBaseLibraryItem> pItem = MakeNewItem();
|
||||
pLibrary->AddItem(pItem);
|
||||
return pItem;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::DeleteItem(IDataBaseItem* pItem)
|
||||
{
|
||||
assert(pItem);
|
||||
|
||||
UnregisterItem((CBaseLibraryItem*)pItem);
|
||||
if (pItem->GetLibrary())
|
||||
{
|
||||
pItem->GetLibrary()->RemoveItem(pItem);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::LoadLibrary(const QString& inFilename, [[maybe_unused]] bool bReload)
|
||||
{
|
||||
if (auto lib = FindLibrary(inFilename))
|
||||
{
|
||||
return lib;
|
||||
}
|
||||
|
||||
TSmartPtr<CBaseLibrary> pLib = MakeNewLibrary();
|
||||
if (!pLib->Load(MakeFilename(inFilename)))
|
||||
{
|
||||
Error(QObject::tr("Failed to Load Item Library: %1").arg(inFilename).toUtf8().data());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_libs.push_back(pLib);
|
||||
return pLib;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBaseLibraryManager::GetModifiedLibraryCount() const
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
if (m_libs[i]->IsModified())
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::AddLibrary(const QString& library, bool bIsLevelLibrary, bool bIsLoading)
|
||||
{
|
||||
// Make a filename from name of library.
|
||||
QString filename = library;
|
||||
|
||||
if (filename.indexOf(".xml") == -1) // if its already a filename, we don't do anything
|
||||
{
|
||||
filename.replace(' ', '_');
|
||||
if (!bIsLevelLibrary)
|
||||
{
|
||||
filename = MakeFilename(library);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if its the level library it gets saved in the level and should not be concatenated with any other file name
|
||||
filename = filename + ".xml";
|
||||
}
|
||||
}
|
||||
|
||||
IDataBaseLibrary* pBaseLib = FindLibrary(library); //library name
|
||||
if (!pBaseLib)
|
||||
{
|
||||
pBaseLib = FindLibrary(filename); //library file name
|
||||
}
|
||||
if (pBaseLib)
|
||||
{
|
||||
return pBaseLib;
|
||||
}
|
||||
|
||||
CBaseLibrary* lib = MakeNewLibrary();
|
||||
lib->SetName(library);
|
||||
lib->SetLevelLibrary(bIsLevelLibrary);
|
||||
lib->SetFilename(filename, !bIsLoading);
|
||||
// set modified to true, so even empty particle libraries get saved
|
||||
lib->SetModified(true);
|
||||
|
||||
m_libs.push_back(lib);
|
||||
return lib;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryManager::MakeFilename(const QString& library)
|
||||
{
|
||||
QString filename = library;
|
||||
filename.replace(' ', '_');
|
||||
filename.replace(".xml", "");
|
||||
|
||||
// make it contain the canonical libs path:
|
||||
Path::ConvertBackSlashToSlash(filename);
|
||||
|
||||
QString LibsPath(GetLibsPath());
|
||||
Path::ConvertBackSlashToSlash(LibsPath);
|
||||
|
||||
if (filename.left(LibsPath.length()).compare(LibsPath, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
filename = filename.mid(LibsPath.length());
|
||||
}
|
||||
|
||||
return LibsPath + filename + ".xml";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseLibraryManager::IsUniqueFilename(const QString& library)
|
||||
{
|
||||
QString resultPath = MakeFilename(library);
|
||||
CCryFile xmlFile;
|
||||
// If we can find a file for the path
|
||||
return !xmlFile.Open(resultPath.toUtf8().data(), "rb");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::DeleteLibrary(const QString& library, bool forceDeleteLevel)
|
||||
{
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
if (QString::compare(library, m_libs[i]->GetName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
CBaseLibrary* pLibrary = m_libs[i];
|
||||
// Check if not level library, they cannot be deleted.
|
||||
if (!pLibrary->IsLevelLibrary() || forceDeleteLevel)
|
||||
{
|
||||
for (int j = 0; j < pLibrary->GetItemCount(); j++)
|
||||
{
|
||||
UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
|
||||
}
|
||||
pLibrary->RemoveAllItems();
|
||||
|
||||
if (pLibrary->IsLevelLibrary())
|
||||
{
|
||||
m_pLevelLibrary = nullptr;
|
||||
}
|
||||
m_libs.erase(m_libs.begin() + i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::GetLibrary(int index) const
|
||||
{
|
||||
assert(index >= 0 && index < m_libs.size());
|
||||
return m_libs[index];
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
|
||||
{
|
||||
IDataBaseLibrary* pLevelLib = nullptr;
|
||||
|
||||
for (int i = 0; i < GetLibraryCount(); i++)
|
||||
{
|
||||
if (GetLibrary(i)->IsLevelLibrary())
|
||||
{
|
||||
pLevelLib = GetLibrary(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return pLevelLib;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::SaveAllLibs()
|
||||
{
|
||||
for (int i = 0; i < GetLibraryCount(); i++)
|
||||
{
|
||||
// Check if library is modified.
|
||||
IDataBaseLibrary* pLibrary = GetLibrary(i);
|
||||
|
||||
//Level library is saved when the level is saved
|
||||
if (pLibrary->IsLevelLibrary())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (pLibrary->IsModified())
|
||||
{
|
||||
if (pLibrary->Save())
|
||||
{
|
||||
pLibrary->SetModified(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::Serialize(XmlNodeRef& node, bool bLoading)
|
||||
{
|
||||
static const char* const LEVEL_LIBRARY_TAG = "LevelLibrary";
|
||||
|
||||
QString rootNodeName = GetRootNodeName();
|
||||
if (bLoading)
|
||||
{
|
||||
XmlNodeRef libs = node->findChild(rootNodeName.toUtf8().data());
|
||||
if (libs)
|
||||
{
|
||||
for (int i = 0; i < libs->getChildCount(); i++)
|
||||
{
|
||||
// Load only library name.
|
||||
XmlNodeRef libNode = libs->getChild(i);
|
||||
if (strcmp(libNode->getTag(), LEVEL_LIBRARY_TAG) == 0)
|
||||
{
|
||||
if (!m_pLevelLibrary)
|
||||
{
|
||||
QString libName;
|
||||
libNode->getAttr("Name", libName);
|
||||
m_pLevelLibrary = static_cast<CBaseLibrary*>(AddLibrary(libName, true));
|
||||
}
|
||||
m_pLevelLibrary->Serialize(libNode, bLoading);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString libName;
|
||||
if (libNode->getAttr("Name", libName))
|
||||
{
|
||||
// Load this library.
|
||||
if (!FindLibrary(libName))
|
||||
{
|
||||
LoadLibrary(MakeFilename(libName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save all libraries.
|
||||
XmlNodeRef libs = node->newChild(rootNodeName.toUtf8().data());
|
||||
for (int i = 0; i < GetLibraryCount(); i++)
|
||||
{
|
||||
IDataBaseLibrary* pLib = GetLibrary(i);
|
||||
if (pLib->IsLevelLibrary())
|
||||
{
|
||||
// Level libraries are saved in in level.
|
||||
XmlNodeRef libNode = libs->newChild(LEVEL_LIBRARY_TAG);
|
||||
pLib->Serialize(libNode, bLoading);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save only library name.
|
||||
XmlNodeRef libNode = libs->newChild("Library");
|
||||
libNode->setAttr("Name", pLib->GetName().toUtf8().data());
|
||||
}
|
||||
}
|
||||
SaveAllLibs();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QString& libName)
|
||||
{
|
||||
// unlikely we'll ever encounter more than 16
|
||||
std::vector<AZStd::string> possibleDuplicates;
|
||||
possibleDuplicates.reserve(16);
|
||||
|
||||
// search for strings in the database that might have a similar name (ignore case)
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
//Check if the item is in the target library first.
|
||||
IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
|
||||
QString itemLibraryName;
|
||||
if (itemLibrary)
|
||||
{
|
||||
itemLibraryName = itemLibrary->GetName();
|
||||
}
|
||||
|
||||
// Item is not in the library so there cannot be a naming conflict.
|
||||
if (!libName.isEmpty() && !itemLibraryName.isEmpty() && itemLibraryName != libName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString& name = pItem->GetName();
|
||||
if (name.startsWith(srcName, Qt::CaseInsensitive))
|
||||
{
|
||||
possibleDuplicates.push_back(AZStd::string(name.toUtf8().data()));
|
||||
}
|
||||
}
|
||||
pEnum->Release();
|
||||
|
||||
if (possibleDuplicates.empty())
|
||||
{
|
||||
return srcName;
|
||||
}
|
||||
|
||||
std::sort(possibleDuplicates.begin(), possibleDuplicates.end(), [](const AZStd::string& strOne, const AZStd::string& strTwo)
|
||||
{
|
||||
// I can assume size sorting since if the length is different, either one of the two strings doesn't
|
||||
// closely match the string we are trying to duplicate, or it's a bigger number (X1 vs X10)
|
||||
if (strOne.size() != strTwo.size())
|
||||
{
|
||||
return strOne.size() < strTwo.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return azstricmp(strOne.c_str(), strTwo.c_str()) < 0;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
int num = 0;
|
||||
QString returnValue = srcName;
|
||||
while (num < possibleDuplicates.size() && QString::compare(possibleDuplicates[num].c_str(), returnValue, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
returnValue = QStringLiteral("%1%2%3").arg(srcName).arg("_").arg(num);
|
||||
++num;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::Validate()
|
||||
{
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
pItem->Validate();
|
||||
}
|
||||
pEnum->Release();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid)
|
||||
{
|
||||
assert(pItem);
|
||||
|
||||
bool bNotify = false;
|
||||
|
||||
if (m_bUniqGuidMap)
|
||||
{
|
||||
REFGUID oldGuid = pItem->GetGUID();
|
||||
if (!GuidUtil::IsEmpty(oldGuid))
|
||||
{
|
||||
m_itemsGuidMap.erase(oldGuid);
|
||||
}
|
||||
if (GuidUtil::IsEmpty(newGuid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, nullptr);
|
||||
if (!pOldItem)
|
||||
{
|
||||
pItem->m_guid = newGuid;
|
||||
m_itemsGuidMap[newGuid] = pItem;
|
||||
pItem->m_bRegistered = true;
|
||||
bNotify = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pOldItem != pItem)
|
||||
{
|
||||
ReportDuplicateItem(pItem, pOldItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bUniqNameMap)
|
||||
{
|
||||
QString fullName = pItem->GetFullName();
|
||||
if (!pItem->GetName().isEmpty())
|
||||
{
|
||||
CBaseLibraryItem* pOldItem = static_cast<CBaseLibraryItem*>(FindItemByName(fullName));
|
||||
if (!pOldItem)
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
m_itemsNameMap[fullName] = pItem;
|
||||
pItem->m_bRegistered = true;
|
||||
bNotify = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pOldItem != pItem)
|
||||
{
|
||||
ReportDuplicateItem(pItem, pOldItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Notify listeners.
|
||||
if (bNotify)
|
||||
{
|
||||
NotifyItemEvent(pItem, EDB_ITEM_EVENT_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem)
|
||||
{
|
||||
assert(pItem);
|
||||
|
||||
bool bNotify = false;
|
||||
|
||||
if (m_bUniqGuidMap)
|
||||
{
|
||||
if (GuidUtil::IsEmpty(pItem->GetGUID()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), nullptr);
|
||||
if (!pOldItem)
|
||||
{
|
||||
m_itemsGuidMap[pItem->GetGUID()] = pItem;
|
||||
pItem->m_bRegistered = true;
|
||||
bNotify = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pOldItem != pItem)
|
||||
{
|
||||
ReportDuplicateItem(pItem, pOldItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bUniqNameMap)
|
||||
{
|
||||
QString fullName = pItem->GetFullName();
|
||||
if (!fullName.isEmpty())
|
||||
{
|
||||
CBaseLibraryItem* pOldItem = static_cast<CBaseLibraryItem*>(FindItemByName(fullName));
|
||||
if (!pOldItem)
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
m_itemsNameMap[fullName] = pItem;
|
||||
pItem->m_bRegistered = true;
|
||||
bNotify = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pOldItem != pItem)
|
||||
{
|
||||
ReportDuplicateItem(pItem, pOldItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Notify listeners.
|
||||
if (bNotify)
|
||||
{
|
||||
NotifyItemEvent(pItem, EDB_ITEM_EVENT_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::SetRegisteredFlag(CBaseLibraryItem* pItem, bool bFlag)
|
||||
{
|
||||
pItem->m_bRegistered = bFlag;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::ReportDuplicateItem(CBaseLibraryItem* pItem, CBaseLibraryItem* pOldItem)
|
||||
{
|
||||
QString sLibName;
|
||||
if (pOldItem->GetLibrary())
|
||||
{
|
||||
sLibName = pOldItem->GetLibrary()->GetName();
|
||||
}
|
||||
CErrorRecord err;
|
||||
err.pItem = pItem;
|
||||
err.error = QStringLiteral("Item %1 with duplicate GUID to loaded item %2 ignored").arg(pItem->GetFullName(), pOldItem->GetFullName());
|
||||
GetIEditor()->GetErrorReport()->ReportError(err);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::UnregisterItem(CBaseLibraryItem* pItem)
|
||||
{
|
||||
// Notify listeners.
|
||||
NotifyItemEvent(pItem, EDB_ITEM_EVENT_DELETE);
|
||||
|
||||
if (!pItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_bUniqGuidMap)
|
||||
{
|
||||
m_itemsGuidMap.erase(pItem->GetGUID());
|
||||
}
|
||||
if (m_bUniqNameMap && !pItem->GetFullName().isEmpty())
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
auto findIter = m_itemsNameMap.find(pItem->GetFullName());
|
||||
if (findIter != m_itemsNameMap.end())
|
||||
{
|
||||
_smart_ptr<CBaseLibraryItem> item = findIter->second;
|
||||
m_itemsNameMap.erase(findIter);
|
||||
}
|
||||
}
|
||||
|
||||
pItem->m_bRegistered = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseLibraryManager::MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName)
|
||||
{
|
||||
assert(pLibrary);
|
||||
QString name = pLibrary->GetName() + ".";
|
||||
if (!group.isEmpty())
|
||||
{
|
||||
name += group + ".";
|
||||
}
|
||||
name += itemName;
|
||||
return name;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
|
||||
{
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
pItem->GatherUsedResources(resources);
|
||||
}
|
||||
pEnum->Release();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItemEnumerator* CBaseLibraryManager::GetItemEnumerator()
|
||||
{
|
||||
if (m_bUniqNameMap)
|
||||
{
|
||||
return new CDataBaseItemEnumerator<ItemsNameMap>(&m_itemsNameMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CDataBaseItemEnumerator<ItemsGUIDMap>(&m_itemsGuidMap);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnBeginNewScene:
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
case eNotify_OnBeginSceneOpen:
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
case eNotify_OnCloseScene:
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName)
|
||||
{
|
||||
m_itemsNameMapMutex.lock();
|
||||
if (!oldName.isEmpty())
|
||||
{
|
||||
m_itemsNameMap.erase(oldName);
|
||||
}
|
||||
if (!pItem->GetFullName().isEmpty())
|
||||
{
|
||||
m_itemsNameMap[pItem->GetFullName()] = pItem;
|
||||
}
|
||||
m_itemsNameMapMutex.unlock();
|
||||
|
||||
OnItemChanged(pItem);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::AddListener(IDataBaseManagerListener* pListener)
|
||||
{
|
||||
stl::push_back_unique(m_listeners, pListener);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::RemoveListener(IDataBaseManagerListener* pListener)
|
||||
{
|
||||
stl::find_and_erase(m_listeners, pListener);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::NotifyItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event)
|
||||
{
|
||||
// Notify listeners.
|
||||
if (!m_listeners.empty())
|
||||
{
|
||||
for (int i = 0; i < m_listeners.size(); i++)
|
||||
{
|
||||
m_listeners[i]->OnDataBaseItemEvent(pItem, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::OnItemChanged(IDataBaseItem* pItem)
|
||||
{
|
||||
NotifyItemEvent(pItem, EDB_ITEM_EVENT_CHANGED);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh)
|
||||
{
|
||||
NotifyItemEvent(pItem, bRefresh ? EDB_ITEM_EVENT_UPDATE_PROPERTIES
|
||||
: EDB_ITEM_EVENT_UPDATE_PROPERTIES_NO_EDITOR_REFRESH);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseLibraryManager::SetSelectedItem(IDataBaseItem* pItem)
|
||||
{
|
||||
if (m_pSelectedItem == pItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_pSelectedItem = (CBaseLibraryItem*)pItem;
|
||||
NotifyItemEvent(m_pSelectedItem, EDB_ITEM_EVENT_SELECTED);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::GetSelectedItem() const
|
||||
{
|
||||
return m_pSelectedItem;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::GetSelectedParentItem() const
|
||||
{
|
||||
return m_pSelectedParent;
|
||||
}
|
||||
|
||||
void CBaseLibraryManager::ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation)
|
||||
{
|
||||
if (!lib || newLocation >= m_libs.size() || lib == m_libs[newLocation])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
if (lib == m_libs[i])
|
||||
{
|
||||
_smart_ptr<CBaseLibrary> curLib = m_libs[i];
|
||||
m_libs.erase(m_libs.begin() + i);
|
||||
m_libs.insert(m_libs.begin() + newLocation, curLib);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CBaseLibraryManager::SetLibraryName(CBaseLibrary* lib, const QString& name)
|
||||
{
|
||||
// SetFilename will validate if the name is duplicate with exist libraries.
|
||||
if (lib->SetFilename(MakeFilename(name)))
|
||||
{
|
||||
lib->SetName(name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,226 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_BASELIBRARYMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_BASELIBRARYMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include "Include/IBaseLibraryManager.h"
|
||||
#include "Include/IDataBaseItem.h"
|
||||
#include "Include/IDataBaseLibrary.h"
|
||||
#include "Include/IDataBaseManager.h"
|
||||
#include "Util/TRefCountBase.h"
|
||||
#include "Util/GuidUtil.h"
|
||||
#include "BaseLibrary.h"
|
||||
#include "Util/smartptr.h"
|
||||
#include <EditorDefs.h>
|
||||
#include <QtUtil.h>
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
/** Manages all Libraries and Items.
|
||||
*/
|
||||
class SANDBOX_API CBaseLibraryManager
|
||||
: public IBaseLibraryManager
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
public:
|
||||
CBaseLibraryManager();
|
||||
~CBaseLibraryManager();
|
||||
|
||||
//! Clear all libraries.
|
||||
void ClearAll() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IDocListener implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) override;
|
||||
//! Delete item from library and manager.
|
||||
void DeleteItem(IDataBaseItem* pItem) override;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
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);
|
||||
|
||||
IDataBaseItemEnumerator* GetItemEnumerator() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set item currently selected.
|
||||
void SetSelectedItem(IDataBaseItem* pItem) override;
|
||||
// Get currently selected item.
|
||||
IDataBaseItem* GetSelectedItem() const override;
|
||||
IDataBaseItem* GetSelectedParentItem() const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library.
|
||||
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.
|
||||
int GetLibraryCount() const override { return static_cast<int>(m_libs.size()); };
|
||||
//! Get number of modified libraries.
|
||||
int GetModifiedLibraryCount() const override;
|
||||
|
||||
//! Get Item library by index.
|
||||
IDataBaseLibrary* GetLibrary(int index) const override;
|
||||
|
||||
//! Get Level Item library.
|
||||
IDataBaseLibrary* GetLevelLibrary() const override;
|
||||
|
||||
//! Find Items Library by name.
|
||||
IDataBaseLibrary* FindLibrary(const QString& library) override;
|
||||
|
||||
//! Find Items Library's index by name.
|
||||
int FindLibraryIndex(const QString& library) override;
|
||||
|
||||
//! Load Items library.
|
||||
IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) override;
|
||||
|
||||
//! Save all modified libraries.
|
||||
void SaveAllLibs() override;
|
||||
|
||||
//! Serialize property manager.
|
||||
void Serialize(XmlNodeRef& node, bool bLoading) override;
|
||||
|
||||
//! Export items to game.
|
||||
void Export([[maybe_unused]] XmlNodeRef& node) override {};
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
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.
|
||||
QString GetRootNodeName() override = 0;
|
||||
//! Path to libraries in this manager.
|
||||
QString GetLibsPath() override = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
void Validate() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void GatherUsedResources(CUsedResources& resources) override;
|
||||
|
||||
void AddListener(IDataBaseManagerListener* pListener) override;
|
||||
void RemoveListener(IDataBaseManagerListener* pListener) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid) override;
|
||||
void RegisterItem(CBaseLibraryItem* pItem) override;
|
||||
void UnregisterItem(CBaseLibraryItem* pItem) override;
|
||||
|
||||
// Only Used internally.
|
||||
void OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName) override;
|
||||
|
||||
// Called by items to indicated that they have been modified.
|
||||
// Sends item changed event to listeners.
|
||||
void OnItemChanged(IDataBaseItem* pItem) override;
|
||||
void OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh) override;
|
||||
|
||||
QString MakeFilename(const QString& library);
|
||||
bool IsUniqueFilename(const QString& library) override;
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
void ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation) override;
|
||||
|
||||
bool SetLibraryName(CBaseLibrary* lib, const QString& name) override;
|
||||
|
||||
protected:
|
||||
void SplitFullItemName(const QString& fullItemName, QString& libraryName, QString& itemName);
|
||||
void NotifyItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event);
|
||||
void SetRegisteredFlag(CBaseLibraryItem* pItem, bool bFlag);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Must be overriden.
|
||||
//! Makes a new Item.
|
||||
virtual CBaseLibraryItem* MakeNewItem() = 0;
|
||||
virtual CBaseLibrary* MakeNewLibrary() = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void ReportDuplicateItem(CBaseLibraryItem* pItem, CBaseLibraryItem* pOldItem);
|
||||
|
||||
protected:
|
||||
bool m_bUniqGuidMap;
|
||||
bool m_bUniqNameMap;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
//! Array of all loaded entity items libraries.
|
||||
std::vector<_smart_ptr<CBaseLibrary> > m_libs;
|
||||
|
||||
// There is always one current level library.
|
||||
TSmartPtr<CBaseLibrary> m_pLevelLibrary;
|
||||
|
||||
// GUID to item map.
|
||||
typedef std::map<GUID, _smart_ptr<CBaseLibraryItem>, guid_less_predicate> ItemsGUIDMap;
|
||||
ItemsGUIDMap m_itemsGuidMap;
|
||||
|
||||
// Case insensitive name to items map.
|
||||
typedef std::map<QString, _smart_ptr<CBaseLibraryItem>, stl::less_stricmp<QString>> ItemsNameMap;
|
||||
ItemsNameMap m_itemsNameMap;
|
||||
AZStd::mutex m_itemsNameMapMutex;
|
||||
|
||||
std::vector<IDataBaseManagerListener*> m_listeners;
|
||||
|
||||
// Currently selected item.
|
||||
_smart_ptr<CBaseLibraryItem> m_pSelectedItem;
|
||||
_smart_ptr<CBaseLibraryItem> m_pSelectedParent;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class TMap>
|
||||
class CDataBaseItemEnumerator
|
||||
: public IDataBaseItemEnumerator
|
||||
{
|
||||
TMap* m_pMap;
|
||||
typename TMap::iterator m_iterator;
|
||||
|
||||
public:
|
||||
CDataBaseItemEnumerator(TMap* pMap)
|
||||
{
|
||||
assert(pMap);
|
||||
m_pMap = pMap;
|
||||
m_iterator = m_pMap->begin();
|
||||
}
|
||||
void Release() override { delete this; };
|
||||
IDataBaseItem* GetFirst() override
|
||||
{
|
||||
m_iterator = m_pMap->begin();
|
||||
if (m_iterator == m_pMap->end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_iterator->second;
|
||||
}
|
||||
IDataBaseItem* GetNext() override
|
||||
{
|
||||
if (m_iterator != m_pMap->end())
|
||||
{
|
||||
m_iterator++;
|
||||
}
|
||||
if (m_iterator == m_pMap->end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_iterator->second;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_BASELIBRARYMANAGER_H
|
||||
@@ -63,7 +63,7 @@ ly_add_target(
|
||||
set(pal_cmake_files "")
|
||||
foreach(enabled_platform ${LY_PAL_TOOLS_ENABLED})
|
||||
string(TOLOWER ${enabled_platform} enabled_platform_lowercase)
|
||||
ly_get_list_relative_pal_filename(pal_cmake_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${enabled_platform})
|
||||
o3de_pal_dir(pal_cmake_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${enabled_platform} ${O3DE_ENGINE_RESTRICTED_PATH} ${LY_ROOT_FOLDER})
|
||||
list(APPEND pal_cmake_files ${pal_cmake_dir}/editor_lib_${enabled_platform_lowercase}_files.cmake)
|
||||
endforeach()
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// Editor
|
||||
#include "SelectLightAnimationDialog.h"
|
||||
#include "SelectSequenceDialog.h"
|
||||
#include "SelectEAXPresetDlg.h"
|
||||
#include "QtViewPaneManager.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
@@ -1,170 +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 "EditorDefs.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#ifdef _CRTDBG_MAP_ALLOC
|
||||
#ifdef CRTDBG_MAP_ALLOC
|
||||
#pragma pack (push,1)
|
||||
#define nNoMansLandSize 4
|
||||
typedef struct MyCrtMemBlockHeader
|
||||
{
|
||||
struct MyCrtMemBlockHeader* pBlockHeaderNext;
|
||||
struct MyCrtMemBlockHeader* pBlockHeaderPrev;
|
||||
char* szFileName;
|
||||
int nLine;
|
||||
size_t nDataSize;
|
||||
int nBlockUse;
|
||||
long lRequest;
|
||||
unsigned char gap[nNoMansLandSize];
|
||||
/* followed by:
|
||||
* unsigned char data[nDataSize];
|
||||
* unsigned char anotherGap[nNoMansLandSize];
|
||||
*/
|
||||
} MyCrtMemBlockHeader;
|
||||
#pragma pack (pop)
|
||||
|
||||
#define pbData(pblock) ((unsigned char*)((MyCrtMemBlockHeader*)pblock + 1))
|
||||
#define pHdr(pbData) (((MyCrtMemBlockHeader*)pbData) - 1)
|
||||
|
||||
|
||||
void crtdebug(const char* s, ...)
|
||||
{
|
||||
char str[32768];
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, s);
|
||||
vsprintf(str, s, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
|
||||
FILE* l = nullptr;
|
||||
azfopen(&l, "crtdump.txt", "a+t");
|
||||
if (l)
|
||||
{
|
||||
fprintf(l, "%s", str);
|
||||
fclose(l);
|
||||
}
|
||||
}
|
||||
|
||||
int crtAllocHook(int nAllocType, void* pvData,
|
||||
size_t nSize, int nBlockUse, long lRequest,
|
||||
const unsigned char* szFileName, int nLine)
|
||||
{
|
||||
if (nBlockUse == _CRT_BLOCK)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int total_cnt = 0;
|
||||
static int total_mem = 0;
|
||||
if (nAllocType == _HOOK_ALLOC)
|
||||
{
|
||||
//total_mem += nSize;
|
||||
//total_cnt++;
|
||||
//_CrtMemState mem_state;
|
||||
//_CrtMemCheckpoint( &mem_state );
|
||||
//total_cnt = mem_state.lCounts[_NORMAL_BLOCK];
|
||||
//total_mem = mem_state.lTotalCount;
|
||||
if ((total_cnt & 0xF) == 0)
|
||||
{
|
||||
//_CrtCheckMemory();
|
||||
}
|
||||
|
||||
total_cnt++;
|
||||
total_mem += nSize;
|
||||
|
||||
//crtdebug( "<CRT> Alloc %d,size=%d,in: %s %d (total size=%d,num=%d)\n",lRequest,nSize,szFileName,nLine,total_mem,total_cnt );
|
||||
crtdebug("Size=%d, [Total=%d,N=%d] [%s:%d]\n", nSize, total_mem, total_cnt, szFileName, nLine);
|
||||
}
|
||||
else if (nAllocType == _HOOK_FREE)
|
||||
{
|
||||
MyCrtMemBlockHeader* pHead;
|
||||
pHead = pHdr(pvData);
|
||||
|
||||
total_cnt--;
|
||||
total_mem -= pHead->nDataSize;
|
||||
|
||||
crtdebug("Size=%d, [Total=%d,N=%d] [%s:%d]\n", pHead->nDataSize, total_mem, total_cnt, pHead->szFileName, pHead->nLine);
|
||||
//crtdebug( "<CRT> Free size=%d,in: %s %d (total size=%d,num=%d)\n",pHead->nDataSize,pHead->szFileName,pHead->nLine,total_mem,total_cnt );
|
||||
//total_mem -= nSize;
|
||||
//total_cnt--;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int crtReportHook(int nRptType, char* szMsg, int* retVal)
|
||||
{
|
||||
static int gl_num_asserts = 0;
|
||||
if (gl_num_asserts != 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
gl_num_asserts++;
|
||||
switch (nRptType)
|
||||
{
|
||||
case _CRT_WARN:
|
||||
crtdebug("<CRT WARNING> %s\n", szMsg);
|
||||
break;
|
||||
case _CRT_ERROR:
|
||||
crtdebug("<CRT ERROR> %s\n", szMsg);
|
||||
break;
|
||||
case _CRT_ASSERT:
|
||||
crtdebug("<CRT ASSERT> %s\n", szMsg);
|
||||
break;
|
||||
}
|
||||
gl_num_asserts--;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void InitCrt()
|
||||
{
|
||||
FILE* l = nullptr;
|
||||
azfopen(&l, "crtdump.txt", "w");
|
||||
if (l)
|
||||
{
|
||||
fclose(l);
|
||||
}
|
||||
|
||||
//_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
|
||||
//_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
|
||||
//_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
|
||||
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_WNDW);
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW);
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_WNDW);
|
||||
|
||||
//_CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_CHECK_CRT_DF|_CRTDBG_LEAK_CHECK_DF|_CRTDBG_DELAY_FREE_MEM_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) );
|
||||
//_CrtSetDbgFlag( _CRTDBG_CHECK_CRT_DF|_CRTDBG_LEAK_CHECK_DF/*|_CRTDBG_DELAY_FREE_MEM_DF*/ | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) );
|
||||
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
flags &= ~_CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_CRT_DF;
|
||||
|
||||
_CrtSetDbgFlag(flags);
|
||||
|
||||
_CrtSetAllocHook (crtAllocHook);
|
||||
_CrtSetReportHook(crtReportHook);
|
||||
}
|
||||
|
||||
void DoneCrt()
|
||||
{
|
||||
//_CrtCheckMemory();
|
||||
//_CrtDumpMemoryLeaks();
|
||||
}
|
||||
|
||||
// Autoinit CRT.
|
||||
//struct __autoinit_crt { __autoinit_crt() { InitCrt(); }; ~__autoinit_crt() { DoneCrt(); } } __autoinit_crt_var;
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
+21
-18
@@ -124,9 +124,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "ScopedVariableSetter.h"
|
||||
|
||||
#include "Util/3DConnexionDriver.h"
|
||||
|
||||
#include "DimensionsDialog.h"
|
||||
|
||||
#include "Util/AutoDirectoryRestoreFileDialog.h"
|
||||
#include "Util/EditorAutoLevelLoadTest.h"
|
||||
#include "AboutDialog.h"
|
||||
@@ -1352,8 +1349,27 @@ void CCryEditApp::CompileCriticalAssets() const
|
||||
}
|
||||
}
|
||||
assetsInQueueNotifcation.BusDisconnect();
|
||||
CCryEditApp::OutputStartupMessage(QString("Asset Processor is now ready."));
|
||||
|
||||
// Signal the "CriticalAssetsCompiled" lifecycle event
|
||||
// Also reload the "assetcatalog.xml" if it exists
|
||||
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
AZ::ComponentApplicationLifecycle::SignalEvent(*settingsRegistry, "CriticalAssetsCompiled", R"({})");
|
||||
// Reload the assetcatalog.xml at this point again
|
||||
// Start Monitoring Asset changes over the network and load the AssetCatalog
|
||||
auto LoadCatalog = [settingsRegistry](AZ::Data::AssetCatalogRequests* assetCatalogRequests)
|
||||
{
|
||||
if (AZ::IO::FixedMaxPath assetCatalogPath;
|
||||
settingsRegistry->Get(assetCatalogPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
|
||||
{
|
||||
assetCatalogPath /= "assetcatalog.xml";
|
||||
assetCatalogRequests->LoadCatalog(assetCatalogPath.c_str());
|
||||
}
|
||||
};
|
||||
AZ::Data::AssetCatalogRequestBus::Broadcast(AZStd::move(LoadCatalog));
|
||||
}
|
||||
|
||||
CCryEditApp::OutputStartupMessage(QString("Asset Processor is now ready."));
|
||||
}
|
||||
|
||||
bool CCryEditApp::ConnectToAssetProcessor() const
|
||||
@@ -1669,7 +1685,7 @@ bool CCryEditApp::InitInstance()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AZ::SettingsRegistryInterface* settingsRegistry = AZ::SettingsRegistry::Get())
|
||||
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
AZ::ComponentApplicationLifecycle::SignalEvent(*settingsRegistry, "LegacySystemInterfaceCreated", R"({})");
|
||||
}
|
||||
@@ -1787,12 +1803,6 @@ bool CCryEditApp::InitInstance()
|
||||
InitLevel(cmdInfo);
|
||||
});
|
||||
|
||||
#ifdef USE_WIP_FEATURES_MANAGER
|
||||
// load the WIP features file
|
||||
CWipFeatureManager::Instance()->EnableManager(!cmdInfo.m_bDeveloperMode);
|
||||
CWipFeatureManager::Init();
|
||||
#endif
|
||||
|
||||
if (!m_bConsoleMode && !m_bPreviewMode)
|
||||
{
|
||||
GetIEditor()->UpdateViews();
|
||||
@@ -2123,13 +2133,6 @@ int CCryEditApp::ExitInstance(int exitCode)
|
||||
}
|
||||
qobject_cast<Editor::EditorQtApplication*>(qApp)->UnloadSettings();
|
||||
|
||||
#ifdef USE_WIP_FEATURES_MANAGER
|
||||
//
|
||||
// close wip features manager
|
||||
//
|
||||
CWipFeatureManager::Shutdown();
|
||||
#endif
|
||||
|
||||
if (IsInRegularEditorMode())
|
||||
{
|
||||
if (GetIEditor())
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
#include "WipFeatureManager.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "ViewPane.h"
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "ActionManager.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "ErrorReportDialog.h"
|
||||
#include "SurfaceTypeValidator.h"
|
||||
#include "Util/AutoLogTime.h"
|
||||
#include "CheckOutDialog.h"
|
||||
#include "GameExporter.h"
|
||||
@@ -99,8 +98,7 @@ namespace Internal
|
||||
// CCryEditDoc construction/destruction
|
||||
|
||||
CCryEditDoc::CCryEditDoc()
|
||||
: doc_validate_surface_types(nullptr)
|
||||
, m_modifiedModuleFlags(eModifiedNothing)
|
||||
: m_modifiedModuleFlags(eModifiedNothing)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Set member variables to initial values
|
||||
@@ -120,7 +118,6 @@ CCryEditDoc::CCryEditDoc()
|
||||
|
||||
GetIEditor()->SetDocument(this);
|
||||
CLogFile::WriteLine("Document created");
|
||||
RegisterConsoleVariables();
|
||||
|
||||
MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_FILE_SAVE_AS, this, &CCryEditDoc::OnFileSaveAs);
|
||||
bool isPrefabSystemEnabled = false;
|
||||
@@ -459,8 +456,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
}
|
||||
}
|
||||
|
||||
CSurfaceTypeValidator().Validate();
|
||||
|
||||
LogLoadTime(GetTickCount() - t0);
|
||||
// Loaded with success, remove event from log file
|
||||
GetIEditor()->GetSettingsManager()->UnregisterEvent(loadEvent);
|
||||
@@ -1910,25 +1905,6 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
|
||||
m_bDocumentReady = bReady;
|
||||
}
|
||||
|
||||
void CCryEditDoc::RegisterConsoleVariables()
|
||||
{
|
||||
doc_validate_surface_types = gEnv->pConsole->GetCVar("doc_validate_surface_types");
|
||||
|
||||
if (!doc_validate_surface_types)
|
||||
{
|
||||
doc_validate_surface_types = REGISTER_INT_CB("doc_validate_surface_types", 0, 0,
|
||||
"Flag indicating whether icons are displayed on the animation graph.\n"
|
||||
"Default is 1.\n",
|
||||
OnValidateSurfaceTypesChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::OnValidateSurfaceTypesChanged(ICVar*)
|
||||
{
|
||||
CErrorsRecorder errorsRecorder(GetIEditor());
|
||||
CSurfaceTypeValidator().Validate();
|
||||
}
|
||||
|
||||
void CCryEditDoc::OnStartLevelResourceList()
|
||||
{
|
||||
// after loading another level we clear the RFOM_Level list, the first time the list should be empty
|
||||
|
||||
@@ -176,9 +176,7 @@ protected:
|
||||
virtual void OnFileSaveAs();
|
||||
//! called immediately after saving the level.
|
||||
void AfterSave();
|
||||
void RegisterConsoleVariables();
|
||||
void OnStartLevelResourceList();
|
||||
static void OnValidateSurfaceTypesChanged(ICVar*);
|
||||
|
||||
QString GetCryIndexPath(const char* levelFilePath) const;
|
||||
|
||||
@@ -194,7 +192,6 @@ protected:
|
||||
XmlNodeRef m_environmentTemplate;
|
||||
std::list<IDocListener*> m_listeners;
|
||||
bool m_bDocumentReady = false;
|
||||
ICVar* doc_validate_surface_types = nullptr;
|
||||
int m_modifiedModuleFlags;
|
||||
// On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though.
|
||||
// The right way would require us to save to the level folder the export status of the level.
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
⼯䴠捩潲潳瑦嘠獩慵⭃敧敮慲整敲潳牵散猠牣灩
|
||||
⼯
|
||||
椣据畬敤∠敲潳牵散栮�
|
||||
|
||||
搣晥湩偁呓䑕佉剟䅅佄䱎彙奓䉍䱏�
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯䜠湥牥瑡摥映潲桴䕔员义䱃䑕⁅′敲潳牵散�
|
||||
⼯
|
||||
椣据畬敤∠楷牮獥栮�
|
||||
椣据畬敤∠敲潳牵散栮�
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
産摮晥䄠卐啔䥄彏䕒䑁乏奌卟䵙佂卌
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯䔠杮楬桳⠠湕瑩摥匠慴整⥳爠獥畯捲獥
|
||||
|
||||
椣搡晥湩摥䄨塆剟卅問䍒彅䱄⥌簠⁼敤楦敮⡤䙁彘䅔䝒䕟啎�
|
||||
䅌䝎䅕䕇䰠乁彇久䱇卉ⱈ匠䉕䅌䝎䕟䝎䥌䡓啟�
|
||||
|
||||
椣摦晥䄠卐啔䥄彏义佖䕋�
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯吠塅䥔䍎啌䕄
|
||||
⼯
|
||||
|
||||
′䕔员义䱃䑕⁅
|
||||
䕂䥇�
|
||||
††⌢湩汣摵∢楷牮獥栮∢牜湜�
|
||||
††⌢湩汣摵∢敲潳牵散栮∢牜湜�
|
||||
††尢∰
|
||||
久�
|
||||
|
||||
″䕔员义䱃䑕⁅
|
||||
䕂䥇�
|
||||
††尢屲≮
|
||||
††尢∰
|
||||
久�
|
||||
|
||||
‱䕔员义䱃䑕⁅
|
||||
䕂䥇�
|
||||
††爢獥畯捲屨∰
|
||||
久�
|
||||
|
||||
攣摮晩††⼯䄠卐啔䥄彏义佖䕋�
|
||||
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯䴠湥�
|
||||
⼯
|
||||
|
||||
䑉归䕍啎䱟噉䍅䕒呁⁅䕍啎
|
||||
䕂䥇�
|
||||
††佐啐⁐☢楆敬�
|
||||
††䕂䥇�
|
||||
††††䕍啎呉䵅∠慓敶猠瑥楴杮≳†††††††䑉䙟䱉彅䅓䕖䕓呔义升
|
||||
††††䕍啎呉䵅∠汃獯≥†††††††††††䑉䙟䱉彅䱃协彅䥌䕖剃䅅䕔噟䕉�
|
||||
††久�
|
||||
††佐啐⁐☢楖睥�
|
||||
††䕂䥇�
|
||||
††††䕍啎呉䵅∠楌敶牃慥整䰠杯敧≲†††††䑉噟䕉彗䥌䕖剃䅅䕔佌䝇剅䡃䍅䕋�
|
||||
††††䕍啎呉䵅∠楌敶牃慥整倠潲楦敬䔠楤潴≲†䑉噟䕉彗䥌䕖剃䅅䕔剐䙏䱉䕅䥄佔ⱒ䌠䕈䭃䑅
|
||||
††††䕍啎呉䵅∠楌敶牃慥整䘠汩祓据匠瑥楴杮≳䑉噟䕉彗䥌䕖剃䅅䕔䥆䕌奓䍎䕓呔义升䡃䍅䕋�
|
||||
††久�
|
||||
久�
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯䐠慩潬�
|
||||
⼯
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔偟䍉䕋⁒䥄䱁䝏塅〠ⰰ㌠㘱㔲�
|
||||
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久�
|
||||
䅃呐佉⁎匢汥捥⁴慧敭戠極摬搠物捥潴祲�
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋ〲ⰰ㌲ⰸ〵ㄬ�
|
||||
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㔲ⰹ㌲ⰸ〵ㄬ�
|
||||
††佃呎佒⁌††††∢䤬䍄䑟剉䍅佔奒呟䕒ⱅ匢獹牔敥楖睥㈳Ⱒ噔当䅈䉓呕佔华簠吠卖䡟十䥌䕎⁓⁼噔当䥌䕎䅓剔住⁔⁼噔当䡓坏䕓䅌坌奁⁓⁼南䉟剏䕄⁒⁼南䡟䍓佒䱌簠圠当䅔卂佔ⱐⰷⰷ〳ⰲ㈲�
|
||||
久�
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔䅟䑄呟剁䕇協䐠䅉佌䕇⁘ⰰ〠〵ⰰ㐠〰
|
||||
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠䐠当䕃呎剅簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久�
|
||||
䅃呐佉⁎䐢獩潣敶楌敶牃慥整琠牡敧獴�
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††啐䡓啂呔乏†††刢晥敲桳Ⱒ䑉彃䕒剆卅ⱈⰸⰸ〷ㄬ�
|
||||
††啐䡓啂呔乏†††䄢摤挠獵潴⸮Ⱒ䑉彃啂呔乏䅟䑄偟䕅ⱒ㈸㠬㜬ⰰ㠱
|
||||
††佃呎佒⁌††††唢敳眠摩牥猠慥捲戨潲摡慣瑳∩䤬䍄䍟䕈䭃䕟䅎䱂䑅∬畂瑴湯Ⱒ卂䅟呕䍏䕈䭃佂⁘⁼南呟䉁呓偏㈬㌳ㄬⰲ〲ⰰ〱
|
||||
††佃呎佒⁌††††∢䤬䍄䱟卉彔䕐剅ⱓ堢偔敒潰瑲Ⱒ南呟䉁呓偏㠬㌬ⰲ㠴ⰴ㐳ⰲ南䕟彘呓呁䍉䑅䕇
|
||||
††䕄偆单䉈呕佔⁎†唢敳猠汥捥整≤䤬佄ⱋ㠱ⰰ㜳ⰹ〷ㄬ�
|
||||
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㔲ⰹ㜳ⰹ〷ㄬ�
|
||||
††啐䡓啂呔乏†††䄢摤戠⁹偉⸮∮䤬䍄䉟呕佔彎䑁彄䅍䕔䥒䱁ㄬ㜵㠬㜬ⰰ㠱
|
||||
久�
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔偟䕅归䥌呓䐠䅉佌䕇⁘ⰰ〠㤳ⰵ㈠㌱
|
||||
呓䱙⁅卄卟呅但呎簠䐠当䥆䕘卄卙簠䐠当䕃呎剅簠圠当䡃䱉⁄⁼南噟卉䉉䕌簠圠当佂䑒剅簠圠当奓䵓久�
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††呌塅⁔†††††倢敥獲∺䤬䍄卟䅔䥔ⱃ㜱㈬ⰷ㈲㠬
|
||||
††啐䡓啂呔乏†††䄢摤⸮∮䤬䍄䉟呕佔彎䑁彄䕐剅㔬ⰶ㐲㔬ⰶ㘱
|
||||
††啐䡓啂呔乏†††䔢楤⸮Ⱒ䑉彃啂呔乏䕟䥄彔䕐剅ㄬ㘱㈬ⰴ㘵ㄬ�
|
||||
††啐䡓啂呔乏†††刢浥癯≥䤬䍄䉟呕佔彎䕄䕌䕔偟䕅ⱒ㜱ⰶ㐲㔬ⰲ㘱
|
||||
††䕄偆单䉈呕佔⁎†匢慴瑲䄠汬Ⱒ䑉彃啂呔乏卟䅔呒䅟䱌㐬㐬㐬ⰸ㘱
|
||||
††啐䡓啂呔乏†††刢獥瑥䄠汬Ⱒ䑉彃啂呔乏剟卅呅䅟䱌ㄬ㘷㐬㔬ⰲ㘱
|
||||
††啐䡓啂呔乏†††䘢牯散匠湹汁≬䤬䍄䉟呕佔彎但䍒彅奓䍎䅟䱌㔬ⰶⰴ㘵ㄬ�
|
||||
††啐䡓啂呔乏†††䌢敬湡䄠汬Ⱒ䑉彃啂呔乏䍟䕌乁䅟䱌㈬㈳㐬㔬ⰲ㘱
|
||||
††啐䡓啂呔乏†††匢牣敥獮潨⁴汁≬䤬䍄䉟呕佔彎䍓䕒久䡓呏䅟䱌ㄬ㘱㐬㔬ⰶ㘱
|
||||
††佃呎佒⁌††††∢䤬䍄䱟卉彔䕐剅ⱓ堢偔敒潰瑲Ⱒ南呟䉁呓偏㐬㐬ⰴ㠳ⰶ㘱ⰴ南䕟彘呓呁䍉䑅䕇
|
||||
††䡃䍅䉋塏††††䰢癩䍥敲瑡≥䤬䍄䉟呕佔彎久䉁䕌䱟噉䍅䕒呁ⱅ㠲ⰸⰴ㈵㌬ⰶ卂偟单䱈䭉⁅⁼卂䵟䱕䥔䥌䕎
|
||||
††䡃䍅䉋塏††††匢湹屣䍮浡牥≡䤬䍄䉟呕佔彎䅃䕍䅒卟乙ⱃ㐳ⰵⰴ㈵㌬ⰶ卂偟单䱈䭉⁅⁼卂䵟䱕䥔䥌䕎
|
||||
††啐䡓啂呔乏†††䐢獩潣敶≲䤬䍄䉟呕佔彎䥄䍓噏剅偟䕅卒㈬㈳㈬ⰴ㈵ㄬ�
|
||||
久�
|
||||
|
||||
䑉彄䑉彄䥌䕖剃䅅䕔卟呅䥔䝎当䅐䕎⁌䥄䱁䝏塅〠ⰰㄠ㘵〲�
|
||||
呓䱙⁅卄卟呅但呎簠圠当䡃䱉�
|
||||
但呎㠠䴢⁓桓汥汄∲〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††啐䡓啂呔乏†††䄢摤琠牡敧獴⸮∮䤬䍄䉟呕佔彎䥄䍓噏剅偟䕅卒㐬㐬㠬ⰰ㘱
|
||||
久�
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔䕟䥄彔佃乎䍅䥔乏䐠䅉佌䕇⁘ⰰ〠㠲ⰸㄠ㌸
|
||||
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久�
|
||||
䅃呐佉⁎䰢癩䍥敲瑡潨瑳猠瑥楴杮≳
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋ㔱ⰸ㔱ⰴ㠵㈬�
|
||||
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㈲ⰱ㔱ⰴ㠵㈬�
|
||||
††呌塅⁔†††††丢浡㩥Ⱒ䑉彃呓呁䍉ㄬⰶ㘴㈬ⰲ�
|
||||
††䑅呉䕔员††††䑉彃䑅呉呟剁䕇彔䅎䕍㐬ⰴ㐴ㄬ〰ㄬⰴ卅䅟呕䡏䍓佒䱌
|
||||
††呌塅⁔†††††䤢㩐Ⱒ䑉彃呓呁䍉ㄬ㈵㐬ⰶ〱㠬
|
||||
††佃呎佒⁌††††∢䤬䍄呟剁䕇彔偉䑁剄卅ⱓ匢獹偉摁牤獥㍳∲圬当䅔卂佔ⱐ㘱ⰸ㐴ㄬ〰ㄬ�
|
||||
††呌塅⁔†††††倢慬晴牯㩭Ⱒ䑉彃呓呁䍉㠬㈬ⰶ〳㠬
|
||||
††呌塅⁔†††††䈢極摬瀠瑡愨瑵浯瑡捩㨩Ⱒ䑉彃呓呁䍉ㄬⰹ㈱ⰰ㐷㠬
|
||||
††啐䡓啂呔乏†††吢獥⁴偉Ⱒ䑉彃啂呔乏呟卅彔佃乎䍅䥔乏ㄬ㠶㘬ⰰ〱ⰰ㘱
|
||||
††佃䉍䉏塏††††䑉彃佃䉍彏䱐呁但䵒㐬ⰴ㐲ㄬ〰㠬ⰸ䉃当剄偏佄乗䥌呓簠圠当卖剃䱏⁌⁼南呟䉁呓偏
|
||||
††啐䡓啂呔乏†††刢獥癯敬渠浡潴䤠≐䤬䍄䉟呕佔彎䕒剆卅彈偉㐬ⰴ〶ㄬ〰ㄬ�
|
||||
††佃呎佒⁌††††䔢慮汢桴獩瀠敥≲䤬䍄䍟䕈䭃䕟䅎䱂䑅∬畂瑴湯Ⱒ卂䅟呕䍏䕈䭃佂⁘⁼南呟䉁呓偏㠬㠬㘬ⰷ〱
|
||||
††則問䉐塏††††䈢極摬猠瑥楴杮≳䤬䍄卟䅔䥔ⱃⰷ〸㈬㈷㜬�
|
||||
††呌塅⁔†††††䈢極摬攠數畣慴汢㩥Ⱒ䑉彃呓呁䍉ㄬⰹ㈹㔬ⰶ�
|
||||
††啐䡓啂呔乏†††⸢⸮Ⱒ䑉彃啂呔乏偟䍉彋䅇䕍䑟剉䍅佔奒㈬㤴ㄬ㐰㈬ⰲ㐱
|
||||
††䑅呉䕔员††††䑉彃䑅呉䉟䥕䑌剟住彔䅐䡔㈬ⰰ〱ⰴ㈲ⰶ㐱䔬当啁佔午剃䱏�
|
||||
††䑅呉䕔员††††䑉彃䑅呉䉟䥕䑌䕟䕘啃䅔䱂ⱅ〲ㄬㄳ㈬㤴ㄬⰴ卅䅟呕䡏䍓佒䱌
|
||||
久�
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔呟十彋䅗呉䐠䅉佌䕇⁘ⰰ〠㌲ⰸ㐠�
|
||||
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久�
|
||||
䅃呐佉⁎䐢慩潬≧
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㐹㈬ⰰ〵ㄬ�
|
||||
††呌塅⁔†††††匢慴楴≣䤬䍄呟十彋剐䝏䕒卓呟塅ⱔⰷⰷ㈲ⰴ�
|
||||
久�
|
||||
|
||||
䑉彄䥌䕖剃䅅䕔䅟䑄䉟彙偉䐠䅉佌䕇⁘ⰰ〠㌱ⰷ㜠�
|
||||
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久�
|
||||
䅃呐佉⁎䄢摤䰠癩䍥敲瑡祢䤠≐
|
||||
但呎㠠䴢⁓桓汥汄≧〴ⰰ〠砰�
|
||||
䕂䥇�
|
||||
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋⰷ㠴㔬ⰸ〲
|
||||
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌㄷ㐬ⰸ㠵㈬�
|
||||
††呌塅⁔†††††䤢㩐Ⱒㄭ㤬ㄬⰲ〱㠬
|
||||
††䑅呉䕔员††††䤠䍄呟剁䕇彔偉䑁剄卅ⱓ㔲ㄬⰰ〱ⰰ㔱圬当䅔卂佔�
|
||||
††啐䡓啂呔乏†††吢獥⁴偉Ⱒ䑉彃啂呔乏呟卅彔佃乎䍅䥔乏㈬ⰵ㜲ㄬ〰ㄬ�
|
||||
久�
|
||||
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯䐠卅䝉䥎䙎�
|
||||
⼯
|
||||
|
||||
椣摦晥䄠卐啔䥄彏义佖䕋�
|
||||
啇䑉䱅义卅䐠卅䝉䥎䙎�
|
||||
䕂䥇�
|
||||
††䑉彄䥌䕖剃䅅䕔䅟䑄呟剁䕇協䥄䱁䝏
|
||||
††䕂䥇�
|
||||
††久�
|
||||
|
||||
††䑉彄䥌䕖剃䅅䕔䕟䥄彔佃乎䍅䥔乏䥄䱁䝏
|
||||
††䕂䥇�
|
||||
††久�
|
||||
|
||||
††䑉彄䥌䕖剃䅅䕔呟十彋䅗呉䥄䱁䝏
|
||||
††䕂䥇�
|
||||
††††䕌呆䅍䝒义�
|
||||
††††䥒䡇䵔剁䥇ⱎ㈠ㄳ
|
||||
††††佔䵐剁䥇ⱎ㜠
|
||||
††††佂呔䵏䅍䝒义㐳
|
||||
††久�
|
||||
|
||||
††䑉彄䥌䕖剃䅅䕔䅟䑄䉟彙偉䥄䱁䝏
|
||||
††䕂䥇�
|
||||
††久�
|
||||
久�
|
||||
攣摮晩††⼯䄠卐啔䥄彏义佖䕋�
|
||||
|
||||
攣摮晩††⼯䔠杮楬桳⠠湕瑩摥匠慴整⥳爠獥畯捲獥
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
|
||||
|
||||
|
||||
椣湦敤偁呓䑕佉䥟噎䭏䑅
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
⼯
|
||||
⼯䜠湥牥瑡摥映潲桴䕔员义䱃䑕⁅″敲潳牵散�
|
||||
⼯
|
||||
|
||||
|
||||
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯�
|
||||
攣摮晩††⼯渠瑯䄠卐啔䥄彏义佖䕋�
|
||||
@@ -1,71 +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 "EditorDefs.h"
|
||||
|
||||
#include "DimensionsDialog.h"
|
||||
|
||||
// Qt
|
||||
#include <QButtonGroup>
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_DimensionsDialog.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
CDimensionsDialog::CDimensionsDialog(QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_group(new QButtonGroup(this))
|
||||
, ui(new Ui::CDimensionsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(tr("Generate Terrain Texture"));
|
||||
|
||||
m_group->addButton(ui->Dim512, 512);
|
||||
m_group->addButton(ui->Dim1024, 1024);
|
||||
m_group->addButton(ui->Dim2048, 2048);
|
||||
m_group->addButton(ui->Dim4096, 4096);
|
||||
m_group->addButton(ui->Dim8192, 8192);
|
||||
m_group->addButton(ui->Dim16384, 16384);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CDimensionsDialog::~CDimensionsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CDimensionsDialog::SetDimensions(unsigned int iWidth)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Select a dimension option button in the dialog
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QAbstractButton* button = m_group->button(iWidth);
|
||||
assert(button);
|
||||
|
||||
button->setChecked(true);
|
||||
}
|
||||
|
||||
UINT CDimensionsDialog::GetDimensions()
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Get the currently selected dimension option button in the dialog
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
assert(m_group->checkedId() != -1);
|
||||
|
||||
return m_group->checkedId();
|
||||
}
|
||||
|
||||
#include <moc_DimensionsDialog.cpp>
|
||||
@@ -1,47 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
|
||||
#define CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
class QButtonGroup;
|
||||
|
||||
namespace Ui {
|
||||
class CDimensionsDialog;
|
||||
}
|
||||
|
||||
class CDimensionsDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CDimensionsDialog(QWidget* pParent = nullptr); // standard constructor
|
||||
~CDimensionsDialog();
|
||||
|
||||
UINT GetDimensions();
|
||||
void SetDimensions(unsigned int iWidth);
|
||||
|
||||
protected:
|
||||
void UpdateData(bool fromUi = true); // DDX/DDV support
|
||||
|
||||
private:
|
||||
QButtonGroup* m_group;
|
||||
|
||||
QScopedPointer<Ui::CDimensionsDialog> ui;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDimensionsDialog</class>
|
||||
<widget class="QDialog" name="CDimensionsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>465</width>
|
||||
<height>237</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="STATIC2">
|
||||
<property name="title">
|
||||
<string>Texture Dimensions (Texture Dimensions divided by Terrain Size = Texels per meter)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim512">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>512 x 512</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim1024">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1024 x 1024</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim2048">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2048 x 2048</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim4096">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4096 x 4096</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim8192">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>8192 x 8192</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Dim16384">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>16384 x 16384</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CDimensionsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>77</x>
|
||||
<y>294</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>7</x>
|
||||
<y>296</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,138 +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 "EditorDefs.h"
|
||||
|
||||
#include "DeepSelection.h"
|
||||
|
||||
// Editor
|
||||
#include "Objects/BaseObject.h"
|
||||
|
||||
|
||||
//! Functor for sorting selected objects on deep selection mode.
|
||||
struct NearDistance
|
||||
{
|
||||
NearDistance(){}
|
||||
bool operator()(const CDeepSelection::RayHitObject& lhs, const CDeepSelection::RayHitObject& rhs) const
|
||||
{
|
||||
return lhs.distance < rhs.distance;
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CDeepSelection::CDeepSelection()
|
||||
: m_Mode(DSM_NONE)
|
||||
, m_previousMode(DSM_NONE)
|
||||
, m_CandidateObjectCount(0)
|
||||
, m_CurrentSelectedPos(-1)
|
||||
{
|
||||
m_LastPickPoint = QPoint(-1, -1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CDeepSelection::~CDeepSelection()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::Reset(bool bResetLastPick)
|
||||
{
|
||||
for (int i = 0; i < m_CandidateObjectCount; ++i)
|
||||
{
|
||||
m_RayHitObjects[i].object->ClearFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
m_CandidateObjectCount = 0;
|
||||
m_CurrentSelectedPos = -1;
|
||||
|
||||
m_RayHitObjects.clear();
|
||||
|
||||
if (bResetLastPick)
|
||||
{
|
||||
m_LastPickPoint = QPoint(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::AddObject(float distance, CBaseObject* pObj)
|
||||
{
|
||||
m_RayHitObjects.push_back(RayHitObject(distance, pObj));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CDeepSelection::OnCycling (const QPoint& pt)
|
||||
{
|
||||
QPoint diff = m_LastPickPoint - pt;
|
||||
LONG epsilon = 2;
|
||||
m_LastPickPoint = pt;
|
||||
|
||||
if (abs(diff.x()) < epsilon && abs(diff.y()) < epsilon)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDeepSelection::ExcludeHitTest(int except)
|
||||
{
|
||||
int nExcept = except % m_CandidateObjectCount;
|
||||
|
||||
for (int i = 0; i < m_CandidateObjectCount; ++i)
|
||||
{
|
||||
m_RayHitObjects[i].object->SetFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
m_RayHitObjects[nExcept].object->ClearFlags(OBJFLAG_NO_HITTEST);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int CDeepSelection::CollectCandidate(float fMinDistance, float fRange)
|
||||
{
|
||||
m_CandidateObjectCount = 0;
|
||||
|
||||
if (!m_RayHitObjects.empty())
|
||||
{
|
||||
std::sort(m_RayHitObjects.begin(), m_RayHitObjects.end(), NearDistance());
|
||||
|
||||
for (std::vector<CDeepSelection::RayHitObject>::iterator itr = m_RayHitObjects.begin();
|
||||
itr != m_RayHitObjects.end(); ++itr)
|
||||
{
|
||||
if (itr->distance - fMinDistance < fRange)
|
||||
{
|
||||
++m_CandidateObjectCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_CandidateObjectCount;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CBaseObject* CDeepSelection::GetCandidateObject(int index)
|
||||
{
|
||||
m_CurrentSelectedPos = index % m_CandidateObjectCount;
|
||||
|
||||
return m_RayHitObjects[m_CurrentSelectedPos].object;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//!
|
||||
void CDeepSelection::SetMode(EDeepSelectionMode mode)
|
||||
{
|
||||
m_previousMode = m_Mode;
|
||||
m_Mode = mode;
|
||||
}
|
||||
@@ -1,87 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Deep Selection Header
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
#define CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
#pragma once
|
||||
|
||||
class CBaseObject;
|
||||
|
||||
//! Deep Selection
|
||||
//! Additional output information of HitContext on using "deep selection mode".
|
||||
//! At the deep selection mode, it supports second selection pass for easy
|
||||
//! selection on crowded area with two different method.
|
||||
//! One is to show pop menu of candidate objects list. Another is the cyclic
|
||||
//! selection on pick clicking.
|
||||
class CDeepSelection
|
||||
: public _i_reference_target_t
|
||||
{
|
||||
public:
|
||||
//! Deep Selection Mode Definition
|
||||
enum EDeepSelectionMode
|
||||
{
|
||||
DSM_NONE = 0, // Not using deep selection.
|
||||
DSM_POP = 1, // Deep selection mode with pop context menu.
|
||||
DSM_CYCLE = 2 // Deep selection mode with cyclic selection on each clinking same point.
|
||||
};
|
||||
|
||||
//! Subclass for container of the selected object with hit distance.
|
||||
struct RayHitObject
|
||||
{
|
||||
RayHitObject(float dist, CBaseObject* pObj)
|
||||
: distance(dist)
|
||||
, object(pObj)
|
||||
{
|
||||
}
|
||||
|
||||
float distance;
|
||||
CBaseObject* object;
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CDeepSelection();
|
||||
virtual ~CDeepSelection();
|
||||
|
||||
void Reset(bool bResetLastPick = false);
|
||||
void AddObject(float distance, CBaseObject* pObj);
|
||||
//! Check if clicking point is same position with last position,
|
||||
//! to decide whether to continue cycling mode.
|
||||
bool OnCycling (const QPoint& pt);
|
||||
//! All objects in list are excluded for hitting test except one, current selection.
|
||||
void ExcludeHitTest(int except);
|
||||
void SetMode(EDeepSelectionMode mode);
|
||||
inline EDeepSelectionMode GetMode() const { return m_Mode; }
|
||||
inline EDeepSelectionMode GetPreviousMode() const { return m_previousMode; }
|
||||
//! Collect object in the deep selection range. The distance from the minimum
|
||||
//! distance is less than deep selection range.
|
||||
int CollectCandidate(float fMinDistance, float fRange);
|
||||
//! Return the candidate object in index position, then it is to be current
|
||||
//! selection position.
|
||||
CBaseObject* GetCandidateObject(int index);
|
||||
//! Return the current selection position that is update in "GetCandidateObject"
|
||||
//! function call.
|
||||
inline int GetCurrentSelectPos() const { return m_CurrentSelectedPos; }
|
||||
//! Return the number of objects in the deep selection range.
|
||||
inline int GetCandidateObjectCount() const { return m_CandidateObjectCount; }
|
||||
|
||||
private:
|
||||
//! Current mode
|
||||
EDeepSelectionMode m_Mode;
|
||||
EDeepSelectionMode m_previousMode;
|
||||
//! Last picking point to check whether cyclic selection continue.
|
||||
QPoint m_LastPickPoint;
|
||||
//! List of the selected objects with ray hitting
|
||||
std::vector<RayHitObject> m_RayHitObjects;
|
||||
int m_CandidateObjectCount;
|
||||
int m_CurrentSelectedPos;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_EDITMODE_DEEPSELECTION_H
|
||||
@@ -112,29 +112,31 @@ void EditorPreferencesDialog::showEvent(QShowEvent* event)
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event)
|
||||
bool WidgetConsumesKeyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
// If the enter key is pressed during any text input, the dialog box will close
|
||||
// making it inconvenient to do multiple edits. This routine captures the
|
||||
// Key_Enter or Key_Return and clears the focus to give a visible cue that
|
||||
// editing of that field has finished and then doesn't propogate it.
|
||||
// editing of that field has finished and then doesn't propagate it.
|
||||
if (event->key() != Qt::Key::Key_Enter && event->key() != Qt::Key::Key_Return)
|
||||
{
|
||||
QApplication::sendEvent(widget, event);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if (QWidget* editWidget = QApplication::focusWidget())
|
||||
{
|
||||
if (QWidget* editWidget = QApplication::focusWidget())
|
||||
{
|
||||
editWidget->clearFocus();
|
||||
}
|
||||
editWidget->clearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditorPreferencesDialog::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
WidgetHandleKeyPressEvent(this, event);
|
||||
if (!WidgetConsumesKeyPressEvent(event))
|
||||
{
|
||||
QDialog::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPreferencesDialog::OnTreeCurrentItemChanged()
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ui
|
||||
|
||||
class EditorPreferencesTreeWidgetItem;
|
||||
|
||||
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event);
|
||||
bool WidgetConsumesKeyPressEvent(QKeyEvent* event);
|
||||
|
||||
class EditorPreferencesDialog
|
||||
: public QDialog
|
||||
|
||||
@@ -28,7 +28,7 @@ void CEditorPreferencesPage_AWS::Reflect(AZ::SerializeContext& serialize)
|
||||
if (editContext)
|
||||
{
|
||||
editContext->Class<UsageOptions>("Options", "")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &UsageOptions::m_awsAttributionEnabled, "Allow O3DE to send information about your use of AWS Core Gem to AWS",
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &UsageOptions::m_awsAttributionEnabled, "Allow <a href=\"https://aws.amazon.com/privacy/\">O3DE</a> to send information about your use of AWS Core Gem to AWS",
|
||||
"");
|
||||
|
||||
editContext->Class<CEditorPreferencesPage_AWS>("AWS Preferences", "AWS Preferences")
|
||||
|
||||
@@ -41,8 +41,6 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
->Field("ShowBBoxes", &Display::m_showBBoxes)
|
||||
->Field("DrawEntityLabels", &Display::m_drawEntityLabels)
|
||||
->Field("ShowTriggerBounds", &Display::m_showTriggerBounds)
|
||||
->Field("ShowIcons", &Display::m_showIcons)
|
||||
->Field("DistanceScaleIcons", &Display::m_distanceScaleIcons)
|
||||
->Field("ShowFrozenHelpers", &Display::m_showFrozenHelpers)
|
||||
->Field("FillSelectedShapes", &Display::m_fillSelectedShapes)
|
||||
->Field("ShowGridGuide", &Display::m_showGridGuide)
|
||||
@@ -118,10 +116,6 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
|
||||
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")
|
||||
@@ -244,8 +238,6 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
|
||||
}
|
||||
gSettings.viewports.bDrawEntityLabels = m_display.m_drawEntityLabels;
|
||||
gSettings.viewports.bShowTriggerBounds = m_display.m_showTriggerBounds;
|
||||
gSettings.viewports.bShowIcons = m_display.m_showIcons;
|
||||
gSettings.viewports.bDistanceScaleIcons = m_display.m_distanceScaleIcons;
|
||||
gSettings.viewports.nShowFrozenHelpers = m_display.m_showFrozenHelpers;
|
||||
gSettings.viewports.bFillSelectedShapes = m_display.m_fillSelectedShapes;
|
||||
gSettings.viewports.bShowGridGuide = m_display.m_showGridGuide;
|
||||
@@ -300,8 +292,6 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
|
||||
m_display.m_showBBoxes = (ds->GetRenderFlags() & RENDER_FLAG_BBOX) == RENDER_FLAG_BBOX;
|
||||
m_display.m_drawEntityLabels = gSettings.viewports.bDrawEntityLabels;
|
||||
m_display.m_showTriggerBounds = gSettings.viewports.bShowTriggerBounds;
|
||||
m_display.m_showIcons = gSettings.viewports.bShowIcons;
|
||||
m_display.m_distanceScaleIcons = gSettings.viewports.bDistanceScaleIcons;
|
||||
m_display.m_showFrozenHelpers = gSettings.viewports.nShowFrozenHelpers;
|
||||
m_display.m_fillSelectedShapes = gSettings.viewports.bFillSelectedShapes;
|
||||
m_display.m_showGridGuide = gSettings.viewports.bShowGridGuide;
|
||||
|
||||
@@ -62,8 +62,6 @@ private:
|
||||
bool m_showBBoxes;
|
||||
bool m_drawEntityLabels;
|
||||
bool m_showTriggerBounds;
|
||||
bool m_showIcons;
|
||||
bool m_distanceScaleIcons;
|
||||
bool m_showFrozenHelpers;
|
||||
bool m_fillSelectedShapes;
|
||||
bool m_showGridGuide;
|
||||
|
||||
@@ -454,9 +454,6 @@ void EditorViewportWidget::Update()
|
||||
|
||||
// Render
|
||||
{
|
||||
// TODO: Move out this logic to a controller and refactor to work with Atom
|
||||
ProcessRenderLisneters(m_displayContext);
|
||||
|
||||
m_displayContext.Flush2D();
|
||||
|
||||
// Post Render Callback
|
||||
@@ -585,11 +582,11 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
|
||||
case eNotify_OnCloseScene:
|
||||
m_renderViewport->SetScene(nullptr);
|
||||
SetDefaultCamera();
|
||||
break;
|
||||
|
||||
case eNotify_OnEndSceneOpen:
|
||||
UpdateScene();
|
||||
SetDefaultCamera();
|
||||
break;
|
||||
|
||||
case eNotify_OnBeginNewScene:
|
||||
@@ -1030,8 +1027,6 @@ void EditorViewportWidget::OnTitleMenu(QMenu* menu)
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Safe Frame"), &gSettings.viewports.bShowSafeFrame);
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Construction Plane"), &gSettings.snap.constructPlaneDisplay);
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Trigger Bounds"), &gSettings.viewports.bShowTriggerBounds);
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Icons"), &gSettings.viewports.bShowIcons, &gSettings.viewports.bShowSizeBasedIcons);
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Size-based Icons"), &gSettings.viewports.bShowSizeBasedIcons, &gSettings.viewports.bShowIcons);
|
||||
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Helpers of Frozen Objects"), &gSettings.viewports.nShowFrozenHelpers);
|
||||
|
||||
if (!m_predefinedAspectRatios.IsEmpty())
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
#include "ErrorRecorder.h"
|
||||
#include "BaseLibraryItem.h"
|
||||
#include "Include/IErrorReport.h"
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#define CRYINCLUDE_EDITOR_CORE_ERRORRECORDER_H
|
||||
#pragma once
|
||||
|
||||
#include "Include/EditorCoreAPI.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Automatic class to record and display error.
|
||||
class EDITOR_CORE_API CErrorsRecorder
|
||||
|
||||
@@ -67,24 +67,6 @@ QString CErrorRecord::GetErrorText() const
|
||||
{
|
||||
str += QString("\t ");
|
||||
}
|
||||
if (pItem)
|
||||
{
|
||||
switch (pItem->GetType())
|
||||
{
|
||||
case EDB_TYPE_MATERIAL:
|
||||
str += QString("\t Material=\"");
|
||||
break;
|
||||
case EDB_TYPE_PARTICLE:
|
||||
str += QString("\t Particle=\"");
|
||||
break;
|
||||
case EDB_TYPE_MUSIC:
|
||||
str += QString("\t Music=\"");
|
||||
break;
|
||||
default:
|
||||
str += QString("\t Item=\"");
|
||||
}
|
||||
str += pItem->GetFullName() + "\"";
|
||||
}
|
||||
if (pObject)
|
||||
{
|
||||
str += QString("\t Object=\"") + pObject->GetName() + "\"";
|
||||
@@ -101,7 +83,6 @@ CErrorReport::CErrorReport()
|
||||
m_bImmediateMode = true;
|
||||
m_bShowErrors = true;
|
||||
m_pObject = nullptr;
|
||||
m_pItem = nullptr;
|
||||
m_pParticle = nullptr;
|
||||
}
|
||||
|
||||
@@ -140,10 +121,6 @@ void CErrorReport::ReportError(CErrorRecord& err)
|
||||
{
|
||||
err.pObject = m_pObject;
|
||||
}
|
||||
else if (err.pItem == nullptr && m_pItem != nullptr)
|
||||
{
|
||||
err.pItem = m_pItem;
|
||||
}
|
||||
m_errors.push_back(err);
|
||||
}
|
||||
bNoRecurse = false;
|
||||
@@ -255,12 +232,6 @@ void CErrorReport::SetCurrentValidatorObject(CBaseObject* pObject)
|
||||
m_pObject = pObject;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CErrorReport::SetCurrentValidatorItem(CBaseLibraryItem* pItem)
|
||||
{
|
||||
m_pItem = pItem;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CErrorReport::SetCurrentFile(const QString& file)
|
||||
{
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
// forward declarations.
|
||||
class CParticleItem;
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
#include <CryCommon/IValidator.h>
|
||||
#include <CryCommon/smartptr.h>
|
||||
|
||||
#include "Objects/BaseObject.h"
|
||||
#include "Include/EditorCoreAPI.h"
|
||||
#include "Include/IErrorReport.h"
|
||||
#include "ErrorRecorder.h"
|
||||
|
||||
@@ -56,16 +59,13 @@ public:
|
||||
int count;
|
||||
//! Object that caused this error.
|
||||
_smart_ptr<CBaseObject> pObject;
|
||||
//! Library Item that caused this error.
|
||||
_smart_ptr<CBaseLibraryItem> pItem;
|
||||
int flags;
|
||||
|
||||
CErrorRecord(CBaseObject* object, ESeverity _severity, const QString& _error, int _flags = 0, int _count = 0,
|
||||
CBaseLibraryItem* item = 0, EValidatorModule _module = VALIDATOR_MODULE_EDITOR)
|
||||
EValidatorModule _module = VALIDATOR_MODULE_EDITOR)
|
||||
: severity(_severity)
|
||||
, module(_module)
|
||||
, pObject(object)
|
||||
, pItem(item)
|
||||
, flags(_flags)
|
||||
, count(_count)
|
||||
, error(_error)
|
||||
@@ -77,7 +77,6 @@ public:
|
||||
severity = ESEVERITY_WARNING;
|
||||
module = VALIDATOR_MODULE_EDITOR;
|
||||
pObject = 0;
|
||||
pItem = 0;
|
||||
flags = 0;
|
||||
count = 0;
|
||||
}
|
||||
@@ -116,8 +115,6 @@ public:
|
||||
|
||||
//! Assign current Object to which new reported warnings are assigned.
|
||||
void SetCurrentValidatorObject(CBaseObject* pObject);
|
||||
//! Assign current Item to which new reported warnings are assigned.
|
||||
void SetCurrentValidatorItem(CBaseLibraryItem* pItem);
|
||||
//! Assign current filename.
|
||||
void SetCurrentFile(const QString& file);
|
||||
|
||||
@@ -127,7 +124,6 @@ private:
|
||||
bool m_bImmediateMode;
|
||||
bool m_bShowErrors;
|
||||
_smart_ptr<CBaseObject> m_pObject;
|
||||
_smart_ptr<CBaseLibraryItem> m_pItem;
|
||||
CParticleItem* m_pParticle;
|
||||
QString m_currentFilename;
|
||||
};
|
||||
|
||||
@@ -362,10 +362,6 @@ void CErrorReportDialog::CopyToClipboard()
|
||||
{
|
||||
str += QString::fromLatin1(" [Object: %1]").arg(pRecord->pObject->GetName());
|
||||
}
|
||||
if (pRecord->pItem)
|
||||
{
|
||||
str += QString::fromLatin1(" [Material: %1]").arg(pRecord->pItem->GetName());
|
||||
}
|
||||
str += QString::fromLatin1("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,11 +149,7 @@ QVariant CErrorReportTableModel::data(const CErrorRecord& record, int column, in
|
||||
case ColumnFile:
|
||||
return record.file;
|
||||
case ColumnObject:
|
||||
if (record.pItem)
|
||||
{
|
||||
return record.pItem->GetFullName();
|
||||
}
|
||||
else if (record.pObject)
|
||||
if (record.pObject)
|
||||
{
|
||||
return record.pObject->GetName();
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
|
||||
#include "ViewManager.h"
|
||||
#include "AnimationContext.h"
|
||||
#include "UndoViewPosition.h"
|
||||
#include "UndoViewRotation.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "ActionManager.h"
|
||||
|
||||
@@ -1,587 +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 "EditorDefs.h"
|
||||
|
||||
#include "TriMesh.h"
|
||||
|
||||
// Editor
|
||||
#include "Util/fastlib.h"
|
||||
#include "Objects/SubObjSelection.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh::CTriMesh()
|
||||
{
|
||||
pFaces = nullptr;
|
||||
pVertices = nullptr;
|
||||
pWSVertices = nullptr;
|
||||
pUV = nullptr;
|
||||
pColors = nullptr;
|
||||
pEdges = nullptr;
|
||||
pWeights = nullptr;
|
||||
|
||||
nFacesCount = 0;
|
||||
nVertCount = 0;
|
||||
nUVCount = 0;
|
||||
nEdgeCount = 0;
|
||||
|
||||
selectionType = SO_ELEM_NONE;
|
||||
|
||||
memset(m_streamSize, 0, sizeof(m_streamSize));
|
||||
memset(m_streamSel, 0, sizeof(m_streamSel));
|
||||
streamSelMask = 0;
|
||||
|
||||
m_streamSel[VERTICES] = &vertSel;
|
||||
m_streamSel[EDGES] = &edgeSel;
|
||||
m_streamSel[FACES] = &faceSel;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh::~CTriMesh()
|
||||
{
|
||||
free(pFaces);
|
||||
free(pEdges);
|
||||
free(pVertices);
|
||||
free(pUV);
|
||||
free(pColors);
|
||||
free(pWSVertices);
|
||||
free(pWeights);
|
||||
}
|
||||
|
||||
// Set stream size.
|
||||
void CTriMesh::ReallocStream(int stream, int nNewCount)
|
||||
{
|
||||
assert(stream >= 0 && stream < LAST_STREAM);
|
||||
if (stream < 0 || stream >= LAST_STREAM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_streamSize[stream] == nNewCount)
|
||||
{
|
||||
return; // Stream already have required size.
|
||||
}
|
||||
void* pStream = nullptr;
|
||||
int nElementSize = 0;
|
||||
GetStreamInfo(stream, pStream, nElementSize);
|
||||
pStream = ReAllocElements(pStream, nNewCount, nElementSize);
|
||||
m_streamSize[stream] = nNewCount;
|
||||
|
||||
switch (stream)
|
||||
{
|
||||
case VERTICES:
|
||||
pVertices = (CTriVertex*)pStream;
|
||||
nVertCount = nNewCount;
|
||||
vertSel.resize(nNewCount);
|
||||
break;
|
||||
case FACES:
|
||||
pFaces = (CTriFace*)pStream;
|
||||
nFacesCount = nNewCount;
|
||||
faceSel.resize(nNewCount);
|
||||
break;
|
||||
case EDGES:
|
||||
pEdges = (CTriEdge*)pStream;
|
||||
nEdgeCount = nNewCount;
|
||||
edgeSel.resize(nNewCount);
|
||||
break;
|
||||
case TEXCOORDS:
|
||||
pUV = (SMeshTexCoord*)pStream;
|
||||
nUVCount = nNewCount;
|
||||
break;
|
||||
case COLORS:
|
||||
pColors = (SMeshColor*)pStream;
|
||||
break;
|
||||
case WEIGHTS:
|
||||
pWeights = (float*)pStream;
|
||||
break;
|
||||
case LINES:
|
||||
pLines = (CTriLine*)pStream;
|
||||
break;
|
||||
case WS_POSITIONS:
|
||||
pWSVertices = (Vec3*)pStream;
|
||||
break;
|
||||
default:
|
||||
assert(0); // unknown stream.
|
||||
}
|
||||
m_streamSize[stream] = nNewCount;
|
||||
}
|
||||
|
||||
// Set stream size.
|
||||
void CTriMesh::GetStreamInfo(int stream, void*& pStream, int& nElementSize) const
|
||||
{
|
||||
assert(stream >= 0 && stream < LAST_STREAM);
|
||||
switch (stream)
|
||||
{
|
||||
case VERTICES:
|
||||
pStream = pVertices;
|
||||
nElementSize = sizeof(CTriVertex);
|
||||
break;
|
||||
case FACES:
|
||||
pStream = pFaces;
|
||||
nElementSize = sizeof(CTriFace);
|
||||
break;
|
||||
case EDGES:
|
||||
pStream = pEdges;
|
||||
nElementSize = sizeof(CTriEdge);
|
||||
break;
|
||||
case TEXCOORDS:
|
||||
pStream = pUV;
|
||||
nElementSize = sizeof(SMeshTexCoord);
|
||||
break;
|
||||
case COLORS:
|
||||
pStream = pColors;
|
||||
nElementSize = sizeof(SMeshColor);
|
||||
break;
|
||||
case WEIGHTS:
|
||||
pStream = pWeights;
|
||||
nElementSize = sizeof(float);
|
||||
break;
|
||||
case LINES:
|
||||
pStream = pLines;
|
||||
nElementSize = sizeof(CTriLine);
|
||||
break;
|
||||
case WS_POSITIONS:
|
||||
pStream = pWSVertices;
|
||||
nElementSize = sizeof(Vec3);
|
||||
break;
|
||||
default:
|
||||
assert(0); // unknown stream.
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void* CTriMesh::ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element)
|
||||
{
|
||||
return realloc(old_ptr, new_elem_num * size_of_element);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
inline int FindVertexInHash(const Vec3& vPosToFind, const CTriVertex* pVectors, std::vector<int>& hash, float fEpsilon)
|
||||
{
|
||||
for (uint32 i = 0; i < hash.size(); i++)
|
||||
{
|
||||
const Vec3& v0 = pVectors[hash[i]].pos;
|
||||
const Vec3& v1 = vPosToFind;
|
||||
if (fabsf(v0.y - v1.y) < fEpsilon && fabsf(v0.x - v1.x) < fEpsilon && fabsf(v0.z - v1.z) < fEpsilon)
|
||||
{
|
||||
return hash[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
inline int FindTexCoordInHash(const SMeshTexCoord& coordToFind, const SMeshTexCoord* pCoords, std::vector<int>& hash, float fEpsilon)
|
||||
{
|
||||
for (uint32 i = 0; i < hash.size(); i++)
|
||||
{
|
||||
const SMeshTexCoord& t0 = pCoords[hash[i]];
|
||||
const SMeshTexCoord& t1 = coordToFind;
|
||||
|
||||
if (t0.IsEquivalent(t1, fEpsilon))
|
||||
{
|
||||
return hash[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::SharePositions()
|
||||
{
|
||||
float fEpsilon = 0.0001f;
|
||||
float fHashScale = 256.0f / MAX(bbox.GetSize().GetLength(), fEpsilon);
|
||||
std::vector<int> arrHashTable[256];
|
||||
|
||||
CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
|
||||
SMeshColor* pNewColors = nullptr;
|
||||
if (pColors)
|
||||
{
|
||||
pNewColors = new SMeshColor[GetVertexCount()];
|
||||
}
|
||||
|
||||
int nLastIndex = 0;
|
||||
for (int f = 0; f < GetFacesCount(); f++)
|
||||
{
|
||||
CTriFace& face = pFaces[f];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec3& v = pVertices[face.v[i]].pos;
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((v.x + v.y + v.z) * fHashScale));
|
||||
|
||||
int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
{
|
||||
pNewVerts[nLastIndex] = pVertices[face.v[i]];
|
||||
if (pColors)
|
||||
{
|
||||
pNewColors[nLastIndex] = pColors[face.v[i]];
|
||||
}
|
||||
face.v[i] = nLastIndex;
|
||||
// Reserve some space already.
|
||||
arrHashTable[nHash].reserve(100);
|
||||
arrHashTable[nHash].push_back(nLastIndex);
|
||||
nLastIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
face.v[i] = find;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetVertexCount(nLastIndex);
|
||||
memcpy(pVertices, pNewVerts, nLastIndex * sizeof(CTriVertex));
|
||||
delete []pNewVerts;
|
||||
|
||||
if (pColors)
|
||||
{
|
||||
SetColorsCount(nLastIndex);
|
||||
memcpy(pColors, pNewColors, nLastIndex * sizeof(SMeshColor));
|
||||
delete []pNewColors;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::ShareUV()
|
||||
{
|
||||
float fEpsilon = 0.0001f;
|
||||
float fHashScale = 256.0f;
|
||||
std::vector<int> arrHashTable[256];
|
||||
|
||||
SMeshTexCoord* pNewUV = new SMeshTexCoord[GetUVCount()];
|
||||
|
||||
int nLastIndex = 0;
|
||||
for (int f = 0; f < GetFacesCount(); f++)
|
||||
{
|
||||
CTriFace& face = pFaces[f];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const Vec2 uv = pUV[face.uv[i]].GetUV();
|
||||
uint8 nHash = static_cast<uint8>(RoundFloatToInt((uv.x + uv.y) * fHashScale));
|
||||
|
||||
int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon);
|
||||
if (find < 0)
|
||||
{
|
||||
pNewUV[nLastIndex] = pUV[face.uv[i]];
|
||||
face.uv[i] = nLastIndex;
|
||||
arrHashTable[nHash].reserve(100);
|
||||
arrHashTable[nHash].push_back(nLastIndex);
|
||||
nLastIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
face.uv[i] = find;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetUVCount(nLastIndex);
|
||||
memcpy(pUV, pNewUV, nLastIndex * sizeof(SMeshTexCoord));
|
||||
delete []pNewUV;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::CalcFaceNormals()
|
||||
{
|
||||
for (int i = 0; i < nFacesCount; i++)
|
||||
{
|
||||
CTriFace& face = pFaces[i];
|
||||
Vec3 p1 = pVertices[face.v[0]].pos;
|
||||
Vec3 p2 = pVertices[face.v[1]].pos;
|
||||
Vec3 p3 = pVertices[face.v[2]].pos;
|
||||
face.normal = (p2 - p1).Cross(p3 - p1);
|
||||
face.normal.Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
#define TEX_EPS 0.001f
|
||||
#define VER_EPS 0.001f
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
|
||||
{
|
||||
void* pTrgStream = nullptr;
|
||||
void* pSrcStream = nullptr;
|
||||
int nElemSize = 0;
|
||||
fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
|
||||
if (pSrcStream)
|
||||
{
|
||||
ReallocStream(stream, fromMesh.GetStreamSize(stream));
|
||||
GetStreamInfo(stream, pTrgStream, nElemSize);
|
||||
memcpy(pTrgStream, pSrcStream, nElemSize * fromMesh.GetStreamSize(stream));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::Copy(CTriMesh& fromMesh, int nCopyFlags)
|
||||
{
|
||||
streamSelMask = fromMesh.streamSelMask;
|
||||
|
||||
if (nCopyFlags & COPY_VERTICES)
|
||||
{
|
||||
CopyStream(fromMesh, VERTICES);
|
||||
}
|
||||
if (nCopyFlags & COPY_FACES)
|
||||
{
|
||||
CopyStream(fromMesh, FACES);
|
||||
}
|
||||
if (nCopyFlags & COPY_EDGES)
|
||||
{
|
||||
CopyStream(fromMesh, EDGES);
|
||||
}
|
||||
if (nCopyFlags & COPY_TEXCOORDS)
|
||||
{
|
||||
CopyStream(fromMesh, TEXCOORDS);
|
||||
}
|
||||
if (nCopyFlags & COPY_COLORS)
|
||||
{
|
||||
CopyStream(fromMesh, COLORS);
|
||||
}
|
||||
if (nCopyFlags & COPY_WEIGHTS)
|
||||
{
|
||||
CopyStream(fromMesh, WEIGHTS);
|
||||
}
|
||||
if (nCopyFlags & COPY_LINES)
|
||||
{
|
||||
CopyStream(fromMesh, LINES);
|
||||
}
|
||||
|
||||
if (nCopyFlags & COPY_VERT_SEL)
|
||||
{
|
||||
vertSel = fromMesh.vertSel;
|
||||
}
|
||||
if (nCopyFlags & COPY_EDGE_SEL)
|
||||
{
|
||||
edgeSel = fromMesh.edgeSel;
|
||||
}
|
||||
if (nCopyFlags & COPY_FACE_SEL)
|
||||
{
|
||||
faceSel = fromMesh.faceSel;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::UpdateEdges()
|
||||
{
|
||||
SetEdgeCount(GetFacesCount() * 3);
|
||||
|
||||
std::map<CTriEdge, int> edgemap;
|
||||
|
||||
int nEdges = 0;
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
CTriFace& face = pFaces[i];
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int v0 = j;
|
||||
int v1 = (j != 2) ? j + 1 : 0;
|
||||
CTriEdge edge;
|
||||
edge.flags = 0;
|
||||
|
||||
// First vertex index must always be smaller.
|
||||
if (face.v[v0] < face.v[v1])
|
||||
{
|
||||
edge.v[0] = face.v[v0];
|
||||
edge.v[1] = face.v[v1];
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.v[0] = face.v[v1];
|
||||
edge.v[1] = face.v[v0];
|
||||
}
|
||||
edge.face[0] = i;
|
||||
edge.face[1] = -1;
|
||||
int nedge = stl::find_in_map(edgemap, edge, -1);
|
||||
if (nedge >= 0)
|
||||
{
|
||||
// Assign this face as a second member of the edge.
|
||||
if (pEdges[nedge].face[1] < 0)
|
||||
{
|
||||
pEdges[nedge].face[1] = i;
|
||||
}
|
||||
|
||||
face.edge[j] = nedge;
|
||||
}
|
||||
else
|
||||
{
|
||||
edgemap[edge] = nEdges;
|
||||
pEdges[nEdges] = edge;
|
||||
face.edge[j] = nEdges;
|
||||
nEdges++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetEdgeCount(nEdges);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::SoftSelection(const SSubObjSelOptions& options)
|
||||
{
|
||||
int i;
|
||||
int nVerts = GetVertexCount();
|
||||
CTriVertex* pVerts = pVertices;
|
||||
|
||||
for (i = 0; i < nVerts; i++)
|
||||
{
|
||||
if (pWeights[i] == 1.0f)
|
||||
{
|
||||
const Vec3& vp = pVerts[i].pos;
|
||||
for (int j = 0; j < nVerts; j++)
|
||||
{
|
||||
if (pWeights[j] != 1.0f)
|
||||
{
|
||||
if (vp.IsEquivalent(pVerts[j].pos, options.fSoftSelFalloff))
|
||||
{
|
||||
float fDist = vp.GetDistance(pVerts[j].pos);
|
||||
if (fDist < options.fSoftSelFalloff)
|
||||
{
|
||||
float fWeight = 1.0f - (fDist / options.fSoftSelFalloff);
|
||||
if (fWeight > pWeights[j])
|
||||
{
|
||||
pWeights[j] = fWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CTriMesh::UpdateSelection()
|
||||
{
|
||||
bool bAnySelected = false;
|
||||
if (selectionType == SO_ELEM_VERTEX)
|
||||
{
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
if (vertSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
pWeights[i] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selectionType == SO_ELEM_EDGE)
|
||||
{
|
||||
// Clear weights.
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetEdgeCount(); i++)
|
||||
{
|
||||
if (edgeSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
CTriEdge& edge = pEdges[i];
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
pWeights[edge.v[j]] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (selectionType == SO_ELEM_FACE)
|
||||
{
|
||||
// Clear weights.
|
||||
for (int i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
if (faceSel[i])
|
||||
{
|
||||
bAnySelected = true;
|
||||
CTriFace& face = pFaces[i];
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
pWeights[face.v[j]] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bAnySelected;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CTriMesh::ClearSelection()
|
||||
{
|
||||
bool bWasSelected = false;
|
||||
// Remove all selections.
|
||||
int i;
|
||||
for (i = 0; i < GetVertexCount(); i++)
|
||||
{
|
||||
pWeights[i] = 0;
|
||||
}
|
||||
streamSelMask = 0;
|
||||
for (int ii = 0; ii < LAST_STREAM; ii++)
|
||||
{
|
||||
if (m_streamSel[ii] && !m_streamSel[ii]->is_zero())
|
||||
{
|
||||
bWasSelected = true;
|
||||
m_streamSel[ii]->clear();
|
||||
}
|
||||
}
|
||||
return bWasSelected;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges)
|
||||
{
|
||||
// Brute force algorithm using binary search.
|
||||
// for every edge check if edge vertex is inside inVertices array.
|
||||
std::sort(inVertices.begin(), inVertices.end());
|
||||
for (int i = 0; i < GetEdgeCount(); i++)
|
||||
{
|
||||
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[0])) != inVertices.end())
|
||||
{
|
||||
outEdges.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pEdges[i].v[1])) != inVertices.end())
|
||||
{
|
||||
outEdges.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces)
|
||||
{
|
||||
// Brute force algorithm using binary search.
|
||||
// for every face check if face vertex is inside inVertices array.
|
||||
std::sort(inVertices.begin(), inVertices.end());
|
||||
for (int i = 0; i < GetFacesCount(); i++)
|
||||
{
|
||||
if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[0])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[1])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast<int>(pFaces[i].v[2])) != inVertices.end())
|
||||
{
|
||||
outFaces.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,238 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
|
||||
#pragma once
|
||||
|
||||
#include <IIndexedMesh.h>
|
||||
#include "Util/bitarray.h"
|
||||
|
||||
struct SSubObjSelOptions;
|
||||
|
||||
typedef std::vector<int> MeshElementsArray;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vertex used in the TriMesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriVertex
|
||||
{
|
||||
Vec3 pos;
|
||||
//float weight; // Selection weight in 0-1 range.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Triangle face used by the Triangle mesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriFace
|
||||
{
|
||||
uint32 v[3]; // Indices to vertices array.
|
||||
uint32 uv[3]; // Indices to texture coordinates array.
|
||||
Vec3 n[3]; // Vertex normals at face vertices.
|
||||
Vec3 normal; // Face normal.
|
||||
uint32 edge[3]; // Indices to the face edges.
|
||||
unsigned char MatID; // Index of face sub material.
|
||||
unsigned char flags; // see ETriMeshFlags
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Mesh edge.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriEdge
|
||||
{
|
||||
uint32 v[2]; // Indices to edge vertices.
|
||||
int face[2]; // Indices to edge faces (-1 if no face).
|
||||
uint32 flags; // see ETriMeshFlags
|
||||
|
||||
CTriEdge() {}
|
||||
bool operator==(const CTriEdge& edge) const
|
||||
{
|
||||
if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
|
||||
(v[0] == edge.v[1] && v[1] == edge.v[0]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const CTriEdge& edge) const { return !(*this == edge); }
|
||||
bool operator<(const CTriEdge& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
|
||||
bool operator>(const CTriEdge& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Mesh line.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriLine
|
||||
{
|
||||
uint32 v[2]; // Indices to edge vertices.
|
||||
|
||||
CTriLine() {}
|
||||
bool operator==(const CTriLine& edge) const
|
||||
{
|
||||
if ((v[0] == edge.v[0] && v[1] == edge.v[1]) ||
|
||||
(v[0] == edge.v[1] && v[1] == edge.v[0]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const CTriLine& edge) const { return !(*this == edge); }
|
||||
bool operator<(const CTriLine& edge) const { return (*(uint64*)v < *(uint64*)edge.v); }
|
||||
bool operator>(const CTriLine& edge) const { return (*(uint64*)v > *(uint64*)edge.v); }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct CTriMeshPoly
|
||||
{
|
||||
std::vector<uint32> v; // Indices to vertices array.
|
||||
std::vector<uint32> uv; // Indices to texture coordinates array.
|
||||
std::vector<Vec3> n; // Vertex normals at face vertices.
|
||||
Vec3 normal; // Polygon normal.
|
||||
uint32 edge[3]; // Indices to the face edges.
|
||||
unsigned char MatID; // Index of face sub material.
|
||||
unsigned char flags; // optional flags.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CTriMesh is used in the Editor as a general purpose editable triangle mesh.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CTriMesh
|
||||
{
|
||||
public:
|
||||
enum EStream
|
||||
{
|
||||
VERTICES,
|
||||
FACES,
|
||||
EDGES,
|
||||
TEXCOORDS,
|
||||
COLORS,
|
||||
WEIGHTS,
|
||||
LINES,
|
||||
WS_POSITIONS,
|
||||
LAST_STREAM,
|
||||
};
|
||||
enum ECopyFlags
|
||||
{
|
||||
COPY_VERTICES = BIT(1),
|
||||
COPY_FACES = BIT(2),
|
||||
COPY_EDGES = BIT(3),
|
||||
COPY_TEXCOORDS = BIT(4),
|
||||
COPY_COLORS = BIT(5),
|
||||
COPY_VERT_SEL = BIT(6),
|
||||
COPY_EDGE_SEL = BIT(7),
|
||||
COPY_FACE_SEL = BIT(8),
|
||||
COPY_WEIGHTS = BIT(9),
|
||||
COPY_LINES = BIT(10),
|
||||
COPY_ALL = 0xFFFF,
|
||||
};
|
||||
// geometry data
|
||||
CTriFace* pFaces;
|
||||
CTriEdge* pEdges;
|
||||
CTriVertex* pVertices;
|
||||
SMeshTexCoord* pUV;
|
||||
SMeshColor* pColors; // If allocated same size as pVerts array.
|
||||
Vec3* pWSVertices; // World space vertices.
|
||||
float* pWeights;
|
||||
CTriLine* pLines;
|
||||
|
||||
int nFacesCount;
|
||||
int nVertCount;
|
||||
int nUVCount;
|
||||
int nEdgeCount;
|
||||
int nLinesCount;
|
||||
|
||||
AABB bbox;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Selections.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBitArray vertSel;
|
||||
CBitArray edgeSel;
|
||||
CBitArray faceSel;
|
||||
// Every bit of the selection mask correspond to a stream, if bit is set this stream have some elements selected
|
||||
int streamSelMask;
|
||||
|
||||
// Selection element type.
|
||||
// see ESubObjElementType
|
||||
int selectionType;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vertices of the front facing triangles.
|
||||
CBitArray frontFacingVerts;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Functions.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh();
|
||||
~CTriMesh();
|
||||
|
||||
int GetFacesCount() const { return nFacesCount; }
|
||||
int GetVertexCount() const { return nVertCount; }
|
||||
int GetUVCount() const { return nUVCount; }
|
||||
int GetEdgeCount() const { return nEdgeCount; }
|
||||
int GetLinesCount() const { return nLinesCount; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFacesCount(int nNewCount) { ReallocStream(FACES, nNewCount); }
|
||||
void SetVertexCount(int nNewCount)
|
||||
{
|
||||
ReallocStream(VERTICES, nNewCount);
|
||||
if (pColors)
|
||||
{
|
||||
ReallocStream(COLORS, nNewCount);
|
||||
}
|
||||
ReallocStream(WEIGHTS, nNewCount);
|
||||
}
|
||||
void SetColorsCount(int nNewCount) { ReallocStream(COLORS, nNewCount); }
|
||||
void SetUVCount(int nNewCount) { ReallocStream(TEXCOORDS, nNewCount); }
|
||||
void SetEdgeCount(int nNewCount) { ReallocStream(EDGES, nNewCount); }
|
||||
void SetLinesCount(int nNewCount) { ReallocStream(LINES, nNewCount); }
|
||||
|
||||
void ReallocStream(int stream, int nNewCount);
|
||||
void GetStreamInfo(int stream, void*& pStream, int& nElementSize) const;
|
||||
int GetStreamSize(int stream) const { return m_streamSize[stream]; };
|
||||
|
||||
// Calculate per face normal.
|
||||
void CalcFaceNormals();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Welding functions.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SharePositions();
|
||||
void ShareUV();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Recreate edges of the mesh.
|
||||
void UpdateEdges();
|
||||
|
||||
void Copy(CTriMesh& fromMesh, int nCopyFlags = COPY_ALL);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sub-object selection specific methods.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Return true if something is selected.
|
||||
bool UpdateSelection();
|
||||
// Clear all selections, return true if something was selected.
|
||||
bool ClearSelection();
|
||||
void SoftSelection(const SSubObjSelOptions& options);
|
||||
CBitArray* GetStreamSelection(int nStream) { return m_streamSel[nStream]; };
|
||||
// Returns true if specified stream have any selected elements.
|
||||
bool StreamHaveSelection(int nStream) { return streamSelMask & (1 << nStream); }
|
||||
void GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outEdges);
|
||||
void GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray& outFaces);
|
||||
|
||||
private:
|
||||
void* ReAllocElements(void* old_ptr, int new_elem_num, int size_of_element);
|
||||
void CopyStream(CTriMesh& fromMesh, int stream);
|
||||
|
||||
// For internal use.
|
||||
int m_streamSize[LAST_STREAM];
|
||||
CBitArray* m_streamSel[LAST_STREAM];
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_TRIMESH_H
|
||||
@@ -44,7 +44,6 @@ class CMusicManager;
|
||||
struct IEditorParticleManager;
|
||||
class CEAXPresetManager;
|
||||
class CErrorReport;
|
||||
class CBaseLibraryItem;
|
||||
class ICommandManager;
|
||||
class CEditorCommandManager;
|
||||
class CHyperGraphManager;
|
||||
@@ -52,10 +51,7 @@ class CConsoleSynchronization;
|
||||
class CUIEnumsDatabase;
|
||||
struct ISourceControl;
|
||||
struct IEditorClassFactory;
|
||||
struct IDataBaseItem;
|
||||
struct ITransformManipulator;
|
||||
struct IDataBaseManager;
|
||||
class IFacialEditor;
|
||||
class CDialog;
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
class C3DConnexionDriver;
|
||||
@@ -82,8 +78,6 @@ struct IEventLoopHook;
|
||||
struct IErrorReport; // Vladimir@conffx
|
||||
struct IFileUtil; // Vladimir@conffx
|
||||
struct IEditorLog; // Vladimir@conffx
|
||||
struct IEditorMaterialManager; // Vladimir@conffx
|
||||
struct IBaseLibraryManager; // Vladimir@conffx
|
||||
struct IImageUtil; // Vladimir@conffx
|
||||
struct IEditorParticleUtils; // Leroy@conffx
|
||||
struct ILogFile; // Vladimir@conffx
|
||||
@@ -519,10 +513,6 @@ struct IEditor
|
||||
//! Get access to object manager.
|
||||
virtual struct IObjectManager* GetObjectManager() = 0;
|
||||
virtual CSettingsManager* GetSettingsManager() = 0;
|
||||
//! Get DB manager that own items of specified type.
|
||||
virtual IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType) = 0;
|
||||
virtual IBaseLibraryManager* GetMaterialManagerLibrary() = 0; // Vladimir@conffx
|
||||
virtual IEditorMaterialManager* GetIEditorMaterialManager() = 0; // Vladimir@Conffx
|
||||
//! Returns IconManager.
|
||||
virtual IIconManager* GetIconManager() = 0;
|
||||
//! Get Music Manager.
|
||||
|
||||
@@ -892,11 +892,6 @@ void CEditorImpl::CloseView(const GUID& classId)
|
||||
}
|
||||
}
|
||||
|
||||
IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
|
||||
{
|
||||
const AZ::Color c = AzQtComponents::fromQColor(color);
|
||||
@@ -1624,18 +1619,6 @@ SEditorSettings* CEditorImpl::GetEditorSettings()
|
||||
return &gSettings;
|
||||
}
|
||||
|
||||
// Vladimir@Conffx
|
||||
IBaseLibraryManager* CEditorImpl::GetMaterialManagerLibrary()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Vladimir@Conffx
|
||||
IEditorMaterialManager* CEditorImpl::GetIEditorMaterialManager()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IImageUtil* CEditorImpl::GetImageUtil()
|
||||
{
|
||||
return m_pImageUtil;
|
||||
|
||||
@@ -157,7 +157,6 @@ public:
|
||||
void LockSelection(bool bLock) override;
|
||||
bool IsSelectionLocked() override;
|
||||
|
||||
IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType) override;
|
||||
CMusicManager* GetMusicManager() override { return m_pMusicManager; };
|
||||
|
||||
IEditorFileMonitor* GetFileMonitor() override;
|
||||
@@ -294,8 +293,6 @@ public:
|
||||
void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) override;
|
||||
|
||||
SSystemGlobalEnvironment* GetEnv() override;
|
||||
IBaseLibraryManager* GetMaterialManagerLibrary() override; // Vladimir@Conffx
|
||||
IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx
|
||||
IImageUtil* GetImageUtil() override; // Vladimir@conffx
|
||||
SEditorSettings* GetEditorSettings() override;
|
||||
ILogFile* GetLogFile() override { return m_pLogFile; }
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
class CGizmo;
|
||||
class CBaseObject;
|
||||
struct IDisplayViewport;
|
||||
class CDeepSelection;
|
||||
struct AABB;
|
||||
|
||||
#include <QRect>
|
||||
@@ -105,8 +104,6 @@ struct HitContext
|
||||
CBaseObject* object;
|
||||
//! gizmo object that have been hit.
|
||||
CGizmo* gizmo;
|
||||
//! for deep selection mode
|
||||
CDeepSelection* pDeepSelection;
|
||||
//! For linking tool
|
||||
const char* name;
|
||||
//! true if this hit was from the object icon
|
||||
@@ -131,7 +128,6 @@ struct HitContext
|
||||
bIgnoreAxis = false;
|
||||
bOnlyGizmo = false;
|
||||
bUseSelectionHelpers = false;
|
||||
pDeepSelection = 0;
|
||||
name = nullptr;
|
||||
iconHit = false;
|
||||
}
|
||||
|
||||
@@ -1,20 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#pragma once
|
||||
|
||||
struct IAnimationCompressionManager
|
||||
{
|
||||
virtual bool IsEnabled() const = 0;
|
||||
virtual void UpdateLocalAnimations() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
@@ -1,433 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for asset display in the asset browser,
|
||||
// this header should be used to create plugins.
|
||||
// The method Release of this interface should NOT be called.
|
||||
// Instead, the FreeData from the database (from IAssetItemDatabase) should
|
||||
// be used as it will safely release all the items from the database.
|
||||
// It is still possible to call the release method, but this is not the
|
||||
// recomended method, specially for usage outside of the plugins because there
|
||||
// is no guarantee that a the asset will be properly removed from the database
|
||||
// manager.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#pragma once
|
||||
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
namespace AssetViewer
|
||||
{
|
||||
// Used in GetAssetFieldValue for each asset type to check if field name is the right one
|
||||
inline bool IsFieldName(const char* pIncomingFieldName, const char* pFieldName)
|
||||
{
|
||||
return !strncmp(pIncomingFieldName, pFieldName, strlen(pIncomingFieldName));
|
||||
}
|
||||
}
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types visible in the asset browser.
|
||||
struct IAssetItem
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x04F20346, 0x2EC3, 0x43f2, 0xBD, 0xA1, 0x2C, 0x0B, 0x97, 0x76, 0xF3, 0x84);
|
||||
|
||||
// The supported asset flags
|
||||
enum EAssetFlags
|
||||
{
|
||||
// asset is visible in the database for filtering and sorting (not asset view control related)
|
||||
eFlag_Visible = BIT(0),
|
||||
// the asset is loaded
|
||||
eFlag_Loaded = BIT(1),
|
||||
// the asset is loaded
|
||||
eFlag_Cached = BIT(2),
|
||||
// the asset is selected in a selection set
|
||||
eFlag_Selected = BIT(3),
|
||||
// this asset is invalid, no thumb is shown/available
|
||||
eFlag_Invalid = BIT(4),
|
||||
// this asset has some errors/warnings, in the asset browser it will show some blinking/red elements
|
||||
// and the user can check out the errors. Error text will be fetched using GetAssetFieldValue( "errors", &someStringVar )
|
||||
eFlag_HasErrors = BIT(5),
|
||||
// this flag is set when the asset is rendering its contents using GDI, and not the engine's rendering capabilities
|
||||
// (this flags is used as hint for the preview tool, which will use a double-buffer canvas if this flag is set,
|
||||
// and send a memory HDC to the OnBeginPreview method, for drawing of the asset)
|
||||
eFlag_UseGdiRendering = BIT(6),
|
||||
// set if this asset is draggable into the render viewports, and can be created there
|
||||
eFlag_CanBeDraggedInViewports = BIT(7),
|
||||
// set if this asset can be moved after creation, otherwise the asset instance will just be created where user clicked
|
||||
eFlag_CanBeMovedAfterDroppedIntoViewport = BIT(8),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_ThumbnailLoaded = BIT(9),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_UsedInLevel = BIT(10)
|
||||
};
|
||||
|
||||
// Asset field name and field values map
|
||||
typedef std::map < QString/*fieldName*/, QString/*value*/ > TAssetFieldValuesMap;
|
||||
// Dependency category names and corresponding files map, example: "Textures"=>{ "foam.dds","water.dds","normal.dds" }
|
||||
typedef std::map < QString/*dependencyCategory*/, std::set<QString>/*dependency filenames*/ > TAssetDependenciesMap;
|
||||
|
||||
virtual ~IAssetItem() {
|
||||
}
|
||||
|
||||
// Description:
|
||||
// Get the hash number/key used for database thumbnail and info records management
|
||||
virtual uint32 GetHash() const = 0;
|
||||
// Description:
|
||||
// Set the hash number/key used for database thumbnail and info records management
|
||||
virtual void SetHash(uint32 hash) = 0;
|
||||
// Description:
|
||||
// Get the owner database for this asset
|
||||
// Return Value:
|
||||
// The owner database for this asset
|
||||
// See Also:
|
||||
// SetOwnerDatabase()
|
||||
virtual IAssetItemDatabase* GetOwnerDatabase() const = 0;
|
||||
// Description:
|
||||
// Set the owner database for this asset
|
||||
// Arguments:
|
||||
// piOwnerDisplayDatabase - the owner database
|
||||
// See Also:
|
||||
// GetOwnerDatabase()
|
||||
virtual void SetOwnerDatabase(IAssetItemDatabase* pOwnerDisplayDatabase) = 0;
|
||||
// Description:
|
||||
// Get the asset's dependency files / objects
|
||||
// Return Value:
|
||||
// The vector with filenames which this asset is dependent upon, ex.: ["Textures"].(vector of textures)
|
||||
virtual const TAssetDependenciesMap& GetDependencies() const = 0;
|
||||
// Description:
|
||||
// Set the file size of this asset in bytes
|
||||
// Arguments:
|
||||
// aSize - size of the file in bytes
|
||||
// See Also:
|
||||
// GetFileSize()
|
||||
virtual void SetFileSize(quint64 aSize) = 0;
|
||||
// Description:
|
||||
// Get the file size of this asset in bytes
|
||||
// Return Value:
|
||||
// The file size of this asset in bytes
|
||||
// See Also:
|
||||
// SetFileSize()
|
||||
virtual quint64 GetFileSize() const = 0;
|
||||
// Description:
|
||||
// Set asset filename (extension included and no path)
|
||||
// Arguments:
|
||||
// pName - the asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// GetFilename()
|
||||
virtual void SetFilename(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get asset filename (extension included and no path)
|
||||
// Return Value:
|
||||
// The asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// SetFilename()
|
||||
virtual QString GetFilename() const = 0;
|
||||
// Description:
|
||||
// Set the asset's relative path
|
||||
// Arguments:
|
||||
// pName - file's relative path
|
||||
// See Also:
|
||||
// GetRelativePath()
|
||||
virtual void SetRelativePath(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get the asset's relative path
|
||||
// Return Value:
|
||||
// The asset's relative path
|
||||
// See Also:
|
||||
// SetRelativePath()
|
||||
virtual QString GetRelativePath() const = 0;
|
||||
// Description:
|
||||
// Set the file extension ( dot(s) must be included )
|
||||
// Arguments:
|
||||
// pExt - the file's extension
|
||||
// See Also:
|
||||
// GetFileExtension()
|
||||
virtual void SetFileExtension(const char* pExt) = 0;
|
||||
// Description:
|
||||
// Get the file extension ( dot(s) included )
|
||||
// Return Value:
|
||||
// The file extension ( dot(s) included )
|
||||
// See Also:
|
||||
// SetFileExtension()
|
||||
virtual QString GetFileExtension() const = 0;
|
||||
// Description:
|
||||
// Get the asset flags, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// The asset flags, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// SetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual UINT GetFlags() const = 0;
|
||||
// Description:
|
||||
// Set the asset flags
|
||||
// Arguments:
|
||||
// aFlags - flags, OR-ed values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual void SetFlags(UINT aFlags) = 0;
|
||||
// Description:
|
||||
// Set/clear a single flag bit for the asset
|
||||
// Arguments:
|
||||
// aFlag - the flag to set/clear, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), IsFlagSet()
|
||||
virtual void SetFlag(EAssetFlags aFlag, bool bSet = true) = 0;
|
||||
// Description:
|
||||
// Check if a specified flag is set
|
||||
// Arguments:
|
||||
// aFlag - the flag to check, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// True if the flag is set
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), SetFlag()
|
||||
virtual bool IsFlagSet(EAssetFlags aFlag) const = 0;
|
||||
// Description:
|
||||
// Set this asset's index; used in sorting, selections, and to know where an asset is in the current list
|
||||
// Arguments:
|
||||
// aIndex - the asset's index
|
||||
// See Also:
|
||||
// GetIndex()
|
||||
virtual void SetIndex(UINT aIndex) = 0;
|
||||
// Description:
|
||||
// Get the asset's index in the current list
|
||||
// Return Value:
|
||||
// The asset's index in the current list
|
||||
// See Also:
|
||||
// SetIndex()
|
||||
virtual UINT GetIndex() const = 0;
|
||||
// Description:
|
||||
// Get the asset's field raw data value into a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to destination according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to query the value for
|
||||
// pDest - the destination variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is returned correctly
|
||||
// See Also:
|
||||
// SetAssetFieldValue()
|
||||
virtual QVariant GetAssetFieldValue(const char* pFieldName) const = 0;
|
||||
// Description:
|
||||
// Set the asset's field raw data value from a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to source according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to set the value for
|
||||
// pSrc - the source variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is set correctly
|
||||
// See Also:
|
||||
// GetAssetFieldValue()
|
||||
virtual bool SetAssetFieldValue(const char* pFieldName, void* pSrc) = 0;
|
||||
// Description:
|
||||
// Get the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// rstDrawingRectangle - destination location to set with the asset's thumbnail rectangle location
|
||||
// See Also:
|
||||
// SetDrawingRectangle()
|
||||
virtual void GetDrawingRectangle(QRect& rstDrawingRectangle) const = 0;
|
||||
// Description:
|
||||
// Set the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// crstDrawingRectangle - source to set the asset's thumbnail rectangle
|
||||
// See Also:
|
||||
// GetDrawingRectangle()
|
||||
virtual void SetDrawingRectangle(const QRect& crstDrawingRectangle) = 0;
|
||||
// Description:
|
||||
// Checks if the given 2D point is inside the asset's thumb rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given 2D point is inside the asset's thumb rectangle
|
||||
// See Also:
|
||||
// HitTest(CRect)
|
||||
virtual bool HitTest(int nX, int nY) const = 0;
|
||||
// Description:
|
||||
// Checks if the given rectangle intersects the asset thumb's rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given rectangle intersects the asset thumb's rectangle
|
||||
// See Also:
|
||||
// HitTest(int nX,int nY)
|
||||
virtual bool HitTest(const QRect& roTestRect) const = 0;
|
||||
// Description:
|
||||
// When user drags this asset item into a viewport, this method is called when the dragging operation ends
|
||||
// and the mouse button is released, for the asset to return an instance of the asset object to be placed in the level
|
||||
// Arguments:
|
||||
// aX - instance's X position component in world coordinates
|
||||
// aY - instance's Y position component in world coordinates
|
||||
// aZ - instance's Z position component in world coordinates
|
||||
// Return Value:
|
||||
// The newly created asset instance (Example: BrushObject*)
|
||||
// See Also:
|
||||
// MoveInstanceInViewport()
|
||||
virtual void* CreateInstanceInViewport(float aX, float aY, float aZ) = 0;
|
||||
// Description:
|
||||
// When the mouse button is released after level object creation, the user now can move the mouse
|
||||
// and move the asset instance in the 3D world
|
||||
// Arguments:
|
||||
// pDraggedObject - the actual entity or brush object (CBaseObject* usually) to be moved around with the mouse
|
||||
// returned by the CreateInstanceInViewport()
|
||||
// aNewX - the new X world coordinates of the asset instance
|
||||
// aNewY - the new Y world coordinates of the asset instance
|
||||
// aNewZ - the new Z world coordinates of the asset instance
|
||||
// Return Value:
|
||||
// True if asset instance was moved properly
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual bool MoveInstanceInViewport(const void* pDraggedObject, float aNewX, float aNewY, float aNewZ) = 0;
|
||||
// Description:
|
||||
// This will be called when the user presses ESCAPE key when dragging the asset in the viewport, you must delete the given object
|
||||
// because the creation was aborted
|
||||
// Arguments:
|
||||
// pDraggedObject - the asset instance to be deleted ( you must cast to the needed type, and delete it properly )
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual void AbortCreateInstanceInViewport(const void* pDraggedObject) = 0;
|
||||
// Description:
|
||||
// This method is used to cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully cached
|
||||
// See Also:
|
||||
// UnCache()
|
||||
virtual bool Cache() = 0;
|
||||
// Description:
|
||||
// This method is used to force cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully forced cached
|
||||
// See Also:
|
||||
// UnCache(), Cache()
|
||||
virtual bool ForceCache() = 0;
|
||||
// Description:
|
||||
// This method is used to load the thumbnail image of the asset
|
||||
// Return Value:
|
||||
// True if thumb loaded ok
|
||||
// See Also:
|
||||
// UnloadThumbnail()
|
||||
virtual bool LoadThumbnail() = 0;
|
||||
// Description:
|
||||
// This method is used to unload the thumbnail image of the asset
|
||||
// See Also:
|
||||
// LoadThumbnail()
|
||||
virtual void UnloadThumbnail() = 0;
|
||||
// Description:
|
||||
// This is called when the asset starts to be previewed in full detail, so here you can load the whole asset, in fine detail
|
||||
// ( textures are fully loaded, models etc. ). It is called once, when the Preview dialog is shown
|
||||
// Arguments:
|
||||
// hPreviewWnd - the window handle of the quick preview dialog
|
||||
// hMemDC - the memory DC used to render assets that can render themselves in the DC, otherwise they will render in the dialog's HWND
|
||||
// See Also:
|
||||
// OnEndPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnBeginPreview(QWidget* hPreviewWnd) = 0;
|
||||
// Description:
|
||||
// Called when the Preview dialog is closed, you may release the detail asset data here
|
||||
// See Also:
|
||||
// OnBeginPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnEndPreview() = 0;
|
||||
// Description:
|
||||
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// Arguments:
|
||||
// pParentWnd - a valid CDialog*, or nullptr
|
||||
// Return Value:
|
||||
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// See Also:
|
||||
// OnBeginPreview(), OnEndPreview()
|
||||
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
|
||||
virtual QWidget* GetCustomPreviewPanelFooter(QWidget* pParentWnd) = 0;
|
||||
// Description:
|
||||
// Used when dragging/rotate/zoom a model, or other asset that can support preview
|
||||
// Arguments:
|
||||
// hRenderWindow - the rendering window handle
|
||||
// rstViewport - the viewport rectangle
|
||||
// aMouseX - the render window relative mouse pointer X coordinate
|
||||
// aMouseY - the render window relative mouse pointer Y coordinate
|
||||
// aMouseDeltaX - the X coordinate delta between two mouse movements
|
||||
// aMouseDeltaY - the Y coordinate delta between two mouse movements
|
||||
// aMouseWheelDelta - the mouse wheel scroll delta/step
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONUP
|
||||
// See Also:
|
||||
// OnPreviewRenderKeyEvent()
|
||||
virtual void PreviewRender(
|
||||
QWidget* hRenderWindow,
|
||||
const QRect& rstViewport,
|
||||
int aMouseX = 0, int aMouseY = 0,
|
||||
int aMouseDeltaX = 0, int aMouseDeltaY = 0,
|
||||
int aMouseWheelDelta = 0, UINT aKeyFlags = 0) = 0;
|
||||
// Description:
|
||||
// This is called when the user manipulates the assets in interactive render and a key is pressed ( with down or up state )
|
||||
// Arguments:
|
||||
// bKeyDown - true if this is a WM_KEYDOWN event, else it is a WM_KEYUP event
|
||||
// aChar - the char/key code pressed/released
|
||||
// aKeyFlags - the key flags, compatible with WM_KEYDOWN/UP events
|
||||
// See Also:
|
||||
// InteractiveRender()
|
||||
virtual void OnPreviewRenderKeyEvent(bool bKeyDown, UINT aChar, UINT aKeyFlags) = 0;
|
||||
// Description:
|
||||
// Called when user clicked once on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbDblClick()
|
||||
virtual void OnThumbClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Called when user double clicked on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbClick()
|
||||
//! called when user clicked twice on the thumb image
|
||||
virtual void OnThumbDblClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Draw the cached thumb bitmap only, if any, no other kind of rendering
|
||||
// Arguments:
|
||||
// hDC - the destination DC, where to draw the thumb
|
||||
// rRect - the destination rectangle
|
||||
// Return Value:
|
||||
// True if drawing of the thumbnail was done OK
|
||||
// See Also:
|
||||
// Render()
|
||||
virtual bool DrawThumbImage(QPainter* painter, const QRect& rRect) = 0;
|
||||
// Description:
|
||||
// Writes asset info to a XML node.
|
||||
// This is needed to save cached info as a persistent XML file for the next run of the editor.
|
||||
// Arguments:
|
||||
// node - An XML node to contain the info
|
||||
// See Also:
|
||||
// FromXML()
|
||||
virtual void ToXML(XmlNodeRef& node) const = 0;
|
||||
// Description:
|
||||
// Gets asset info from a XML node.
|
||||
// This is needed to get the asset info from previous runs of the editor without re-caching it.
|
||||
// Arguments:
|
||||
// node - An XML node that contains info for this asset
|
||||
// See Also:
|
||||
// ToXML()
|
||||
virtual void FromXML(const XmlNodeRef& node) = 0;
|
||||
|
||||
// From IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
@@ -1,259 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for asset database creators used to
|
||||
// create an asset plugin for the asset browser
|
||||
// The category of the plugin must be Asset Item DB
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#pragma once
|
||||
struct IAssetItem;
|
||||
struct IAssetViewer;
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
// Description:
|
||||
// This struct keeps the info, filter and sorting settings for an asset field
|
||||
struct SAssetField
|
||||
{
|
||||
// the condition for the current filter on the field
|
||||
enum EAssetFilterCondition
|
||||
{
|
||||
eCondition_Any = 0,
|
||||
// string conditions
|
||||
// this also supports '*' and '?' as wildcards inside text
|
||||
eCondition_Contains,
|
||||
// this filter will search the target for at least one of the words specified
|
||||
// ( ex: filter: "water car moon" , field value : "the_great_moon.dds", this will pass the test
|
||||
// it also supports '*' and '?' as wildcards inside words text
|
||||
eCondition_ContainsOneOfTheWords,
|
||||
eCondition_StartsWith,
|
||||
eCondition_EndsWith,
|
||||
// string & numerical conditions
|
||||
eCondition_Equal,
|
||||
eCondition_Greater,
|
||||
eCondition_Less,
|
||||
eCondition_GreaterOrEqual,
|
||||
eCondition_LessOrEqual,
|
||||
eCondition_Not,
|
||||
eCondition_InsideRange
|
||||
};
|
||||
|
||||
// the asset field type
|
||||
enum EAssetFieldType
|
||||
{
|
||||
eType_None = 0,
|
||||
eType_Bool,
|
||||
eType_Int8,
|
||||
eType_Int16,
|
||||
eType_Int32,
|
||||
eType_Int64,
|
||||
eType_Float,
|
||||
eType_Double,
|
||||
eType_String
|
||||
};
|
||||
|
||||
// used when a field can have different specific values
|
||||
typedef QStringList TFieldEnumValues;
|
||||
|
||||
SAssetField(
|
||||
const char* pFieldName = "",
|
||||
const char* pDisplayName = "Unnamed field",
|
||||
EAssetFieldType aFieldType = eType_None,
|
||||
UINT aColumnWidth = 50,
|
||||
bool bVisibleInUI = true,
|
||||
bool bReadOnly = true)
|
||||
{
|
||||
m_fieldName = pFieldName;
|
||||
m_displayName = pDisplayName;
|
||||
m_fieldType = aFieldType;
|
||||
m_filterCondition = eCondition_Equal;
|
||||
m_bUseEnumValues = false;
|
||||
m_bReadOnly = bReadOnly;
|
||||
m_listColumnWidth = aColumnWidth;
|
||||
m_bFieldVisibleInUI = bVisibleInUI;
|
||||
m_bPostFilter = false;
|
||||
|
||||
SetupEnumValues();
|
||||
}
|
||||
|
||||
void SetupEnumValues()
|
||||
{
|
||||
m_bUseEnumValues = true;
|
||||
|
||||
if (m_fieldType == eType_Bool)
|
||||
{
|
||||
m_enumValues.clear();
|
||||
m_enumValues.push_back("Yes");
|
||||
m_enumValues.push_back("No");
|
||||
}
|
||||
}
|
||||
|
||||
// the field's display name, used in UI
|
||||
QString m_displayName,
|
||||
// the field internal name, used in C++ code
|
||||
m_fieldName,
|
||||
// the current filter value, if its empty "" then no filter is applied
|
||||
m_filterValue,
|
||||
// the field's max value, valid when the field's filter condition is eAssertFilterCondition_InsideRange
|
||||
m_maxFilterValue,
|
||||
// the name of the database holding this field, used in Asset Browser preset editor, if its "" then the field
|
||||
// is common to all current databases
|
||||
m_parentDatabaseName;
|
||||
// is this field visible in the UI ?
|
||||
bool m_bFieldVisibleInUI,
|
||||
// if true, then you cannot modify this field of an asset item, only use it
|
||||
m_bReadOnly,
|
||||
// this field filter is applied after the other filters
|
||||
m_bPostFilter;
|
||||
// the field data type
|
||||
EAssetFieldType m_fieldType;
|
||||
// the filter's condition
|
||||
EAssetFilterCondition m_filterCondition;
|
||||
// use the enum list values to choose a value for the field ?
|
||||
bool m_bUseEnumValues;
|
||||
// this map is used when asset field has m_bUseEnumValues on true,
|
||||
// choose a value for the field from this list in the UI
|
||||
TFieldEnumValues m_enumValues;
|
||||
// recommended list column width
|
||||
unsigned int m_listColumnWidth;
|
||||
};
|
||||
|
||||
struct SFieldFiltersPreset
|
||||
{
|
||||
QString presetName2;
|
||||
QStringList checkedDatabaseNames;
|
||||
bool bUsedInLevel;
|
||||
std::vector<SAssetField> fields;
|
||||
};
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types
|
||||
// visible in the asset browser.
|
||||
struct IAssetItemDatabase
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0xFB09B039, 0x1D9D, 0x4057, 0xA5, 0xF0, 0xAA, 0x3C, 0x7B, 0x97, 0xAE, 0xA8)
|
||||
|
||||
typedef std::vector<SAssetField> TAssetFields;
|
||||
typedef std::map < QString/*field name*/, SAssetField > TAssetFieldFiltersMap;
|
||||
typedef std::map < QString/*asset filename*/, IAssetItem* > TFilenameAssetMap;
|
||||
typedef AZStd::function<bool(const IAssetItem*)> MetaDataChangeListener;
|
||||
|
||||
// Description:
|
||||
// Refresh the database by scanning the folders/paks for files, does not load the files, only filename and filesize are fetched
|
||||
virtual void Refresh() = 0;
|
||||
// Description:
|
||||
// Fills the asset meta data from the loaded xml meta data DB.
|
||||
// Arguments:
|
||||
// db - the database XML node from where to cache the info
|
||||
virtual void PrecacheFieldsInfoFromFileDB(const XmlNodeRef& db) = 0;
|
||||
// Description:
|
||||
// Return all assets loaded/scanned by this database
|
||||
// Return Value:
|
||||
// The assets map reference (filename-asset)
|
||||
virtual TFilenameAssetMap& GetAssets() = 0;
|
||||
// Description:
|
||||
// Get an asset item by its filename
|
||||
// Return Value:
|
||||
// A single asset from the database given the filename
|
||||
virtual IAssetItem* GetAsset(const char* pAssetFilename) = 0;
|
||||
// Description:
|
||||
// Return the asset fields this database's items support
|
||||
// Return Value:
|
||||
// The asset fields vector reference
|
||||
virtual TAssetFields& GetAssetFields() = 0;
|
||||
// Description:
|
||||
// Return an asset field object pointer by the field internal name
|
||||
// Arguments:
|
||||
// pFieldName - the internal field's name (ex: "filename", "relativepath")
|
||||
// Return Value:
|
||||
// The asset field object pointer
|
||||
virtual SAssetField* GetAssetFieldByName(const char* pFieldName) = 0;
|
||||
// Description:
|
||||
// Get the database name
|
||||
// Return Value:
|
||||
// Returns the database name, ex: "Textures"
|
||||
virtual const char* GetDatabaseName() const = 0;
|
||||
// Description:
|
||||
// Get the database supported file name extension(s)
|
||||
// Return Value:
|
||||
// Returns the supported extensions, separated by comma, ex: "tga,bmp,dds"
|
||||
virtual const char* GetSupportedExtensions() const = 0;
|
||||
// Description:
|
||||
// Free the database internal data structures
|
||||
virtual void FreeData() = 0;
|
||||
// Description:
|
||||
// Apply filters to this database which will set/unset the IAssetItem::eAssetFlag_Visible of each asset, based
|
||||
// on the given field filters
|
||||
// Arguments:
|
||||
// rFieldFilters - a reference to the field filters map (fieldname-field)
|
||||
// See Also:
|
||||
// ClearFilters()
|
||||
virtual void ApplyFilters(const TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
// Description:
|
||||
// Clear the current filters, by setting the IAssetItem::eAssetFlag_Visible of each asset to true
|
||||
// See Also:
|
||||
// ApplyFilters()
|
||||
virtual void ClearFilters() = 0;
|
||||
virtual QWidget* CreateDbFilterDialog(QWidget* pParent, IAssetViewer* pViewerCtrl) = 0;
|
||||
virtual void UpdateDbFilterDialogUI(QWidget* pDlg) = 0;
|
||||
virtual void OnAssetBrowserOpen() = 0;
|
||||
virtual void OnAssetBrowserClose() = 0;
|
||||
// Description:
|
||||
// Gets the filename for saving new cached asset info.
|
||||
// Return Value:
|
||||
// A file name to save new transactions to the persistent asset info DB
|
||||
// See Also:
|
||||
// CAssetInfoFileDB, IAssetItem::ToXML(), IAssetItem::FromXML()
|
||||
virtual const char* GetTransactionFilename() const = 0;
|
||||
// Description:
|
||||
// Adds a callback to be called when the meta data of this asset changed.
|
||||
// Arguments:
|
||||
// callBack - A functor to be added
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// RemoveMetaDataChangeListener()
|
||||
virtual bool AddMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// Removes a callback from the list of meta data change listeners.
|
||||
// Arguments:
|
||||
// callBack - A functor to be removed
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener()
|
||||
virtual bool RemoveMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// The method that should be called when the meta data of an asset item changes to notify all listeners
|
||||
// Arguments:
|
||||
// pAssetItem - An asset item whose meta data have changed
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener(), RemoveMetaDataChangeListener()
|
||||
virtual void OnMetaDataChange(const IAssetItem* pAssetItem) = 0;
|
||||
|
||||
//! from IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] REFIID riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
@@ -1,46 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : This file declares a control which objective is to display
|
||||
// multiple assets allowing selection and preview of such things
|
||||
// It also handles scrolling and changes in the thumbnail display size
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#pragma once
|
||||
#include "IObservable.h"
|
||||
#include "IAssetItemDatabase.h"
|
||||
|
||||
struct IAssetItem;
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
// Description:
|
||||
// Observer for the asset viewer events
|
||||
struct IAssetViewerObserver
|
||||
{
|
||||
virtual void OnChangeStatusBarInfo(UINT nSelectedItems, UINT nVisibleItems, UINT nTotalItems) {};
|
||||
virtual void OnSelectionChanged() {};
|
||||
virtual void OnChangedPreviewedAsset(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetDblClick(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetFilterChanged() {};
|
||||
};
|
||||
|
||||
// Description:
|
||||
// The asset viewer interface for the asset database plugins to use
|
||||
struct IAssetViewer
|
||||
{
|
||||
DEFINE_OBSERVABLE_PURE_METHODS(IAssetViewerObserver);
|
||||
|
||||
virtual HWND GetRenderWindow() = 0;
|
||||
virtual void ApplyFilters(const IAssetItemDatabase::TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
virtual const IAssetItemDatabase::TAssetFieldFiltersMap& GetCurrentFilters() = 0;
|
||||
virtual void ClearFilters() = 0;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
@@ -1,143 +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
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include <IEditor.h>
|
||||
#include "Include/IDataBaseItem.h"
|
||||
#include "Include/IDataBaseLibrary.h"
|
||||
#include "Include/IDataBaseManager.h"
|
||||
#include "Util/TRefCountBase.h"
|
||||
|
||||
class CBaseLibraryItem;
|
||||
class CBaseLibrary;
|
||||
|
||||
struct IBaseLibraryManager
|
||||
: public TRefCountBase<IDataBaseManager>
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
//! Clear all libraries.
|
||||
virtual void ClearAll() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IDocListener implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
virtual IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) = 0;
|
||||
//! Delete item from library and manager.
|
||||
virtual void DeleteItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
virtual IDataBaseItem* FindItem(REFGUID guid) const = 0;
|
||||
virtual IDataBaseItem* FindItemByName(const QString& fullItemName) = 0;
|
||||
virtual IDataBaseItem* LoadItemByName(const QString& fullItemName) = 0;
|
||||
|
||||
virtual IDataBaseItemEnumerator* GetItemEnumerator() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set item currently selected.
|
||||
virtual void SetSelectedItem(IDataBaseItem* pItem) = 0;
|
||||
// Get currently selected item.
|
||||
virtual IDataBaseItem* GetSelectedItem() const = 0;
|
||||
virtual IDataBaseItem* GetSelectedParentItem() const = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library.
|
||||
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool isLevelLibrary = false, bool bIsLoading = true) = 0;
|
||||
virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) = 0;
|
||||
//! Get number of libraries.
|
||||
virtual int GetLibraryCount() const = 0;
|
||||
//! Get number of modified libraries.
|
||||
virtual int GetModifiedLibraryCount() const = 0;
|
||||
|
||||
//! Get Item library by index.
|
||||
virtual IDataBaseLibrary* GetLibrary(int index) const = 0;
|
||||
|
||||
//! Get Level Item library.
|
||||
virtual IDataBaseLibrary* GetLevelLibrary() const = 0;
|
||||
|
||||
//! Find Items Library by name.
|
||||
virtual IDataBaseLibrary* FindLibrary(const QString& library) = 0;
|
||||
|
||||
//! Find the Library's index by name.
|
||||
virtual int FindLibraryIndex(const QString& library) = 0;
|
||||
|
||||
//! Load Items library.
|
||||
#ifdef LoadLibrary
|
||||
#undef LoadLibrary
|
||||
#endif
|
||||
virtual IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) = 0;
|
||||
|
||||
//! Save all modified libraries.
|
||||
virtual void SaveAllLibs() = 0;
|
||||
|
||||
//! Serialize property manager.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
//! Export items to game.
|
||||
virtual void Export(XmlNodeRef& node) = 0;
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
// Vera@conffx, add LibName parameter so we could make an unique name depends on input library.
|
||||
// Arguments:
|
||||
// - name: name of the item
|
||||
// - libName: The library of the item. Given the library name, the function will return a unique name in the library
|
||||
// Default value "": The function will ignore the library name and return a unique name in the manager
|
||||
virtual QString MakeUniqueItemName(const QString& name, const QString& libName = "") = 0;
|
||||
virtual QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) = 0;
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
virtual QString GetRootNodeName() = 0;
|
||||
//! Path to libraries in this manager.
|
||||
virtual QString GetLibsPath() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
virtual void Validate() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GatherUsedResources(CUsedResources& resources) = 0;
|
||||
|
||||
virtual void AddListener(IDataBaseManagerListener* pListener) = 0;
|
||||
virtual void RemoveListener(IDataBaseManagerListener* pListener) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid) = 0;
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem) = 0;
|
||||
virtual void UnregisterItem(CBaseLibraryItem* pItem) = 0;
|
||||
|
||||
// Only Used internally.
|
||||
virtual void OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName) = 0;
|
||||
|
||||
// Called by items to indicated that they have been modified.
|
||||
// Sends item changed event to listeners.
|
||||
virtual void OnItemChanged(IDataBaseItem* pItem) = 0;
|
||||
virtual void OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh) = 0;
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation) = 0;
|
||||
// simplifies the library renaming process
|
||||
virtual bool SetLibraryName(CBaseLibrary* lib, const QString& name) = 0;
|
||||
|
||||
|
||||
//Check if the file name is unique.
|
||||
//Params: library: library name. NOT the file path.
|
||||
virtual bool IsUniqueFilename(const QString& library) = 0;
|
||||
//CONFETTI END
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
@@ -1,85 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for console connectivity plugins.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
#pragma once
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description
|
||||
// This interface provide access to the console connectivity
|
||||
// functionality.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IConsoleConnectivity
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x4DAA85E1, 0x8498, 0x402f, 0x9B, 0x85, 0x7F, 0x62, 0x9D, 0x76, 0x79, 0x8A);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//TODO: Must add the useful interface here.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Description:
|
||||
// Checks if a development console is connected to the development PC.
|
||||
// See Also:
|
||||
// Arguments:
|
||||
// Nothing
|
||||
// Return:
|
||||
// bool - true if it is connected, false otherwise.
|
||||
virtual bool IsConnectedToConsole() = 0;
|
||||
|
||||
// Description:
|
||||
// Send a file from the specified local filename to the console platform creating the full path
|
||||
// as required so it can copy to the remote filename.
|
||||
// See Also:
|
||||
// Nothing
|
||||
// Arguments:
|
||||
// szLocalFileName - is the local filename from which you want to copy the file.
|
||||
// szRemoteFilename - is the full path and filename to where you want to copy the file.
|
||||
// Return:
|
||||
// bool - true if the copy succeeded, false otherwise.
|
||||
virtual bool SendFile(const char* szLocalFileName, const char* szRemoteFilename) = 0;
|
||||
|
||||
// Description:
|
||||
// Notifies to the console that a file has been changed, typically uploaded.
|
||||
// This will be usually called after a SendFile (see above) call, so that the
|
||||
// system running on the console may decide what to do with this new file.
|
||||
// Typically the system will have to load or reloads this new file.
|
||||
// See Also:
|
||||
// SendFile
|
||||
// Arguments:
|
||||
// szRemoteFilename - is the full path and filename in the console of the changed
|
||||
// file.
|
||||
// Return:
|
||||
// bool - true if succeeded sending the notification, false otherwise.
|
||||
virtual bool NotifyFileChange(const char* szRemoteFilename) = 0;
|
||||
|
||||
|
||||
// Description:
|
||||
// Gets the the title IP for the connected console .
|
||||
// Arguments:
|
||||
// dwConsoleAddressPlaceholder - is the pointer to the placeholder of the variable
|
||||
// which will contain the title IP of the console.
|
||||
// Return:
|
||||
// bool - true if dwConsoleAddressPlaceholder now contains the IP address, else false.
|
||||
virtual bool GetConsoleAddress(DWORD* dwConsoleAddressPlaceholder) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) { return E_NOINTERFACE; };
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef() { return 0; };
|
||||
virtual ULONG STDMETHODCALLTYPE Release() { return 0; };
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
@@ -1,92 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
#pragma once
|
||||
|
||||
#include <qwindowdefs.h>
|
||||
#include <IEditor.h>
|
||||
|
||||
struct IDataBaseLibrary;
|
||||
class CUsedResources;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** Base class for all items contained in BaseLibraray.
|
||||
*/
|
||||
struct IDataBaseItem
|
||||
{
|
||||
struct SerializeContext
|
||||
{
|
||||
XmlNodeRef node;
|
||||
bool bUndo;
|
||||
bool bLoading;
|
||||
bool bCopyPaste;
|
||||
bool bIgnoreChilds;
|
||||
bool bUniqName;
|
||||
SerializeContext()
|
||||
: node(0)
|
||||
, bLoading(false)
|
||||
, bCopyPaste(false)
|
||||
, bIgnoreChilds(false)
|
||||
, bUniqName(false)
|
||||
, bUndo(false) {};
|
||||
SerializeContext(XmlNodeRef _node, bool bLoad)
|
||||
: node(_node)
|
||||
, bLoading(bLoad)
|
||||
, bCopyPaste(false)
|
||||
, bIgnoreChilds(false)
|
||||
, bUniqName(false)
|
||||
, bUndo(false) {};
|
||||
SerializeContext(const SerializeContext& ctx)
|
||||
: node(ctx.node)
|
||||
, bLoading(ctx.bLoading)
|
||||
, bCopyPaste(ctx.bCopyPaste)
|
||||
, bIgnoreChilds(ctx.bIgnoreChilds)
|
||||
, bUniqName(ctx.bUniqName)
|
||||
, bUndo(ctx.bUndo) {};
|
||||
};
|
||||
|
||||
virtual EDataBaseItemType GetType() const = 0;
|
||||
|
||||
//! Return Library this item are contained in.
|
||||
//! Item can only be at one library.
|
||||
virtual IDataBaseLibrary* GetLibrary() const = 0;
|
||||
|
||||
//! Change item name.
|
||||
virtual void SetName(const QString& name) = 0;
|
||||
//! Get item name.
|
||||
virtual const QString& GetName() const = 0;
|
||||
|
||||
//! Get full item name, including name of library.
|
||||
//! Name formed by adding dot after name of library
|
||||
//! eg. library Pickup and item PickupRL form full item name: "Pickups.PickupRL".
|
||||
virtual QString GetFullName() const = 0;
|
||||
|
||||
//! Get only nameof group from prototype.
|
||||
virtual QString GetGroupName() = 0;
|
||||
//! Get short name of prototype without group.
|
||||
virtual QString GetShortName() = 0;
|
||||
|
||||
//! Serialize library item to archive.
|
||||
virtual void Serialize(SerializeContext& ctx) = 0;
|
||||
|
||||
//! Generate new unique id for this item.
|
||||
virtual void GenerateId() = 0;
|
||||
//! Returns GUID of this material.
|
||||
virtual const GUID& GetGUID() const = 0;
|
||||
|
||||
//! Validate item for errors.
|
||||
virtual void Validate() {};
|
||||
|
||||
//! Gathers resources by this item.
|
||||
virtual void GatherUsedResources([[maybe_unused]] CUsedResources& resources) {};
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
@@ -1,118 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
#pragma once
|
||||
|
||||
|
||||
struct IDataBaseManager;
|
||||
struct IDataBaseItem;
|
||||
|
||||
class QString;
|
||||
class XmlNodeRef;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// Interface to access specific library of editor data base.
|
||||
// Ex. Archetype library, Material Library.
|
||||
// See Also:
|
||||
// IDataBaseItem,IDataBaseManager
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseLibrary
|
||||
{
|
||||
// Description:
|
||||
// Return IDataBaseManager interface to the manager for items stored in this library.
|
||||
virtual IDataBaseManager* GetManager() = 0;
|
||||
|
||||
// Description:
|
||||
// Return library name.
|
||||
virtual const QString& GetName() const = 0;
|
||||
|
||||
// Description:
|
||||
// Return filename where this library is stored.
|
||||
virtual const QString& GetFilename() const = 0;
|
||||
|
||||
// Description:
|
||||
// Save contents of library to file.
|
||||
virtual bool Save() = 0;
|
||||
|
||||
// Description:
|
||||
// Load library from file.
|
||||
// Arguments:
|
||||
// filename - Full specified library filename (relative to root game folder).
|
||||
virtual bool Load(const QString& filename) = 0;
|
||||
|
||||
// Description:
|
||||
// Serialize library parameters and items to/from XML node.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
// Description:
|
||||
// Marks library as modified, indicates that some item in library was modified.
|
||||
virtual void SetModified(bool bModified = true) = 0;
|
||||
|
||||
// Description:
|
||||
// Check if library parameters or any items where modified.
|
||||
// If any item was modified library may need saving before closing editor.
|
||||
virtual bool IsModified() const = 0;
|
||||
|
||||
// Description:
|
||||
// Check if this library is not shared and internal to current level.
|
||||
virtual bool IsLevelLibrary() const = 0;
|
||||
|
||||
// Description:
|
||||
// Make this library accessible only from current Level. (not shared)
|
||||
virtual void SetLevelLibrary(bool bEnable) = 0;
|
||||
|
||||
// Description:
|
||||
// Associate a new item with the library.
|
||||
// Watch out if item was already in another library.
|
||||
virtual void AddItem(IDataBaseItem* pItem, bool bRegister = true) = 0;
|
||||
|
||||
// Description:
|
||||
// Return number of items in library.
|
||||
virtual int GetItemCount() const = 0;
|
||||
|
||||
// Description:
|
||||
// Get item by index.
|
||||
// See Also:
|
||||
// GetItemCount
|
||||
// Arguments:
|
||||
// index - Index from 0 to GetItemCount()
|
||||
virtual IDataBaseItem* GetItem(int index) = 0;
|
||||
|
||||
// Description:
|
||||
// Remove item from library, does not destroy item,
|
||||
// only unliks it from this library, to delete item use IDataBaseManager.
|
||||
// See Also:
|
||||
// AddItem
|
||||
virtual void RemoveItem(IDataBaseItem* item) = 0;
|
||||
|
||||
// Description:
|
||||
// Remove all items from library, does not destroy items,
|
||||
// only unliks them from this library, to delete item use IDataBaseManager.
|
||||
// See Also:
|
||||
// RemoveItem,AddItem
|
||||
virtual void RemoveAllItems() = 0;
|
||||
|
||||
// Description:
|
||||
// Find item in library by name.
|
||||
// This function usually uses linear search so it is not particularry fast.
|
||||
// See Also:
|
||||
// GetItem
|
||||
virtual IDataBaseItem* FindItem(const QString& name) = 0;
|
||||
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation) = 0;
|
||||
//CONFETTI END
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
@@ -1,134 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct IDataBaseItem;
|
||||
struct IDataBaseLibrary;
|
||||
class CUsedResources;
|
||||
|
||||
enum EDataBaseItemEvent
|
||||
{
|
||||
EDB_ITEM_EVENT_ADD,
|
||||
EDB_ITEM_EVENT_DELETE,
|
||||
EDB_ITEM_EVENT_CHANGED,
|
||||
EDB_ITEM_EVENT_SELECTED,
|
||||
EDB_ITEM_EVENT_UPDATE_PROPERTIES,
|
||||
EDB_ITEM_EVENT_UPDATE_PROPERTIES_NO_EDITOR_REFRESH
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// Callback class to intercept item creation and deletion events.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseManagerListener
|
||||
{
|
||||
virtual void OnDataBaseItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event) = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// his interface is used to enumerate al items registered to the database manager.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseItemEnumerator
|
||||
{
|
||||
virtual ~IDataBaseItemEnumerator() = default;
|
||||
|
||||
virtual void Release() = 0;
|
||||
virtual IDataBaseItem* GetFirst() = 0;
|
||||
virtual IDataBaseItem* GetNext() = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Interface to the collection of all items or specific type
|
||||
// in data base libraries.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseManager
|
||||
{
|
||||
//! Clear all libraries.
|
||||
virtual void ClearAll() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
virtual IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) = 0;
|
||||
//! Delete item from library and manager.
|
||||
virtual void DeleteItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
virtual IDataBaseItem* FindItem(REFGUID guid) const = 0;
|
||||
virtual IDataBaseItem* FindItemByName(const QString& fullItemName) = 0;
|
||||
|
||||
virtual IDataBaseItemEnumerator* GetItemEnumerator() = 0;
|
||||
|
||||
// Select one item in DB.
|
||||
virtual void SetSelectedItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library. Set isLevelLibrary to true if its the "level" library which gets saved inside the level
|
||||
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool isLevelLibrary = false, bool bIsLoading = true) = 0;
|
||||
virtual void DeleteLibrary(const QString& library, bool forceDeleteLibrary = false) = 0;
|
||||
//! Get number of libraries.
|
||||
virtual int GetLibraryCount() const = 0;
|
||||
//! Get Item library by index.
|
||||
virtual IDataBaseLibrary* GetLibrary(int index) const = 0;
|
||||
|
||||
//! Find Items Library by name.
|
||||
virtual IDataBaseLibrary* FindLibrary(const QString& library) = 0;
|
||||
|
||||
//! Load Items library.
|
||||
#ifdef LoadLibrary
|
||||
#undef LoadLibrary
|
||||
#endif
|
||||
virtual IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) = 0;
|
||||
|
||||
//! Save all modified libraries.
|
||||
virtual void SaveAllLibs() = 0;
|
||||
|
||||
//! Serialize property manager.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
//! Export items to game.
|
||||
virtual void Export([[maybe_unused]] XmlNodeRef& node) {};
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
virtual QString MakeUniqueItemName(const QString& name, const QString& libName = "") = 0;
|
||||
virtual QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) = 0;
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
virtual QString GetRootNodeName() = 0;
|
||||
//! Path to libraries in this manager.
|
||||
virtual QString GetLibsPath() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
virtual void Validate() = 0;
|
||||
|
||||
// Description:
|
||||
// Collects names of all resource files used by managed items.
|
||||
// Arguments:
|
||||
// resources - Structure where all filenames are collected.
|
||||
virtual void GatherUsedResources(CUsedResources& resources) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Register listeners.
|
||||
virtual void AddListener(IDataBaseManagerListener* pListener) = 0;
|
||||
virtual void RemoveListener(IDataBaseManagerListener* pListener) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
@@ -1,20 +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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
#include <IMaterial.h>
|
||||
|
||||
struct IEditorMaterial
|
||||
: public CBaseLibraryItem
|
||||
{
|
||||
virtual int GetFlags() const = 0;
|
||||
virtual IMaterial* GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
|
||||
virtual void DisableHighlightForFrame() = 0;
|
||||
};
|
||||
@@ -1,21 +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
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_MATERIAL_IEDITORMATERIALMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_MATERIAL_IEDITORMATERIALMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include <Include/IBaseLibraryManager.h>
|
||||
#include <IMaterial.h>
|
||||
|
||||
|
||||
struct IEditorMaterialManager
|
||||
{
|
||||
virtual void GotoMaterial(IMaterial* pMaterial) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_MATERIAL_MATERIALMANAGER_H
|
||||
@@ -14,7 +14,6 @@
|
||||
// forward declarations.
|
||||
class CParticleItem;
|
||||
class CBaseObject;
|
||||
class CBaseLibraryItem;
|
||||
class CErrorRecord;
|
||||
class QString;
|
||||
|
||||
@@ -52,9 +51,6 @@ struct IErrorReport
|
||||
//! Assign current Object to which new reported warnings are assigned.
|
||||
virtual void SetCurrentValidatorObject(CBaseObject* pObject) = 0;
|
||||
|
||||
//! Assign current Item to which new reported warnings are assigned.
|
||||
virtual void SetCurrentValidatorItem(CBaseLibraryItem* pItem) = 0;
|
||||
|
||||
//! Assign current filename.
|
||||
virtual void SetCurrentFile(const QString& file) = 0;
|
||||
};
|
||||
|
||||
@@ -1,43 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class IFacialEditor
|
||||
{
|
||||
public:
|
||||
enum EyeType
|
||||
{
|
||||
EYE_LEFT,
|
||||
EYE_RIGHT
|
||||
};
|
||||
|
||||
virtual int GetNumMorphTargets() const = 0;
|
||||
virtual const char* GetMorphTargetName(int index) const = 0;
|
||||
virtual void PreviewEffector(int index, float value) = 0;
|
||||
virtual void ClearAllPreviewEffectors() = 0;
|
||||
virtual void SetForcedNeckRotation(const Quat& rotation) = 0;
|
||||
virtual void SetForcedEyeRotation(const Quat& rotation, EyeType eye) = 0;
|
||||
virtual int GetJoystickCount() const = 0;
|
||||
virtual const char* GetJoystickName(int joystickIndex) const = 0;
|
||||
virtual void SetJoystickPosition(int joystickIndex, float x, float y) = 0;
|
||||
virtual void GetJoystickPosition(int joystickIndex, float& x, float& y) const = 0;
|
||||
virtual void LoadJoystickFile(const char* filename) = 0;
|
||||
virtual void LoadCharacter(const char* filename) = 0;
|
||||
virtual void LoadSequence(const char* filename) = 0;
|
||||
virtual void SetVideoFrameResolution(int width, int height, int bpp) = 0;
|
||||
virtual int GetVideoFramePitch() = 0;
|
||||
virtual void* GetVideoFrameBits() = 0;
|
||||
virtual void ShowVideoFramePane() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
@@ -116,9 +116,6 @@ struct IFileUtil
|
||||
virtual bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) = 0;
|
||||
virtual void EditTextureFile(const char* txtureFile, bool bUseGameFolder) = 0;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
virtual bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename) = 0;
|
||||
|
||||
//! Reformat filter string for (MFC) CFileDialog style file filtering
|
||||
virtual void FormatFilterString(QString& filter) = 0;
|
||||
|
||||
|
||||
@@ -1,29 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Interface for rendering custom 3D elements in the main
|
||||
// render viewport. Particularly usefull for debug geometries.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
struct DisplayContext;
|
||||
|
||||
struct IRenderListener
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x8D52F857, 0x1027, 0x4346, 0xAC, 0x7B, 0xF6, 0x20, 0xDA, 0x7C, 0xCE, 0x42)
|
||||
|
||||
virtual void Render(DisplayContext& rDisplayContext) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
@@ -1,38 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : This file declares the interface used by the texture viewer
|
||||
// and (implemented first implemented by the Texture Database Creator) to
|
||||
// syncronize their threads. A thread interace could be useful there.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class CTextureDatabaseItem;
|
||||
|
||||
struct ITextureDatabaseUpdater
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Thread control
|
||||
virtual void NotifyShutDown() = 0;
|
||||
virtual void Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
virtual void WaitForThread() = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Data access
|
||||
virtual CTextureDatabaseItem* GetItem(const char* szAddItem) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
@@ -21,7 +21,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(SANDBOX_IMPORTS) && defined(SANDBOX_EXPORTS)
|
||||
#error SANDBOX_EXPORTS and SANDBOX_IMPORTS can't be defined at the same time
|
||||
#error SANDBOX_EXPORTS and SANDBOX_IMPORTS cannot be defined at the same time
|
||||
#endif
|
||||
|
||||
#if defined(SANDBOX_EXPORTS)
|
||||
|
||||
@@ -85,9 +85,6 @@ public:
|
||||
MOCK_METHOD0(IsSelectionLocked, bool());
|
||||
MOCK_METHOD0(GetObjectManager, struct IObjectManager* ());
|
||||
MOCK_METHOD0(GetSettingsManager, CSettingsManager* ());
|
||||
MOCK_METHOD1(GetDBItemManager, IDataBaseManager* (EDataBaseItemType));
|
||||
MOCK_METHOD0(GetMaterialManagerLibrary, IBaseLibraryManager* ());
|
||||
MOCK_METHOD0(GetIEditorMaterialManager, IEditorMaterialManager* ());
|
||||
MOCK_METHOD0(GetIconManager, IIconManager* ());
|
||||
MOCK_METHOD0(GetMusicManager, CMusicManager* ());
|
||||
MOCK_METHOD2(GetTerrainElevation, float(float , float ));
|
||||
|
||||
@@ -35,6 +35,11 @@ namespace DisplaySettingsPythonBindingsUnitTests
|
||||
|
||||
m_app.Start(appDesc);
|
||||
m_app.RegisterComponentDescriptor(AzToolsFramework::DisplaySettingsPythonFuncsHandler::CreateDescriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
// in the unit tests.
|
||||
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
|
||||
@@ -1,506 +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 "EditorDefs.h"
|
||||
|
||||
#include "SimpleTriangleRasterizer.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if !defined FLT_MAX
|
||||
#define FLT_MAX 3.402823466e+38F
|
||||
#endif
|
||||
|
||||
void CSimpleTriangleRasterizer::lambertHorizlineConservative(float fx1, float fx2, int yy, IRasterizeSink* inpSink)
|
||||
{
|
||||
int x1 = (int)floorf(fx1 + 0.25f), x2 = (int)floorf(fx2 + .75f);
|
||||
|
||||
if (x1 < m_iMinX)
|
||||
{
|
||||
x1 = m_iMinX;
|
||||
}
|
||||
if (x2 > m_iMaxX + 1)
|
||||
{
|
||||
x2 = m_iMaxX + 1;
|
||||
}
|
||||
if (x1 > m_iMaxX + 1)
|
||||
{
|
||||
x1 = m_iMaxX + 1;
|
||||
}
|
||||
if (x2 < m_iMinX)
|
||||
{
|
||||
x2 = m_iMinX;
|
||||
}
|
||||
|
||||
|
||||
inpSink->Line(fx1, fx2, x1, x2, yy);
|
||||
}
|
||||
|
||||
void CSimpleTriangleRasterizer::lambertHorizlineSubpixelCorrect(float fx1, float fx2, int yy, IRasterizeSink* inpSink)
|
||||
{
|
||||
int x1 = (int)floorf(fx1 + 0.5f), x2 = (int)floorf(fx2 + 0.5f);
|
||||
// int x1=(int)floorf(fx1*1023.f/1024.f+1.f),x2=(int)floorf(fx2*1023.f/1024.f+1.f);
|
||||
|
||||
if (x1 < m_iMinX)
|
||||
{
|
||||
x1 = m_iMinX;
|
||||
}
|
||||
if (x2 > m_iMaxX)
|
||||
{
|
||||
x2 = m_iMaxX;
|
||||
}
|
||||
if (x1 > m_iMaxX)
|
||||
{
|
||||
x1 = m_iMaxX;
|
||||
}
|
||||
if (x2 < m_iMinX)
|
||||
{
|
||||
x2 = m_iMinX;
|
||||
}
|
||||
|
||||
inpSink->Line(fx1, fx2, x1, x2, yy);
|
||||
}
|
||||
|
||||
// optimizable
|
||||
void CSimpleTriangleRasterizer::CopyAndSortY(const float infX[3], const float infY[3], float outfX[3], float outfY[3])
|
||||
{
|
||||
outfX[0] = infX[0];
|
||||
outfY[0] = infY[0];
|
||||
outfX[1] = infX[1];
|
||||
outfY[1] = infY[1];
|
||||
outfX[2] = infX[2];
|
||||
outfY[2] = infY[2];
|
||||
|
||||
// Sort the coordinates, so that (x[1], y[1]) becomes the highest coord
|
||||
float tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outfY[1] > outfY[2])
|
||||
{
|
||||
tmp = outfY[1];
|
||||
outfY[1] = outfY[2];
|
||||
outfY[2] = tmp;
|
||||
tmp = outfX[1];
|
||||
outfX[1] = outfX[2];
|
||||
outfX[2] = tmp;
|
||||
|
||||
if (outfY[0] > outfY[1])
|
||||
{
|
||||
tmp = outfY[0];
|
||||
outfY[0] = outfY[1];
|
||||
outfY[1] = tmp;
|
||||
tmp = outfX[0];
|
||||
outfX[0] = outfX[1];
|
||||
outfX[1] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillRectConservative(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
inpSink->Triangle(m_iMinY);
|
||||
|
||||
float fMinX = (std::min)(_x[0], (std::min)(_x[1], _x[2]));
|
||||
float fMaxX = (std::max)(_x[0], (std::max)(_x[1], _x[2]));
|
||||
float fMinY = (std::min)(_y[0], (std::min)(_y[1], _y[2]));
|
||||
float fMaxY = (std::max)(_y[0], (std::max)(_y[1], _y[2]));
|
||||
|
||||
int iMinX = (std::max)(m_iMinX, (int)floorf(fMinX));
|
||||
int iMaxX = (std::min)(m_iMaxX + 1, (int)ceilf(fMaxX));
|
||||
int iMinY = (std::max)(m_iMinY, (int)floorf(fMinY));
|
||||
int iMaxY = (std::min)(m_iMaxY + 1, (int)ceilf(fMaxY));
|
||||
|
||||
for (int y = iMinY; y < iMaxY; y++)
|
||||
{
|
||||
inpSink->Line(fMinX, fMaxX, iMinX, iMaxX, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillConservative(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
float x[3], y[3];
|
||||
|
||||
CopyAndSortY(_x, _y, x, y);
|
||||
|
||||
// Calculate interpolation steps
|
||||
float fX1toX2step = 0.0f;
|
||||
float fX1toX3step = 0.0f;
|
||||
float fX2toX3step = 0.0f;
|
||||
if (fabsf(y[1] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX2step = (x[1] - x[0]) / (float)(y[1] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX3step = (x[2] - x[0]) / (float)(y[2] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[1]) > FLT_EPSILON)
|
||||
{
|
||||
fX2toX3step = (x[2] - x[1]) / (float)(y[2] - y[1]);
|
||||
}
|
||||
|
||||
float fX1toX2 = x[0], fX1toX3 = x[0], fX2toX3 = x[1];
|
||||
bool bFirstLine = true;
|
||||
bool bTriangleCallDone = false;
|
||||
|
||||
// Go through the scanlines of the triangle
|
||||
int yy = (int)floorf(y[0]); // was floor
|
||||
|
||||
for (; yy <= (int)floorf(y[2]); yy++)
|
||||
// for(yy=m_iMinY; yy<=m_iMaxY; yy++) // juhu
|
||||
{
|
||||
float fSubPixelYStart = 0.0f, fSubPixelYEnd = 1.0f;
|
||||
float start, end;
|
||||
|
||||
// first line
|
||||
if (bFirstLine)
|
||||
{
|
||||
fSubPixelYStart = y[0] - floorf(y[0]);
|
||||
start = x[0];
|
||||
end = x[0];
|
||||
bFirstLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy <= (int)floorf(y[1]))
|
||||
{
|
||||
start = (std::min)(fX1toX2, fX1toX3);
|
||||
end = (std::max)(fX1toX2, fX1toX3);
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (std::min)(fX2toX3, fX1toX3);
|
||||
end = (std::max)(fX2toX3, fX1toX3);
|
||||
}
|
||||
}
|
||||
|
||||
// middle corner line
|
||||
if (yy == (int)floorf(y[1]))
|
||||
{
|
||||
fSubPixelYEnd = y[1] - floorf(y[1]);
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX3);
|
||||
end = (std::max)(end, fX1toX3);
|
||||
start = (std::min)(start, x[1]);
|
||||
end = (std::max)(end, x[1]);
|
||||
|
||||
fSubPixelYStart = fSubPixelYEnd;
|
||||
fSubPixelYEnd = 1.0f;
|
||||
}
|
||||
|
||||
// last line
|
||||
if (yy == (int)floorf(y[2]))
|
||||
{
|
||||
start = (std::min)(start, x[2]);
|
||||
end = (std::max)(end, x[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy < (int)floorf(y[1]))
|
||||
{
|
||||
fX1toX2 += fX1toX2step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX2);
|
||||
end = (std::max)(end, fX1toX2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fX2toX3 += fX2toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX2toX3);
|
||||
end = (std::max)(end, fX2toX3);
|
||||
}
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
start = (std::min)(start, fX1toX3);
|
||||
end = (std::max)(end, fX1toX3);
|
||||
}
|
||||
|
||||
if (yy >= m_iMinY && yy <= m_iMaxY)
|
||||
{
|
||||
if (!bTriangleCallDone)
|
||||
{
|
||||
inpSink->Triangle(yy);
|
||||
bTriangleCallDone = true;
|
||||
}
|
||||
|
||||
lambertHorizlineConservative(start, end, yy, inpSink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CSimpleTriangleRasterizer::CallbackFillSubpixelCorrect(float _x[3], float _y[3], IRasterizeSink* inpSink)
|
||||
{
|
||||
float x[3], y[3];
|
||||
|
||||
CopyAndSortY(_x, _y, x, y);
|
||||
|
||||
if (fabs(y[0] - floorf(y[0])) < FLT_EPSILON)
|
||||
{
|
||||
y[0] -= FLT_EPSILON;
|
||||
}
|
||||
|
||||
// Calculate interpolation steps
|
||||
float fX1toX2step = 0.0f;
|
||||
float fX1toX3step = 0.0f;
|
||||
float fX2toX3step = 0.0f;
|
||||
if (fabsf(y[1] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX2step = (x[1] - x[0]) / (y[1] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[0]) > FLT_EPSILON)
|
||||
{
|
||||
fX1toX3step = (x[2] - x[0]) / (y[2] - y[0]);
|
||||
}
|
||||
if (fabsf(y[2] - y[1]) > FLT_EPSILON)
|
||||
{
|
||||
fX2toX3step = (x[2] - x[1]) / (y[2] - y[1]);
|
||||
}
|
||||
|
||||
float fX1toX2 = x[0], fX1toX3 = x[0], fX2toX3 = x[1];
|
||||
bool bFirstLine = true;
|
||||
bool bTriangleCallDone = false;
|
||||
|
||||
y[0] -= 0.5f;
|
||||
y[1] -= 0.5f;
|
||||
y[2] -= 0.5f;
|
||||
// y[0]=y[0]*1023.f/1024.f+1.f;
|
||||
// y[1]=y[1]*1023.f/1024.f+1.f;
|
||||
// y[2]=y[2]*1023.f/1024.f+1.f;
|
||||
|
||||
for (int yy = (int)floorf(y[0]); yy <= (int)floorf(y[2]); yy++)
|
||||
{
|
||||
float fSubPixelYStart = 0.0f, fSubPixelYEnd = 1.0f;
|
||||
float start, end;
|
||||
|
||||
// first line
|
||||
if (bFirstLine)
|
||||
{
|
||||
fSubPixelYStart = y[0] - floorf(y[0]);
|
||||
start = x[0];
|
||||
end = x[0];
|
||||
bFirstLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy <= (int)floorf(y[1]))
|
||||
{
|
||||
start = (std::min)(fX1toX2, fX1toX3);
|
||||
end = (std::max)(fX1toX2, fX1toX3);
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (std::min)(fX2toX3, fX1toX3);
|
||||
end = (std::max)(fX2toX3, fX1toX3);
|
||||
}
|
||||
}
|
||||
|
||||
// middle corner line
|
||||
if (yy == (int)floorf(y[1]))
|
||||
{
|
||||
fSubPixelYEnd = y[1] - floorf(y[1]);
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
|
||||
fSubPixelYStart = fSubPixelYEnd;
|
||||
fSubPixelYEnd = 1.0f;
|
||||
}
|
||||
|
||||
// last line
|
||||
if (yy != (int)floorf(y[2]))
|
||||
{
|
||||
// top part without middle corner line
|
||||
if (yy < (int)floorf(y[1]))
|
||||
{
|
||||
fX1toX2 += fX1toX2step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
fX2toX3 += fX2toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
|
||||
fX1toX3 += fX1toX3step * (fSubPixelYEnd - fSubPixelYStart);
|
||||
}
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
if (yy >= m_iMinY && yy <= m_iMaxY)
|
||||
{
|
||||
if (!bTriangleCallDone)
|
||||
{
|
||||
inpSink->Triangle(yy);
|
||||
bTriangleCallDone = true;
|
||||
}
|
||||
|
||||
lambertHorizlineSubpixelCorrect(start, end, yy, inpSink);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// shrink triangle by n pixel, optimizable
|
||||
void CSimpleTriangleRasterizer::ShrinkTriangle(float inoutfX[3], float inoutfY[3], float infAmount)
|
||||
{
|
||||
float fX[3] = { inoutfX[0], inoutfX[1], inoutfX[2] };
|
||||
float fY[3] = { inoutfY[0], inoutfY[1], inoutfY[2] };
|
||||
|
||||
/*
|
||||
// move edge to opposing vertex
|
||||
float dx,dy,fLength;
|
||||
|
||||
for(int a=0;a<3;a++)
|
||||
{
|
||||
int b=a+1;if(b>=3)b=0;
|
||||
int c=b+1;if(c>=3)c=0;
|
||||
|
||||
dx=fX[a]-(fX[b]+fX[c])*0.5f;
|
||||
dy=fY[a]-(fY[b]+fY[c])*0.5f;
|
||||
fLength=(float)sqrt(dx*dx+dy*dy);
|
||||
if(fLength>1.0f)
|
||||
{
|
||||
dx/=fLength;dy/=fLength;
|
||||
inoutfX[b]+=dx;inoutfY[b]+=dy;
|
||||
inoutfX[c]+=dx;inoutfY[c]+=dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// move vertex to opposing edge
|
||||
float dx,dy,fLength;
|
||||
|
||||
for(int a=0;a<3;a++)
|
||||
{
|
||||
int b=a+1;if(b>=3)b=0;
|
||||
int c=b+1;if(c>=3)c=0;
|
||||
|
||||
dx=fX[a]-(fX[b]+fX[c])*0.5f;
|
||||
dy=fY[a]-(fY[b]+fY[c])*0.5f;
|
||||
fLength=(float)sqrt(dx*dx+dy*dy);
|
||||
if(fLength>1.0f)
|
||||
{
|
||||
dx/=fLength;dy/=fLength;
|
||||
inoutfX[a]-=dx;inoutfY[a]-=dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// move vertex to get edges shifted perpendicular for 1 unit
|
||||
for (int a = 0; a < 3; a++)
|
||||
{
|
||||
float dx1, dy1, dx2, dy2, fLength;
|
||||
|
||||
int b = a + 1;
|
||||
if (b >= 3)
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
int c = b + 1;
|
||||
if (c >= 3)
|
||||
{
|
||||
c = 0;
|
||||
}
|
||||
|
||||
dx1 = fX[b] - fX[a];
|
||||
dy1 = fY[b] - fY[a];
|
||||
fLength = (float)sqrt(dx1 * dx1 + dy1 * dy1);
|
||||
if (infAmount > 0)
|
||||
{
|
||||
if (fLength < infAmount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fLength == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dx1 /= fLength;
|
||||
dy1 /= fLength;
|
||||
|
||||
dx2 = fX[c] - fX[a];
|
||||
dy2 = fY[c] - fY[a];
|
||||
fLength = (float)sqrt(dx2 * dx2 + dy2 * dy2);
|
||||
if (infAmount > 0)
|
||||
{
|
||||
if (fLength < infAmount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fLength == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dx2 /= fLength;
|
||||
dy2 /= fLength;
|
||||
|
||||
inoutfX[a] += (dx1 + dx2) * infAmount;
|
||||
inoutfY[a] += (dy1 + dy2) * infAmount;
|
||||
}
|
||||
}
|
||||
@@ -1,181 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
#define CRYINCLUDE_EDITOR_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
#pragma once
|
||||
|
||||
class CSimpleTriangleRasterizer
|
||||
{
|
||||
public:
|
||||
|
||||
class IRasterizeSink
|
||||
{
|
||||
public:
|
||||
|
||||
//! is called once per triangel for the first possible visible line
|
||||
//! /param iniStartY
|
||||
virtual void Triangle([[maybe_unused]] const int iniStartY)
|
||||
{
|
||||
}
|
||||
|
||||
//! callback function
|
||||
//! /param infXLeft included - not clipped against left and reight border
|
||||
//! /param infXRight excluded - not clipped against left and reight border
|
||||
//! /param iniXLeft included
|
||||
//! /param iniXRight excluded
|
||||
//! /param iniY
|
||||
virtual void Line(const float infXLeft, const float infXRight,
|
||||
const int iniXLeft, const int iniXRight, const int iniY) = 0;
|
||||
};
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
||||
//! implementation sink sample
|
||||
class CDWORDFlatFill
|
||||
: public IRasterizeSink
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
CDWORDFlatFill(DWORD* inpBuffer, const DWORD indwPitchInPixels, DWORD indwValue)
|
||||
{
|
||||
m_dwValue = indwValue;
|
||||
m_pBuffer = inpBuffer;
|
||||
m_dwPitchInPixels = indwPitchInPixels;
|
||||
}
|
||||
|
||||
virtual void Triangle(const int iniY)
|
||||
{
|
||||
m_pBufferLine = &m_pBuffer[iniY * m_dwPitchInPixels];
|
||||
}
|
||||
|
||||
virtual void Line([[maybe_unused]] const float infXLeft, [[maybe_unused]] const float infXRight,
|
||||
const int iniLeft, const int iniRight, [[maybe_unused]] const int iniY)
|
||||
{
|
||||
DWORD* mem = &m_pBufferLine[iniLeft];
|
||||
|
||||
for (int x = iniLeft; x < iniRight; x++)
|
||||
{
|
||||
*mem++ = m_dwValue;
|
||||
}
|
||||
|
||||
m_pBufferLine += m_dwPitchInPixels;
|
||||
}
|
||||
|
||||
private:
|
||||
DWORD m_dwValue; //!< fill value
|
||||
DWORD* m_pBufferLine; //!< to get rid of the multiplication per line
|
||||
|
||||
DWORD m_dwPitchInPixels; //!< in DWORDS, not in Bytes
|
||||
DWORD* m_pBuffer; //!< pointer to the buffer
|
||||
};
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
||||
//! constructor
|
||||
//! /param iniWidth excluded
|
||||
//! /param iniHeight excluded
|
||||
CSimpleTriangleRasterizer(const int iniWidth, const int iniHeight)
|
||||
{
|
||||
m_iMinX = 0;
|
||||
m_iMinY = 0;
|
||||
m_iMaxX = iniWidth - 1;
|
||||
m_iMaxY = iniHeight - 1;
|
||||
}
|
||||
/*
|
||||
//! constructor
|
||||
//! /param iniMinX included
|
||||
//! /param iniMinY included
|
||||
//! /param iniMaxX included
|
||||
//! /param iniMaxY included
|
||||
CSimpleTriangleRasterizer( const int iniMinX, const int iniMinY, const int iniMaxX, const int iniMaxY )
|
||||
{
|
||||
m_iMinX=iniMinX;
|
||||
m_iMinY=iniMinY;
|
||||
m_iMaxX=iniMaxX;
|
||||
m_iMaxY=iniMaxY;
|
||||
}
|
||||
*/
|
||||
//! simple triangle filler with clipping (optimizable), not subpixel correct
|
||||
//! /param pBuffer pointer o the color buffer
|
||||
//! /param indwWidth width of the color buffer
|
||||
//! /param indwHeight height of the color buffer
|
||||
//! /param x array of the x coordiantes of the three vertices
|
||||
//! /param y array of the x coordiantes of the three vertices
|
||||
//! /param indwValue value of the triangle
|
||||
void DWORDFlatFill(DWORD* inpBuffer, const DWORD indwPitchInPixels, float x[3], float y[3], DWORD indwValue, bool inbConservative)
|
||||
{
|
||||
CDWORDFlatFill pix(inpBuffer, indwPitchInPixels, indwValue);
|
||||
|
||||
if (inbConservative)
|
||||
{
|
||||
CallbackFillConservative(x, y, &pix);
|
||||
}
|
||||
else
|
||||
{
|
||||
CallbackFillSubpixelCorrect(x, y, &pix);
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle around triangle - more stable - use for debugging purpose
|
||||
void CallbackFillRectConservative(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
|
||||
//! subpixel correct triangle filler (conservative or not conservative)
|
||||
//! \param pBuffer pointe to the DWORD
|
||||
//! \param indwWidth width of the buffer pBuffer pointes to
|
||||
//! \param indwHeight height of the buffer pBuffer pointes to
|
||||
//! \param x array of the x coordiantes of the three vertices
|
||||
//! \param y array of the x coordiantes of the three vertices
|
||||
//! \param inpSink pointer to the sink interface (is called per triangle and per triangle line)
|
||||
void CallbackFillConservative(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
//! subpixel correct triangle filler (conservative or not conservative)
|
||||
//! \param pBuffer pointe to the DWORD
|
||||
//! \param indwWidth width of the buffer pBuffer pointes to
|
||||
//! \param indwHeight height of the buffer pBuffer pointes to
|
||||
//! \param x array of the x coordiantes of the three vertices
|
||||
//! \param y array of the x coordiantes of the three vertices
|
||||
//! \param inpSink pointer to the sink interface (is called per triangle and per triangle line)
|
||||
void CallbackFillSubpixelCorrect(float x[3], float y[3], IRasterizeSink * inpSink);
|
||||
|
||||
//!
|
||||
//! /param inoutfX
|
||||
//! /param inoutfY
|
||||
//! /param infAmount could be positive or negative
|
||||
static void ShrinkTriangle(float inoutfX[3], float inoutfY[3], float infAmount);
|
||||
|
||||
private:
|
||||
|
||||
// Clipping Rect;
|
||||
|
||||
int m_iMinX; //!< minimum x value included
|
||||
int m_iMinY; //!< minimum y value included
|
||||
int m_iMaxX; //!< maximum x value included
|
||||
int m_iMaxY; //!< maximum x value included
|
||||
|
||||
void lambertHorizlineConservative(float fx1, float fx2, int y, IRasterizeSink* inpSink);
|
||||
void lambertHorizlineSubpixelCorrect(float fx1, float fx2, int y, IRasterizeSink* inpSink);
|
||||
void CopyAndSortY(const float infX[3], const float infY[3], float outfX[3], float outfY[3]);
|
||||
};
|
||||
|
||||
|
||||
// extension ideas:
|
||||
// * callback with coverage mask (possible non ordered sampling)
|
||||
// * z-buffer behaviour
|
||||
// * gouraud shading
|
||||
// * texture mapping with nearest/bicubic/bilinear filter
|
||||
// * further primitives: thick line, ellipse
|
||||
// * build a template version
|
||||
// *
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_LIGHTMAPCOMPILER_SIMPLETRIANGLERASTERIZER_H
|
||||
@@ -154,37 +154,6 @@
|
||||
<file alias="error_report_warning.svg">res/error_report_warning.svg</file>
|
||||
<file alias="error_report_comment.svg">res/error_report_comment.svg</file>
|
||||
<file alias="error_report_helper.svg">res/error_report_helper.svg</file>
|
||||
<file>particles_tree_00.png</file>
|
||||
<file>particles_tree_01.png</file>
|
||||
<file>particles_tree_02.png</file>
|
||||
<file>particles_tree_03.png</file>
|
||||
<file>particles_tree_04.png</file>
|
||||
<file>particles_tree_05.png</file>
|
||||
<file>particles_tree_06.png</file>
|
||||
<file>particles_tree_07.png</file>
|
||||
<file>arhitype_tree_00.png</file>
|
||||
<file>arhitype_tree_01.png</file>
|
||||
<file>arhitype_tree_02.png</file>
|
||||
<file>arhitype_tree_03.png</file>
|
||||
<file>water.png</file>
|
||||
<file>bmp00005_00.png</file>
|
||||
<file>bmp00005_01.png</file>
|
||||
<file>bmp00005_02.png</file>
|
||||
<file>bmp00005_03.png</file>
|
||||
<file>bmp00005_04.png</file>
|
||||
<file>bmp00005_05.png</file>
|
||||
<file>bmp00005_06.png</file>
|
||||
<file>bmp00005_07.png</file>
|
||||
<file>bmp00005_08.png</file>
|
||||
<file>bmp00005_09.png</file>
|
||||
<file>bmp00006_00.png</file>
|
||||
<file>bmp00006_01.png</file>
|
||||
<file>bmp00006_02.png</file>
|
||||
<file>bmp00006_03.png</file>
|
||||
<file>bmp00006_04.png</file>
|
||||
<file>bmp00006_05.png</file>
|
||||
<file>bmp00006_06.png</file>
|
||||
<file>bmp00006_07.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/cursors">
|
||||
<file>res/arr_addkey.cur</file>
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
|
||||
// Editor
|
||||
#include "NewTerrainDialog.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_NewLevelDialog.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
@@ -115,7 +112,6 @@ CNewLevelDialog::~CNewLevelDialog()
|
||||
void CNewLevelDialog::OnStartup()
|
||||
{
|
||||
UpdateData(false);
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void CNewLevelDialog::UpdateData(bool fromUi)
|
||||
|
||||
@@ -133,6 +133,9 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>LEVEL</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -1,168 +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
|
||||
*
|
||||
*/
|
||||
// NewTerrainDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "NewTerrainDialog.h"
|
||||
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
|
||||
#include <ui_NewTerrainDialog.h>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
|
||||
|
||||
CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_terrainResolutionIndex(0)
|
||||
, m_terrainUnitsIndex(0)
|
||||
, m_bUpdate(false)
|
||||
, ui(new Ui::CNewTerrainDialog)
|
||||
, m_initialized(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(tr("Terrain options"));
|
||||
|
||||
// Default is 1024x1024, and m_terrainResolution holds an index to the combo box
|
||||
m_terrainResolutionIndex = 3;
|
||||
|
||||
connect(ui->TERRAIN_RESOLUTION, SIGNAL(activated(int)), this, SLOT(OnComboBoxSelectionTerrainResolution()));
|
||||
connect(ui->TERRAIN_UNITS, SIGNAL(activated(int)), this, SLOT(OnComboBoxSelectionTerrainUnits()));
|
||||
}
|
||||
|
||||
|
||||
CNewTerrainDialog::~CNewTerrainDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::UpdateData(bool fromUi)
|
||||
{
|
||||
if (fromUi)
|
||||
{
|
||||
m_terrainResolutionIndex = ui->TERRAIN_RESOLUTION->currentIndex();
|
||||
m_terrainUnitsIndex = ui->TERRAIN_UNITS->currentIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->TERRAIN_RESOLUTION->setCurrentIndex(m_terrainResolutionIndex);
|
||||
ui->TERRAIN_UNITS->setCurrentIndex(m_terrainUnitsIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::OnInitDialog()
|
||||
{
|
||||
// Initialize terrain values.
|
||||
int resolution = Ui::START_TERRAIN_RESOLUTION;
|
||||
|
||||
// Fill terrain resolution combo box
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ui->TERRAIN_RESOLUTION->addItem(QString("%1x%1").arg(resolution));
|
||||
resolution *= 2;
|
||||
}
|
||||
|
||||
UpdateTerrainUnits();
|
||||
UpdateTerrainInfo();
|
||||
|
||||
// Save data.
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::UpdateTerrainUnits()
|
||||
{
|
||||
uint32 terrainRes = GetTerrainResolution();
|
||||
int size = terrainRes * GetTerrainUnits();
|
||||
int maxUnit = IntegerLog2(Ui::MAXIMUM_TERRAIN_RESOLUTION / terrainRes);
|
||||
int units = Ui::START_TERRAIN_UNITS;
|
||||
|
||||
ui->TERRAIN_UNITS->clear();
|
||||
for (int i = 0; i <= maxUnit; i++)
|
||||
{
|
||||
ui->TERRAIN_UNITS->addItem(QString::number(units));
|
||||
units *= 2;
|
||||
}
|
||||
if (size > Ui::MAXIMUM_TERRAIN_RESOLUTION)
|
||||
{
|
||||
m_terrainUnitsIndex = 0;
|
||||
}
|
||||
ui->TERRAIN_UNITS->setCurrentText(QString::number(m_terrainUnitsIndex));
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::UpdateTerrainInfo()
|
||||
{
|
||||
int sizeX = GetTerrainResolution() * GetTerrainUnits();
|
||||
int sizeY = GetTerrainResolution() * GetTerrainUnits();
|
||||
|
||||
QString str;
|
||||
if (sizeX >= 1000)
|
||||
{
|
||||
str = tr("Terrain Size: %1 x %2 Kilometers").arg((float)sizeX / 1000.0f, 0, 'f', 3).arg((float)sizeY / 1000.0f, 0, 'f', 3);
|
||||
}
|
||||
else if (sizeX > 0)
|
||||
{
|
||||
str = tr("Terrain Size: %1 x %2 Meters").arg(sizeX).arg(sizeY);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = tr("Level will have no terrain");
|
||||
}
|
||||
|
||||
ui->TERRAIN_INFO->setText(str);
|
||||
}
|
||||
|
||||
|
||||
int CNewTerrainDialog::GetTerrainResolution() const
|
||||
{
|
||||
// convert combo box index into resolution value
|
||||
return Ui::START_TERRAIN_RESOLUTION * (1 << m_terrainResolutionIndex);
|
||||
}
|
||||
|
||||
|
||||
int CNewTerrainDialog::GetTerrainUnits() const
|
||||
{
|
||||
// convert combo box index into units value
|
||||
return Ui::START_TERRAIN_UNITS * (1 << m_terrainUnitsIndex);
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::OnComboBoxSelectionTerrainResolution()
|
||||
{
|
||||
UpdateData();
|
||||
|
||||
UpdateTerrainUnits();
|
||||
|
||||
UpdateTerrainInfo();
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::OnComboBoxSelectionTerrainUnits()
|
||||
{
|
||||
UpdateData();
|
||||
|
||||
UpdateTerrainInfo();
|
||||
}
|
||||
|
||||
|
||||
void CNewTerrainDialog::showEvent(QShowEvent* event)
|
||||
{
|
||||
if (!m_initialized)
|
||||
{
|
||||
OnInitDialog();
|
||||
m_initialized = true;
|
||||
}
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
#include <moc_NewTerrainDialog.cpp>
|
||||
@@ -1,71 +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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
|
||||
#define CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CNewTerrainDialog;
|
||||
|
||||
enum TerrainDialogConstants
|
||||
{
|
||||
START_TERRAIN_RESOLUTION_POWER_OF_TWO = 7,
|
||||
START_TERRAIN_RESOLUTION = 1 << START_TERRAIN_RESOLUTION_POWER_OF_TWO,
|
||||
MAXIMUM_TERRAIN_POWER_OF_TWO = 16,
|
||||
MAXIMUM_TERRAIN_RESOLUTION = 1 << MAXIMUM_TERRAIN_POWER_OF_TWO,
|
||||
POWER_OFFSET = (MAXIMUM_TERRAIN_POWER_OF_TWO - START_TERRAIN_RESOLUTION_POWER_OF_TWO),
|
||||
START_TERRAIN_UNITS = 1
|
||||
};
|
||||
}
|
||||
|
||||
class CNewTerrainDialog
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CNewTerrainDialog(QWidget* pParent = nullptr); // standard constructor
|
||||
~CNewTerrainDialog();
|
||||
|
||||
int GetTerrainResolution() const;
|
||||
int GetTerrainUnits() const;
|
||||
|
||||
void IsResize(bool bIsResize);
|
||||
|
||||
|
||||
protected:
|
||||
void UpdateData(bool fromUi = true);
|
||||
void OnInitDialog();
|
||||
|
||||
void UpdateTerrainUnits();
|
||||
void UpdateTerrainInfo();
|
||||
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
void OnComboBoxSelectionTerrainResolution();
|
||||
void OnComboBoxSelectionTerrainUnits();
|
||||
|
||||
public:
|
||||
int m_terrainResolutionIndex;
|
||||
int m_terrainUnitsIndex;
|
||||
bool m_bUpdate;
|
||||
|
||||
QScopedPointer<Ui::CNewTerrainDialog> ui;
|
||||
bool m_initialized;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
|
||||
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CNewTerrainDialog</class>
|
||||
<widget class="QDialog" name="CNewTerrainDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QFrame" name="USE_TERRAIN">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="STATIC3">
|
||||
<property name="text">
|
||||
<string>Heightmap Resolution:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>TERRAIN_RESOLUTION</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="TERRAIN_RESOLUTION"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="STATIC4">
|
||||
<property name="text">
|
||||
<string>Meters Per Texel:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>TERRAIN_UNITS</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="TERRAIN_UNITS"/>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="TERRAIN_INFO">
|
||||
<property name="text">
|
||||
<string>Terrain Size: 32x32 Km</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CNewTerrainDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>176</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>169</x>
|
||||
<y>1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CNewTerrainDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>245</x>
|
||||
<y>172</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>247</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -36,12 +36,6 @@
|
||||
// To use the Andrew's algorithm in order to make convex hull from the points, this header is needed.
|
||||
#include "Util/GeometryUtil.h"
|
||||
|
||||
namespace {
|
||||
QColor kLinkColorParent = QColor(0, 255, 255);
|
||||
QColor kLinkColorChild = QColor(0, 0, 255);
|
||||
QColor kLinkColorGray = QColor(128, 128, 128);
|
||||
}
|
||||
|
||||
extern CObjectManager* g_pObjectManager;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -761,72 +755,6 @@ void CBaseObject::SetModified(bool)
|
||||
{
|
||||
}
|
||||
|
||||
void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
|
||||
{
|
||||
Vec3 wp = GetWorldPos();
|
||||
|
||||
bool bDisplaySelectionHelper = false;
|
||||
if (!CanBeDrawn(dc, bDisplaySelectionHelper))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw link between parent and child.
|
||||
if (dc.flags & DISPLAY_LINKS)
|
||||
{
|
||||
if (GetParent())
|
||||
{
|
||||
dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild);
|
||||
}
|
||||
size_t nChildCount = GetChildCount();
|
||||
for (size_t i = 0; i < nChildCount; ++i)
|
||||
{
|
||||
const CBaseObject* pChild = GetChild(i);
|
||||
dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw Bounding box
|
||||
if (dc.flags & DISPLAY_BBOX)
|
||||
{
|
||||
AABB box;
|
||||
GetBoundBox(box);
|
||||
dc.SetColor(Vec3(1, 1, 1));
|
||||
dc.DrawWireBox(box.min, box.max);
|
||||
}
|
||||
|
||||
if (IsHighlighted())
|
||||
{
|
||||
DrawHighlight(dc);
|
||||
}
|
||||
|
||||
if (IsSelected())
|
||||
{
|
||||
DrawArea(dc);
|
||||
|
||||
CSelectionGroup* pSelection = GetObjectManager()->GetSelection();
|
||||
|
||||
// If the number of selected object is over 2, the merged boundbox should be used to render the measurement axis.
|
||||
if (!pSelection || (pSelection && pSelection->GetCount() == 1))
|
||||
{
|
||||
DrawDimensions(dc);
|
||||
}
|
||||
}
|
||||
|
||||
if (bDisplaySelectionHelper)
|
||||
{
|
||||
DrawSelectionHelper(dc, wp, labelColor, 1.0f);
|
||||
}
|
||||
else if (!(dc.flags & DISPLAY_HIDENAMES))
|
||||
{
|
||||
DrawLabel(dc, wp, labelColor);
|
||||
}
|
||||
|
||||
SetDrawTextureIconProperties(dc, wp);
|
||||
DrawTextureIcon(dc, wp);
|
||||
DrawWarningIcons(dc, wp);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::DrawDimensions(DisplayContext&, AABB*)
|
||||
{
|
||||
@@ -850,91 +778,6 @@ void CBaseObject::DrawSelectionHelper(DisplayContext& dc, const Vec3& pos, const
|
||||
dc.SetState(nPrevState);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetDrawTextureIconProperties(DisplayContext& dc, const Vec3& pos, float alpha, int texIconFlags)
|
||||
{
|
||||
if (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons)
|
||||
{
|
||||
if (IsHighlighted())
|
||||
{
|
||||
dc.SetColor(QColor(255, 120, 0), 0.8f * alpha);
|
||||
}
|
||||
else if (IsSelected())
|
||||
{
|
||||
dc.SetSelectedColor(alpha);
|
||||
}
|
||||
else if (IsFrozen())
|
||||
{
|
||||
dc.SetFreezeColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetColor(QColor(255, 255, 255), alpha);
|
||||
}
|
||||
|
||||
m_vDrawIconPos = pos;
|
||||
|
||||
int nIconFlags = texIconFlags;
|
||||
if (CheckFlags(OBJFLAG_SHOW_ICONONTOP))
|
||||
{
|
||||
Vec3 objectPos = GetWorldPos();
|
||||
|
||||
AABB box;
|
||||
GetBoundBox(box);
|
||||
m_vDrawIconPos.z = (m_vDrawIconPos.z - objectPos.z) + box.max.z;
|
||||
nIconFlags |= DisplayContext::TEXICON_ALIGN_BOTTOM;
|
||||
}
|
||||
m_nIconFlags = nIconFlags;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::DrawTextureIcon(DisplayContext& dc, [[maybe_unused]] const Vec3& pos, [[maybe_unused]] float alpha)
|
||||
{
|
||||
if (m_nTextureIcon && (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons))
|
||||
{
|
||||
dc.DrawTextureLabel(GetTextureIconDrawPos(), OBJECT_TEXTURE_ICON_SIZEX, OBJECT_TEXTURE_ICON_SIZEY, GetTextureIcon(), GetTextureIconFlags());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::DrawWarningIcons(DisplayContext& dc, const Vec3&)
|
||||
{
|
||||
if (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons)
|
||||
{
|
||||
const int warningIconSizeX = OBJECT_TEXTURE_ICON_SIZEX / 2;
|
||||
const int warningIconSizeY = OBJECT_TEXTURE_ICON_SIZEY / 2;
|
||||
|
||||
const int iconOffsetX = m_nTextureIcon ? (-OBJECT_TEXTURE_ICON_SIZEX / 2) : 0;
|
||||
const int iconOffsetY = m_nTextureIcon ? (-OBJECT_TEXTURE_ICON_SIZEY / 2) : 0;
|
||||
|
||||
if (gSettings.viewports.bShowScaleWarnings)
|
||||
{
|
||||
const EScaleWarningLevel scaleWarningLevel = GetScaleWarningLevel();
|
||||
|
||||
if (scaleWarningLevel != eScaleWarningLevel_None)
|
||||
{
|
||||
dc.SetColor(QColor(255, scaleWarningLevel == eScaleWarningLevel_RescaledNonUniform ? 50 : 255, 50), 1.0f);
|
||||
dc.DrawTextureLabel(GetTextureIconDrawPos(), warningIconSizeX, warningIconSizeY,
|
||||
GetIEditor()->GetIconManager()->GetIconTexture(eIcon_ScaleWarning), GetTextureIconFlags(),
|
||||
-warningIconSizeX / 2, iconOffsetX - (warningIconSizeY / 2));
|
||||
}
|
||||
}
|
||||
|
||||
if (gSettings.viewports.bShowRotationWarnings)
|
||||
{
|
||||
const ERotationWarningLevel rotationWarningLevel = GetRotationWarningLevel();
|
||||
if (rotationWarningLevel != eRotationWarningLevel_None)
|
||||
{
|
||||
dc.SetColor(QColor(255, rotationWarningLevel == eRotationWarningLevel_RotatedNonRectangular ? 50 : 255, 50), 1.0f);
|
||||
dc.DrawTextureLabel(GetTextureIconDrawPos(), warningIconSizeX, warningIconSizeY,
|
||||
GetIEditor()->GetIconManager()->GetIconTexture(eIcon_RotationWarning), GetTextureIconFlags(),
|
||||
warningIconSizeX / 2, iconOffsetY - (warningIconSizeY / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& lC, float alpha, float size)
|
||||
{
|
||||
|
||||
@@ -398,9 +398,6 @@ public:
|
||||
// Interface to be implemented in plugins.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Draw object to specified viewport.
|
||||
virtual void Display([[maybe_unused]] DisplayContext& disp) {}
|
||||
|
||||
//! Perform intersection testing of this object.
|
||||
//! Return true if was hit.
|
||||
virtual bool HitTest([[maybe_unused]] HitContext& hc) { return false; };
|
||||
@@ -529,8 +526,6 @@ protected:
|
||||
void ResolveParent(CBaseObject* object);
|
||||
void SetColor(const QColor& color);
|
||||
|
||||
//! Draw default object items.
|
||||
virtual void DrawDefault(DisplayContext& dc, const QColor& labelColor = QColor(255, 255, 255));
|
||||
//! Draw object label.
|
||||
void DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& labelColor = QColor(255, 255, 255), float alpha = 1.0f, float size = 1.f);
|
||||
//! Draw 3D Axis at object position.
|
||||
@@ -539,10 +534,6 @@ protected:
|
||||
void DrawArea(DisplayContext& dc);
|
||||
//! Draw selection helper.
|
||||
void DrawSelectionHelper(DisplayContext& dc, const Vec3& pos, const QColor& labelColor = QColor(255, 255, 255), float alpha = 1.0f);
|
||||
//! Draw helper icon.
|
||||
virtual void DrawTextureIcon(DisplayContext& dc, const Vec3& pos, float alpha = 1.0f);
|
||||
//! Draw warning icons
|
||||
virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
|
||||
//! Check if dimension's figures can be displayed before draw them.
|
||||
virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = nullptr);
|
||||
|
||||
@@ -575,7 +566,6 @@ protected:
|
||||
//! Only used by ObjectManager.
|
||||
bool IsPotentiallyVisible() const;
|
||||
|
||||
void SetDrawTextureIconProperties(DisplayContext& dc, const Vec3& pos, float alpha = 1.0f, int texIconFlags = 0);
|
||||
const Vec3& GetTextureIconDrawPos(){ return m_vDrawIconPos; };
|
||||
int GetTextureIconFlags(){ return m_nIconFlags; };
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define CLASS_ENVIRONMENT_LIGHT "EnvironmentLight"
|
||||
|
||||
class CEntityObject;
|
||||
class CSelectionGroup;
|
||||
class QMenu;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "ErrorReport.h"
|
||||
#include <AzCore/std/containers/set.h>
|
||||
|
||||
#include <CryCommon/IXml.h>
|
||||
|
||||
class CErrorRecord;
|
||||
struct IObjectManager;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "Util/Image.h"
|
||||
#include "ObjectManagerLegacyUndo.h"
|
||||
#include "Include/HitContext.h"
|
||||
#include "EditMode/DeepSelection.h"
|
||||
#include "Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h"
|
||||
|
||||
#include <AzCore/Console/Console.h>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/dialog/PakManager">
|
||||
<file alias="file.png">res/pakmanager_file.png</file>
|
||||
<file alias="folder.png">res/pakmanager_folder.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,202 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CPakManagerDlg</class>
|
||||
<widget class="QDialog" name="CPakManagerDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>661</width>
|
||||
<height>494</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_OPEN_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open PAK...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_CREATE_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create PAK...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_ADD_FILES_TO_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add files...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_ADD_FOLDERS_TO_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add folder...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_EXTRACT_FILES_FROM_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extract...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_DELETE_FILES_FROM_PAK">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete entries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BUTTON_CLOSE">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="STATIC">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="STATIC_PATH">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><none></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="LIST_FILES">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>120</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Filename</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Modified</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="STATIC_PAK_STATUS">
|
||||
<property name="text">
|
||||
<string>Ready</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="PROGRESS">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="PakManagerDlg.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# 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(LY_COMPILE_OPTIONS PRIVATE -fexceptions)
|
||||
@@ -723,97 +723,6 @@ CComponentEntityObject* CComponentEntityObject::FindObjectForEntity(AZ::EntityId
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CComponentEntityObject::Display(DisplayContext& dc)
|
||||
{
|
||||
if (!(dc.flags & DISPLAY_2D))
|
||||
{
|
||||
m_entityIconVisible = false;
|
||||
}
|
||||
|
||||
bool displaySelectionHelper = false;
|
||||
if (!CanBeDrawn(dc, displaySelectionHelper))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawDefault(dc);
|
||||
|
||||
bool showIcons = m_hasIcon;
|
||||
if (showIcons)
|
||||
{
|
||||
SEditorSettings* editorSettings = GetIEditor()->GetEditorSettings();
|
||||
if (!editorSettings->viewports.bShowIcons && !editorSettings->viewports.bShowSizeBasedIcons)
|
||||
{
|
||||
showIcons = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_entityId.IsValid())
|
||||
{
|
||||
// Draw link to parent if this or the parent object are selected.
|
||||
{
|
||||
AZ::EntityId parentId;
|
||||
EBUS_EVENT_ID_RESULT(parentId, m_entityId, AZ::TransformBus, GetParentId);
|
||||
if (parentId.IsValid())
|
||||
{
|
||||
bool isParentVisible = false;
|
||||
AzToolsFramework::EditorEntityInfoRequestBus::EventResult(isParentVisible, parentId, &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsVisible);
|
||||
|
||||
CComponentEntityObject* parentObject = CComponentEntityObject::FindObjectForEntity(parentId);
|
||||
if (isParentVisible && (IsSelected() || (parentObject && parentObject->IsSelected())))
|
||||
{
|
||||
const QColor kLinkColorParent(0, 255, 255);
|
||||
const QColor kLinkColorChild(0, 0, 255);
|
||||
|
||||
AZ::Vector3 parentTranslation;
|
||||
EBUS_EVENT_ID_RESULT(parentTranslation, parentId, AZ::TransformBus, GetWorldTranslation);
|
||||
dc.DrawLine(AZVec3ToLYVec3(parentTranslation), GetWorldTM().GetTranslation(), kLinkColorParent, kLinkColorChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't draw icons if we have an ancestor in the same location that has an icon - makes sure
|
||||
// ancestor icons draw on top and are able to be selected over children. Also check if a descendant
|
||||
// is selected at the same location. In cases of entity hierarchies where numerous ancestors have
|
||||
// no position offset, we need this so the ancestors don't draw over us when we're selected
|
||||
if (showIcons)
|
||||
{
|
||||
if ((dc.flags & DISPLAY_2D) ||
|
||||
IsSelected() ||
|
||||
IsAncestorIconDrawingAtSameLocation() ||
|
||||
IsDescendantSelectedAtSameLocation())
|
||||
{
|
||||
showIcons = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow components to override in-editor visualization.
|
||||
{
|
||||
const AzFramework::DisplayContextRequestGuard displayContextGuard(dc);
|
||||
|
||||
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
|
||||
AzFramework::DebugDisplayRequestBus::Bind(
|
||||
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
|
||||
|
||||
AzFramework::DebugDisplayRequests* debugDisplay =
|
||||
AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
|
||||
|
||||
AzFramework::EntityDebugDisplayEventBus::Event(
|
||||
m_entityId, &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
|
||||
AzFramework::ViewportInfo{ dc.GetView()->asCViewport()->GetViewportId() },
|
||||
*debugDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentEntityObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
|
||||
{
|
||||
CEntityObject::DrawDefault(dc, labelColor);
|
||||
|
||||
DrawAccent(dc);
|
||||
}
|
||||
|
||||
bool CComponentEntityObject::IsIsolated() const
|
||||
{
|
||||
return m_isIsolated;
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
bool SetRotation(const Quat& rotate, int flags) override;
|
||||
bool SetScale(const Vec3& scale, int flags) override;
|
||||
void InvalidateTM(int nWhyFlags) override;
|
||||
void Display(DisplayContext& disp) override;
|
||||
bool HitTest(HitContext& hc) override;
|
||||
void GetLocalBounds(AABB& box) override;
|
||||
void GetBoundBox(AABB& box) override;
|
||||
@@ -69,7 +68,6 @@ public:
|
||||
void DetachThis(bool bKeepPos = true) override;
|
||||
XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode) override;
|
||||
void DeleteEntity() override;
|
||||
void DrawDefault(DisplayContext& dc, const QColor& labelColor = QColor(255, 255, 255)) override;
|
||||
|
||||
bool IsIsolated() const override;
|
||||
bool IsSelected() const override;
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <AzToolsFramework/ToolsComponents/SelectionComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/Editor/RichTextHighlighter.h>
|
||||
|
||||
#include "OutlinerDisplayOptionsMenu.h"
|
||||
#include "OutlinerSortFilterProxyModel.hxx"
|
||||
@@ -252,17 +253,7 @@ QVariant OutlinerListModel::dataForName(const QModelIndex& index, int role) cons
|
||||
if (s_paintingName && !m_filterString.empty())
|
||||
{
|
||||
// highlight characters in filter
|
||||
int highlightTextIndex = 0;
|
||||
do
|
||||
{
|
||||
highlightTextIndex = label.lastIndexOf(QString(m_filterString.c_str()), highlightTextIndex - 1, Qt::CaseInsensitive);
|
||||
if (highlightTextIndex >= 0)
|
||||
{
|
||||
const QString BACKGROUND_COLOR{ "#707070" };
|
||||
label.insert(static_cast<int>(highlightTextIndex + m_filterString.length()), "</span>");
|
||||
label.insert(highlightTextIndex, "<span style=\"background-color: " + BACKGROUND_COLOR + "\">");
|
||||
}
|
||||
} while(highlightTextIndex > 0);
|
||||
label = AzToolsFramework::RichTextHighlighter::HighlightText(label, m_filterString.c_str());
|
||||
}
|
||||
return label;
|
||||
}
|
||||
@@ -2608,17 +2599,13 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
|
||||
optionV4.text.clear();
|
||||
optionV4.widget->style()->drawControl(QStyle::CE_ItemViewItem, &optionV4, painter);
|
||||
|
||||
// Now we setup a Text Document so it can draw the rich text
|
||||
QTextDocument textDoc;
|
||||
textDoc.setDefaultFont(optionV4.font);
|
||||
textDoc.setDefaultStyleSheet("body {color: white}");
|
||||
textDoc.setHtml("<body>" + entityNameRichText + "</body>");
|
||||
int verticalOffset = GetEntityNameVerticalOffset(entityId);
|
||||
painter->translate(textRect.topLeft() + QPoint(0, verticalOffset));
|
||||
textDoc.setTextWidth(textRect.width());
|
||||
textDoc.drawContents(painter, QRectF(0, 0, textRect.width(), textRect.height()));
|
||||
|
||||
AzToolsFramework::RichTextHighlighter::PaintHighlightedRichText(
|
||||
entityNameRichText, painter, optionV4, textRect, QPoint(0, verticalOffset));
|
||||
|
||||
painter->restore();
|
||||
|
||||
OutlinerListModel::s_paintingName = false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -196,7 +196,6 @@
|
||||
#define ID_FILE_EXPORT_TERRAINAREA 33904
|
||||
#define ID_FILE_EXPORT_TERRAINAREAWITHOBJECTS 33910
|
||||
#define ID_FILE_EXPORT_SELECTEDOBJECTS 33911
|
||||
#define ID_TERRAIN_TIMEOFDAY 33912
|
||||
#define ID_SPLINE_PREVIOUS_KEY 33916
|
||||
#define ID_SPLINE_NEXT_KEY 33917
|
||||
#define ID_SPLINE_FLATTEN_ALL 33918
|
||||
@@ -290,7 +289,6 @@
|
||||
#define ID_TV_TRACKS_TOOLBAR_LAST 35183 // for up to 100 "Add Tracks..." dynamically added Track View Track buttons
|
||||
#define ID_OPEN_TERRAIN_EDITOR 36007
|
||||
#define ID_OPEN_UICANVASEDITOR 36010
|
||||
#define ID_TERRAIN_TIMEOFDAYBUTTON 36011
|
||||
#define ID_OPEN_TERRAINTEXTURE_EDITOR 36012
|
||||
#define ID_SKINS_REFRESH 36014
|
||||
#define ID_FILE_GENERATETERRAIN 36016
|
||||
|
||||
@@ -1,67 +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 "EditorDefs.h"
|
||||
|
||||
#include "SelectEAXPresetDlg.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include "ui_SelectEAXPresetDlg.h"
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
CSelectEAXPresetDlg::CSelectEAXPresetDlg(QWidget* pParent)
|
||||
: QDialog(pParent)
|
||||
, m_ui(new Ui_CSelectEAXPresetDlg)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
CSelectEAXPresetDlg::~CSelectEAXPresetDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CSelectEAXPresetDlg::SetCurrPreset(const QString& sPreset)
|
||||
{
|
||||
QAbstractListModel* model = Model();
|
||||
if (!model)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndexList indexes = model->match(QModelIndex(), Qt::DisplayRole, sPreset, 1, Qt::MatchExactly);
|
||||
|
||||
if (!indexes.isEmpty())
|
||||
{
|
||||
m_ui->listView->setCurrentIndex(indexes.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
QString CSelectEAXPresetDlg::GetCurrPreset() const
|
||||
{
|
||||
if (m_ui->listView->currentIndex().isValid())
|
||||
{
|
||||
return m_ui->listView->currentIndex().data().toString();
|
||||
}
|
||||
// EXCEPTION: OCX Property Pages should return false
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
void CSelectEAXPresetDlg::SetModel(QAbstractListModel* model)
|
||||
{
|
||||
m_ui->listView->setModel(model);
|
||||
}
|
||||
|
||||
QAbstractListModel* CSelectEAXPresetDlg::Model() const
|
||||
{
|
||||
return static_cast<QAbstractListModel*>(m_ui->listView->model());
|
||||
}
|
||||
|
||||
#include "moc_SelectEAXPresetDlg.cpp"
|
||||
@@ -1,43 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
// CSelectEAXPresetDlg dialog
|
||||
#ifndef CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
|
||||
#define CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QDialog>
|
||||
#endif
|
||||
|
||||
class QAbstractListModel;
|
||||
class Ui_CSelectEAXPresetDlg;
|
||||
|
||||
class CSelectEAXPresetDlg
|
||||
: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CSelectEAXPresetDlg(QWidget* pParent = nullptr); // standard constructor
|
||||
~CSelectEAXPresetDlg();
|
||||
|
||||
void SetCurrPreset(const QString& sPreset);
|
||||
QString GetCurrPreset() const;
|
||||
|
||||
protected:
|
||||
void SetModel(QAbstractListModel* model);
|
||||
QAbstractListModel* Model() const;
|
||||
|
||||
private:
|
||||
Ui_CSelectEAXPresetDlg* m_ui;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSelectEAXPresetDlg</class>
|
||||
<widget class="QDialog" name="CSelectEAXPresetDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>197</width>
|
||||
<height>233</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Select Preset...</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>listView</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CSelectEAXPresetDlg</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>51</x>
|
||||
<y>207</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>49</x>
|
||||
<y>199</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CSelectEAXPresetDlg</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>148</x>
|
||||
<y>213</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>131</x>
|
||||
<y>199</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -142,9 +142,6 @@ SEditorSettings::SEditorSettings()
|
||||
viewports.bShowMeshStatsOnMouseOver = false;
|
||||
viewports.bDrawEntityLabels = false;
|
||||
viewports.bShowTriggerBounds = false;
|
||||
viewports.bShowIcons = true;
|
||||
viewports.bDistanceScaleIcons = true;
|
||||
viewports.bShowSizeBasedIcons = false;
|
||||
viewports.nShowFrozenHelpers = true;
|
||||
viewports.bFillSelectedShapes = false;
|
||||
viewports.nTopMapTextureResolution = 512;
|
||||
@@ -534,8 +531,6 @@ void SEditorSettings::Save(bool isEditorClosing)
|
||||
SaveValue("Settings", "ShowMeshStatsOnMouseOver", viewports.bShowMeshStatsOnMouseOver);
|
||||
SaveValue("Settings", "DrawEntityLabels", viewports.bDrawEntityLabels);
|
||||
SaveValue("Settings", "ShowTriggerBounds", viewports.bShowTriggerBounds);
|
||||
SaveValue("Settings", "ShowIcons", viewports.bShowIcons);
|
||||
SaveValue("Settings", "ShowSizeBasedIcons", viewports.bShowSizeBasedIcons);
|
||||
SaveValue("Settings", "ShowFrozenHelpers", viewports.nShowFrozenHelpers);
|
||||
SaveValue("Settings", "FillSelectedShapes", viewports.bFillSelectedShapes);
|
||||
SaveValue("Settings", "MapTextureResolution", viewports.nTopMapTextureResolution);
|
||||
@@ -736,8 +731,6 @@ void SEditorSettings::Load()
|
||||
LoadValue("Settings", "ShowMeshStatsOnMouseOver", viewports.bShowMeshStatsOnMouseOver);
|
||||
LoadValue("Settings", "DrawEntityLabels", viewports.bDrawEntityLabels);
|
||||
LoadValue("Settings", "ShowTriggerBounds", viewports.bShowTriggerBounds);
|
||||
LoadValue("Settings", "ShowIcons", viewports.bShowIcons);
|
||||
LoadValue("Settings", "ShowSizeBasedIcons", viewports.bShowSizeBasedIcons);
|
||||
LoadValue("Settings", "ShowFrozenHelpers", viewports.nShowFrozenHelpers);
|
||||
LoadValue("Settings", "FillSelectedShapes", viewports.bFillSelectedShapes);
|
||||
LoadValue("Settings", "MapTextureResolution", viewports.nTopMapTextureResolution);
|
||||
|
||||
@@ -136,13 +136,6 @@ struct SViewportsSettings
|
||||
bool bDrawEntityLabels;
|
||||
//! Show Trigger bounds.
|
||||
bool bShowTriggerBounds;
|
||||
//! Show Icons in viewport.
|
||||
bool bShowIcons;
|
||||
//! Scale icons with distance, so they aren't a fixed size no matter how far away you are
|
||||
bool bDistanceScaleIcons;
|
||||
|
||||
//! Show Size-based Icons in viewport.
|
||||
bool bShowSizeBasedIcons;
|
||||
|
||||
//! Show Helpers in viewport for frozen objects.
|
||||
int nShowFrozenHelpers;
|
||||
|
||||
@@ -1,23 +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 "EditorDefs.h"
|
||||
|
||||
#include "SurfaceTypeValidator.h"
|
||||
|
||||
// Editor
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/BaseObject.h"
|
||||
#include "ErrorReport.h"
|
||||
|
||||
|
||||
void CSurfaceTypeValidator::Validate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,24 +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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
|
||||
#define CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
class CSurfaceTypeValidator
|
||||
{
|
||||
public:
|
||||
void Validate();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5201dbba6c8114914ed680b04b72a5e18e22c0519a514bcccdc7ae8d32670b4e
|
||||
size 993
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:48a7250ad41c5e298079ddd13910b58baca2ef592defcc162ccc9df542d28905
|
||||
size 981
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:98b9e9abcc54b4f3e6903ad74bb50f364bfe4c8cd9fedc9653a6603d64a1ee0a
|
||||
size 838
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1199c834fc8de69f9d7c76e8c7fbd84e9b92713b9f07b513137085e5089432cb
|
||||
size 857
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:79b44be1dbe5518e06dc8c8823d00462136d39ffe60a32ef4f64dc0712654d33
|
||||
size 646
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6ea7450c1a278570e2a1dba3a8b4d7d4e5f0d054e8371139ebdb5220c405d355
|
||||
size 537
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bc73f0720f2ff877aff5c6646938b7fc509a69d92e766fecb9fa010eecadee7b
|
||||
size 606
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e63519ed54fc19a4b4a2a38cb2c5f148b7404ac614d4aab039b71fee64cd7425
|
||||
size 569
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8742cad4b8f8f5bba59abb9cc028db84de222ed8b393398f6837fea16bb4a1d8
|
||||
size 563
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ef85628301b4edc4f858f0988e4f072772be3feb92d27a2ec33b72a27bcee7ff
|
||||
size 583
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d17bfbdee6d37566b241adf64241ef47b62145aaac3e9e8f9691d1fb866b5fcb
|
||||
size 717
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:98b629abf927bcea41d8857b1761d12a37836471d7106b2f5210337c0ace0d9c
|
||||
size 1103
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e949111b33e28834995807cab30ecb58d988a81a2d58fa166117962c85b8e149
|
||||
size 849
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user