EditorBuiltin.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System.Runtime.CompilerServices;
  4. using BansheeEngine;
  5. namespace BansheeEditor
  6. {
  7. /** @addtogroup Utility-Editor
  8. * @{
  9. */
  10. /// <summary>
  11. /// Types of icons that may be displayed on the tool bar.
  12. /// </summary>
  13. public enum ToolbarIcon // Note: Must match C++ enum ToolbarIcon
  14. {
  15. NewCamera, NewRenderable, NewPointLight, NewDirLight, NewSpotLight, NewSceneObject, NewCube, NewSphere, NewCone,
  16. NewQuad, NewMat, NewCSScript, NewShader, NewSpriteTex, Pause, Play, Step, Undo, Redo, OpenProject, SaveProject,
  17. SaveScene
  18. };
  19. /// <summary>
  20. /// Types of icons that may be displayed in the scene window.
  21. /// </summary>
  22. public enum SceneWindowIcon // Note: Must match C++ enum SceneWindowIcon
  23. {
  24. View, Move, Rotate, Scale, Pivot, Center, Local, World, MoveSnap, RotateSnap
  25. };
  26. /// <summary>
  27. /// Types of icons that may be displayed in the library window.
  28. /// </summary>
  29. public enum LibraryWindowIcon // Note: Must match C++ enum LibraryWindowIcon
  30. {
  31. Home, Up, Clear, Options
  32. };
  33. /// <summary>
  34. /// Types of icons that may be displayed in the inspector window.
  35. /// </summary>
  36. public enum InspectorWindowIcon // Note: Must match C++ enum InspectorWindowIcon
  37. {
  38. Create, Clone, Clear, Resize, Delete, MoveUp, MoveDown, Edit, Apply, Add, Cancel
  39. };
  40. /// <summary>
  41. /// Types of icons that may be displayed for resources in the library window.
  42. /// </summary>
  43. public enum LibraryItemIcon // Note: Must match C++ enum ProjectIcon
  44. {
  45. Folder, Mesh, Font, Texture, PlainText, ScriptCode, SpriteTexture, Shader, ShaderInclude, Material, Prefab, GUISkin,
  46. PhysicsMaterial, PhysicsMesh, AudioClip, AnimationClip
  47. };
  48. /// <summary>
  49. /// Types of icons that can be used for displaying types of log messages.
  50. /// </summary>
  51. public enum LogIcon // Note: Must match C++ enum LogMessageIcon
  52. {
  53. Info, Warning, Error
  54. }
  55. /// <summary>
  56. /// Contains various editor-specific resources that are always available.
  57. /// </summary>
  58. public static class EditorBuiltin
  59. {
  60. /// <summary>Returns a texture displaying an X button.</summary>
  61. public static SpriteTexture XBtnIcon { get { return Internal_GetXBtnIcon(); } }
  62. /// <summary>Returns text contained in the default "empty" shader.</summary>
  63. public static string EmptyShaderCode { get { return Internal_GetEmptyShaderCode(); } }
  64. /// <summary>Returns text contained in the default "empty" C# script.</summary>
  65. public static string EmptyCSScriptCode { get { return Internal_GetEmptyCSScriptCode(); } }
  66. /// <summary>
  67. /// Retrieves an icon used for displaying an entry in the library window.
  68. /// </summary>
  69. /// <param name="icon">Type of the icon to retrieve.</param>
  70. /// <param name="size">Size of the icon to retrieve in pixels. This will be rounded
  71. /// to nearest available size.</param>
  72. /// <returns>Sprite texture of the icon.</returns>
  73. public static SpriteTexture GetLibraryItemIcon(LibraryItemIcon icon, int size)
  74. {
  75. return Internal_GetLibraryItemIcon(icon, size);
  76. }
  77. /// <summary>
  78. /// Retrieves an icon that may be displayed on the main window's toolbar.
  79. /// </summary>
  80. /// <param name="icon">Type of icon to retrieve.</param>
  81. /// <returns>Sprite texture of the icon.</returns>
  82. public static SpriteTexture GetToolbarIcon(ToolbarIcon icon)
  83. {
  84. return Internal_GetToolbarIcon(icon);
  85. }
  86. /// <summary>
  87. /// Retrieves an icon that may be displayed on the library window.
  88. /// </summary>
  89. /// <param name="icon">Type of icon to retrieve.</param>
  90. /// <returns>Sprite texture of the icon.</returns>
  91. public static SpriteTexture GetLibraryWindowIcon(LibraryWindowIcon icon)
  92. {
  93. return Internal_GetLibraryWindowIcon(icon);
  94. }
  95. /// <summary>
  96. /// Retrieves an icon that may be displayed on the inspector window.
  97. /// </summary>
  98. /// <param name="icon">Type of icon to retrieve.</param>
  99. /// <returns>Sprite texture of the icon.</returns>
  100. public static SpriteTexture GetInspectorWindowIcon(InspectorWindowIcon icon)
  101. {
  102. return Internal_GetInspectorWindowIcon(icon);
  103. }
  104. /// <summary>
  105. /// Retrieves an icon that may be displayed on the scene window.
  106. /// </summary>
  107. /// <param name="icon">Type of icon to retrieve.</param>
  108. /// <returns>Sprite texture of the icon.</returns>
  109. public static GUIContentImages GetSceneWindowIcon(SceneWindowIcon icon)
  110. {
  111. return Internal_GetSceneWindowIcon(icon);
  112. }
  113. /// <summary>
  114. /// Retrieves an icon that represents different types of log entries.
  115. /// </summary>
  116. /// <param name="icon">Type of icon to retrieve.</param>
  117. /// <param name="size">Size of the icon in pixels. Nearest available size will be returned.</param>
  118. /// <param name="dark">Controls should the dark or light version of the icon be returned.</param>
  119. /// <returns>Sprite texture of the icon.</returns>
  120. public static SpriteTexture GetLogIcon(LogIcon icon, int size, bool dark)
  121. {
  122. return Internal_GetLogIcon(icon, size, dark);
  123. }
  124. [MethodImpl(MethodImplOptions.InternalCall)]
  125. private static extern SpriteTexture Internal_GetLibraryItemIcon(LibraryItemIcon icon, int size);
  126. [MethodImpl(MethodImplOptions.InternalCall)]
  127. private static extern SpriteTexture Internal_GetXBtnIcon();
  128. [MethodImpl(MethodImplOptions.InternalCall)]
  129. private static extern string Internal_GetEmptyShaderCode();
  130. [MethodImpl(MethodImplOptions.InternalCall)]
  131. private static extern string Internal_GetEmptyCSScriptCode();
  132. [MethodImpl(MethodImplOptions.InternalCall)]
  133. private static extern SpriteTexture Internal_GetToolbarIcon(ToolbarIcon icon);
  134. [MethodImpl(MethodImplOptions.InternalCall)]
  135. private static extern SpriteTexture Internal_GetLibraryWindowIcon(LibraryWindowIcon icon);
  136. [MethodImpl(MethodImplOptions.InternalCall)]
  137. private static extern SpriteTexture Internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
  138. [MethodImpl(MethodImplOptions.InternalCall)]
  139. private static extern GUIContentImages Internal_GetSceneWindowIcon(SceneWindowIcon icon);
  140. [MethodImpl(MethodImplOptions.InternalCall)]
  141. private static extern SpriteTexture Internal_GetLogIcon(LogIcon icon, int size, bool dark);
  142. }
  143. /** @} */
  144. }