EditorBuiltin.cs 6.3 KB

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