iInspectable.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * Enum that determines the text-wrapping mode to use.
  3. */
  4. export declare enum InspectableType {
  5. /**
  6. * Checkbox for booleans
  7. */
  8. Checkbox = 0,
  9. /**
  10. * Sliders for numbers
  11. */
  12. Slider = 1,
  13. /**
  14. * Vector3
  15. */
  16. Vector3 = 2,
  17. /**
  18. * Quaternions
  19. */
  20. Quaternion = 3,
  21. /**
  22. * Color3
  23. */
  24. Color3 = 4,
  25. /**
  26. * String
  27. */
  28. String = 5,
  29. /**
  30. * Button
  31. */
  32. Button = 6,
  33. /**
  34. * Options
  35. */
  36. Options = 7,
  37. /**
  38. * Tab
  39. */
  40. Tab = 8,
  41. /**
  42. * File button
  43. */
  44. FileButton = 9,
  45. /**
  46. * Vector2
  47. */
  48. Vector2 = 10
  49. }
  50. /**
  51. * Interface used to define custom inspectable options in "Options" mode.
  52. * This interface is used by the inspector to display the list of options
  53. */
  54. export interface IInspectableOptions {
  55. /**
  56. * Defines the visible part of the option
  57. */
  58. label: string;
  59. /**
  60. * Defines the value part of the option (returned through the callback)
  61. */
  62. value: number | string;
  63. /**
  64. * Defines if the option should be selected or not
  65. */
  66. selected?: boolean;
  67. }
  68. /**
  69. * Interface used to define custom inspectable properties.
  70. * This interface is used by the inspector to display custom property grids
  71. * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
  72. */
  73. export interface IInspectable {
  74. /**
  75. * Gets the label to display
  76. */
  77. label: string;
  78. /**
  79. * Gets the name of the property to edit
  80. */
  81. propertyName: string;
  82. /**
  83. * Gets the type of the editor to use
  84. */
  85. type: InspectableType;
  86. /**
  87. * Gets the minimum value of the property when using in "slider" mode
  88. */
  89. min?: number;
  90. /**
  91. * Gets the maximum value of the property when using in "slider" mode
  92. */
  93. max?: number;
  94. /**
  95. * Gets the setp to use when using in "slider" mode
  96. */
  97. step?: number;
  98. /**
  99. * Gets the callback function when using "Button" mode
  100. */
  101. callback?: () => void;
  102. /**
  103. * Gets the callback function when using "FileButton" mode
  104. */
  105. fileCallback?: (file: File) => void;
  106. /**
  107. * Gets the list of options when using "Option" mode
  108. */
  109. options?: IInspectableOptions[];
  110. /**
  111. * Gets the extensions to accept when using "FileButton" mode.
  112. * The value should be a comma separated string with the list of extensions to accept e.g., ".jpg, .png, .tga, .dds, .env".
  113. */
  114. accept?: string;
  115. }