babylon.nodeEditor.d.ts 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. /// <reference types="react" />
  2. declare module NODEEDITOR {
  3. /**
  4. * Port model
  5. */
  6. export class DefaultPortModel extends PortModel {
  7. /**
  8. * If the port is input or output
  9. */
  10. position: string | "input" | "output";
  11. /**
  12. * What the port is connected to
  13. */
  14. connection: BABYLON.Nullable<BABYLON.NodeMaterialConnectionPoint>;
  15. defaultValue: any;
  16. static idCounter: number;
  17. constructor(name: string, type?: string);
  18. canLinkToPort(port: DefaultPortModel): boolean;
  19. syncWithNodeMaterialConnectionPoint(connection: BABYLON.NodeMaterialConnectionPoint): void;
  20. getNodeModel(): DefaultNodeModel;
  21. link(outPort: DefaultPortModel): LinkModel<import("storm-react-diagrams").LinkModelListener>;
  22. createLinkModel(): LinkModel;
  23. static SortInputOutput(a: BABYLON.Nullable<DefaultPortModel>, b: BABYLON.Nullable<DefaultPortModel>): {
  24. input: DefaultPortModel;
  25. output: DefaultPortModel;
  26. } | null;
  27. }
  28. }
  29. declare module NODEEDITOR {
  30. interface ITextLineComponentProps {
  31. label: string;
  32. value: string;
  33. color?: string;
  34. underline?: boolean;
  35. onLink?: () => void;
  36. }
  37. export class TextLineComponent extends React.Component<ITextLineComponentProps> {
  38. constructor(props: ITextLineComponentProps);
  39. onLink(): void;
  40. renderContent(): JSX.Element;
  41. render(): JSX.Element;
  42. }
  43. }
  44. declare module NODEEDITOR {
  45. interface ILineContainerComponentProps {
  46. title: string;
  47. children: any[] | any;
  48. closed?: boolean;
  49. }
  50. export class LineContainerComponent extends React.Component<ILineContainerComponentProps, {
  51. isExpanded: boolean;
  52. }> {
  53. private static _InMemoryStorage;
  54. constructor(props: ILineContainerComponentProps);
  55. switchExpandedState(): void;
  56. renderHeader(): JSX.Element;
  57. render(): JSX.Element;
  58. }
  59. }
  60. declare module NODEEDITOR {
  61. export class PropertyChangedEvent {
  62. object: any;
  63. property: string;
  64. value: any;
  65. initialValue: any;
  66. }
  67. }
  68. declare module NODEEDITOR {
  69. interface ITextInputLineComponentProps {
  70. label: string;
  71. target?: any;
  72. propertyName?: string;
  73. value?: string;
  74. onChange?: (value: string) => void;
  75. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  76. }
  77. export class TextInputLineComponent extends React.Component<ITextInputLineComponentProps, {
  78. value: string;
  79. }> {
  80. private _localChange;
  81. constructor(props: ITextInputLineComponentProps);
  82. shouldComponentUpdate(nextProps: ITextInputLineComponentProps, nextState: {
  83. value: string;
  84. }): boolean;
  85. raiseOnPropertyChanged(newValue: string, previousValue: string): void;
  86. updateValue(value: string): void;
  87. render(): JSX.Element;
  88. }
  89. }
  90. declare module NODEEDITOR {
  91. /**
  92. * Generic node model which stores information about a node editor block
  93. */
  94. export class GenericNodeModel extends DefaultNodeModel {
  95. /**
  96. * BABYLON.Vector2 for the node if it exists
  97. */
  98. vector2: BABYLON.Nullable<BABYLON.Vector2>;
  99. /**
  100. * BABYLON.Vector3 for the node if it exists
  101. */
  102. vector3: BABYLON.Nullable<BABYLON.Vector3>;
  103. /**
  104. * BABYLON.Vector4 for the node if it exists
  105. */
  106. vector4: BABYLON.Nullable<BABYLON.Vector4>;
  107. /**
  108. * BABYLON.Matrix for the node if it exists
  109. */
  110. matrix: BABYLON.Nullable<BABYLON.Matrix>;
  111. /**
  112. * Constructs the node model
  113. */
  114. constructor();
  115. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor, filterInputs: string[]): void;
  116. renderProperties(globalState: GlobalState): JSX.Element;
  117. }
  118. }
  119. declare module NODEEDITOR {
  120. /**
  121. * GenericNodeWidgetProps
  122. */
  123. export interface GenericNodeWidgetProps {
  124. node: BABYLON.Nullable<GenericNodeModel>;
  125. globalState: GlobalState;
  126. }
  127. /**
  128. * GenericNodeWidgetState
  129. */
  130. export interface GenericNodeWidgetState {
  131. }
  132. /**
  133. * Used to display a node block for the node editor
  134. */
  135. export class GenericNodeWidget extends React.Component<GenericNodeWidgetProps, GenericNodeWidgetState> {
  136. /**
  137. * Creates a GenericNodeWidget
  138. * @param props
  139. */
  140. constructor(props: GenericNodeWidgetProps);
  141. render(): JSX.Element;
  142. }
  143. }
  144. declare module NODEEDITOR {
  145. /**
  146. * Node factory which creates editor nodes
  147. */
  148. export class GenericNodeFactory extends SRD.AbstractNodeFactory {
  149. private _globalState;
  150. /**
  151. * Constructs a GenericNodeFactory
  152. */
  153. constructor(globalState: GlobalState);
  154. /**
  155. * Generates a node widget
  156. * @param diagramEngine diagram engine
  157. * @param node node to generate
  158. * @returns node widget jsx
  159. */
  160. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: GenericNodeModel): JSX.Element;
  161. /**
  162. * Gets a new instance of a node model
  163. * @returns generic node model
  164. */
  165. getNewInstance(): GenericNodeModel;
  166. }
  167. }
  168. declare module NODEEDITOR {
  169. export interface IButtonLineComponentProps {
  170. label: string;
  171. onClick: () => void;
  172. }
  173. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  174. constructor(props: IButtonLineComponentProps);
  175. render(): JSX.Element;
  176. }
  177. }
  178. declare module NODEEDITOR {
  179. interface INodeListComponentProps {
  180. globalState: GlobalState;
  181. onAddValueNode: (b: string) => void;
  182. onAddNodeFromClass: (ObjectClass: typeof BABYLON.NodeMaterialBlock) => void;
  183. }
  184. export class NodeListComponent extends React.Component<INodeListComponentProps> {
  185. render(): JSX.Element;
  186. }
  187. }
  188. declare module NODEEDITOR {
  189. interface IPropertyTabComponentProps {
  190. globalState: GlobalState;
  191. }
  192. export class PropertyTabComponent extends React.Component<IPropertyTabComponentProps, {
  193. currentNode: BABYLON.Nullable<DefaultNodeModel>;
  194. }> {
  195. constructor(props: IPropertyTabComponentProps);
  196. componentWillMount(): void;
  197. render(): JSX.Element;
  198. }
  199. }
  200. declare module NODEEDITOR {
  201. interface IPortalProps {
  202. globalState: GlobalState;
  203. }
  204. export class Portal extends React.Component<IPortalProps> {
  205. render(): React.ReactPortal;
  206. }
  207. }
  208. declare module NODEEDITOR {
  209. interface IFileButtonLineComponentProps {
  210. label: string;
  211. onClick: (file: File) => void;
  212. accept: string;
  213. }
  214. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  215. constructor(props: IFileButtonLineComponentProps);
  216. onChange(evt: any): void;
  217. render(): JSX.Element;
  218. }
  219. }
  220. declare module NODEEDITOR {
  221. export interface ICheckBoxLineComponentProps {
  222. label: string;
  223. target?: any;
  224. propertyName?: string;
  225. isSelected?: () => boolean;
  226. onSelect?: (value: boolean) => void;
  227. onValueChanged?: () => void;
  228. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  229. }
  230. export class CheckBoxLineComponent extends React.Component<ICheckBoxLineComponentProps, {
  231. isSelected: boolean;
  232. }> {
  233. private static _UniqueIdSeed;
  234. private _uniqueId;
  235. private _localChange;
  236. constructor(props: ICheckBoxLineComponentProps);
  237. shouldComponentUpdate(nextProps: ICheckBoxLineComponentProps, nextState: {
  238. isSelected: boolean;
  239. }): boolean;
  240. onChange(): void;
  241. render(): JSX.Element;
  242. }
  243. }
  244. declare module NODEEDITOR {
  245. interface ITexturePropertyTabComponentProps {
  246. globalState: GlobalState;
  247. node: TextureNodeModel;
  248. }
  249. export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps> {
  250. /**
  251. * Replaces the texture of the node
  252. * @param file the file of the texture to use
  253. */
  254. replaceTexture(file: File): void;
  255. render(): JSX.Element;
  256. }
  257. }
  258. declare module NODEEDITOR {
  259. /**
  260. * BABYLON.Texture node model which stores information about a node editor block
  261. */
  262. export class TextureNodeModel extends DefaultNodeModel {
  263. private _block;
  264. /**
  265. * BABYLON.Texture for the node if it exists
  266. */
  267. texture: BABYLON.Nullable<BABYLON.Texture>;
  268. /**
  269. * Constructs the node model
  270. */
  271. constructor();
  272. renderProperties(globalState: GlobalState): JSX.Element;
  273. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor, filterInputs: string[]): void;
  274. }
  275. }
  276. declare module NODEEDITOR {
  277. interface ITextureLineComponentProps {
  278. texture: BABYLON.BaseTexture;
  279. width: number;
  280. height: number;
  281. globalState?: any;
  282. hideChannelSelect?: boolean;
  283. }
  284. export class TextureLineComponent extends React.Component<ITextureLineComponentProps, {
  285. displayRed: boolean;
  286. displayGreen: boolean;
  287. displayBlue: boolean;
  288. displayAlpha: boolean;
  289. face: number;
  290. }> {
  291. constructor(props: ITextureLineComponentProps);
  292. shouldComponentUpdate(nextProps: ITextureLineComponentProps, nextState: {
  293. displayRed: boolean;
  294. displayGreen: boolean;
  295. displayBlue: boolean;
  296. displayAlpha: boolean;
  297. face: number;
  298. }): boolean;
  299. componentDidMount(): void;
  300. componentDidUpdate(): void;
  301. updatePreview(): void;
  302. render(): JSX.Element;
  303. }
  304. }
  305. declare module NODEEDITOR {
  306. /**
  307. * GenericNodeWidgetProps
  308. */
  309. export interface ITextureNodeWidgetProps {
  310. node: BABYLON.Nullable<TextureNodeModel>;
  311. globalState: GlobalState;
  312. }
  313. /**
  314. * Used to display a node block for the node editor
  315. */
  316. export class TextureNodeWidget extends React.Component<ITextureNodeWidgetProps> {
  317. /**
  318. * Creates a GenericNodeWidget
  319. * @param props
  320. */
  321. constructor(props: ITextureNodeWidgetProps);
  322. render(): JSX.Element;
  323. }
  324. }
  325. declare module NODEEDITOR {
  326. /**
  327. * Node factory which creates editor nodes
  328. */
  329. export class TextureNodeFactory extends SRD.AbstractNodeFactory {
  330. private _globalState;
  331. /**
  332. * Constructs a TextureNodeFactory
  333. */
  334. constructor(globalState: GlobalState);
  335. /**
  336. * Generates a node widget
  337. * @param diagramEngine diagram engine
  338. * @param node node to generate
  339. * @returns node widget jsx
  340. */
  341. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: TextureNodeModel): JSX.Element;
  342. /**
  343. * Gets a new instance of a node model
  344. * @returns texture node model
  345. */
  346. getNewInstance(): TextureNodeModel;
  347. }
  348. }
  349. declare module NODEEDITOR {
  350. interface INumericInputComponentProps {
  351. label: string;
  352. value: number;
  353. step?: number;
  354. onChange: (value: number) => void;
  355. }
  356. export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
  357. value: string;
  358. }> {
  359. static defaultProps: {
  360. step: number;
  361. };
  362. private _localChange;
  363. constructor(props: INumericInputComponentProps);
  364. shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
  365. value: string;
  366. }): boolean;
  367. updateValue(evt: any): void;
  368. render(): JSX.Element;
  369. }
  370. }
  371. declare module NODEEDITOR {
  372. interface IVector2LineComponentProps {
  373. label: string;
  374. target: any;
  375. propertyName: string;
  376. step?: number;
  377. onChange?: (newvalue: BABYLON.Vector2) => void;
  378. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  379. }
  380. export class Vector2LineComponent extends React.Component<IVector2LineComponentProps, {
  381. isExpanded: boolean;
  382. value: BABYLON.Vector2;
  383. }> {
  384. static defaultProps: {
  385. step: number;
  386. };
  387. private _localChange;
  388. constructor(props: IVector2LineComponentProps);
  389. shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: {
  390. isExpanded: boolean;
  391. value: BABYLON.Vector2;
  392. }): boolean;
  393. switchExpandState(): void;
  394. raiseOnPropertyChanged(previousValue: BABYLON.Vector2): void;
  395. updateStateX(value: number): void;
  396. updateStateY(value: number): void;
  397. render(): JSX.Element;
  398. }
  399. }
  400. declare module NODEEDITOR {
  401. interface IVector2PropertyTabComponentProps {
  402. globalState: GlobalState;
  403. connection: BABYLON.NodeMaterialConnectionPoint;
  404. }
  405. export class Vector2PropertyTabComponent extends React.Component<IVector2PropertyTabComponentProps> {
  406. render(): JSX.Element;
  407. }
  408. }
  409. declare module NODEEDITOR {
  410. interface IVector3LineComponentProps {
  411. label: string;
  412. target: any;
  413. propertyName: string;
  414. step?: number;
  415. onChange?: (newvalue: BABYLON.Vector3) => void;
  416. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  417. }
  418. export class Vector3LineComponent extends React.Component<IVector3LineComponentProps, {
  419. isExpanded: boolean;
  420. value: BABYLON.Vector3;
  421. }> {
  422. static defaultProps: {
  423. step: number;
  424. };
  425. private _localChange;
  426. constructor(props: IVector3LineComponentProps);
  427. shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: {
  428. isExpanded: boolean;
  429. value: BABYLON.Vector3;
  430. }): boolean;
  431. switchExpandState(): void;
  432. raiseOnPropertyChanged(previousValue: BABYLON.Vector3): void;
  433. updateVector3(): void;
  434. updateStateX(value: number): void;
  435. updateStateY(value: number): void;
  436. updateStateZ(value: number): void;
  437. render(): JSX.Element;
  438. }
  439. }
  440. declare module NODEEDITOR {
  441. interface IVector3PropertyTabComponentProps {
  442. globalState: GlobalState;
  443. connection: BABYLON.NodeMaterialConnectionPoint;
  444. }
  445. export class Vector3PropertyTabComponent extends React.Component<IVector3PropertyTabComponentProps> {
  446. render(): JSX.Element;
  447. }
  448. }
  449. declare module NODEEDITOR {
  450. class ListLineOption {
  451. label: string;
  452. value: number | string;
  453. }
  454. interface IOptionsLineComponentProps {
  455. label: string;
  456. target: any;
  457. propertyName: string;
  458. options: ListLineOption[];
  459. noDirectUpdate?: boolean;
  460. onSelect?: (value: number | string) => void;
  461. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  462. valuesAreStrings?: boolean;
  463. defaultIfNull?: number;
  464. }
  465. export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
  466. value: number | string;
  467. }> {
  468. private _localChange;
  469. private _getValue;
  470. constructor(props: IOptionsLineComponentProps);
  471. shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
  472. value: number;
  473. }): boolean;
  474. raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
  475. updateValue(valueString: string): void;
  476. render(): JSX.Element;
  477. }
  478. }
  479. declare module NODEEDITOR {
  480. export interface IColor3LineComponentProps {
  481. label: string;
  482. target: any;
  483. propertyName: string;
  484. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  485. onChange?: () => void;
  486. }
  487. export class Color3LineComponent extends React.Component<IColor3LineComponentProps, {
  488. isExpanded: boolean;
  489. color: BABYLON.Color3;
  490. }> {
  491. private _localChange;
  492. constructor(props: IColor3LineComponentProps);
  493. shouldComponentUpdate(nextProps: IColor3LineComponentProps, nextState: {
  494. color: BABYLON.Color3;
  495. }): boolean;
  496. onChange(newValue: string): void;
  497. switchExpandState(): void;
  498. raiseOnPropertyChanged(previousValue: BABYLON.Color3): void;
  499. updateStateR(value: number): void;
  500. updateStateG(value: number): void;
  501. updateStateB(value: number): void;
  502. copyToClipboard(): void;
  503. render(): JSX.Element;
  504. }
  505. }
  506. declare module NODEEDITOR {
  507. interface IColor3PropertyTabComponentProps {
  508. globalState: GlobalState;
  509. connection: BABYLON.NodeMaterialConnectionPoint;
  510. }
  511. export class Color3PropertyTabComponent extends React.Component<IColor3PropertyTabComponentProps> {
  512. render(): JSX.Element;
  513. }
  514. }
  515. declare module NODEEDITOR {
  516. interface IFloatLineComponentProps {
  517. label: string;
  518. target: any;
  519. propertyName: string;
  520. onChange?: (newValue: number) => void;
  521. isInteger?: boolean;
  522. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  523. additionalClass?: string;
  524. step?: string;
  525. digits?: number;
  526. }
  527. export class FloatLineComponent extends React.Component<IFloatLineComponentProps, {
  528. value: string;
  529. }> {
  530. private _localChange;
  531. private _store;
  532. constructor(props: IFloatLineComponentProps);
  533. shouldComponentUpdate(nextProps: IFloatLineComponentProps, nextState: {
  534. value: string;
  535. }): boolean;
  536. raiseOnPropertyChanged(newValue: number, previousValue: number): void;
  537. updateValue(valueString: string): void;
  538. render(): JSX.Element;
  539. }
  540. }
  541. declare module NODEEDITOR {
  542. interface IFloatPropertyTabComponentProps {
  543. globalState: GlobalState;
  544. connection: BABYLON.NodeMaterialConnectionPoint;
  545. }
  546. export class FloatPropertyTabComponent extends React.Component<IFloatPropertyTabComponentProps> {
  547. render(): JSX.Element;
  548. }
  549. }
  550. declare module NODEEDITOR {
  551. export class StringTools {
  552. /**
  553. * Gets the base math type of node material block connection point.
  554. * @param type Type to parse.
  555. */
  556. static GetBaseType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  557. }
  558. }
  559. declare module NODEEDITOR {
  560. interface IInputPropertyTabComponentProps {
  561. globalState: GlobalState;
  562. inputNode: InputNodeModel;
  563. }
  564. export class InputPropertyTabComponentProps extends React.Component<IInputPropertyTabComponentProps> {
  565. constructor(props: IInputPropertyTabComponentProps);
  566. renderValue(globalState: GlobalState): JSX.Element | null;
  567. setDefaultValue(): void;
  568. render(): JSX.Element;
  569. }
  570. }
  571. declare module NODEEDITOR {
  572. /**
  573. * Generic node model which stores information about a node editor block
  574. */
  575. export class InputNodeModel extends DefaultNodeModel {
  576. connection?: BABYLON.NodeMaterialConnectionPoint;
  577. /**
  578. * Constructs the node model
  579. */
  580. constructor();
  581. renderProperties(globalState: GlobalState): JSX.Element | null;
  582. }
  583. }
  584. declare module NODEEDITOR {
  585. /**
  586. * GenericNodeWidgetProps
  587. */
  588. export interface InputNodeWidgetProps {
  589. node: BABYLON.Nullable<InputNodeModel>;
  590. globalState: GlobalState;
  591. }
  592. /**
  593. * Used to display a node block for the node editor
  594. */
  595. export class InputNodeWidget extends React.Component<InputNodeWidgetProps> {
  596. /**
  597. * Creates a GenericNodeWidget
  598. * @param props
  599. */
  600. constructor(props: InputNodeWidgetProps);
  601. renderValue(value: string): JSX.Element | null;
  602. render(): JSX.Element;
  603. }
  604. }
  605. declare module NODEEDITOR {
  606. /**
  607. * Node factory which creates editor nodes
  608. */
  609. export class InputNodeFactory extends SRD.AbstractNodeFactory {
  610. private _globalState;
  611. /**
  612. * Constructs a GenericNodeFactory
  613. */
  614. constructor(globalState: GlobalState);
  615. /**
  616. * Generates a node widget
  617. * @param diagramEngine diagram engine
  618. * @param node node to generate
  619. * @returns node widget jsx
  620. */
  621. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: InputNodeModel): JSX.Element;
  622. /**
  623. * Gets a new instance of a node model
  624. * @returns input node model
  625. */
  626. getNewInstance(): InputNodeModel;
  627. }
  628. }
  629. declare module NODEEDITOR {
  630. interface ILogComponentProps {
  631. globalState: GlobalState;
  632. }
  633. export class LogEntry {
  634. message: string;
  635. isError: boolean;
  636. constructor(message: string, isError: boolean);
  637. }
  638. export class LogComponent extends React.Component<ILogComponentProps, {
  639. logs: LogEntry[];
  640. }> {
  641. constructor(props: ILogComponentProps);
  642. componentWillMount(): void;
  643. componentDidUpdate(): void;
  644. render(): JSX.Element;
  645. }
  646. }
  647. declare module NODEEDITOR {
  648. interface ILightPropertyTabComponentProps {
  649. globalState: GlobalState;
  650. node: LightNodeModel;
  651. }
  652. export class LightPropertyTabComponent extends React.Component<ILightPropertyTabComponentProps> {
  653. render(): JSX.Element;
  654. }
  655. }
  656. declare module NODEEDITOR {
  657. /**
  658. * BABYLON.Light node model which stores information about a node editor block
  659. */
  660. export class LightNodeModel extends DefaultNodeModel {
  661. private _block;
  662. /**
  663. * BABYLON.Light for the node if it exists
  664. */
  665. light: BABYLON.Nullable<BABYLON.Light>;
  666. /**
  667. * Constructs the node model
  668. */
  669. constructor();
  670. renderProperties(globalState: GlobalState): JSX.Element;
  671. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor, filterInputs: string[]): void;
  672. }
  673. }
  674. declare module NODEEDITOR {
  675. /**
  676. * GenericNodeWidgetProps
  677. */
  678. export interface ILightNodeWidgetProps {
  679. node: BABYLON.Nullable<LightNodeModel>;
  680. globalState: GlobalState;
  681. }
  682. /**
  683. * Used to display a node block for the node editor
  684. */
  685. export class LightNodeWidget extends React.Component<ILightNodeWidgetProps> {
  686. /**
  687. * Creates a GenericNodeWidget
  688. * @param props
  689. */
  690. constructor(props: ILightNodeWidgetProps);
  691. render(): JSX.Element;
  692. }
  693. }
  694. declare module NODEEDITOR {
  695. /**
  696. * Node factory which creates editor nodes
  697. */
  698. export class LightNodeFactory extends SRD.AbstractNodeFactory {
  699. private _globalState;
  700. /**
  701. * Constructs a LightNodeFactory
  702. */
  703. constructor(globalState: GlobalState);
  704. /**
  705. * Generates a node widget
  706. * @param diagramEngine diagram engine
  707. * @param node node to generate
  708. * @returns node widget jsx
  709. */
  710. generateReactWidget(diagramEngine: SRD.DiagramEngine, node: LightNodeModel): JSX.Element;
  711. /**
  712. * Gets a new instance of a node model
  713. * @returns light node model
  714. */
  715. getNewInstance(): LightNodeModel;
  716. }
  717. }
  718. declare module NODEEDITOR {
  719. interface IGraphEditorProps {
  720. globalState: GlobalState;
  721. }
  722. export class NodeCreationOptions {
  723. column: number;
  724. nodeMaterialBlock?: BABYLON.NodeMaterialBlock;
  725. type?: string;
  726. connection?: BABYLON.NodeMaterialConnectionPoint;
  727. }
  728. export class GraphEditor extends React.Component<IGraphEditorProps> {
  729. private _engine;
  730. private _model;
  731. private _nodes;
  732. /** @hidden */
  733. _toAdd: LinkModel[] | null;
  734. /**
  735. * Current row/column position used when adding new nodes
  736. */
  737. private _rowPos;
  738. /**
  739. * Creates a node and recursivly creates its parent nodes from it's input
  740. * @param nodeMaterialBlock
  741. */
  742. createNodeFromObject(options: NodeCreationOptions): DefaultNodeModel;
  743. componentDidMount(): void;
  744. componentWillUnmount(): void;
  745. constructor(props: IGraphEditorProps);
  746. buildMaterial(): void;
  747. build(): void;
  748. addNodeFromClass(ObjectClass: typeof BABYLON.NodeMaterialBlock): DefaultNodeModel;
  749. addValueNode(type: string, column?: number, connection?: BABYLON.NodeMaterialConnectionPoint): DefaultNodeModel;
  750. render(): JSX.Element;
  751. }
  752. }
  753. declare module NODEEDITOR {
  754. /**
  755. * Generic node model which stores information about a node editor block
  756. */
  757. export class DefaultNodeModel extends NodeModel {
  758. /**
  759. * The babylon block this node represents
  760. */
  761. block: BABYLON.Nullable<BABYLON.NodeMaterialBlock>;
  762. ports: {
  763. [s: string]: DefaultPortModel;
  764. };
  765. /**
  766. * Constructs the node model
  767. */
  768. constructor(key: string);
  769. prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor, filterInputs: string[]): void;
  770. renderProperties(globalState: GlobalState): JSX.Element | null;
  771. }
  772. }
  773. declare module NODEEDITOR {
  774. export class GlobalState {
  775. nodeMaterial?: BABYLON.NodeMaterial;
  776. hostElement: HTMLElement;
  777. hostDocument: HTMLDocument;
  778. onSelectionChangedObservable: BABYLON.Observable<BABYLON.Nullable<DefaultNodeModel>>;
  779. onRebuildRequiredObservable: BABYLON.Observable<void>;
  780. onResetRequiredObservable: BABYLON.Observable<void>;
  781. onUpdateRequiredObservable: BABYLON.Observable<void>;
  782. onZoomToFitRequiredObservable: BABYLON.Observable<void>;
  783. onLogRequiredObservable: BABYLON.Observable<LogEntry>;
  784. }
  785. }
  786. declare module NODEEDITOR {
  787. export class Popup {
  788. static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
  789. private static _CopyStyles;
  790. }
  791. }
  792. declare module NODEEDITOR {
  793. /**
  794. * Interface used to specify creation options for the node editor
  795. */
  796. export interface INodeEditorOptions {
  797. nodeMaterial: BABYLON.NodeMaterial;
  798. }
  799. /**
  800. * Class used to create a node editor
  801. */
  802. export class NodeEditor {
  803. /**
  804. * Show the node editor
  805. * @param options defines the options to use to configure the node editor
  806. */
  807. static Show(options: INodeEditorOptions): void;
  808. }
  809. }