EditorBuiltin.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. PhysicsMaterial, PhysicsMesh
  44. };
  45. /// <summary>
  46. /// Types of icons that can be used for displaying types of log messages.
  47. /// </summary>
  48. public enum LogIcon // Note: Must match C++ enum LogMessageIcon
  49. {
  50. Info, Warning, Error
  51. }
  52. /// <summary>
  53. /// Contains various editor-specific resources that are always available.
  54. /// </summary>
  55. public static class EditorBuiltin
  56. {
  57. /// <summary>Returns a texture displaying an X button.</summary>
  58. public static SpriteTexture XBtnIcon { get { return Internal_GetXBtnIcon(); } }
  59. /// <summary>Returns text contained in the default "empty" shader.</summary>
  60. public static string EmptyShaderCode { get { return Internal_GetEmptyShaderCode(); } }
  61. /// <summary>Returns text contained in the default "empty" C# script.</summary>
  62. public static string EmptyCSScriptCode { get { return Internal_GetEmptyCSScriptCode(); } }
  63. /// <summary>
  64. /// Retrieves an icon used for displaying an entry in the library window.
  65. /// </summary>
  66. /// <param name="icon">Type of the icon to retrieve.</param>
  67. /// <param name="size">Size of the icon to retrieve in pixels. This will be rounded
  68. /// to nearest available size.</param>
  69. /// <returns>Sprite texture of the icon.</returns>
  70. public static SpriteTexture GetLibraryItemIcon(LibraryItemIcon icon, int size)
  71. {
  72. return Internal_GetLibraryItemIcon(icon, size);
  73. }
  74. /// <summary>
  75. /// Retrieves an icon that may be displayed on the main window's toolbar.
  76. /// </summary>
  77. /// <param name="icon">Type of icon to retrieve.</param>
  78. /// <returns>Sprite texture of the icon.</returns>
  79. public static SpriteTexture GetToolbarIcon(ToolbarIcon icon)
  80. {
  81. return Internal_GetToolbarIcon(icon);
  82. }
  83. /// <summary>
  84. /// Retrieves an icon that may be displayed on the library window.
  85. /// </summary>
  86. /// <param name="icon">Type of icon to retrieve.</param>
  87. /// <returns>Sprite texture of the icon.</returns>
  88. public static SpriteTexture GetLibraryWindowIcon(LibraryWindowIcon icon)
  89. {
  90. return Internal_GetLibraryWindowIcon(icon);
  91. }
  92. /// <summary>
  93. /// Retrieves an icon that may be displayed on the inspector window.
  94. /// </summary>
  95. /// <param name="icon">Type of icon to retrieve.</param>
  96. /// <returns>Sprite texture of the icon.</returns>
  97. public static SpriteTexture GetInspectorWindowIcon(InspectorWindowIcon icon)
  98. {
  99. return Internal_GetInspectorWindowIcon(icon);
  100. }
  101. /// <summary>
  102. /// Retrieves an icon that may be displayed on the scene window.
  103. /// </summary>
  104. /// <param name="icon">Type of icon to retrieve.</param>
  105. /// <returns>Sprite texture of the icon.</returns>
  106. public static GUIContentImages GetSceneWindowIcon(SceneWindowIcon icon)
  107. {
  108. return Internal_GetSceneWindowIcon(icon);
  109. }
  110. /// <summary>
  111. /// Retrieves an icon that represents different types of log entries.
  112. /// </summary>
  113. /// <param name="icon">Type of icon to retrieve.</param>
  114. /// <param name="size">Size of the icon in pixels. Nearest available size will be returned.</param>
  115. /// <param name="dark">Controls should the dark or light version of the icon be returned.</param>
  116. /// <returns>Sprite texture of the icon.</returns>
  117. public static SpriteTexture GetLogIcon(LogIcon icon, int size, bool dark)
  118. {
  119. return Internal_GetLogIcon(icon, size, dark);
  120. }
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern SpriteTexture Internal_GetLibraryItemIcon(LibraryItemIcon icon, int size);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern SpriteTexture Internal_GetXBtnIcon();
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern string Internal_GetEmptyShaderCode();
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern string Internal_GetEmptyCSScriptCode();
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern SpriteTexture Internal_GetToolbarIcon(ToolbarIcon icon);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern SpriteTexture Internal_GetLibraryWindowIcon(LibraryWindowIcon icon);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern SpriteTexture Internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern GUIContentImages Internal_GetSceneWindowIcon(SceneWindowIcon icon);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern SpriteTexture Internal_GetLogIcon(LogIcon icon, int size, bool dark);
  139. }
  140. }