Files
o3de/Code/Editor/Include/IEditorClassFactory.h
T
Esteban Papp 1f9b284de2 Merge branch 'development' into cmake/SPEC-7179
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Editor/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin_precompiled.h
#	Code/Editor/Plugins/EditorCommon/EditorCommon_precompiled.h
#	Code/Editor/Plugins/EditorCommon/stdafx.cpp
#	Code/Editor/Plugins/FFMPEGPlugin/FFMPEGPlugin_precompiled.h
#	Code/Editor/Plugins/PerforcePlugin/PerforcePlugin_precompiled.h
#	Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsTool_precompiled.h
#	Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFramework_precompiled.h
#	Code/Tools/AssetProcessor/native/precompiled.h
#	Code/Tools/Standalone/StandaloneTools_precompiled.h
#	Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer_precompiled.h
#	Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessing_precompiled.h
#	Gems/Atom/RHI/DX12/Code/Source/RHI/Atom_RHI_DX12_precompiled.h
#	Gems/Atom/RHI/Metal/Code/Include/Platform/Mac/Atom_RHI_Metal_precompiled_Platform.h
#	Gems/Atom/RHI/Metal/Code/Include/Platform/iOS/Atom_RHI_Metal_precompiled_Platform.h
#	Gems/Atom/RHI/Metal/Code/Source/Atom_RHI_Metal_precompiled.h
#	Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake
#	Gems/Atom/RHI/Null/Code/Source/Atom_RHI_Null_precompiled.h
#	Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake
#	Gems/Atom/RHI/Vulkan/Code/Include/Platform/Android/Atom_RHI_Vulkan_precompiled_Platform.h
#	Gems/Atom/RHI/Vulkan/Code/Include/Platform/Linux/Atom_RHI_Vulkan_precompiled_Platform.h
#	Gems/Atom/RHI/Vulkan/Code/Include/Platform/Mac/Atom_RHI_Vulkan_precompiled_Platform.h
#	Gems/Atom/RHI/Vulkan/Code/Include/Platform/Windows/Atom_RHI_Vulkan_precompiled_Platform.h
#	Gems/Atom/RHI/Vulkan/Code/Source/Atom_RHI_Vulkan_precompiled.h
#	Gems/Atom/RHI/Vulkan/Code/Source/RHI/SwapChain.cpp
#	Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake
#	Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont_precompiled.h
#	Gems/Blast/Code/Source/StdAfx.cpp
#	Gems/Camera/Code/Source/Camera_precompiled.h
#	Gems/EMotionFX/Code/Source/EMotionFX_precompiled.h
#	Gems/FastNoise/Code/Source/FastNoise_precompiled.h
#	Gems/Gestures/Code/Source/Gestures_precompiled.h
#	Gems/GradientSignal/Code/Source/GradientSignal_precompiled.h
#	Gems/GraphCanvas/Code/precompiled.h
#	Gems/ImGui/Code/Source/ImGui_precompiled.h
#	Gems/InAppPurchases/Code/Source/InAppPurchases_precompiled.h
#	Gems/LmbrCentral/Code/Source/LmbrCentral_precompiled.h
#	Gems/LmbrCentral/Code/Tests/ShapeGeometryUtilTest.cpp
#	Gems/LyShine/Code/Editor/UiCanvasEditor_precompiled.h
#	Gems/LyShine/Code/Source/Animation/LyShine_precompiled.h
#	Gems/LyShine/Code/Source/LyShine_precompiled.h
#	Gems/LyShineExamples/Code/Source/LyShineExamples_precompiled.h
#	Gems/Maestro/Code/Source/Cinematics/Maestro_precompiled.h
#	Gems/Maestro/Code/Source/Maestro_precompiled.h
#	Gems/MessagePopup/Code/Source/MessagePopup_precompiled.h
#	Gems/Metastream/Code/Source/Metastream_precompiled.h
#	Gems/Microphone/Code/Source/Microphone_precompiled.h
#	Gems/Multiplayer/Code/Source/Multiplayer_precompiled.h
#	Gems/PhysX/Code/NumericalMethods/Source/NumericalMethods_precompiled.h
#	Gems/PhysX/Code/Source/PhysXUnsupported_precompiled.h
#	Gems/PhysX/Code/Source/PhysX_precompiled.h
#	Gems/PhysX/Code/physx_unsupported_files.cmake
#	Gems/PhysXDebug/Code/Source/PhysXDebugUnsupported_precompiled.h
#	Gems/PhysXDebug/Code/Source/PhysXDebug_precompiled.h
#	Gems/ScriptCanvas/Code/Editor/precompiled.h
#	Gems/ScriptCanvas/Code/Source/precompiled.h
#	Gems/ScriptCanvasDeveloper/Code/Source/precompiled.h
#	Gems/ScriptCanvasPhysics/Code/Source/ScriptCanvasPhysics_precompiled.h
#	Gems/ScriptEvents/Code/Source/precompiled.h
#	Gems/ScriptEvents/Code/Tests/Editor/EditorTests.cpp
#	Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweener_precompiled.h
#	Gems/SliceFavorites/Code/Source/SliceFavorites_precompiled.h
#	Gems/StartingPointCamera/Code/Source/StartingPointCamera_precompiled.h
#	Gems/StartingPointInput/Code/Source/StartingPointInput_precompiled.h
#	Gems/StartingPointMovement/Code/Source/StartingPointMovement_precompiled.h
#	Gems/SurfaceData/Code/Source/SurfaceData_precompiled.h
#	Gems/TextureAtlas/Code/Source/TextureAtlas_precompiled.h
#	Gems/TickBusOrderViewer/Code/Source/TickBusOrderViewer_precompiled.h
#	Gems/Twitch/Code/Source/Twitch_precompiled.h
#	Gems/VirtualGamepad/Code/Source/VirtualGamepad_precompiled.h
#	Gems/WhiteBox/Code/Source/WhiteBoxUnsupported_precompiled.h
#	Gems/WhiteBox/Code/Source/WhiteBox_precompiled.h
2021-07-16 15:42:37 -07:00

162 lines
5.2 KiB
C++

/*
* 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 : Class factory support classes
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
#pragma once
#include <vector>
#include <QtCore/QString>
#define DEFINE_UUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID uuid() { return { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; }
#ifdef AZ_PLATFORM_WINDOWS
#include <Unknwn.h>
#else
struct IUnknown
{
virtual ~IUnknown() = default;
};
#endif
#ifdef __uuidof
#undef __uuidof
#endif
#define __uuidof(T) T::uuid()
#if defined(AZ_PLATFORM_LINUX)
# ifndef _REFGUID_DEFINED
# define _REFGUID_DEFINED
typedef const GUID& REFGUID;
# endif
# ifndef _REFIID_DEFINED
# define _REFIID_DEFINED
typedef const GUID& REFIID;
# endif
# ifndef IID_DEFINED
# define IID_DEFINED
typedef GUID IID;
# endif
#ifndef HRESULT_VALUES_DEFINED
#define HRESULT_VALUES_DEFINED
enum
{
E_OUTOFMEMORY = 0x8007000E,
E_FAIL = 0x80004005,
E_ABORT = 0x80004004,
E_INVALIDARG = 0x80070057,
E_NOINTERFACE = 0x80004002,
E_NOTIMPL = 0x80004001,
E_UNEXPECTED = 0x8000FFFF
};
#endif
#endif // defined(AZ_PLATFORM_LINUX)
#include "SandboxAPI.h"
class QObject;
//! System class IDs
enum ESystemClassID
{
ESYSTEM_CLASS_OBJECT = 0x0001,
ESYSTEM_CLASS_EDITTOOL = 0x0002,
ESYSTEM_CLASS_PREFERENCE_PAGE = 0x0020,
ESYSTEM_CLASS_VIEWPANE = 0x0021,
//! Source/Asset Control Management Provider
ESYSTEM_CLASS_SCM_PROVIDER = 0x0022,
ESYSTEM_CLASS_CONSOLE_CONNECTIVITY = 0x0023,
ESYSTEM_CLASS_ASSET_DISPLAY = 0x0024,
ESYSTEM_CLASS_ASSET_TAGGING = 0x0025,
ESYSTEM_CLASS_FRAMEWND_EXTENSION_PANE = 0x0030,
ESYSTEM_CLASS_TRACKVIEW_KEYUI = 0x0040,
ESYSTEM_CLASS_UITOOLS = 0x0050, // UI Emulator tool
ESYSTEM_CLASS_CONTROL = 0x0900,
ESYSTEM_CLASS_USER = 0x1000
};
//! This interface describes a class created by a plugin
struct IClassDesc
: public IUnknown
{
//////////////////////////////////////////////////////////////////////////
// IUnknown implementation.
//////////////////////////////////////////////////////////////////////////
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObj) { return E_NOINTERFACE; }
virtual ULONG STDMETHODCALLTYPE AddRef() { return 0; }
virtual ULONG STDMETHODCALLTYPE Release() { return 0; }
template<class Q>
HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
{
return QueryInterface(__uuidof(Q), (void**)pp);
}
//////////////////////////////////////////////////////////////////////////
// Class description.
//////////////////////////////////////////////////////////////////////////
//! This method returns an Editor defined GUID describing the class this plugin class is associated with.
virtual ESystemClassID SystemClassID() = 0;
//! Return the GUID of the class created by plugin.
virtual REFGUID ClassID() = 0;
//! This method returns the human readable name of the class.
virtual QString ClassName() = 0;
//! This method returns Category of this class, Category is specifying where this plugin class fits best in
//! create panel.
virtual QString Category() = 0;
virtual QString MenuSuggestion() { return QString(); }
virtual QString Tooltip() { return QString(); }
virtual QString Description() { return QString(); }
//! This method returns if the plugin should have a menu item for its pane.
virtual bool ShowInMenu() const { return true; }
//! Qt equivalent of CRuntimeClass::CreateObject(). We might create a full QRuntimeClass, if there's a need for it.
virtual QObject* CreateQObject() const { return nullptr; }
//! For any class that may be conditionally enabled or disabled, this function can be overriden to return true if it is enabled, false otherwise.
//! The default is to always return true.
virtual bool IsEnabled() const { return true; }
//////////////////////////////////////////////////////////////////////////
};
struct IViewPaneClass;
struct CRYEDIT_API IEditorClassFactory
{
public:
virtual ~IEditorClassFactory() = default;
//! Register new class to the factory.
virtual void RegisterClass(IClassDesc* pClassDesc) = 0;
//! Find class in the factory by class name.
virtual IClassDesc* FindClass(const char* pClassName) const = 0;
//! Find class in the factory by class id
virtual IClassDesc* FindClass(const GUID& rClassID) const = 0;
virtual IViewPaneClass* FindViewPaneClassByTitle(const char* pPaneTitle) const = 0;
virtual void UnregisterClass(const char* pClassName) = 0;
virtual void UnregisterClass(const GUID& rClassID) = 0;
//! Get classes that matching specific requirements.
virtual void GetClassesBySystemID(ESystemClassID aSystemClassID, std::vector<IClassDesc*>& rOutClasses) = 0;
virtual void GetClassesByCategory(const char* pCategory, std::vector<IClassDesc*>& rOutClasses) = 0;
};
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H