Removed legacy editor DatabaseLibrary code.

Signed-off-by: Chris Galvan <chgalvan@amazon.com>
This commit is contained in:
Chris Galvan
2022-01-06 10:12:54 -06:00
parent 14661af13f
commit fee88cf5c6
28 changed files with 4 additions and 2430 deletions
-143
View File
@@ -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
-92
View File
@@ -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
-118
View File
@@ -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
-134
View File
@@ -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
-20
View File
@@ -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
-4
View File
@@ -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;
};