babylon.inspector.d.ts 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. /*BabylonJS Inspector*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module INSPECTOR {
  5. }
  6. declare module INSPECTOR {
  7. }
  8. declare module INSPECTOR {
  9. }
  10. declare module INSPECTOR {
  11. }
  12. declare module INSPECTOR {
  13. }
  14. declare module INSPECTOR {
  15. }
  16. declare module INSPECTOR {
  17. }
  18. declare module INSPECTOR {
  19. export class Tools {
  20. static LookForItem(item: any, selectedEntity: any): boolean;
  21. static SortAndFilter(items: any[]): any[];
  22. }
  23. }
  24. declare module INSPECTOR {
  25. }
  26. declare module INSPECTOR {
  27. }
  28. export declare class Inspector {
  29. /** The HTML document relative to this inspector (the window or the popup depending on its mode) */
  30. static DOCUMENT: HTMLDocument;
  31. /** The HTML window. In popup mode, it's the popup itself. Otherwise, it's the current tab */
  32. static WINDOW: Window;
  33. onGUILoaded: BABYLON.Observable<any>;
  34. static GUIObject: any;
  35. /** The inspector is created with the given engine.
  36. * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
  37. * If the parameter 'popup' is true, the inspector is created in another popup.
  38. */
  39. constructor(scene: BABYLON.Scene, popup?: boolean, initialTab?: number | string, parentElement?: BABYLON.Nullable<HTMLElement>, newColors?: {
  40. backgroundColor?: string;
  41. backgroundColorLighter?: string;
  42. backgroundColorLighter2?: string;
  43. backgroundColorLighter3?: string;
  44. color?: string;
  45. colorTop?: string;
  46. colorBot?: string;
  47. });
  48. readonly scene: BABYLON.Scene;
  49. readonly popupMode: boolean;
  50. /**
  51. * Filter the list of item present in the tree.
  52. * All item returned should have the given filter contained in the item id.
  53. */
  54. filterItem(filter: string): void;
  55. /** Display the mesh tab on the given object */
  56. displayObjectDetails(mesh: BABYLON.AbstractMesh): void;
  57. /** Clean the whole tree of item and rebuilds it */
  58. refresh(): void;
  59. /** Remove the inspector panel when it's built as a right panel:
  60. * remove the right panel and remove the wrapper
  61. */
  62. dispose(): void;
  63. /** Open the inspector in a new popup
  64. * Set 'firstTime' to true if there is no inspector created beforehands
  65. */
  66. openPopup(firstTime?: boolean): void;
  67. getActiveTabIndex(): number;
  68. }
  69. declare module INSPECTOR {
  70. export const PROPERTIES: {
  71. /** Format the given object :
  72. * If a format function exists, returns the result of this function.
  73. * If this function doesn't exists, return the object type instead
  74. */
  75. format: (obj: any) => any;
  76. 'type_not_defined': {
  77. properties: any[];
  78. format: () => string;
  79. };
  80. 'Vector2': {
  81. type: typeof BABYLON.Vector2;
  82. format: (vec: BABYLON.Vector2) => string;
  83. };
  84. 'Vector3': {
  85. type: typeof BABYLON.Vector3;
  86. format: (vec: BABYLON.Vector3) => string;
  87. };
  88. 'Color3': {
  89. type: typeof BABYLON.Color3;
  90. format: (color: BABYLON.Color3) => string;
  91. slider: {
  92. r: {
  93. min: number;
  94. max: number;
  95. step: number;
  96. };
  97. g: {
  98. min: number;
  99. max: number;
  100. step: number;
  101. };
  102. b: {
  103. min: number;
  104. max: number;
  105. step: number;
  106. };
  107. };
  108. };
  109. 'Color4': {
  110. type: typeof BABYLON.Color4;
  111. format: (color: BABYLON.Color4) => string;
  112. slider: {
  113. r: {
  114. min: number;
  115. max: number;
  116. step: number;
  117. };
  118. g: {
  119. min: number;
  120. max: number;
  121. step: number;
  122. };
  123. b: {
  124. min: number;
  125. max: number;
  126. step: number;
  127. };
  128. };
  129. };
  130. 'Quaternion': {
  131. type: typeof BABYLON.Quaternion;
  132. };
  133. 'Size': {
  134. type: typeof BABYLON.Size;
  135. format: (size: BABYLON.Size) => string;
  136. };
  137. 'Texture': {
  138. type: typeof BABYLON.Texture;
  139. format: (tex: BABYLON.Texture) => string;
  140. };
  141. 'RenderTargetTexture': {
  142. type: typeof BABYLON.RenderTargetTexture;
  143. };
  144. 'DynamicTexture': {
  145. type: typeof BABYLON.DynamicTexture;
  146. };
  147. 'BaseTexture': {
  148. type: typeof BABYLON.BaseTexture;
  149. };
  150. 'CubeTexture': {
  151. type: typeof BABYLON.CubeTexture;
  152. };
  153. 'HDRCubeTexture': {
  154. type: typeof BABYLON.HDRCubeTexture;
  155. };
  156. 'Sound': {
  157. type: typeof BABYLON.Sound;
  158. };
  159. 'ArcRotateCamera': {
  160. type: typeof BABYLON.ArcRotateCamera;
  161. slider: {
  162. alpha: {
  163. min: number;
  164. max: number;
  165. step: number;
  166. };
  167. beta: {
  168. min: number;
  169. max: number;
  170. step: number;
  171. };
  172. fov: {
  173. min: number;
  174. max: number;
  175. step: number;
  176. };
  177. };
  178. };
  179. 'FreeCamera': {
  180. type: typeof BABYLON.FreeCamera;
  181. slider: {
  182. fov: {
  183. min: number;
  184. max: number;
  185. step: number;
  186. };
  187. };
  188. };
  189. 'Scene': {
  190. type: typeof BABYLON.Scene;
  191. };
  192. 'TransformNode': {
  193. type: typeof BABYLON.TransformNode;
  194. format: (m: BABYLON.TransformNode) => string;
  195. };
  196. 'AbstractMesh': {
  197. type: typeof BABYLON.AbstractMesh;
  198. format: (m: BABYLON.AbstractMesh) => string;
  199. };
  200. 'Mesh': {
  201. type: typeof BABYLON.Mesh;
  202. format: (m: BABYLON.Mesh) => string;
  203. slider: {
  204. visibility: {
  205. min: number;
  206. max: number;
  207. step: number;
  208. };
  209. };
  210. };
  211. 'StandardMaterial': {
  212. type: typeof BABYLON.StandardMaterial;
  213. format: (mat: BABYLON.StandardMaterial) => string;
  214. slider: {
  215. alpha: {
  216. min: number;
  217. max: number;
  218. step: number;
  219. };
  220. };
  221. };
  222. 'PBRMaterial': {
  223. type: typeof BABYLON.PBRMaterial;
  224. slider: {
  225. alpha: {
  226. min: number;
  227. max: number;
  228. step: number;
  229. };
  230. };
  231. };
  232. 'PhysicsImpostor': {
  233. type: typeof BABYLON.PhysicsImpostor;
  234. };
  235. 'ImageProcessingConfiguration': {
  236. type: typeof BABYLON.ImageProcessingConfiguration;
  237. };
  238. 'ColorCurves': {
  239. type: typeof BABYLON.ColorCurves;
  240. };
  241. };
  242. }
  243. declare module INSPECTOR {
  244. export type GUITyping = any;
  245. export let guiLoaded: boolean;
  246. /**
  247. * Function that add gui objects properties to the variable PROPERTIES
  248. */
  249. export function loadGUIProperties(GUI: GUITyping): void;
  250. }
  251. declare module INSPECTOR {
  252. export abstract class Adapter {
  253. protected _obj: any;
  254. constructor(obj: any);
  255. /** Returns the name displayed in the tree */
  256. abstract id(): string;
  257. /** Returns the type of this object - displayed in the tree */
  258. abstract type(): string;
  259. /** Returns the list of properties to be displayed for this adapter */
  260. abstract getProperties(): Array<PropertyLine>;
  261. /** Returns true if the given object correspond to this */
  262. correspondsTo(obj: any): boolean;
  263. /** Returns the adapter unique name */
  264. readonly name: string;
  265. /**
  266. * Returns the actual object used for this adapter
  267. */
  268. readonly object: any;
  269. /** Returns the list of tools available for this adapter */
  270. abstract getTools(): Array<AbstractTreeTool>;
  271. }
  272. }
  273. declare module INSPECTOR {
  274. export class CameraAdapter extends Adapter implements ICameraPOV {
  275. constructor(obj: BABYLON.Camera);
  276. /** Returns the name displayed in the tree */
  277. id(): string;
  278. /** Returns the type of this object - displayed in the tree */
  279. type(): string;
  280. /** Returns the list of properties to be displayed for this adapter */
  281. getProperties(): Array<PropertyLine>;
  282. getTools(): Array<AbstractTreeTool>;
  283. setPOV(): void;
  284. getCurrentActiveCamera(): string;
  285. }
  286. }
  287. declare module INSPECTOR {
  288. export class GUIAdapter extends Adapter implements IToolVisible {
  289. constructor(obj: any);
  290. /** Returns the name displayed in the tree */
  291. id(): string;
  292. /** Returns the type of this object - displayed in the tree */
  293. type(): string;
  294. /** Returns the list of properties to be displayed for this adapter */
  295. getProperties(): Array<PropertyLine>;
  296. getTools(): Array<AbstractTreeTool>;
  297. setVisible(b: boolean): void;
  298. isVisible(): boolean;
  299. }
  300. }
  301. declare module INSPECTOR {
  302. export class LightAdapter extends Adapter implements IToolVisible {
  303. constructor(obj: BABYLON.Light);
  304. /** Returns the name displayed in the tree */
  305. id(): string;
  306. /** Returns the type of this object - displayed in the tree */
  307. type(): string;
  308. /** Returns the list of properties to be displayed for this adapter */
  309. getProperties(): Array<PropertyLine>;
  310. getTools(): Array<AbstractTreeTool>;
  311. setVisible(b: boolean): void;
  312. isVisible(): boolean;
  313. }
  314. }
  315. declare module INSPECTOR {
  316. export class MaterialAdapter extends Adapter {
  317. constructor(obj: BABYLON.Material);
  318. /** Returns the name displayed in the tree */
  319. id(): string;
  320. /** Returns the type of this object - displayed in the tree */
  321. type(): string;
  322. /** Returns the list of properties to be displayed for this adapter */
  323. getProperties(): Array<PropertyLine>;
  324. /** No tools for a material adapter */
  325. getTools(): Array<AbstractTreeTool>;
  326. }
  327. }
  328. declare module INSPECTOR {
  329. export class MeshAdapter extends Adapter implements IToolVisible, IToolDebug, IToolBoundingBox, IToolInfo {
  330. constructor(mesh: BABYLON.Node);
  331. /** Returns the name displayed in the tree */
  332. id(): string;
  333. /** Returns the type of this object - displayed in the tree */
  334. type(): string;
  335. /** Returns the list of properties to be displayed for this adapter */
  336. getProperties(): Array<PropertyLine>;
  337. getTools(): Array<AbstractTreeTool>;
  338. setVisible(b: boolean): void;
  339. isVisible(): boolean;
  340. isBoxVisible(): boolean;
  341. setBoxVisible(b: boolean): boolean;
  342. debug(enable: boolean): void;
  343. /** Returns some information about this mesh */
  344. getInfo(): string;
  345. }
  346. }
  347. declare module INSPECTOR {
  348. export class PhysicsImpostorAdapter extends Adapter implements IToolVisible {
  349. constructor(obj: BABYLON.PhysicsImpostor, viewer: any);
  350. /** Returns the name displayed in the tree */
  351. id(): string;
  352. /** Returns the type of this object - displayed in the tree */
  353. type(): string;
  354. /** Returns the list of properties to be displayed for this adapter */
  355. getProperties(): Array<PropertyLine>;
  356. getTools(): Array<AbstractTreeTool>;
  357. setVisible(b: boolean): void;
  358. isVisible(): boolean;
  359. }
  360. }
  361. declare module INSPECTOR {
  362. export class SoundAdapter extends Adapter implements ISoundInteractions {
  363. constructor(obj: BABYLON.Sound);
  364. /** Returns the name displayed in the tree */
  365. id(): string;
  366. /** Returns the type of this object - displayed in the tree */
  367. type(): string;
  368. /** Returns the list of properties to be displayed for this adapter */
  369. getProperties(): Array<PropertyLine>;
  370. getTools(): Array<AbstractTreeTool>;
  371. setPlaying(callback: Function): void;
  372. }
  373. }
  374. declare module INSPECTOR {
  375. export class TextureAdapter extends Adapter {
  376. constructor(obj: BABYLON.BaseTexture);
  377. /** Returns the name displayed in the tree */
  378. id(): string;
  379. /** Returns the type of this object - displayed in the tree */
  380. type(): string;
  381. /** Returns the list of properties to be displayed for this adapter */
  382. getProperties(): Array<PropertyLine>;
  383. getTools(): Array<AbstractTreeTool>;
  384. }
  385. }
  386. declare module INSPECTOR {
  387. export interface SortDirection {
  388. [property: string]: number;
  389. }
  390. export class DetailPanel extends BasicElement {
  391. constructor(dr?: Array<PropertyLine>);
  392. details: Array<PropertyLine>;
  393. protected _build(): void;
  394. /** Updates the HTML of the detail panel */
  395. update(_items?: Array<PropertyLine>): void;
  396. /** Search an element by name */
  397. searchByName(searchName: string): void;
  398. /**
  399. * Removes all data in the detail panel but keep the header row
  400. */
  401. clean(): void;
  402. /**
  403. * Clean the rows only
  404. */
  405. cleanRow(): void;
  406. /** Overrides basicelement.dispose */
  407. dispose(): void;
  408. }
  409. }
  410. declare module INSPECTOR {
  411. /**
  412. * A property is a link between a data (string) and an object.
  413. */
  414. export class Property {
  415. constructor(prop: string, obj: any, parentObj?: any);
  416. readonly name: string;
  417. value: any;
  418. readonly type: string;
  419. obj: any;
  420. }
  421. }
  422. declare module INSPECTOR {
  423. export class PropertyFormatter {
  424. /**
  425. * Format the value of the given property of the given object.
  426. */
  427. static format(obj: any, prop: string): string;
  428. }
  429. /**
  430. * A property line represents a line in the detail panel. This line is composed of :
  431. * - a name (the property name)
  432. * - a value if this property is of a type 'simple' : string, number, boolean, color, texture
  433. * - the type of the value if this property is of a complex type (Vector2, BABYLON.Size, ...)
  434. * - a ID if defined (otherwise an empty string is displayed)
  435. * The original object is sent to the value object who will update it at will.
  436. *
  437. * A property line can contain OTHER property line objects in the case of a complex type.
  438. * If this instance has no link to other instances, its type is ALWAYS a simple one (see above).
  439. *
  440. */
  441. export class PropertyLine {
  442. constructor(prop: Property, parent?: BABYLON.Nullable<PropertyLine>, level?: number);
  443. validateInput(value: any, forceupdate?: boolean): void;
  444. /** Retrieve the correct object from its parent.
  445. * If no parent exists, returns the property value.
  446. * This method is used at each update in case the property object is removed from the original object
  447. * (example : mesh.position = new BABYLON.Vector3 ; the original vector3 object is deleted from the mesh).
  448. */
  449. updateObject(): any;
  450. readonly name: string;
  451. readonly value: any;
  452. readonly type: string;
  453. /** Delete properly this property line.
  454. * Removes itself from the scheduler.
  455. * Dispose all viewer element (color, texture...)
  456. */
  457. dispose(): void;
  458. /**
  459. * Update the property division with the new property value.
  460. * If this property is complex, update its child, otherwise update its text content
  461. */
  462. update(): void;
  463. toHtml(): HTMLElement;
  464. closeDetails(): void;
  465. }
  466. }
  467. declare module INSPECTOR {
  468. /**
  469. * Represents a html div element.
  470. * The div is built when an instance of BasicElement is created.
  471. */
  472. export abstract class BasicElement {
  473. protected _div: HTMLDivElement;
  474. constructor();
  475. /**
  476. * Returns the div element
  477. */
  478. toHtml(): HTMLDivElement;
  479. /**
  480. * Build the html element
  481. */
  482. protected _build(): void;
  483. abstract update(data?: any): void;
  484. /** Default dispose method if needed */
  485. dispose(): void;
  486. }
  487. }
  488. declare module INSPECTOR {
  489. /**
  490. * Display a very small div corresponding to the given color
  491. */
  492. export class ColorElement extends BasicElement {
  493. constructor(color: BABYLON.Color4 | BABYLON.Color3);
  494. update(color?: BABYLON.Color4 | BABYLON.Color3): void;
  495. }
  496. }
  497. declare module INSPECTOR {
  498. /**
  499. * Represents a html div element.
  500. * The div is built when an instance of BasicElement is created.
  501. */
  502. export class ColorPickerElement extends BasicElement {
  503. protected _input: HTMLInputElement;
  504. constructor(color: BABYLON.Color4 | BABYLON.Color3, propertyLine: PropertyLine);
  505. update(color?: BABYLON.Color4 | BABYLON.Color3): void;
  506. }
  507. }
  508. declare module INSPECTOR {
  509. /**
  510. * Display a very small div. A new canvas is created, with a new js scene, containing only the
  511. * cube texture in a cube
  512. */
  513. export class CubeTextureElement extends BasicElement {
  514. protected _scene: BABYLON.Scene;
  515. protected _cube: BABYLON.Mesh;
  516. protected _textureUrl: string;
  517. /** The texture given as a parameter should be cube. */
  518. constructor(tex: BABYLON.Texture);
  519. update(tex?: BABYLON.Texture): void;
  520. /** Creates the box */
  521. protected _populateScene(): void;
  522. /** Removes properly the babylon engine */
  523. dispose(): void;
  524. }
  525. }
  526. declare module INSPECTOR {
  527. /**
  528. * Display a very small div. A new canvas is created, with a new js scene, containing only the
  529. * cube texture in a cube
  530. */
  531. export class HDRCubeTextureElement extends CubeTextureElement {
  532. /** The texture given as a parameter should be cube. */
  533. constructor(tex: BABYLON.Texture);
  534. /** Creates the box */
  535. protected _populateScene(): void;
  536. }
  537. }
  538. declare module INSPECTOR {
  539. /**
  540. * A search bar can be used to filter elements in the tree panel.
  541. * At each keypress on the input, the treepanel will be filtered.
  542. */
  543. export class SearchBar extends BasicElement {
  544. constructor(tab: PropertyTab);
  545. /** Delete all characters typped in the input element */
  546. reset(): void;
  547. update(): void;
  548. }
  549. export class SearchBarDetails extends BasicElement {
  550. constructor(tab: DetailPanel);
  551. /** Delete all characters typped in the input element */
  552. reset(): void;
  553. update(): void;
  554. }
  555. }
  556. declare module INSPECTOR {
  557. /**
  558. * Display a very small div corresponding to the given texture. On mouse over, display the full image
  559. */
  560. export class TextureElement extends BasicElement {
  561. constructor(tex: BABYLON.Texture);
  562. update(tex?: BABYLON.Texture): void;
  563. }
  564. }
  565. declare module INSPECTOR {
  566. /**
  567. * Creates a tooltip for the parent of the given html element
  568. */
  569. export class Tooltip {
  570. constructor(elem: HTMLElement, tip: string, attachTo?: BABYLON.Nullable<HTMLElement>);
  571. }
  572. }
  573. declare module INSPECTOR {
  574. export class Helpers {
  575. /**
  576. * Returns the type of the given object. First
  577. * uses getClassName. If nothing is returned, used the type of the constructor
  578. */
  579. static GET_TYPE(obj: any): string;
  580. /**
  581. * Returns true if the user browser is edge.
  582. */
  583. static IsBrowserEdge(): boolean;
  584. /**
  585. * Returns true if the user browser is IE.
  586. */
  587. static IsBrowserIE(): boolean;
  588. /** Send the event which name is given in parameter to the window */
  589. static SEND_EVENT(eventName: string): void;
  590. /** Returns the given number with 2 decimal number max if a decimal part exists */
  591. static Trunc(nb: number): number;
  592. /**
  593. * Useful function used to create a div
  594. */
  595. static CreateDiv(className?: BABYLON.Nullable<string>, parent?: HTMLElement, tooltip?: string): HTMLDivElement;
  596. /**
  597. * Useful function used to create a input
  598. */
  599. static CreateInput(className?: string, parent?: HTMLElement, tooltip?: string): HTMLInputElement;
  600. static CreateElement(element: string, className?: BABYLON.Nullable<string>, parent?: HTMLElement, tooltip?: string): HTMLElement;
  601. /**
  602. * Removes all children of the given div.
  603. */
  604. static CleanDiv(div: HTMLElement): void;
  605. /**
  606. * Returns the true value of the given CSS Attribute from the given element (in percentage or in pixel, as it was specified in the css)
  607. */
  608. static Css(elem: HTMLElement, cssAttribute: string): string;
  609. static LoadScript(): void;
  610. static IsSystemName(name: string): boolean;
  611. /**
  612. * Return an array of PropertyLine for an obj
  613. * @param obj
  614. */
  615. static GetAllLinesProperties(obj: any): Array<PropertyLine>;
  616. /**
  617. * Returns an array of string corresponding to tjhe list of properties of the object to be displayed
  618. * @param obj
  619. */
  620. static GetAllLinesPropertiesAsString(obj: any, dontTakeThis?: Array<string>): Array<string>;
  621. static Capitalize(str: string): string;
  622. }
  623. }
  624. declare module INSPECTOR {
  625. export class Scheduler {
  626. /** Is this scheduler in pause ? */
  627. pause: boolean;
  628. /** All properties are refreshed every 250ms */
  629. static REFRESH_TIME: number;
  630. constructor();
  631. static getInstance(): Scheduler;
  632. /** Add a property line to be updated every X ms */
  633. add(prop: PropertyLine): void;
  634. /** Removes the given property from the list of properties to update */
  635. remove(prop: PropertyLine): void;
  636. dispose(): void;
  637. }
  638. }
  639. declare module INSPECTOR {
  640. export class CameraTab extends PropertyTab {
  641. constructor(tabbar: TabBar, inspector: Inspector);
  642. protected _getTree(): Array<TreeItem>;
  643. }
  644. }
  645. declare module INSPECTOR {
  646. /**
  647. * The console tab will have two features :
  648. * - hook all console.log call and display them in this panel (and in the browser console as well)
  649. * - display all Babylon logs (called with Tools.Log...)
  650. */
  651. export class ConsoleTab extends Tab {
  652. constructor(tabbar: TabBar, insp: Inspector);
  653. /** Overrides super.dispose */
  654. dispose(): void;
  655. active(b: boolean): void;
  656. }
  657. }
  658. declare module INSPECTOR {
  659. export class GLTFTab extends Tab {
  660. static readonly IsSupported: boolean;
  661. /** @hidden */
  662. static _Initialize(): void;
  663. constructor(tabbar: TabBar, inspector: Inspector);
  664. dispose(): void;
  665. /** @hidden */
  666. static _GetLoaderDefaultsAsync(): Promise<any>;
  667. }
  668. }
  669. declare module INSPECTOR {
  670. export class GUITab extends PropertyTab {
  671. constructor(tabbar: TabBar, inspector: Inspector);
  672. protected _getTree(): Array<TreeItem>;
  673. }
  674. }
  675. declare module INSPECTOR {
  676. export class LightTab extends PropertyTab {
  677. constructor(tabbar: TabBar, inspector: Inspector);
  678. protected _getTree(): Array<TreeItem>;
  679. }
  680. }
  681. declare module INSPECTOR {
  682. export class MaterialTab extends PropertyTab {
  683. constructor(tabbar: TabBar, inspector: Inspector);
  684. protected _getTree(): Array<TreeItem>;
  685. }
  686. }
  687. declare module INSPECTOR {
  688. export class MeshTab extends PropertyTab {
  689. constructor(tabbar: TabBar, inspector: Inspector);
  690. protected _getTree(): Array<TreeItem>;
  691. }
  692. }
  693. declare module INSPECTOR {
  694. export class PhysicsTab extends PropertyTab {
  695. viewer: any;
  696. constructor(tabbar: TabBar, inspector: Inspector);
  697. protected _getTree(): Array<TreeItem>;
  698. }
  699. }
  700. declare module INSPECTOR {
  701. /**
  702. * A Property tab can creates two panels:
  703. * a tree panel and a detail panel,
  704. * in which properties will be displayed.
  705. * Both panels are separated by a resize bar
  706. */
  707. export abstract class PropertyTab extends Tab {
  708. protected _inspector: Inspector;
  709. /** The panel containing a list of items */
  710. protected _treePanel: HTMLDivElement;
  711. /** The panel containing a list if properties corresponding to an item */
  712. protected _detailsPanel: DetailPanel;
  713. protected _treeItems: Array<TreeItem>;
  714. protected _searchBar: SearchBar;
  715. constructor(tabbar: TabBar, name: string, insp: Inspector);
  716. /** Overrides dispose */
  717. dispose(): void;
  718. update(_items?: Array<TreeItem>): void;
  719. /** Display the details of the given item */
  720. displayDetails(item: TreeItem): void;
  721. /** Select an item in the tree */
  722. select(item: TreeItem): void;
  723. /** Set the given item as active in the tree */
  724. activateNode(item: TreeItem): void;
  725. /** Returns the treeitem corersponding to the given obj, null if not found */
  726. getItemFor(_obj: any): BABYLON.Nullable<TreeItem>;
  727. filter(filter: string): void;
  728. /** Builds the tree panel */
  729. protected abstract _getTree(): Array<TreeItem>;
  730. }
  731. }
  732. declare module INSPECTOR {
  733. export class SceneTab extends Tab {
  734. constructor(tabbar: TabBar, insp: Inspector);
  735. /** Overrides super.dispose */
  736. dispose(): void;
  737. }
  738. }
  739. declare module INSPECTOR {
  740. export class SoundTab extends PropertyTab {
  741. constructor(tabbar: TabBar, inspector: Inspector);
  742. protected _getTree(): Array<TreeItem>;
  743. }
  744. }
  745. declare module INSPECTOR {
  746. export class StatsTab extends Tab {
  747. constructor(tabbar: TabBar, insp: Inspector);
  748. dispose(): void;
  749. active(b: boolean): void;
  750. }
  751. }
  752. declare module INSPECTOR {
  753. export abstract class Tab extends BasicElement {
  754. protected _tabbar: TabBar;
  755. name: string;
  756. protected _isActive: boolean;
  757. protected _panel: HTMLDivElement;
  758. constructor(tabbar: TabBar, name: string);
  759. /** True if the tab is active, false otherwise */
  760. isActive(): boolean;
  761. protected _build(): void;
  762. /** Set this tab as active or not, depending on the current state */
  763. active(b: boolean): void;
  764. update(): void;
  765. /** Creates the tab panel for this tab. */
  766. getPanel(): HTMLElement;
  767. /** Add this in the propertytab with the searchbar */
  768. filter(str: string): void;
  769. /** Dispose properly this tab */
  770. abstract dispose(): void;
  771. /** Select an item in the tree */
  772. select(item: TreeItem): void;
  773. /**
  774. * Returns the total width in pixel of this tab, 0 by default
  775. */
  776. getPixelWidth(): number;
  777. }
  778. }
  779. declare module INSPECTOR {
  780. /**
  781. * A tab bar will contains each view the inspector can have : Canvas2D, Meshes...
  782. * The default active tab is the first one of the list.
  783. */
  784. export class TabBar extends BasicElement {
  785. constructor(inspector: Inspector, initialTab?: number | string);
  786. update(): void;
  787. protected _build(): void;
  788. /** Dispose the current tab, set the given tab as active, and refresh the treeview */
  789. switchTab(tab: Tab): void;
  790. /** Display the mesh tab.
  791. * If a parameter is given, the given mesh details are displayed
  792. */
  793. switchMeshTab(mesh?: BABYLON.AbstractMesh): void;
  794. /** Returns the active tab */
  795. getActiveTab(): BABYLON.Nullable<Tab>;
  796. getActiveTabIndex(): number;
  797. getTabIndex(name: string): number;
  798. readonly inspector: Inspector;
  799. /**
  800. * Returns the total width in pixel of the tabbar,
  801. * that corresponds to the sum of the width of each visible tab + toolbar width
  802. */
  803. getPixelWidth(): number;
  804. /** Display the remaining icon or not depending on the tabbar width.
  805. * This function should be called each time the inspector width is updated
  806. */
  807. updateWidth(): void;
  808. }
  809. }
  810. declare module INSPECTOR {
  811. export class TextureTab extends Tab {
  812. static DDSPreview: DDSPreview;
  813. /** The panel containing a list of items */
  814. protected _treePanel: HTMLElement;
  815. protected _treeItems: Array<TreeItem>;
  816. constructor(tabbar: TabBar, inspector: Inspector);
  817. dispose(): void;
  818. update(_items?: Array<TreeItem>): void;
  819. /** Display the details of the given item */
  820. displayDetails(item: TreeItem): void;
  821. /** Select an item in the tree */
  822. select(item: TreeItem): void;
  823. /** Set the given item as active in the tree */
  824. activateNode(item: TreeItem): void;
  825. }
  826. class DDSPreview {
  827. canvas: HTMLCanvasElement | null;
  828. constructor(AdapterItem: TextureAdapter);
  829. insertPreview(AdapterItem: TextureAdapter): void;
  830. dispose(): void;
  831. }
  832. }
  833. declare module INSPECTOR {
  834. export class ToolsTab extends Tab {
  835. constructor(tabbar: TabBar, insp: Inspector);
  836. dispose(): void;
  837. }
  838. }
  839. declare module INSPECTOR {
  840. export class TreeItem extends BasicElement {
  841. children: Array<TreeItem>;
  842. constructor(tab: Tab, obj: Adapter);
  843. /** Returns the item ID == its adapter ID */
  844. readonly id: string;
  845. /** Add the given item as a child of this one */
  846. add(child: TreeItem): void;
  847. /**
  848. * Returns the original adapter
  849. */
  850. readonly adapter: Adapter;
  851. /**
  852. * Function used to compare this item to another tree item.
  853. * Returns the alphabetical sort of the adapter ID
  854. */
  855. compareTo(item: TreeItem): number;
  856. /** Returns true if the given obj correspond to the adapter linked to this tree item */
  857. correspondsTo(obj: any): boolean;
  858. /** hide all children of this item */
  859. fold(): void;
  860. /** Show all children of this item */
  861. unfold(): void;
  862. /** Build the HTML of this item */
  863. protected _build(): void;
  864. /**
  865. * Returns one HTML element (.details) containing all details of this primitive
  866. */
  867. getDetails(): Array<PropertyLine>;
  868. update(): void;
  869. /**
  870. * Add an event listener on the item :
  871. * - one click display details
  872. */
  873. protected _addEvent(): void;
  874. /** Set this item as active (background lighter) in the tree panel */
  875. active(b: boolean): void;
  876. getDiv(): HTMLDivElement;
  877. }
  878. }
  879. declare module INSPECTOR {
  880. export abstract class AbstractTreeTool {
  881. protected _elem: HTMLElement;
  882. /** Is the tool enabled ? */
  883. protected _on: boolean;
  884. constructor();
  885. toHtml(): HTMLElement;
  886. protected _addEvents(): void;
  887. /**
  888. * Action launched when clicked on this element
  889. * Should be overrided
  890. */
  891. protected action(): void;
  892. }
  893. }
  894. declare module INSPECTOR {
  895. /** Any object implementing this interface should
  896. * provide methods to toggle its bounding box
  897. */
  898. export interface IToolBoundingBox {
  899. isBoxVisible: () => boolean;
  900. setBoxVisible: (b: boolean) => void;
  901. }
  902. /**
  903. * Checkbox to display/hide the primitive
  904. */
  905. export class BoundingBox extends AbstractTreeTool {
  906. constructor(obj: IToolBoundingBox);
  907. protected action(): void;
  908. }
  909. }
  910. declare module INSPECTOR {
  911. export interface ICameraPOV {
  912. setPOV: () => void;
  913. getCurrentActiveCamera: () => string;
  914. id: () => string;
  915. }
  916. /**
  917. *
  918. */
  919. export class CameraPOV extends AbstractTreeTool {
  920. constructor(camera: ICameraPOV);
  921. protected action(): void;
  922. }
  923. }
  924. declare module INSPECTOR {
  925. /** Any object implementing this interface should
  926. * provide methods to toggle its visibility
  927. */
  928. export interface IToolVisible {
  929. isVisible: () => boolean;
  930. setVisible: (b: boolean) => void;
  931. }
  932. /**
  933. * Checkbox to display/hide the primitive
  934. */
  935. export class Checkbox extends AbstractTreeTool {
  936. constructor(obj: IToolVisible);
  937. protected action(): void;
  938. }
  939. }
  940. declare module INSPECTOR {
  941. /** Any object implementing this interface should
  942. * provide methods to toggle a debug area
  943. */
  944. export interface IToolDebug {
  945. debug: (b: boolean) => void;
  946. }
  947. export class DebugArea extends AbstractTreeTool {
  948. constructor(obj: IToolDebug);
  949. protected action(): void;
  950. }
  951. }
  952. declare module INSPECTOR {
  953. /** Any object implementing this interface should
  954. * provide methods to retrieve its info
  955. */
  956. export interface IToolInfo {
  957. getInfo: () => string;
  958. }
  959. /**
  960. * Checkbox to display/hide the primitive
  961. */
  962. export class Info extends AbstractTreeTool {
  963. constructor(obj: IToolInfo);
  964. protected action(): void;
  965. }
  966. }
  967. declare module INSPECTOR {
  968. export interface ISoundInteractions {
  969. setPlaying: (callback: Function) => void;
  970. }
  971. /**
  972. *
  973. */
  974. export class SoundInteractions extends AbstractTreeTool {
  975. constructor(playSound: ISoundInteractions);
  976. protected action(): void;
  977. }
  978. }