EditorEvents.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. // TODO: migrate these interfaces out to the d.ts and migrate the static strings to some common location
  23. export const ModalError = "ModalError";
  24. export interface ModalErrorEvent {
  25. title: string;
  26. message: string;
  27. }
  28. export const PlayerStartRequest = "EditorPlayRequest";
  29. export const PlayerStarted = "EditorPlayerStarted";
  30. export const PlayerStopped = "EditorPlayerStopped";
  31. export const PlayerPaused = "EditorPlayerPaused";
  32. export const PlayerResumed = "EditorPlayerResumed";
  33. export const PlayerLog = "EditorPlayerLog";
  34. export interface PlayerLogEvent {
  35. message: string;
  36. level: number;
  37. }
  38. export const ActiveSceneEditorChange = "EditorActiveSceneEditorChange";
  39. export interface ActiveSceneEditorChangeEvent {
  40. sceneEditor: Editor.SceneEditor3D;
  41. }
  42. export const SceneClosed = "EditorSceneClosed";
  43. export interface SceneClosedEvent {
  44. scene: Atomic.Scene;
  45. }
  46. export const ContentFolderChanged = "ContentFolderChanged";
  47. export interface ContentFolderChangedEvent {
  48. path: string;
  49. }
  50. export const CloseProject = "EditorCloseProject";
  51. export const ProjectClosed = "EditorProjectClosed";
  52. export const ProjectUnloadedNotification = "ProjectUnloadedNotification";
  53. export const RequestProjectLoad = "RequestProjectLoad";
  54. export interface RequestProjectLoadEvent {
  55. // The full path to the .atomic file
  56. path: string;
  57. }
  58. export const LoadProject = "EditorLoadProject";
  59. export const LoadProjectNotification = "EditorLoadProjectNotification";
  60. export interface LoadProjectEvent {
  61. // The full path to the .atomic file
  62. path: string;
  63. }
  64. export const SaveAllResources = "EditorSaveAllResources";
  65. export const SaveResource = "EditorSaveResource";
  66. /**
  67. * Called once the resource has been saved
  68. * @type {String}
  69. */
  70. export const SaveResourceNotification = "EditorSaveResourceNotification";
  71. export interface SaveResourceEvent {
  72. // The full path to the resource to save / empty or undefined for current
  73. path: string;
  74. }
  75. export const EditorResourceClose = "EditorResourceClose";
  76. export interface EditorCloseResourceEvent {
  77. editor:Editor.ResourceEditor;
  78. navigateToAvailableResource:boolean;
  79. }
  80. export const EditResource = "EditorEditResource";
  81. export interface EditResourceEvent {
  82. // The full path to the resource to edit
  83. path: string;
  84. }
  85. export const DeleteResource = "EditorDeleteResource";
  86. /**
  87. * Called once the resource has been deleted
  88. * @type {String}
  89. */
  90. export const DeleteResourceNotification = "DeleteResourceNotification";
  91. export interface DeleteResourceEvent {
  92. // The full path to the resource to edit
  93. path: string;
  94. }
  95. export const RenameResource = "EditorRenameResource";
  96. /**
  97. * Called once the resource has been renamed
  98. * @type {String}
  99. */
  100. export const RenameResourceNotification = "RenameResourceNotification";
  101. export interface RenameResourceEvent {
  102. // The full path to the resource to edit
  103. path: string;
  104. newPath: string;
  105. newName: string;
  106. // the asset to delete
  107. asset: ToolCore.Asset;
  108. }
  109. export const SceneEditStateChange = "SceneEditStateChange";
  110. export interface SceneEditStateChangeEvent {
  111. serializable: Atomic.Serializable;
  112. }
  113. export const InspectorProjectReference = "InspectorProjectReference";
  114. export interface InspectorProjectReferenceEvent {
  115. // The full path to the resource to edit
  116. path: string;
  117. }
  118. export const RemoveCurrentAssetAssigned = "RemoveCurrentAssetAssigned";
  119. export interface RemoveCurrentAssetAssignedEvent {
  120. }
  121. export const UserPreferencesChangedNotification = "UserPreferencesChangedNotification";
  122. export interface UserPreferencesChangedEvent {
  123. /**
  124. * JSON string of the project preferences
  125. */
  126. projectPreferences: string;
  127. /**
  128. * JSON string of the application preferences
  129. */
  130. applicationPreferences: string;
  131. }
  132. export const WebViewLoadEnd = "WebViewLoadEnd";
  133. export const WebMessage = "WebMessage";
  134. // interface to pass modal error messages from core modules
  135. export const EditorModal = "EditorModal";
  136. export interface EditorModalEvent {
  137. uiType: number; // EDITOR_ERROR_MODAL, etc)
  138. title: string; // for modal errors, title text
  139. message: string; // for modal errors, error text
  140. }