EditorBuiltin.cs 6.9 KB

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