babylon.inspector.d.ts 37 KB

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