babylon.nodeEditor.d.ts 30 KB

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