babylon.inspector.d.ts 37 KB

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