EditorCommon.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 <Cry_Geo.h>
  10. #include <Include/IPlugin.h>
  11. #include <QtWidgets/QMainWindow>
  12. #include <LyShine/IDraw2d.h>
  13. #include <LyShine/ILyShine.h>
  14. #include <LyShine/Bus/UiCanvasBus.h>
  15. #include <LyShine/Bus/UiElementBus.h>
  16. #include <LyShine/Bus/UiEditorBus.h>
  17. #include <LyShine/Bus/UiLayoutBus.h>
  18. #include <LyShine/Bus/UiTransform2dBus.h>
  19. #include <LyShine/Bus/UiVisualBus.h>
  20. #include <AzCore/Component/ComponentApplicationBus.h>
  21. #include <AzCore/Component/EntityBus.h>
  22. #include <AzCore/Component/TickBus.h>
  23. #include <AzCore/Math/Vector3.h>
  24. #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
  25. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  26. #include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
  27. #include <AzToolsFramework/Undo/UndoSystem.h>
  28. class CanvasSizeToolbarSection;
  29. class CommandCanvasPropertiesChange;
  30. class CommandCanvasSizeToolbarIndex;
  31. class CommandHierarchyItemCreate;
  32. class CommandHierarchyItemCreateFromData;
  33. class CommandHierarchyItemDelete;
  34. class CommandHierarchyItemRename;
  35. class CommandHierarchyItemReparent;
  36. class CommandHierarchyItemToggleIsExpanded;
  37. class CommandHierarchyItemToggleIsSelectable;
  38. class CommandHierarchyItemToggleIsVisible;
  39. class CommandPropertiesChange;
  40. class ComponentButton;
  41. class CoordinateSystemToolbarSection;
  42. class EditorMenu;
  43. class EditorWindow;
  44. class EnterPreviewToolbar;
  45. class HierarchyClipboard;
  46. class HierarchyHeader;
  47. class HierarchyItem;
  48. class HierarchyMenu;
  49. class HierarchyWidget;
  50. class MainToolbar;
  51. class ModeToolbar;
  52. class NewElementToolbarSection;
  53. class PreviewActionLog;
  54. class PreviewAnimationList;
  55. class PreviewToolbar;
  56. class PropertiesContainer;
  57. class PropertiesWidget;
  58. class PropertiesWrapper;
  59. class UndoStack;
  60. class UndoStackExecutionScope;
  61. class ViewportAnchor;
  62. class ViewportCanvasBackground;
  63. class ViewportElement;
  64. class ViewportHighlight;
  65. class ViewportIcon;
  66. class ViewportInteraction;
  67. class ViewportNudge;
  68. class ViewportPivot;
  69. class ViewportSnap;
  70. class ViewportWidget;
  71. QT_FORWARD_DECLARE_CLASS(QTreeWidgetItem)
  72. using HierarchyItemRawPtrList = std::list< HierarchyItem* >;
  73. using QTreeWidgetItemRawPtrList = std::list< QTreeWidgetItem* >;
  74. using QTreeWidgetItemRawPtrQList = QList< QTreeWidgetItem* >;
  75. // This allows iterating over an enum class.
  76. #define ADD_ENUM_CLASS_ITERATION_OPERATORS(CLASS_NAME, FIRST_VALUE, LAST_VALUE) \
  77. \
  78. inline CLASS_NAME operator++(CLASS_NAME & m){ return m = (CLASS_NAME)(std::underlying_type<CLASS_NAME>::type(m) + 1); } \
  79. inline CLASS_NAME operator*(CLASS_NAME m){ return m; } \
  80. inline CLASS_NAME begin([[maybe_unused]] CLASS_NAME m){ return FIRST_VALUE; } \
  81. inline CLASS_NAME end([[maybe_unused]] CLASS_NAME m){ return (CLASS_NAME)(std::underlying_type<CLASS_NAME>::type(LAST_VALUE) + 1); }
  82. enum class UiEditorMode
  83. {
  84. Edit, Preview
  85. };
  86. enum class FusibleCommand
  87. {
  88. kViewportInteractionMode,
  89. kCanvasSizeToolbarIndex
  90. };
  91. #include "ViewportHelpers.h"
  92. #include "EntityHelpers.h"
  93. #include "SerializeHelpers.h"
  94. #include "FileHelpers.h"
  95. #include "ComponentHelpers.h"
  96. #include "HierarchyHelpers.h"
  97. #include "UiSliceManager.h"
  98. #include "SelectionHelpers.h"
  99. #include "ViewportInteraction.h"
  100. #include "CanvasSizeToolbarSection.h"
  101. #include "CommandCanvasPropertiesChange.h"
  102. #include "CommandCanvasSizeToolbarIndex.h"
  103. #include "CommandHierarchyItemCreate.h"
  104. #include "CommandHierarchyItemCreateFromData.h"
  105. #include "CommandHierarchyItemDelete.h"
  106. #include "CommandHierarchyItemRename.h"
  107. #include "CommandHierarchyItemReparent.h"
  108. #include "CommandHierarchyItemToggleIsExpanded.h"
  109. #include "CommandHierarchyItemToggleIsSelectable.h"
  110. #include "CommandHierarchyItemToggleIsVisible.h"
  111. #include "CommandPropertiesChange.h"
  112. #include "ComponentButton.h"
  113. #include "CoordinateSystemToolbarSection.h"
  114. #include "EditorWindow.h"
  115. #include "EnterPreviewToolbar.h"
  116. #include "HierarchyClipboard.h"
  117. #include "HierarchyHeader.h"
  118. #include "HierarchyItem.h"
  119. #include "HierarchyMenu.h"
  120. #include "HierarchyWidget.h"
  121. #include "MainToolbar.h"
  122. #include "ModeToolbar.h"
  123. #include "NewElementToolbarSection.h"
  124. #include "PreviewActionLog.h"
  125. #include "PreviewAnimationList.h"
  126. #include "PreviewToolbar.h"
  127. #include "PropertiesContainer.h"
  128. #include "PropertiesWidget.h"
  129. #include "PropertiesWrapper.h"
  130. #include "PropertyHandlers.h"
  131. #include "RecentFiles.h"
  132. #include "UndoStack.h"
  133. #include "UndoStackExecutionScope.h"
  134. #include "ViewportAnchor.h"
  135. #include "ViewportCanvasBackground.h"
  136. #include "ViewportHighlight.h"
  137. #include "ViewportIcon.h"
  138. #include "ViewportWidget.h"
  139. // IMPORTANT: This is NOT the permanent location for these values.
  140. #define AZ_QCOREAPPLICATION_SETTINGS_ORGANIZATION_NAME "O3DE"
  141. #define AZ_QCOREAPPLICATION_SETTINGS_APPLICATION_NAME "O3DE"
  142. // See: http://en.wikipedia.org/wiki/Internet_media_type#Prefix_x
  143. #define UICANVASEDITOR_MIMETYPE "application/x-amazon-o3de-uicanvaseditor"
  144. bool ClipboardContainsOurDataType();
  145. #define UICANVASEDITOR_NAME_SHORT "UiCanvasEditor"
  146. #define UICANVASEDITOR_COORDINATE_SYSTEM_CYCLE_SHORTCUT_KEY_SEQUENCE QKeySequence(Qt::CTRL + Qt::Key_W)
  147. #define UICANVASEDITOR_SNAP_TO_GRID_TOGGLE_SHORTCUT_KEY_SEQUENCE QKeySequence(Qt::Key_G)
  148. #define UICANVASEDITOR_CANVAS_DIRECTORY "UI/Canvases"
  149. #define UICANVASEDITOR_CANVAS_EXTENSION "uicanvas"
  150. #define UICANVASEDITOR_QMENU_ITEM_DISABLED_STYLESHEET "QMenu::item:disabled { color: rgb(127, 127, 127); }"
  151. enum HierarchyColumn
  152. {
  153. kHierarchyColumnName,
  154. kHierarchyColumnIsVisible,
  155. kHierarchyColumnIsSelectable,
  156. kHierarchyColumnCount
  157. };
  158. #define UICANVASEDITOR_HIERARCHY_HEADER_ICON_SIZE (16)
  159. // Stores startup (original) location of localization folder
  160. #define UICANVASEDITOR_SETTINGS_STARTUP_LOC_FOLDER_KEY (QString("StartupLocFolder") + " " + FileHelpers::GetAbsoluteGameDir())