IEditor.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/PlatformDef.h>
  10. #ifdef PLUGIN_EXPORTS
  11. #define PLUGIN_API AZ_DLL_EXPORT
  12. #else
  13. #define PLUGIN_API AZ_DLL_IMPORT
  14. #endif
  15. #include <ISystem.h>
  16. #include "Include/SandboxAPI.h"
  17. #include "Util/UndoUtil.h"
  18. #include <CryVersion.h>
  19. #include <AzCore/Component/EntityId.h>
  20. #include <AzCore/Debug/Budget.h>
  21. class QMenu;
  22. struct CRuntimeClass;
  23. struct QtViewPane;
  24. class QMainWindow;
  25. struct QMetaObject;
  26. class CBaseObject;
  27. class CCryEditDoc;
  28. class CAnimationContext;
  29. class CTrackViewSequenceManager;
  30. class CGameEngine;
  31. class CToolBoxManager;
  32. class CClassFactory;
  33. class CMusicManager;
  34. struct IEditorParticleManager;
  35. class CEAXPresetManager;
  36. class CErrorReport;
  37. class ICommandManager;
  38. class CEditorCommandManager;
  39. class CConsoleSynchronization;
  40. struct ISourceControl;
  41. struct IEditorClassFactory;
  42. class CDialog;
  43. #if defined(AZ_PLATFORM_WINDOWS)
  44. class C3DConnexionDriver;
  45. #endif
  46. class CSettingsManager;
  47. class CDisplaySettings;
  48. class CLevelIndependentFileMan;
  49. class CSelectionTreeManager;
  50. struct SEditorSettings;
  51. class CGameExporter;
  52. class IAWSResourceManager;
  53. struct ISystem;
  54. struct IRenderer;
  55. struct AABB;
  56. struct IErrorReport; // Vladimir@conffx
  57. struct IFileUtil; // Vladimir@conffx
  58. struct IEditorLog; // Vladimir@conffx
  59. struct IImageUtil; // Vladimir@conffx
  60. struct IEditorParticleUtils; // Leroy@conffx
  61. struct ILogFile; // Vladimir@conffx
  62. // Qt
  63. class QWidget;
  64. class QMimeData;
  65. class QString;
  66. class QColor;
  67. class QPixmap;
  68. #if !AZ_TRAIT_OS_PLATFORM_APPLE && !defined(AZ_PLATFORM_LINUX)
  69. typedef void* HANDLE;
  70. struct HWND__;
  71. typedef HWND__* HWND;
  72. #endif
  73. namespace Editor
  74. {
  75. class EditorQtApplication;
  76. }
  77. // Global editor notify events.
  78. enum EEditorNotifyEvent
  79. {
  80. // Global events.
  81. eNotify_OnInit = 10, // Sent after editor fully initialized.
  82. eNotify_OnQuit, // Sent before editor quits.
  83. eNotify_OnIdleUpdate, // Sent every frame while editor is idle.
  84. // Document events.
  85. eNotify_OnBeginNewScene, // Sent when the document is begin to be cleared.
  86. eNotify_OnEndNewScene, // Sent after the document have been cleared.
  87. eNotify_OnBeginSceneOpen, // Sent when document is about to be opened.
  88. eNotify_OnEndSceneOpen, // Sent after document have been opened.
  89. eNotify_OnBeginSceneSave, // Sent when document is about to be saved.
  90. eNotify_OnEndSceneSave, // Sent after document have been saved.
  91. eNotify_OnBeginLayerExport, // Sent when a layer is about to be exported.
  92. eNotify_OnEndLayerExport, // Sent after a layer have been exported.
  93. eNotify_OnCloseScene, // Send when the document is about to close.
  94. eNotify_OnSceneClosed, // Send when the document is closed.
  95. eNotify_OnBeginLoad, // Sent when the document is start to load.
  96. eNotify_OnEndLoad, // Sent when the document loading is finished
  97. // Editing events.
  98. eNotify_OnEditModeChange, // Sent when editing mode change (move,rotate,scale,....)
  99. eNotify_OnEditToolChange, // Sent when edit tool is changed (ObjectMode,TerrainModify,....)
  100. // Game related events.
  101. eNotify_OnBeginGameMode, // Sent when editor goes to game mode.
  102. eNotify_OnEndGameMode, // Sent when editor goes out of game mode.
  103. // AI/Physics simulation related events.
  104. eNotify_OnBeginSimulationMode, // Sent when simulation mode is started.
  105. eNotify_OnEndSimulationMode, // Sent when editor goes out of simulation mode.
  106. // UI events.
  107. eNotify_OnUpdateViewports, // Sent when editor needs to update data in the viewports.
  108. eNotify_OnReloadTrackView, // Sent when editor needs to update the track view.
  109. eNotify_OnSplashScreenCreated, // Sent when the editor splash screen was created.
  110. eNotify_OnSplashScreenDestroyed, // Sent when the editor splash screen was destroyed.
  111. eNotify_OnInvalidateControls, // Sent when editor needs to update some of the data that can be cached by controls like combo boxes.
  112. eNotify_OnStyleChanged, // Sent when UI color theme was changed
  113. // Object events.
  114. eNotify_OnSelectionChange, // Sent when object selection change.
  115. eNotify_OnPlaySequence, // Sent when editor start playing animation sequence.
  116. eNotify_OnStopSequence, // Sent when editor stop playing animation sequence.
  117. // Task specific events.
  118. eNotify_OnDataBaseUpdate, // DataBase Library was modified.
  119. eNotify_OnLayerImportBegin, //layer import was started
  120. eNotify_OnLayerImportEnd, //layer import completed
  121. eNotify_OnBeginSWNewScene, // Sent when SW document is begin to be cleared.
  122. eNotify_OnEndSWNewScene, // Sent after SW document have been cleared.
  123. eNotify_OnBeginSWMoveTo, // moveto operation was started
  124. eNotify_OnEndSWMoveTo, // moveto operation completed
  125. eNotify_OnSWLockUnlock, // Sent when commit, rollback or getting lock from segmented world
  126. eNotify_OnSWVegetationStatusChange, // When changed segmented world status of vegetation map
  127. eNotify_OnBeginUndoRedo,
  128. eNotify_OnEndUndoRedo,
  129. eNotify_CameraChanged, // When the active viewport camera was changed
  130. eNotify_OnTextureLayerChange, // Sent when texture layer was added, removed or moved
  131. eNotify_OnSplatmapImport, // Sent when splatmaps get imported
  132. eNotify_OnParticleUpdate, // A particle effect was modified.
  133. eNotify_OnAddAWSProfile, // An AWS profile was added
  134. eNotify_OnSwitchAWSProfile, // The AWS profile was switched
  135. eNotify_OnSwitchAWSDeployment, // The AWS deployment was switched
  136. eNotify_OnFirstAWSUse, // This should only be emitted once
  137. eNotify_OnRefCoordSysChange,
  138. // Entity selection events.
  139. eNotify_OnEntitiesSelected,
  140. eNotify_OnEntitiesDeselected,
  141. // More document events - added here in case enum values matter to any event consumers, metrics reporters, etc.
  142. eNotify_OnBeginCreate, // Sent when the document is starting to be created.
  143. eNotify_OnEndCreate, // Sent when the document creation is finished.
  144. };
  145. // UI event handler
  146. struct IUIEvent
  147. {
  148. virtual void OnClick(DWORD dwId) = 0;
  149. virtual bool IsEnabled(DWORD dwId) = 0;
  150. virtual bool IsChecked(DWORD dwId) = 0;
  151. virtual const char* GetUIElementName(DWORD dwId) = 0;
  152. };
  153. //! Add object that implements this interface to Load listeners of IEditor
  154. //! To receive notifications when new document is loaded.
  155. struct IDocListener
  156. {
  157. virtual ~IDocListener() = default;
  158. //! Called after new level is created.
  159. virtual void OnNewDocument() = 0;
  160. //! Called after level have been loaded.
  161. virtual void OnLoadDocument() = 0;
  162. //! Called when document is being closed.
  163. virtual void OnCloseDocument() = 0;
  164. };
  165. //! Derive from this class if you want to register for getting global editor notifications.
  166. struct IEditorNotifyListener
  167. {
  168. bool m_bIsRegistered;
  169. IEditorNotifyListener()
  170. : m_bIsRegistered(false)
  171. {
  172. }
  173. virtual ~IEditorNotifyListener()
  174. {
  175. if (m_bIsRegistered)
  176. {
  177. CryFatalError("Destroying registered IEditorNotifyListener");
  178. }
  179. }
  180. //! called by the editor to notify the listener about the specified event.
  181. virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) = 0;
  182. };
  183. //! Axis constrains value.
  184. enum AxisConstrains
  185. {
  186. AXIS_NONE = 0,
  187. AXIS_X,
  188. AXIS_Y,
  189. AXIS_Z,
  190. AXIS_XY,
  191. AXIS_YZ,
  192. AXIS_XZ,
  193. AXIS_XYZ,
  194. //! Follow terrain constrain
  195. AXIS_TERRAIN,
  196. };
  197. //! Reference coordinate system values
  198. enum RefCoordSys
  199. { // Don't change this order. Should be in the same order as MainWindow::CreateRefCoordComboBox()
  200. COORDS_VIEW = 0,
  201. COORDS_LOCAL,
  202. COORDS_PARENT,
  203. COORDS_WORLD,
  204. COORDS_USERDEFINED,
  205. LAST_COORD_SYSTEM, // Must always be the last member
  206. };
  207. // Insert locations for menu items
  208. enum EMenuInsertLocation
  209. {
  210. // Custom menu of the plugin
  211. eMenuPlugin,
  212. // Predefined editor menus
  213. eMenuEdit,
  214. eMenuFile,
  215. eMenuInsert,
  216. eMenuGenerators,
  217. eMenuScript,
  218. eMenuView,
  219. eMenuHelp
  220. };
  221. //! Global editor operation mode
  222. enum EOperationMode
  223. {
  224. eOperationModeNone = 0, // None
  225. eCompositingMode, // Normal operation mode where objects are composited in the scene
  226. eModellingMode // Geometry modeling mode
  227. };
  228. //! Mouse events that viewport can send
  229. enum EMouseEvent
  230. {
  231. eMouseMove,
  232. eMouseLDown,
  233. eMouseLUp,
  234. eMouseLDblClick,
  235. eMouseRDown,
  236. eMouseRUp,
  237. eMouseRDblClick,
  238. eMouseMDown,
  239. eMouseMUp,
  240. eMouseMDblClick,
  241. eMouseWheel,
  242. eMouseLeave,
  243. };
  244. //! Viewports update flags
  245. enum UpdateConentFlags
  246. {
  247. eUpdateHeightmap = 0x01,
  248. eUpdateStatObj = 0x02,
  249. eUpdateObjects = 0x04, //! Update objects in viewport.
  250. eRedrawViewports = 0x08 //! Just redraw viewports..
  251. };
  252. enum MouseCallbackFlags
  253. {
  254. MK_CALLBACK_FLAGS = 0x100
  255. };
  256. enum EEditorPathName
  257. {
  258. EDITOR_PATH_OBJECTS,
  259. EDITOR_PATH_TEXTURES,
  260. EDITOR_PATH_SOUNDS,
  261. EDITOR_PATH_MATERIALS,
  262. EDITOR_PATH_UI_ICONS,
  263. EDITOR_PATH_LAST
  264. };
  265. enum EModifiedModule
  266. {
  267. eModifiedNothing = 0x0,
  268. eModifiedTerrain = BIT(0),
  269. eModifiedBrushes = BIT(1),
  270. eModifiedEntities = BIT(2),
  271. eModifiedAll = -1
  272. };
  273. //! Class provided by editor for various registration functions.
  274. struct CRegistrationContext
  275. {
  276. CEditorCommandManager* pCommandManager;
  277. CClassFactory* pClassFactory;
  278. };
  279. //! Interface provided by editor to reach status bar functionality.
  280. struct IMainStatusBar
  281. {
  282. virtual void SetStatusText(const QString& text) = 0;
  283. virtual QWidget* SetItem(QString indicatorName, QString text, QString tip, int iconId) = 0;
  284. virtual QWidget* SetItem(QString indicatorName, QString text, QString tip, const QPixmap& icon) = 0;
  285. virtual QWidget* GetItem(QString indicatorName) = 0;
  286. };
  287. // forward declaration
  288. struct IAnimSequence;
  289. class CTrackViewSequence;
  290. //! Interface to expose TrackViewSequenceManager functionality to SequenceComponent
  291. struct ITrackViewSequenceManager
  292. {
  293. virtual IAnimSequence* OnCreateSequenceObject(QString name, bool isLegacySequence = true, AZ::EntityId entityId = AZ::EntityId()) = 0;
  294. //! Notifies of the delete of a sequence entity OR legacy sequence object
  295. //! @param entityId The Sequence Component Entity Id OR the legacy sequence object Id packed in the lower 32-bits, as returned from IAnimSequence::GetSequenceEntityId()
  296. virtual void OnDeleteSequenceEntity(const AZ::EntityId& entityId) = 0;
  297. //! Get the first sequence with the given name. They may be more than one sequence with this name.
  298. //! Only intended for use with scripting or other cases where a user provides a name.
  299. virtual CTrackViewSequence* GetSequenceByName(QString name) const = 0;
  300. //! Get the sequence with the given EntityId. For legacy support, legacy sequences can be found by giving
  301. //! the sequence ID in the lower 32 bits of the EntityId.
  302. virtual CTrackViewSequence* GetSequenceByEntityId(const AZ::EntityId& entityId) const = 0;
  303. virtual void OnCreateSequenceComponent(AZStd::intrusive_ptr<IAnimSequence>& sequence) = 0;
  304. virtual void OnSequenceActivated(const AZ::EntityId& entityId) = 0;
  305. };
  306. //! Interface to expose TrackViewSequence functionality to SequenceComponent
  307. struct ITrackViewSequence
  308. {
  309. virtual void Load() = 0;
  310. };
  311. //! Interface to permit usage of editor functionality inside the plugin
  312. struct IEditor
  313. {
  314. virtual void DeleteThis() = 0;
  315. //! Access to Editor ISystem interface.
  316. virtual ISystem* GetSystem() = 0;
  317. //! Access to class factory.
  318. virtual IEditorClassFactory* GetClassFactory() = 0;
  319. //! Access to commands manager.
  320. virtual CEditorCommandManager* GetCommandManager() = 0;
  321. virtual ICommandManager* GetICommandManager() = 0;
  322. // Executes an Editor command.
  323. virtual void ExecuteCommand(const char* sCommand, ...) = 0;
  324. virtual void ExecuteCommand(const QString& sCommand) = 0;
  325. virtual void SetDocument(CCryEditDoc* pDoc) = 0;
  326. //! Get active document
  327. virtual CCryEditDoc* GetDocument() const = 0;
  328. //! Check if there is a level loaded
  329. virtual bool IsLevelLoaded() const = 0;
  330. //! Set document modified flag.
  331. virtual void SetModifiedFlag(bool modified = true) = 0;
  332. virtual void SetModifiedModule(EModifiedModule eModifiedModule, bool boSet = true) = 0;
  333. virtual bool IsLevelExported() const = 0;
  334. virtual bool SetLevelExported(bool boExported = true) = 0;
  335. //! Check if active document is modified.
  336. virtual bool IsModified() = 0;
  337. //! Save current document.
  338. virtual bool SaveDocument() = 0;
  339. //! Legacy version of WriteToConsole; don't use.
  340. virtual void WriteToConsole(const char* string) = 0;
  341. //! Write the passed string to the editors console
  342. virtual void WriteToConsole(const QString& string) = 0;
  343. //! Set value of console variable.
  344. virtual void SetConsoleVar(const char* var, float value) = 0;
  345. //! Get value of console variable.
  346. virtual float GetConsoleVar(const char* var) = 0;
  347. //! Shows or Hides console window.
  348. //! @return Previous visibility flag of console.
  349. virtual bool ShowConsole(bool show) = 0;
  350. // Get Main window status bar
  351. virtual IMainStatusBar* GetMainStatusBar() = 0;
  352. //! Change the message in the status bar
  353. virtual void SetStatusText(const QString& pszString) = 0;
  354. //! Query main window of the editor
  355. virtual QMainWindow* GetEditorMainWindow() const = 0;
  356. //! Returns the path of the editors Primary CD folder
  357. virtual QString GetPrimaryCDFolder() = 0;
  358. //! Get current level name (name only)
  359. virtual QString GetLevelName() = 0;
  360. //! Get path to folder of current level (Absolute, contains slash)
  361. virtual QString GetLevelFolder() = 0;
  362. //! Get path to folder of current level (absolute)
  363. virtual QString GetLevelDataFolder() = 0;
  364. //! Get path to folder of current level.
  365. virtual QString GetSearchPath(EEditorPathName path) = 0;
  366. //! This folder is supposed to store Sandbox user settings and state
  367. virtual QString GetResolvedUserFolder() = 0;
  368. //! Execute application and get console output.
  369. virtual bool ExecuteConsoleApp(
  370. const QString& CommandLine,
  371. QString& OutputText,
  372. bool bNoTimeOut = false,
  373. bool bShowWindow = false) = 0;
  374. //! Sets the document modified flag in the editor
  375. virtual void SetDataModified() = 0;
  376. //! Tells if editor startup is finished
  377. virtual bool IsInitialized() const = 0;
  378. //! Check if editor running in gaming mode.
  379. virtual bool IsInGameMode() = 0;
  380. //! Check if editor running in AI/Physics mode.
  381. virtual bool IsInSimulationMode() = 0;
  382. //! Set game mode of editor.
  383. virtual void SetInGameMode(bool inGame) = 0;
  384. //! Return true if Editor runs in the testing mode.
  385. virtual bool IsInTestMode() = 0;
  386. //! Return true if Editor runs in the preview mode.
  387. virtual bool IsInPreviewMode() = 0;
  388. //! Return true if Editor runs in the console only mode.
  389. virtual bool IsInConsolewMode() = 0;
  390. //! return true if editor is running the level load tests mode.
  391. virtual bool IsInLevelLoadTestMode() = 0;
  392. //! Enable/Disable updates of editor.
  393. virtual void EnableUpdate(bool enable) = 0;
  394. virtual SFileVersion GetFileVersion() = 0;
  395. virtual SFileVersion GetProductVersion() = 0;
  396. //! Retrieve pointer to game engine instance
  397. virtual CGameEngine* GetGameEngine() = 0;
  398. virtual CDisplaySettings* GetDisplaySettings() = 0;
  399. //! Create new object
  400. virtual CBaseObject* NewObject(const char* typeName, const char* fileName = "", const char* name = "", float x = 0.0f, float y = 0.0f, float z = 0.0f, bool modifyDoc = true) = 0;
  401. //! Delete object
  402. virtual void DeleteObject(CBaseObject* obj) = 0;
  403. //! Get access to object manager.
  404. virtual struct IObjectManager* GetObjectManager() = 0;
  405. virtual CSettingsManager* GetSettingsManager() = 0;
  406. //! Get Music Manager.
  407. virtual CMusicManager* GetMusicManager() = 0;
  408. virtual float GetTerrainElevation(float x, float y) = 0;
  409. virtual Editor::EditorQtApplication* GetEditorQtApplication() = 0;
  410. virtual const QColor& GetColorByName(const QString& name) = 0;
  411. virtual struct IMovieSystem* GetMovieSystem() = 0;
  412. virtual class CPluginManager* GetPluginManager() = 0;
  413. virtual class CViewManager* GetViewManager() = 0;
  414. virtual class CViewport* GetActiveView() = 0;
  415. virtual void SetActiveView(CViewport* viewport) = 0;
  416. virtual struct IEditorFileMonitor* GetFileMonitor() = 0;
  417. //! QMimeData is used by the Qt clipboard.
  418. //! IMPORTANT: Any QMimeData allocated for the clipboard will be deleted
  419. //! when the editor exists. If a QMimeData is allocated by a different
  420. //! memory allocator (for example, in a different DLL) than the one used
  421. //! by the main editor, a crash will occur on exit, if data is left in
  422. //! the clipboard. The solution is to enfore all allocations of QMimeData
  423. //! using CreateQMimeData().
  424. virtual QMimeData* CreateQMimeData() const = 0;
  425. virtual void DestroyQMimeData(QMimeData* data) const = 0;
  426. //////////////////////////////////////////////////////////////////////////
  427. // Access for CLevelIndependentFileMan
  428. // Manager can be used to register as an module that is asked before editor quits / loads level / creates level
  429. // This gives the module the change to save changes or cancel the process
  430. //////////////////////////////////////////////////////////////////////////
  431. virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
  432. //! Notify all views that data is changed.
  433. virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = nullptr) = 0;
  434. virtual void ResetViews() = 0;
  435. //! Update information in track view dialog.
  436. virtual void ReloadTrackView() = 0;
  437. //! Current position marker
  438. virtual Vec3 GetMarkerPosition() = 0;
  439. //! Set current position marker.
  440. virtual void SetMarkerPosition(const Vec3& pos) = 0;
  441. //! Set current selected region.
  442. virtual void SetSelectedRegion(const AABB& box) = 0;
  443. //! Get currently selected region.
  444. virtual void GetSelectedRegion(AABB& box) = 0;
  445. virtual void SetOperationMode(EOperationMode mode) = 0;
  446. virtual EOperationMode GetOperationMode() = 0;
  447. //! Set constrain on specified axis for objects construction and modifications.
  448. //! @param axis one of AxisConstrains enumerations.
  449. virtual void SetAxisConstraints(AxisConstrains axis) = 0;
  450. //! Get axis constrain for objects construction and modifications.
  451. virtual AxisConstrains GetAxisConstrains() = 0;
  452. //! Set whether axes are forced to the same value when they are changed (x = y = z).
  453. virtual void SetAxisVectorLock(bool bAxisVectorLock) = 0;
  454. //! Get whether axes are forced to the same value when they are changed (x = y = z).
  455. virtual bool IsAxisVectorLocked() = 0;
  456. //! If set, when axis terrain constrain is selected, snapping only to terrain.
  457. virtual void SetTerrainAxisIgnoreObjects(bool bIgnore) = 0;
  458. virtual bool IsTerrainAxisIgnoreObjects() = 0;
  459. //! Set current reference coordinate system used when constructing/modifying objects.
  460. virtual void SetReferenceCoordSys(RefCoordSys refCoords) = 0;
  461. //! Get current reference coordinate system used when constructing/modifying objects.
  462. virtual RefCoordSys GetReferenceCoordSys() = 0;
  463. virtual XmlNodeRef FindTemplate(const QString& templateName) = 0;
  464. virtual void AddTemplate(const QString& templateName, XmlNodeRef& tmpl) = 0;
  465. virtual const QtViewPane* OpenView(QString sViewClassName, bool reuseOpen = true) = 0;
  466. virtual QWidget* FindView(QString viewClassName) = 0;
  467. virtual bool CloseView(const char* sViewClassName) = 0;
  468. virtual bool SetViewFocus(const char* sViewClassName) = 0;
  469. virtual void CloseView(const GUID& classId) = 0; // close ALL panels related to classId, used when unloading plugins.
  470. //! Opens standard color selection dialog.
  471. //! Initialized with the color specified in color parameter.
  472. //! Returns true if selection is made and false if selection is canceled.
  473. virtual bool SelectColor(QColor& color, QWidget* parent = 0) = 0;
  474. //! Get shader enumerator.
  475. virtual class CUndoManager* GetUndoManager() = 0;
  476. //! Begin operation requiring undo
  477. //! Undo manager enters holding state.
  478. virtual void BeginUndo() = 0;
  479. //! Restore all undo objects registered since last BeginUndo call.
  480. //! @param bUndo if true all Undo object registered since BeginUpdate call up to this point will be undone.
  481. virtual void RestoreUndo(bool undo = true) = 0;
  482. //! Accept changes and registers an undo object with the undo manager.
  483. //! This will allow the user to undo the operation.
  484. virtual void AcceptUndo(const QString& name) = 0;
  485. //! Cancel changes and restore undo objects.
  486. virtual void CancelUndo() = 0;
  487. //! Normally this is NOT needed but in special cases this can be useful.
  488. //! This allows to group a set of Begin()/Accept() sequences to be undone in one operation.
  489. virtual void SuperBeginUndo() = 0;
  490. //! When a SuperBegin() used, this method is used to Accept.
  491. //! This leaves the undo database in its modified state and registers the IUndoObjects with the undo system.
  492. //! This will allow the user to undo the operation.
  493. virtual void SuperAcceptUndo(const QString& name) = 0;
  494. //! Cancel changes and restore undo objects.
  495. virtual void SuperCancelUndo() = 0;
  496. //! Suspend undo recording.
  497. virtual void SuspendUndo() = 0;
  498. //! Resume undo recording.
  499. virtual void ResumeUndo() = 0;
  500. // Undo last operation.
  501. virtual void Undo() = 0;
  502. //! Redo last undo.
  503. virtual void Redo() = 0;
  504. //! Check if undo information is recording now.
  505. virtual bool IsUndoRecording() = 0;
  506. //! Check if undo information is suspzended now.
  507. virtual bool IsUndoSuspended() = 0;
  508. //! Put new undo object, must be called between Begin and Accept/Cancel methods.
  509. virtual void RecordUndo(struct IUndoObject* obj) = 0;
  510. //! Completely flush all Undo and redo buffers.
  511. //! Must be done on level reloads or global Fetch operation.
  512. virtual bool FlushUndo(bool isShowMessage = false) = 0;
  513. //! Clear the last N number of steps in the undo stack
  514. virtual bool ClearLastUndoSteps(int steps) = 0;
  515. //! Clear all current Redo steps in the undo stack
  516. virtual bool ClearRedoStack() = 0;
  517. //! Retrieve current animation context.
  518. virtual CAnimationContext* GetAnimation() = 0;
  519. //! Retrieve sequence manager
  520. virtual CTrackViewSequenceManager* GetSequenceManager() = 0;
  521. virtual ITrackViewSequenceManager* GetSequenceManagerInterface() = 0;
  522. //! Returns external tools manager.
  523. virtual CToolBoxManager* GetToolBoxManager() = 0;
  524. //! Get global Error Report instance.
  525. virtual IErrorReport* GetErrorReport() = 0;
  526. virtual IErrorReport* GetLastLoadedLevelErrorReport() = 0;
  527. virtual void StartLevelErrorReportRecording() = 0;
  528. virtual void CommitLevelErrorReport() = 0;
  529. // Retrieve interface to FileUtil
  530. virtual IFileUtil* GetFileUtil() = 0;
  531. // Notify all listeners about the specified event.
  532. virtual void Notify(EEditorNotifyEvent event) = 0;
  533. // Notify all listeners about the specified event, except for one.
  534. virtual void NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener* listener) = 0;
  535. //! Register Editor notifications listener.
  536. virtual void RegisterNotifyListener(IEditorNotifyListener* listener) = 0;
  537. //! Unregister Editor notifications listener.
  538. virtual void UnregisterNotifyListener(IEditorNotifyListener* listener) = 0;
  539. //! Register document notifications listener.
  540. virtual void RegisterDocListener(IDocListener* listener) = 0;
  541. //! Unregister document notifications listener.
  542. virtual void UnregisterDocListener(IDocListener* listener) = 0;
  543. //! Retrieve interface to the source control.
  544. virtual ISourceControl* GetSourceControl() = 0;
  545. //! Retrieve true if source control is provided and enabled in settings
  546. virtual bool IsSourceControlAvailable() = 0;
  547. //! Only returns true if source control is both available AND currently connected and functioning
  548. virtual bool IsSourceControlConnected() = 0;
  549. virtual void ReduceMemory() = 0;
  550. virtual ESystemConfigPlatform GetEditorConfigPlatform() const = 0;
  551. virtual void ReloadTemplates() = 0;
  552. virtual void ShowStatusText(bool bEnable) = 0;
  553. // Provides a way to extend the context menu of an object. The function gets called every time the menu is opened.
  554. typedef AZStd::function<void(QMenu*, const CBaseObject*)> TContextMenuExtensionFunc;
  555. virtual void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) = 0;
  556. virtual SSystemGlobalEnvironment* GetEnv() = 0;
  557. virtual IImageUtil* GetImageUtil() = 0; // Vladimir@conffx
  558. virtual SEditorSettings* GetEditorSettings() = 0;
  559. virtual ILogFile* GetLogFile() = 0; // Vladimir@conffx
  560. // unload all plugins
  561. virtual void UnloadPlugins() = 0;
  562. // reloads the plugins
  563. virtual void LoadPlugins() = 0;
  564. };
  565. //! Callback used by editor when initializing for info in UI dialogs
  566. struct IInitializeUIInfo
  567. {
  568. virtual void SetInfoText(const char* text) = 0;
  569. };
  570. AZ_DECLARE_BUDGET(Editor);