babylon.nodeEditor.d.ts 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485
  1. /// <reference types="react" />
  2. declare module NODEEDITOR {
  3. export class BlockTools {
  4. static GetBlockFromString(data: string, scene: BABYLON.Scene, nodeMaterial: BABYLON.NodeMaterial): BABYLON.DesaturateBlock | BABYLON.RefractBlock | BABYLON.ReflectBlock | BABYLON.DerivativeBlock | BABYLON.Rotate2dBlock | BABYLON.NormalBlendBlock | BABYLON.WorleyNoise3DBlock | BABYLON.SimplexPerlin3DBlock | BABYLON.BonesBlock | BABYLON.InstancesBlock | BABYLON.MorphTargetsBlock | BABYLON.DiscardBlock | BABYLON.ImageProcessingBlock | BABYLON.ColorMergerBlock | BABYLON.VectorMergerBlock | BABYLON.ColorSplitterBlock | BABYLON.VectorSplitterBlock | BABYLON.TextureBlock | BABYLON.ReflectionTextureBlock | BABYLON.LightBlock | BABYLON.FogBlock | BABYLON.VertexOutputBlock | BABYLON.FragmentOutputBlock | BABYLON.AddBlock | BABYLON.ClampBlock | BABYLON.ScaleBlock | BABYLON.CrossBlock | BABYLON.DotBlock | BABYLON.PowBlock | BABYLON.MultiplyBlock | BABYLON.TransformBlock | BABYLON.TrigonometryBlock | BABYLON.RemapBlock | BABYLON.NormalizeBlock | BABYLON.FresnelBlock | BABYLON.LerpBlock | BABYLON.NLerpBlock | BABYLON.DivideBlock | BABYLON.SubtractBlock | BABYLON.StepBlock | BABYLON.SmoothStepBlock | BABYLON.OneMinusBlock | BABYLON.ReciprocalBlock | BABYLON.ViewDirectionBlock | BABYLON.LightInformationBlock | BABYLON.MaxBlock | BABYLON.MinBlock | BABYLON.LengthBlock | BABYLON.DistanceBlock | BABYLON.NegateBlock | BABYLON.PerturbNormalBlock | BABYLON.RandomNumberBlock | BABYLON.ReplaceColorBlock | BABYLON.PosterizeBlock | BABYLON.ArcTan2Block | BABYLON.GradientBlock | BABYLON.FrontFacingBlock | BABYLON.WaveBlock | BABYLON.InputBlock | null;
  5. static GetColorFromConnectionNodeType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  6. 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;
  7. static GetStringFromConnectionNodeType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): "Float" | "Vector2" | "Vector3" | "Vector4" | "Matrix" | "Color3" | "Color4" | "";
  8. }
  9. }
  10. declare module NODEEDITOR {
  11. interface ILogComponentProps {
  12. globalState: GlobalState;
  13. }
  14. export class LogEntry {
  15. message: string;
  16. isError: boolean;
  17. constructor(message: string, isError: boolean);
  18. }
  19. export class LogComponent extends React.Component<ILogComponentProps, {
  20. logs: LogEntry[];
  21. }> {
  22. constructor(props: ILogComponentProps);
  23. componentDidMount(): void;
  24. componentDidUpdate(): void;
  25. render(): JSX.Element;
  26. }
  27. }
  28. declare module NODEEDITOR {
  29. export enum PreviewMeshType {
  30. Sphere = 0,
  31. Box = 1,
  32. Torus = 2,
  33. Cylinder = 3,
  34. Plane = 4,
  35. ShaderBall = 5,
  36. Custom = 6
  37. }
  38. }
  39. declare module NODEEDITOR {
  40. export interface IDisplayManager {
  41. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  42. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  43. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  44. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  45. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  46. }
  47. }
  48. declare module NODEEDITOR {
  49. export interface INodeLocationInfo {
  50. blockId: number;
  51. x: number;
  52. y: number;
  53. }
  54. export interface IFrameData {
  55. x: number;
  56. y: number;
  57. width: number;
  58. height: number;
  59. color: number[];
  60. name: string;
  61. isCollapsed: boolean;
  62. blocks: number[];
  63. comments: string;
  64. }
  65. export interface IEditorData {
  66. locations: INodeLocationInfo[];
  67. x: number;
  68. y: number;
  69. zoom: number;
  70. frames?: IFrameData[];
  71. map?: {
  72. [key: number]: number;
  73. };
  74. }
  75. }
  76. declare module NODEEDITOR {
  77. export class SerializationTools {
  78. static UpdateLocations(material: BABYLON.NodeMaterial, globalState: GlobalState): void;
  79. static Serialize(material: BABYLON.NodeMaterial, globalState: GlobalState, selectedBlocks?: BABYLON.NodeMaterialBlock[]): string;
  80. static Deserialize(serializationObject: any, globalState: GlobalState): void;
  81. }
  82. }
  83. declare module NODEEDITOR {
  84. export class StringTools {
  85. private static _SaveAs;
  86. private static _Click;
  87. /**
  88. * Gets the base math type of node material block connection point.
  89. * @param type Type to parse.
  90. */
  91. static GetBaseType(type: BABYLON.NodeMaterialBlockConnectionPointTypes): string;
  92. /**
  93. * Download a string into a file that will be saved locally by the browser
  94. * @param content defines the string to download locally as a file
  95. */
  96. static DownloadAsFile(document: HTMLDocument, content: string, filename: string): void;
  97. }
  98. }
  99. declare module NODEEDITOR {
  100. export class FrameNodePort extends NodePort {
  101. connectionPoint: BABYLON.NodeMaterialConnectionPoint;
  102. node: GraphNode;
  103. private _portLabel;
  104. private _parentFrameId;
  105. private _isInput;
  106. private _framePortPosition;
  107. private _framePortId;
  108. private _onFramePortPositionChangedObservable;
  109. get parentFrameId(): number;
  110. get onFramePortPositionChangedObservable(): BABYLON.Observable<FrameNodePort>;
  111. get isInput(): boolean;
  112. get portLabel(): string;
  113. get framePortId(): number;
  114. set portLabel(newLabel: string);
  115. get framePortPosition(): FramePortPosition;
  116. set framePortPosition(position: FramePortPosition);
  117. constructor(portContainer: HTMLElement, connectionPoint: BABYLON.NodeMaterialConnectionPoint, node: GraphNode, globalState: GlobalState, isInput: boolean, framePortId: number, parentFrameId: number);
  118. static CreateFrameNodePortElement(connectionPoint: BABYLON.NodeMaterialConnectionPoint, node: GraphNode, root: HTMLElement, displayManager: BABYLON.Nullable<IDisplayManager>, globalState: GlobalState, isInput: boolean, framePortId: number, parentFrameId: number): FrameNodePort;
  119. }
  120. }
  121. declare module NODEEDITOR {
  122. export enum FramePortPosition {
  123. Top = 0,
  124. Middle = 1,
  125. Bottom = 2
  126. }
  127. export class GraphFrame {
  128. private readonly CollapsedWidth;
  129. private static _FrameCounter;
  130. private static _FramePortCounter;
  131. private _name;
  132. private _color;
  133. private _x;
  134. private _y;
  135. private _gridAlignedX;
  136. private _gridAlignedY;
  137. private _width;
  138. private _height;
  139. element: HTMLDivElement;
  140. private _borderElement;
  141. private _headerElement;
  142. private _headerTextElement;
  143. private _headerCollapseElement;
  144. private _headerCloseElement;
  145. private _commentsElement;
  146. private _portContainer;
  147. private _outputPortContainer;
  148. private _inputPortContainer;
  149. private _nodes;
  150. private _ownerCanvas;
  151. private _mouseStartPointX;
  152. private _mouseStartPointY;
  153. private _onSelectionChangedObserver;
  154. private _onGraphNodeRemovalObserver;
  155. private _isCollapsed;
  156. private _frameInPorts;
  157. private _frameOutPorts;
  158. private _controlledPorts;
  159. private _id;
  160. private _comments;
  161. private _frameIsResizing;
  162. private _resizingDirection;
  163. private _minFrameHeight;
  164. private _minFrameWidth;
  165. private mouseXLimit;
  166. onExpandStateChanged: BABYLON.Observable<GraphFrame>;
  167. private readonly CloseSVG;
  168. private readonly ExpandSVG;
  169. private readonly CollapseSVG;
  170. get id(): number;
  171. get isCollapsed(): boolean;
  172. private _createInputPort;
  173. set isCollapsed(value: boolean);
  174. get nodes(): GraphNode[];
  175. get ports(): FrameNodePort[];
  176. get name(): string;
  177. set name(value: string);
  178. get color(): BABYLON.Color3;
  179. set color(value: BABYLON.Color3);
  180. get x(): number;
  181. set x(value: number);
  182. get y(): number;
  183. set y(value: number);
  184. get width(): number;
  185. set width(value: number);
  186. get height(): number;
  187. set height(value: number);
  188. get comments(): string;
  189. set comments(comments: string);
  190. constructor(candidate: BABYLON.Nullable<HTMLDivElement>, canvas: GraphCanvasComponent, doNotCaptureNodes?: boolean);
  191. refresh(): void;
  192. addNode(node: GraphNode): void;
  193. removeNode(node: GraphNode): void;
  194. syncNode(node: GraphNode): void;
  195. cleanAccumulation(): void;
  196. private _onDown;
  197. move(newX: number, newY: number, align?: boolean): void;
  198. private _onUp;
  199. private _moveFrame;
  200. private _onMove;
  201. moveFramePortUp(nodePort: FrameNodePort): void;
  202. private _movePortUp;
  203. moveFramePortDown(nodePort: FrameNodePort): void;
  204. private _movePortDown;
  205. private initResizing;
  206. private cleanUpResizing;
  207. private updateMinHeightWithComments;
  208. private _isResizingTop;
  209. private _isResizingRight;
  210. private _isResizingBottom;
  211. private _isResizingLeft;
  212. private _onRightHandlePointerDown;
  213. private _onRightHandlePointerMove;
  214. private _moveRightHandle;
  215. private _onRightHandlePointerUp;
  216. private _onBottomHandlePointerDown;
  217. private _onBottomHandlePointerMove;
  218. private _moveBottomHandle;
  219. private _onBottomHandlePointerUp;
  220. private _onLeftHandlePointerDown;
  221. private _onLeftHandlePointerMove;
  222. private _moveLeftHandle;
  223. private _onLeftHandlePointerUp;
  224. private _onTopHandlePointerDown;
  225. private _onTopHandlePointerMove;
  226. private _moveTopHandle;
  227. private _onTopHandlePointerUp;
  228. private _onTopRightHandlePointerDown;
  229. private _onTopRightHandlePointerMove;
  230. private _moveTopRightHandle;
  231. private _onTopRightHandlePointerUp;
  232. private _onBottomRightHandlePointerDown;
  233. private _onBottomRightHandlePointerMove;
  234. private _moveBottomRightHandle;
  235. private _onBottomRightHandlePointerUp;
  236. private _onBottomLeftHandlePointerDown;
  237. private _onBottomLeftHandlePointerMove;
  238. private _moveBottomLeftHandle;
  239. private _onBottomLeftHandlePointerUp;
  240. private _onTopLeftHandlePointerDown;
  241. private _onTopLeftHandlePointerMove;
  242. private _moveTopLeftHandle;
  243. private _onTopLeftHandlePointerUp;
  244. private _expandLeft;
  245. private _expandTop;
  246. private _expandRight;
  247. private _expandBottom;
  248. dispose(): void;
  249. serialize(): IFrameData;
  250. export(): void;
  251. static Parse(serializationData: IFrameData, canvas: GraphCanvasComponent, map?: {
  252. [key: number]: number;
  253. }): GraphFrame;
  254. }
  255. }
  256. declare module NODEEDITOR {
  257. export class NodePort {
  258. connectionPoint: BABYLON.NodeMaterialConnectionPoint;
  259. node: GraphNode;
  260. protected _element: HTMLDivElement;
  261. protected _img: HTMLImageElement;
  262. protected _globalState: GlobalState;
  263. protected _onCandidateLinkMovedObserver: BABYLON.Nullable<BABYLON.Observer<BABYLON.Nullable<BABYLON.Vector2>>>;
  264. protected _onSelectionChangedObserver: BABYLON.Nullable<BABYLON.Observer<BABYLON.Nullable<GraphFrame | GraphNode | NodeLink | NodePort | FramePortData>>>;
  265. delegatedPort: BABYLON.Nullable<FrameNodePort>;
  266. get element(): HTMLDivElement;
  267. refresh(): void;
  268. constructor(portContainer: HTMLElement, connectionPoint: BABYLON.NodeMaterialConnectionPoint, node: GraphNode, globalState: GlobalState);
  269. dispose(): void;
  270. static CreatePortElement(connectionPoint: BABYLON.NodeMaterialConnectionPoint, node: GraphNode, root: HTMLElement, displayManager: BABYLON.Nullable<IDisplayManager>, globalState: GlobalState): NodePort;
  271. }
  272. }
  273. declare module NODEEDITOR {
  274. export class NodeLink {
  275. private _graphCanvas;
  276. private _portA;
  277. private _portB?;
  278. private _nodeA;
  279. private _nodeB?;
  280. private _path;
  281. private _selectionPath;
  282. private _onSelectionChangedObserver;
  283. private _isVisible;
  284. onDisposedObservable: BABYLON.Observable<NodeLink>;
  285. get isVisible(): boolean;
  286. set isVisible(value: boolean);
  287. get portA(): FrameNodePort | NodePort;
  288. get portB(): FrameNodePort | NodePort | undefined;
  289. get nodeA(): GraphNode;
  290. get nodeB(): GraphNode | undefined;
  291. update(endX?: number, endY?: number, straight?: boolean): void;
  292. constructor(graphCanvas: GraphCanvasComponent, portA: NodePort, nodeA: GraphNode, portB?: NodePort, nodeB?: GraphNode);
  293. onClick(): void;
  294. dispose(): void;
  295. }
  296. }
  297. declare module NODEEDITOR {
  298. export interface IGraphCanvasComponentProps {
  299. globalState: GlobalState;
  300. }
  301. export type FramePortData = {
  302. frame: GraphFrame;
  303. port: FrameNodePort;
  304. };
  305. export const isFramePortData: (variableToCheck: any) => variableToCheck is FramePortData;
  306. export class GraphCanvasComponent extends React.Component<IGraphCanvasComponentProps> {
  307. private readonly MinZoom;
  308. private readonly MaxZoom;
  309. private _hostCanvas;
  310. private _graphCanvas;
  311. private _selectionContainer;
  312. private _frameContainer;
  313. private _svgCanvas;
  314. private _rootContainer;
  315. private _nodes;
  316. private _links;
  317. private _mouseStartPointX;
  318. private _mouseStartPointY;
  319. private _dropPointX;
  320. private _dropPointY;
  321. private _selectionStartX;
  322. private _selectionStartY;
  323. private _candidateLinkedHasMoved;
  324. private _x;
  325. private _y;
  326. private _zoom;
  327. private _selectedNodes;
  328. private _selectedLink;
  329. private _selectedPort;
  330. private _candidateLink;
  331. private _candidatePort;
  332. private _gridSize;
  333. private _selectionBox;
  334. private _selectedFrame;
  335. private _frameCandidate;
  336. private _frames;
  337. private _altKeyIsPressed;
  338. private _ctrlKeyIsPressed;
  339. private _oldY;
  340. _frameIsMoving: boolean;
  341. _isLoading: boolean;
  342. get gridSize(): number;
  343. set gridSize(value: number);
  344. get globalState(): GlobalState;
  345. get nodes(): GraphNode[];
  346. get links(): NodeLink[];
  347. get frames(): GraphFrame[];
  348. get zoom(): number;
  349. set zoom(value: number);
  350. get x(): number;
  351. set x(value: number);
  352. get y(): number;
  353. set y(value: number);
  354. get selectedNodes(): GraphNode[];
  355. get selectedLink(): BABYLON.Nullable<NodeLink>;
  356. get selectedFrame(): BABYLON.Nullable<GraphFrame>;
  357. get selectedPort(): BABYLON.Nullable<NodePort>;
  358. get canvasContainer(): HTMLDivElement;
  359. get hostCanvas(): HTMLDivElement;
  360. get svgCanvas(): HTMLElement;
  361. get selectionContainer(): HTMLDivElement;
  362. get frameContainer(): HTMLDivElement;
  363. constructor(props: IGraphCanvasComponentProps);
  364. getGridPosition(position: number, useCeil?: boolean): number;
  365. getGridPositionCeil(position: number): number;
  366. updateTransform(): void;
  367. onKeyUp(): void;
  368. findNodeFromBlock(block: BABYLON.NodeMaterialBlock): GraphNode;
  369. reset(): void;
  370. connectPorts(pointA: BABYLON.NodeMaterialConnectionPoint, pointB: BABYLON.NodeMaterialConnectionPoint): void;
  371. removeLink(link: NodeLink): void;
  372. appendBlock(block: BABYLON.NodeMaterialBlock): GraphNode;
  373. distributeGraph(): void;
  374. componentDidMount(): void;
  375. onMove(evt: React.PointerEvent): void;
  376. onDown(evt: React.PointerEvent<HTMLElement>): void;
  377. onUp(evt: React.PointerEvent): void;
  378. onWheel(evt: React.WheelEvent): void;
  379. zoomToFit(): void;
  380. processCandidatePort(): void;
  381. processEditorData(editorData: IEditorData): void;
  382. render(): JSX.Element;
  383. }
  384. }
  385. declare module NODEEDITOR {
  386. export class PropertyChangedEvent {
  387. object: any;
  388. property: string;
  389. value: any;
  390. initialValue: any;
  391. }
  392. }
  393. declare module NODEEDITOR {
  394. interface IFloatLineComponentProps {
  395. label: string;
  396. target: any;
  397. propertyName: string;
  398. onChange?: (newValue: number) => void;
  399. isInteger?: boolean;
  400. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  401. additionalClass?: string;
  402. step?: string;
  403. digits?: number;
  404. globalState: GlobalState;
  405. }
  406. export class FloatLineComponent extends React.Component<IFloatLineComponentProps, {
  407. value: string;
  408. }> {
  409. private _localChange;
  410. private _store;
  411. constructor(props: IFloatLineComponentProps);
  412. shouldComponentUpdate(nextProps: IFloatLineComponentProps, nextState: {
  413. value: string;
  414. }): boolean;
  415. raiseOnPropertyChanged(newValue: number, previousValue: number): void;
  416. updateValue(valueString: string): void;
  417. render(): JSX.Element;
  418. }
  419. }
  420. declare module NODEEDITOR {
  421. interface IFloatPropertyTabComponentProps {
  422. globalState: GlobalState;
  423. inputBlock: BABYLON.InputBlock;
  424. }
  425. export class FloatPropertyTabComponent extends React.Component<IFloatPropertyTabComponentProps> {
  426. render(): JSX.Element;
  427. }
  428. }
  429. declare module NODEEDITOR {
  430. interface ISliderLineComponentProps {
  431. label: string;
  432. target?: any;
  433. propertyName?: string;
  434. minimum: number;
  435. maximum: number;
  436. step: number;
  437. directValue?: number;
  438. useEuler?: boolean;
  439. onChange?: (value: number) => void;
  440. onInput?: (value: number) => void;
  441. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  442. decimalCount?: number;
  443. }
  444. export class SliderLineComponent extends React.Component<ISliderLineComponentProps, {
  445. value: number;
  446. }> {
  447. private _localChange;
  448. constructor(props: ISliderLineComponentProps);
  449. shouldComponentUpdate(nextProps: ISliderLineComponentProps, nextState: {
  450. value: number;
  451. }): boolean;
  452. onChange(newValueString: any): void;
  453. onInput(newValueString: any): void;
  454. prepareDataToRead(value: number): number;
  455. render(): JSX.Element;
  456. }
  457. }
  458. declare module NODEEDITOR {
  459. interface INumericInputComponentProps {
  460. label: string;
  461. value: number;
  462. step?: number;
  463. onChange: (value: number) => void;
  464. globalState: GlobalState;
  465. }
  466. export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
  467. value: string;
  468. }> {
  469. static defaultProps: {
  470. step: number;
  471. };
  472. private _localChange;
  473. constructor(props: INumericInputComponentProps);
  474. shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
  475. value: string;
  476. }): boolean;
  477. updateValue(evt: any): void;
  478. render(): JSX.Element;
  479. }
  480. }
  481. declare module NODEEDITOR {
  482. interface IVector2LineComponentProps {
  483. label: string;
  484. target: any;
  485. propertyName: string;
  486. step?: number;
  487. onChange?: (newvalue: BABYLON.Vector2) => void;
  488. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  489. globalState: GlobalState;
  490. }
  491. export class Vector2LineComponent extends React.Component<IVector2LineComponentProps, {
  492. isExpanded: boolean;
  493. value: BABYLON.Vector2;
  494. }> {
  495. static defaultProps: {
  496. step: number;
  497. };
  498. private _localChange;
  499. constructor(props: IVector2LineComponentProps);
  500. shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: {
  501. isExpanded: boolean;
  502. value: BABYLON.Vector2;
  503. }): boolean;
  504. switchExpandState(): void;
  505. raiseOnPropertyChanged(previousValue: BABYLON.Vector2): void;
  506. updateStateX(value: number): void;
  507. updateStateY(value: number): void;
  508. render(): JSX.Element;
  509. }
  510. }
  511. declare module NODEEDITOR {
  512. interface IVector2PropertyTabComponentProps {
  513. globalState: GlobalState;
  514. inputBlock: BABYLON.InputBlock;
  515. }
  516. export class Vector2PropertyTabComponent extends React.Component<IVector2PropertyTabComponentProps> {
  517. render(): JSX.Element;
  518. }
  519. }
  520. declare module NODEEDITOR {
  521. export interface IColorPickerComponentProps {
  522. value: BABYLON.Color4 | BABYLON.Color3;
  523. onColorChanged: (newOne: string) => void;
  524. disableAlpha?: boolean;
  525. }
  526. interface IColorPickerComponentState {
  527. pickerEnabled: boolean;
  528. color: {
  529. r: number;
  530. g: number;
  531. b: number;
  532. a?: number;
  533. };
  534. hex: string;
  535. }
  536. export class ColorPickerLineComponent extends React.Component<IColorPickerComponentProps, IColorPickerComponentState> {
  537. private _floatRef;
  538. private _floatHostRef;
  539. constructor(props: IColorPickerComponentProps);
  540. syncPositions(): void;
  541. shouldComponentUpdate(nextProps: IColorPickerComponentProps, nextState: IColorPickerComponentState): boolean;
  542. componentDidUpdate(): void;
  543. componentDidMount(): void;
  544. render(): JSX.Element;
  545. }
  546. }
  547. declare module NODEEDITOR {
  548. export interface IColor3LineComponentProps {
  549. label: string;
  550. target: any;
  551. propertyName: string;
  552. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  553. onChange?: () => void;
  554. globalState: GlobalState;
  555. }
  556. export class Color3LineComponent extends React.Component<IColor3LineComponentProps, {
  557. isExpanded: boolean;
  558. color: BABYLON.Color3;
  559. }> {
  560. private _localChange;
  561. constructor(props: IColor3LineComponentProps);
  562. shouldComponentUpdate(nextProps: IColor3LineComponentProps, nextState: {
  563. color: BABYLON.Color3;
  564. }): boolean;
  565. onChange(newValue: string): void;
  566. switchExpandState(): void;
  567. raiseOnPropertyChanged(previousValue: BABYLON.Color3): void;
  568. updateStateR(value: number): void;
  569. updateStateG(value: number): void;
  570. updateStateB(value: number): void;
  571. copyToClipboard(): void;
  572. render(): JSX.Element;
  573. }
  574. }
  575. declare module NODEEDITOR {
  576. interface IColor3PropertyTabComponentProps {
  577. globalState: GlobalState;
  578. inputBlock: BABYLON.InputBlock;
  579. }
  580. export class Color3PropertyTabComponent extends React.Component<IColor3PropertyTabComponentProps> {
  581. render(): JSX.Element;
  582. }
  583. }
  584. declare module NODEEDITOR {
  585. interface IVector3LineComponentProps {
  586. label: string;
  587. target: any;
  588. propertyName: string;
  589. step?: number;
  590. onChange?: (newvalue: BABYLON.Vector3) => void;
  591. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  592. globalState: GlobalState;
  593. }
  594. export class Vector3LineComponent extends React.Component<IVector3LineComponentProps, {
  595. isExpanded: boolean;
  596. value: BABYLON.Vector3;
  597. }> {
  598. static defaultProps: {
  599. step: number;
  600. };
  601. private _localChange;
  602. constructor(props: IVector3LineComponentProps);
  603. shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: {
  604. isExpanded: boolean;
  605. value: BABYLON.Vector3;
  606. }): boolean;
  607. switchExpandState(): void;
  608. raiseOnPropertyChanged(previousValue: BABYLON.Vector3): void;
  609. updateVector3(): void;
  610. updateStateX(value: number): void;
  611. updateStateY(value: number): void;
  612. updateStateZ(value: number): void;
  613. render(): JSX.Element;
  614. }
  615. }
  616. declare module NODEEDITOR {
  617. interface IVector3PropertyTabComponentProps {
  618. globalState: GlobalState;
  619. inputBlock: BABYLON.InputBlock;
  620. }
  621. export class Vector3PropertyTabComponent extends React.Component<IVector3PropertyTabComponentProps> {
  622. render(): JSX.Element;
  623. }
  624. }
  625. declare module NODEEDITOR {
  626. interface IVector4LineComponentProps {
  627. label: string;
  628. target?: any;
  629. propertyName?: string;
  630. value?: BABYLON.Vector4;
  631. step?: number;
  632. onChange?: (newvalue: BABYLON.Vector4) => void;
  633. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  634. globalState: GlobalState;
  635. }
  636. export class Vector4LineComponent extends React.Component<IVector4LineComponentProps, {
  637. isExpanded: boolean;
  638. value: BABYLON.Vector4;
  639. }> {
  640. static defaultProps: {
  641. step: number;
  642. };
  643. private _localChange;
  644. constructor(props: IVector4LineComponentProps);
  645. shouldComponentUpdate(nextProps: IVector4LineComponentProps, nextState: {
  646. isExpanded: boolean;
  647. value: BABYLON.Vector4;
  648. }): boolean;
  649. switchExpandState(): void;
  650. raiseOnPropertyChanged(previousValue: BABYLON.Vector4): void;
  651. updateVector4(): void;
  652. updateStateX(value: number): void;
  653. updateStateY(value: number): void;
  654. updateStateZ(value: number): void;
  655. updateStateW(value: number): void;
  656. render(): JSX.Element;
  657. }
  658. }
  659. declare module NODEEDITOR {
  660. interface IVector4PropertyTabComponentProps {
  661. globalState: GlobalState;
  662. inputBlock: BABYLON.InputBlock;
  663. }
  664. export class Vector4PropertyTabComponent extends React.Component<IVector4PropertyTabComponentProps> {
  665. render(): JSX.Element;
  666. }
  667. }
  668. declare module NODEEDITOR {
  669. class ListLineOption {
  670. label: string;
  671. value: number | string;
  672. }
  673. interface IOptionsLineComponentProps {
  674. label: string;
  675. target: any;
  676. className?: string;
  677. propertyName?: string;
  678. options: ListLineOption[];
  679. noDirectUpdate?: boolean;
  680. onSelect?: (value: number | string) => void;
  681. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  682. valuesAreStrings?: boolean;
  683. defaultIfNull?: number;
  684. getSelection?: (target: any) => number;
  685. }
  686. export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
  687. value: number | string;
  688. }> {
  689. private _localChange;
  690. private _getValue;
  691. constructor(props: IOptionsLineComponentProps);
  692. shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
  693. value: number;
  694. }): boolean;
  695. raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
  696. updateValue(valueString: string): void;
  697. render(): JSX.Element;
  698. }
  699. }
  700. declare module NODEEDITOR {
  701. interface IMatrixLineComponentProps {
  702. label: string;
  703. target: any;
  704. propertyName: string;
  705. step?: number;
  706. onChange?: (newValue: BABYLON.Matrix) => void;
  707. onModeChange?: (mode: number) => void;
  708. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  709. mode?: number;
  710. globalState: GlobalState;
  711. }
  712. export class MatrixLineComponent extends React.Component<IMatrixLineComponentProps, {
  713. value: BABYLON.Matrix;
  714. mode: number;
  715. angle: number;
  716. }> {
  717. private _localChange;
  718. constructor(props: IMatrixLineComponentProps);
  719. shouldComponentUpdate(nextProps: IMatrixLineComponentProps, nextState: {
  720. value: BABYLON.Matrix;
  721. mode: number;
  722. angle: number;
  723. }): boolean;
  724. raiseOnPropertyChanged(previousValue: BABYLON.Vector3): void;
  725. updateMatrix(): void;
  726. updateRow(value: BABYLON.Vector4, row: number): void;
  727. updateBasedOnMode(value: number): void;
  728. render(): JSX.Element;
  729. }
  730. }
  731. declare module NODEEDITOR {
  732. interface IMatrixPropertyTabComponentProps {
  733. globalState: GlobalState;
  734. inputBlock: BABYLON.InputBlock;
  735. }
  736. export class MatrixPropertyTabComponent extends React.Component<IMatrixPropertyTabComponentProps> {
  737. render(): JSX.Element;
  738. }
  739. }
  740. declare module NODEEDITOR {
  741. interface ILineContainerComponentProps {
  742. title: string;
  743. children: any[] | any;
  744. closed?: boolean;
  745. }
  746. export class LineContainerComponent extends React.Component<ILineContainerComponentProps, {
  747. isExpanded: boolean;
  748. }> {
  749. constructor(props: ILineContainerComponentProps);
  750. switchExpandedState(): void;
  751. renderHeader(): JSX.Element;
  752. render(): JSX.Element;
  753. }
  754. }
  755. declare module NODEEDITOR {
  756. export interface IPropertyComponentProps {
  757. globalState: GlobalState;
  758. block: BABYLON.NodeMaterialBlock;
  759. }
  760. }
  761. declare module NODEEDITOR {
  762. interface ITextInputLineComponentProps {
  763. label: string;
  764. globalState: GlobalState;
  765. target?: any;
  766. propertyName?: string;
  767. value?: string;
  768. onChange?: (value: string) => void;
  769. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  770. }
  771. export class TextInputLineComponent extends React.Component<ITextInputLineComponentProps, {
  772. value: string;
  773. }> {
  774. private _localChange;
  775. constructor(props: ITextInputLineComponentProps);
  776. shouldComponentUpdate(nextProps: ITextInputLineComponentProps, nextState: {
  777. value: string;
  778. }): boolean;
  779. raiseOnPropertyChanged(newValue: string, previousValue: string): void;
  780. updateValue(value: string, raisePropertyChanged: boolean): void;
  781. render(): JSX.Element;
  782. }
  783. }
  784. declare module NODEEDITOR {
  785. interface ITextLineComponentProps {
  786. label: string;
  787. value: string;
  788. color?: string;
  789. underline?: boolean;
  790. onLink?: () => void;
  791. }
  792. export class TextLineComponent extends React.Component<ITextLineComponentProps> {
  793. constructor(props: ITextLineComponentProps);
  794. onLink(): void;
  795. renderContent(): JSX.Element;
  796. render(): JSX.Element;
  797. }
  798. }
  799. declare module NODEEDITOR {
  800. export class GenericPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  801. constructor(props: IPropertyComponentProps);
  802. render(): JSX.Element;
  803. }
  804. }
  805. declare module NODEEDITOR {
  806. export interface ICheckBoxLineComponentProps {
  807. label: string;
  808. target?: any;
  809. propertyName?: string;
  810. isSelected?: () => boolean;
  811. onSelect?: (value: boolean) => void;
  812. onValueChanged?: () => void;
  813. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  814. }
  815. export class CheckBoxLineComponent extends React.Component<ICheckBoxLineComponentProps, {
  816. isSelected: boolean;
  817. }> {
  818. private static _UniqueIdSeed;
  819. private _uniqueId;
  820. private _localChange;
  821. constructor(props: ICheckBoxLineComponentProps);
  822. shouldComponentUpdate(nextProps: ICheckBoxLineComponentProps, nextState: {
  823. isSelected: boolean;
  824. }): boolean;
  825. onChange(): void;
  826. render(): JSX.Element;
  827. }
  828. }
  829. declare module NODEEDITOR {
  830. export interface IColor4LineComponentProps {
  831. label: string;
  832. target: any;
  833. propertyName: string;
  834. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  835. onChange?: () => void;
  836. globalState: GlobalState;
  837. }
  838. export class Color4LineComponent extends React.Component<IColor4LineComponentProps, {
  839. isExpanded: boolean;
  840. color: BABYLON.Color4;
  841. }> {
  842. private _localChange;
  843. constructor(props: IColor4LineComponentProps);
  844. shouldComponentUpdate(nextProps: IColor4LineComponentProps, nextState: {
  845. color: BABYLON.Color4;
  846. }): boolean;
  847. onChange(newValue: string): void;
  848. switchExpandState(): void;
  849. raiseOnPropertyChanged(previousValue: BABYLON.Color4): void;
  850. updateStateR(value: number): void;
  851. updateStateG(value: number): void;
  852. updateStateB(value: number): void;
  853. updateStateA(value: number): void;
  854. copyToClipboard(): void;
  855. render(): JSX.Element;
  856. }
  857. }
  858. declare module NODEEDITOR {
  859. interface IColor4PropertyTabComponentProps {
  860. globalState: GlobalState;
  861. inputBlock: BABYLON.InputBlock;
  862. }
  863. export class Color4PropertyTabComponent extends React.Component<IColor4PropertyTabComponentProps> {
  864. render(): JSX.Element;
  865. }
  866. }
  867. declare module NODEEDITOR {
  868. export class InputPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  869. private onValueChangedObserver;
  870. constructor(props: IPropertyComponentProps);
  871. componentDidMount(): void;
  872. componentWillUnmount(): void;
  873. renderValue(globalState: GlobalState): JSX.Element | null;
  874. setDefaultValue(): void;
  875. render(): JSX.Element;
  876. }
  877. }
  878. declare module NODEEDITOR {
  879. export class TransformPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  880. constructor(props: IPropertyComponentProps);
  881. render(): JSX.Element;
  882. }
  883. }
  884. declare module NODEEDITOR {
  885. export class PerturbNormalPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  886. constructor(props: IPropertyComponentProps);
  887. render(): JSX.Element;
  888. }
  889. }
  890. declare module NODEEDITOR {
  891. export class WorleyNoise3DNodePropertyComponent extends React.Component<IPropertyComponentProps> {
  892. constructor(props: IPropertyComponentProps);
  893. render(): JSX.Element;
  894. }
  895. }
  896. declare module NODEEDITOR {
  897. export class ClampPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  898. constructor(props: IPropertyComponentProps);
  899. forceRebuild(): void;
  900. render(): JSX.Element;
  901. }
  902. }
  903. declare module NODEEDITOR {
  904. interface IGradientStepComponentProps {
  905. globalState: GlobalState;
  906. step: BABYLON.GradientBlockColorStep;
  907. lineIndex: number;
  908. onDelete: () => void;
  909. onUpdateStep: () => void;
  910. onCheckForReOrder: () => void;
  911. }
  912. export class GradientStepComponent extends React.Component<IGradientStepComponentProps, {
  913. gradient: number;
  914. }> {
  915. constructor(props: IGradientStepComponentProps);
  916. updateColor(color: string): void;
  917. updateStep(gradient: number): void;
  918. onPointerUp(): void;
  919. render(): JSX.Element;
  920. }
  921. }
  922. declare module NODEEDITOR {
  923. export interface IButtonLineComponentProps {
  924. label: string;
  925. onClick: () => void;
  926. }
  927. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  928. constructor(props: IButtonLineComponentProps);
  929. render(): JSX.Element;
  930. }
  931. }
  932. declare module NODEEDITOR {
  933. export class GradientPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  934. constructor(props: IPropertyComponentProps);
  935. forceRebuild(): void;
  936. deleteStep(step: BABYLON.GradientBlockColorStep): void;
  937. addNewStep(): void;
  938. checkForReOrder(): void;
  939. render(): JSX.Element;
  940. }
  941. }
  942. declare module NODEEDITOR {
  943. export class LightPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  944. render(): JSX.Element;
  945. }
  946. }
  947. declare module NODEEDITOR {
  948. export class LightInformationPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  949. render(): JSX.Element;
  950. }
  951. }
  952. declare module NODEEDITOR {
  953. export class RemapPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  954. constructor(props: IPropertyComponentProps);
  955. forceRebuild(): void;
  956. render(): JSX.Element;
  957. }
  958. }
  959. declare module NODEEDITOR {
  960. interface IFileButtonLineComponentProps {
  961. label: string;
  962. onClick: (file: File) => void;
  963. accept: string;
  964. }
  965. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  966. private uploadRef;
  967. constructor(props: IFileButtonLineComponentProps);
  968. onChange(evt: any): void;
  969. render(): JSX.Element;
  970. }
  971. }
  972. declare module NODEEDITOR {
  973. export class TexturePropertyTabComponent extends React.Component<IPropertyComponentProps, {
  974. isEmbedded: boolean;
  975. loadAsCubeTexture: boolean;
  976. }> {
  977. get textureBlock(): BABYLON.TextureBlock | BABYLON.ReflectionTextureBlock;
  978. constructor(props: IPropertyComponentProps);
  979. UNSAFE_componentWillUpdate(nextProps: IPropertyComponentProps, nextState: {
  980. isEmbedded: boolean;
  981. loadAsCubeTexture: boolean;
  982. }): void;
  983. private _generateRandomForCache;
  984. updateAfterTextureLoad(): void;
  985. removeTexture(): void;
  986. _prepareTexture(): void;
  987. /**
  988. * Replaces the texture of the node
  989. * @param file the file of the texture to use
  990. */
  991. replaceTexture(file: File): void;
  992. replaceTextureWithUrl(url: string): void;
  993. render(): JSX.Element;
  994. }
  995. }
  996. declare module NODEEDITOR {
  997. export class TrigonometryPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  998. constructor(props: IPropertyComponentProps);
  999. render(): JSX.Element;
  1000. }
  1001. }
  1002. declare module NODEEDITOR {
  1003. export class PropertyLedger {
  1004. static RegisteredControls: {
  1005. [key: string]: React.ComponentClass<IPropertyComponentProps>;
  1006. };
  1007. }
  1008. }
  1009. declare module NODEEDITOR {
  1010. export class InputDisplayManager implements IDisplayManager {
  1011. getHeaderClass(block: BABYLON.NodeMaterialBlock): "" | "constant" | "inspector";
  1012. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1013. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1014. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1015. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1016. }
  1017. }
  1018. declare module NODEEDITOR {
  1019. export class OutputDisplayManager implements IDisplayManager {
  1020. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1021. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1022. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1023. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1024. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1025. }
  1026. }
  1027. declare module NODEEDITOR {
  1028. export class ClampDisplayManager implements IDisplayManager {
  1029. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1030. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1031. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1032. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1033. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1034. }
  1035. }
  1036. declare module NODEEDITOR {
  1037. export class GradientDisplayManager implements IDisplayManager {
  1038. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1039. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1040. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1041. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1042. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1043. }
  1044. }
  1045. declare module NODEEDITOR {
  1046. export class RemapDisplayManager implements IDisplayManager {
  1047. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1048. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1049. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1050. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1051. private _extractInputValue;
  1052. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1053. }
  1054. }
  1055. declare module NODEEDITOR {
  1056. export class TrigonometryDisplayManager implements IDisplayManager {
  1057. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1058. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1059. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1060. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1061. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1062. }
  1063. }
  1064. declare module NODEEDITOR {
  1065. interface ITextureLineComponentProps {
  1066. texture: BABYLON.BaseTexture;
  1067. width: number;
  1068. height: number;
  1069. globalState?: any;
  1070. hideChannelSelect?: boolean;
  1071. }
  1072. export interface ITextureLineComponentState {
  1073. displayRed: boolean;
  1074. displayGreen: boolean;
  1075. displayBlue: boolean;
  1076. displayAlpha: boolean;
  1077. face: number;
  1078. }
  1079. export class TextureLineComponent extends React.Component<ITextureLineComponentProps, ITextureLineComponentState> {
  1080. private canvasRef;
  1081. constructor(props: ITextureLineComponentProps);
  1082. shouldComponentUpdate(nextProps: ITextureLineComponentProps, nextState: {
  1083. displayRed: boolean;
  1084. displayGreen: boolean;
  1085. displayBlue: boolean;
  1086. displayAlpha: boolean;
  1087. face: number;
  1088. }): boolean;
  1089. componentDidMount(): void;
  1090. componentDidUpdate(): void;
  1091. updatePreview(): void;
  1092. static UpdatePreview(previewCanvas: HTMLCanvasElement, texture: BABYLON.BaseTexture, width: number, options: ITextureLineComponentState, onReady?: () => void, globalState?: any): void;
  1093. render(): JSX.Element;
  1094. }
  1095. }
  1096. declare module NODEEDITOR {
  1097. export class TextureDisplayManager implements IDisplayManager {
  1098. private _previewCanvas;
  1099. private _previewImage;
  1100. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1101. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1102. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1103. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1104. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1105. }
  1106. }
  1107. declare module NODEEDITOR {
  1108. export class DiscardDisplayManager implements IDisplayManager {
  1109. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1110. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1111. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1112. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1113. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1114. }
  1115. }
  1116. declare module NODEEDITOR {
  1117. export class DisplayLedger {
  1118. static RegisteredControls: {
  1119. [key: string]: any;
  1120. };
  1121. }
  1122. }
  1123. declare module NODEEDITOR {
  1124. export class GraphNode {
  1125. block: BABYLON.NodeMaterialBlock;
  1126. private _visual;
  1127. private _header;
  1128. private _connections;
  1129. private _inputsContainer;
  1130. private _outputsContainer;
  1131. private _content;
  1132. private _comments;
  1133. private _inputPorts;
  1134. private _outputPorts;
  1135. private _links;
  1136. private _x;
  1137. private _y;
  1138. private _gridAlignedX;
  1139. private _gridAlignedY;
  1140. private _mouseStartPointX;
  1141. private _mouseStartPointY;
  1142. private _globalState;
  1143. private _onSelectionChangedObserver;
  1144. private _onSelectionBoxMovedObserver;
  1145. private _onFrameCreatedObserver;
  1146. private _onUpdateRequiredObserver;
  1147. private _ownerCanvas;
  1148. private _isSelected;
  1149. private _displayManager;
  1150. private _isVisible;
  1151. get isVisible(): boolean;
  1152. set isVisible(value: boolean);
  1153. get outputPorts(): NodePort[];
  1154. get inputPorts(): NodePort[];
  1155. get links(): NodeLink[];
  1156. get gridAlignedX(): number;
  1157. get gridAlignedY(): number;
  1158. get x(): number;
  1159. set x(value: number);
  1160. get y(): number;
  1161. set y(value: number);
  1162. get width(): number;
  1163. get height(): number;
  1164. get id(): number;
  1165. get name(): string;
  1166. get isSelected(): boolean;
  1167. set isSelected(value: boolean);
  1168. constructor(block: BABYLON.NodeMaterialBlock, globalState: GlobalState);
  1169. isOverlappingFrame(frame: GraphFrame): boolean;
  1170. getPortForConnectionPoint(point: BABYLON.NodeMaterialConnectionPoint): BABYLON.Nullable<NodePort>;
  1171. getLinksForConnectionPoint(point: BABYLON.NodeMaterialConnectionPoint): NodeLink[];
  1172. private _refreshFrames;
  1173. _refreshLinks(): void;
  1174. refresh(): void;
  1175. private _onDown;
  1176. cleanAccumulation(useCeil?: boolean): void;
  1177. private _onUp;
  1178. private _onMove;
  1179. renderProperties(): BABYLON.Nullable<JSX.Element>;
  1180. appendVisual(root: HTMLDivElement, owner: GraphCanvasComponent): void;
  1181. dispose(): void;
  1182. }
  1183. }
  1184. declare module NODEEDITOR {
  1185. export class GlobalState {
  1186. nodeMaterial: BABYLON.NodeMaterial;
  1187. hostElement: HTMLElement;
  1188. hostDocument: HTMLDocument;
  1189. hostWindow: Window;
  1190. onSelectionChangedObservable: BABYLON.Observable<BABYLON.Nullable<GraphNode | NodePort | GraphFrame | NodeLink | FramePortData>>;
  1191. onRebuildRequiredObservable: BABYLON.Observable<void>;
  1192. onBuiltObservable: BABYLON.Observable<void>;
  1193. onResetRequiredObservable: BABYLON.Observable<void>;
  1194. onUpdateRequiredObservable: BABYLON.Observable<void>;
  1195. onZoomToFitRequiredObservable: BABYLON.Observable<void>;
  1196. onReOrganizedRequiredObservable: BABYLON.Observable<void>;
  1197. onLogRequiredObservable: BABYLON.Observable<LogEntry>;
  1198. onErrorMessageDialogRequiredObservable: BABYLON.Observable<string>;
  1199. onIsLoadingChanged: BABYLON.Observable<boolean>;
  1200. onPreviewCommandActivated: BABYLON.Observable<void>;
  1201. onLightUpdated: BABYLON.Observable<void>;
  1202. onPreviewBackgroundChanged: BABYLON.Observable<void>;
  1203. onBackFaceCullingChanged: BABYLON.Observable<void>;
  1204. onDepthPrePassChanged: BABYLON.Observable<void>;
  1205. onAnimationCommandActivated: BABYLON.Observable<void>;
  1206. onCandidateLinkMoved: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector2>>;
  1207. onSelectionBoxMoved: BABYLON.Observable<DOMRect | ClientRect>;
  1208. onFrameCreatedObservable: BABYLON.Observable<GraphFrame>;
  1209. onCandidatePortSelectedObservable: BABYLON.Observable<BABYLON.Nullable<FrameNodePort | NodePort>>;
  1210. onGraphNodeRemovalObservable: BABYLON.Observable<GraphNode>;
  1211. onGetNodeFromBlock: (block: BABYLON.NodeMaterialBlock) => GraphNode;
  1212. onGridSizeChanged: BABYLON.Observable<void>;
  1213. previewMeshType: PreviewMeshType;
  1214. previewMeshFile: File;
  1215. listOfCustomPreviewMeshFiles: File[];
  1216. rotatePreview: boolean;
  1217. backgroundColor: BABYLON.Color4;
  1218. backFaceCulling: boolean;
  1219. depthPrePass: boolean;
  1220. blockKeyboardEvents: boolean;
  1221. hemisphericLight: boolean;
  1222. directionalLight0: boolean;
  1223. directionalLight1: boolean;
  1224. controlCamera: boolean;
  1225. storeEditorData: (serializationObject: any) => void;
  1226. customSave?: {
  1227. label: string;
  1228. action: (data: string) => Promise<void>;
  1229. };
  1230. constructor();
  1231. }
  1232. }
  1233. declare module NODEEDITOR {
  1234. export interface IButtonLineComponentProps {
  1235. data: string;
  1236. tooltip: string;
  1237. }
  1238. export class DraggableLineComponent extends React.Component<IButtonLineComponentProps> {
  1239. constructor(props: IButtonLineComponentProps);
  1240. render(): JSX.Element;
  1241. }
  1242. }
  1243. declare module NODEEDITOR {
  1244. interface INodeListComponentProps {
  1245. globalState: GlobalState;
  1246. }
  1247. export class NodeListComponent extends React.Component<INodeListComponentProps, {
  1248. filter: string;
  1249. }> {
  1250. private static _Tooltips;
  1251. constructor(props: INodeListComponentProps);
  1252. filterContent(filter: string): void;
  1253. render(): JSX.Element;
  1254. }
  1255. }
  1256. declare module NODEEDITOR {
  1257. export interface IFramePropertyTabComponentProps {
  1258. globalState: GlobalState;
  1259. frame: GraphFrame;
  1260. }
  1261. export class FramePropertyTabComponent extends React.Component<IFramePropertyTabComponentProps> {
  1262. private onFrameExpandStateChangedObserver;
  1263. constructor(props: IFramePropertyTabComponentProps);
  1264. componentDidMount(): void;
  1265. componentWillUnmount(): void;
  1266. render(): JSX.Element;
  1267. }
  1268. }
  1269. declare module NODEEDITOR {
  1270. export interface IFrameNodePortPropertyTabComponentProps {
  1271. globalState: GlobalState;
  1272. frameNodePort: FrameNodePort;
  1273. frame: GraphFrame;
  1274. }
  1275. export class FrameNodePortPropertyTabComponent extends React.Component<IFrameNodePortPropertyTabComponentProps, {
  1276. port: FrameNodePort;
  1277. }> {
  1278. private _onFramePortPositionChangedObserver;
  1279. private _onSelectionChangedObserver;
  1280. constructor(props: IFrameNodePortPropertyTabComponentProps);
  1281. componentWillUnmount(): void;
  1282. render(): JSX.Element;
  1283. }
  1284. }
  1285. declare module NODEEDITOR {
  1286. interface IPropertyTabComponentProps {
  1287. globalState: GlobalState;
  1288. }
  1289. export class PropertyTabComponent extends React.Component<IPropertyTabComponentProps, {
  1290. currentNode: BABYLON.Nullable<GraphNode>;
  1291. currentFrame: BABYLON.Nullable<GraphFrame>;
  1292. currentFrameNodePort: BABYLON.Nullable<FrameNodePort>;
  1293. }> {
  1294. private _onBuiltObserver;
  1295. constructor(props: IPropertyTabComponentProps);
  1296. componentDidMount(): void;
  1297. componentWillUnmount(): void;
  1298. processInputBlockUpdate(ib: BABYLON.InputBlock): void;
  1299. renderInputBlock(block: BABYLON.InputBlock): JSX.Element | null;
  1300. load(file: File): void;
  1301. save(): void;
  1302. customSave(): void;
  1303. saveToSnippetServer(): void;
  1304. loadFromSnippet(): void;
  1305. render(): JSX.Element;
  1306. }
  1307. }
  1308. declare module NODEEDITOR {
  1309. interface IPortalProps {
  1310. globalState: GlobalState;
  1311. }
  1312. export class Portal extends React.Component<IPortalProps> {
  1313. render(): React.ReactPortal;
  1314. }
  1315. }
  1316. declare module NODEEDITOR {
  1317. interface IMessageDialogComponentProps {
  1318. globalState: GlobalState;
  1319. }
  1320. export class MessageDialogComponent extends React.Component<IMessageDialogComponentProps, {
  1321. message: string;
  1322. isError: boolean;
  1323. }> {
  1324. constructor(props: IMessageDialogComponentProps);
  1325. render(): JSX.Element | null;
  1326. }
  1327. }
  1328. declare module NODEEDITOR {
  1329. export class PreviewManager {
  1330. private _nodeMaterial;
  1331. private _onBuildObserver;
  1332. private _onPreviewCommandActivatedObserver;
  1333. private _onAnimationCommandActivatedObserver;
  1334. private _onUpdateRequiredObserver;
  1335. private _onPreviewBackgroundChangedObserver;
  1336. private _onBackFaceCullingChangedObserver;
  1337. private _onDepthPrePassChangedObserver;
  1338. private _onLightUpdatedObserver;
  1339. private _engine;
  1340. private _scene;
  1341. private _meshes;
  1342. private _camera;
  1343. private _material;
  1344. private _globalState;
  1345. private _currentType;
  1346. private _lightParent;
  1347. constructor(targetCanvas: HTMLCanvasElement, globalState: GlobalState);
  1348. private _handleAnimations;
  1349. private _prepareLights;
  1350. private _prepareMeshes;
  1351. private _refreshPreviewMesh;
  1352. private _forceCompilationAsync;
  1353. private _updatePreview;
  1354. dispose(): void;
  1355. }
  1356. }
  1357. declare module NODEEDITOR {
  1358. interface IPreviewMeshControlComponent {
  1359. globalState: GlobalState;
  1360. togglePreviewAreaComponent: () => void;
  1361. }
  1362. export class PreviewMeshControlComponent extends React.Component<IPreviewMeshControlComponent> {
  1363. private colorInputRef;
  1364. private filePickerRef;
  1365. constructor(props: IPreviewMeshControlComponent);
  1366. changeMeshType(newOne: PreviewMeshType): void;
  1367. useCustomMesh(evt: any): void;
  1368. onPopUp(): void;
  1369. changeAnimation(): void;
  1370. changeBackground(value: string): void;
  1371. changeBackgroundClick(): void;
  1372. render(): JSX.Element;
  1373. }
  1374. }
  1375. declare module NODEEDITOR {
  1376. interface IPreviewAreaComponentProps {
  1377. globalState: GlobalState;
  1378. width: number;
  1379. }
  1380. export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentProps, {
  1381. isLoading: boolean;
  1382. }> {
  1383. private _onIsLoadingChangedObserver;
  1384. constructor(props: IPreviewAreaComponentProps);
  1385. componentWillUnmount(): void;
  1386. changeBackFaceCulling(value: boolean): void;
  1387. changeDepthPrePass(value: boolean): void;
  1388. render(): JSX.Element;
  1389. }
  1390. }
  1391. declare module NODEEDITOR {
  1392. interface IGraphEditorProps {
  1393. globalState: GlobalState;
  1394. }
  1395. interface IGraphEditorState {
  1396. showPreviewPopUp: boolean;
  1397. }
  1398. interface IInternalPreviewAreaOptions extends BABYLON.IInspectorOptions {
  1399. popup: boolean;
  1400. original: boolean;
  1401. explorerWidth?: string;
  1402. inspectorWidth?: string;
  1403. embedHostWidth?: string;
  1404. }
  1405. export class GraphEditor extends React.Component<IGraphEditorProps, IGraphEditorState> {
  1406. private readonly NodeWidth;
  1407. private _graphCanvas;
  1408. private _startX;
  1409. private _moveInProgress;
  1410. private _leftWidth;
  1411. private _rightWidth;
  1412. private _blocks;
  1413. private _previewManager;
  1414. private _copiedNodes;
  1415. private _copiedFrame;
  1416. private _mouseLocationX;
  1417. private _mouseLocationY;
  1418. private _onWidgetKeyUpPointer;
  1419. private _previewHost;
  1420. private _popUpWindow;
  1421. /**
  1422. * Creates a node and recursivly creates its parent nodes from it's input
  1423. * @param nodeMaterialBlock
  1424. */
  1425. createNodeFromObject(block: BABYLON.NodeMaterialBlock, recursion?: boolean): GraphNode;
  1426. addValueNode(type: string): GraphNode;
  1427. componentDidMount(): void;
  1428. componentWillUnmount(): void;
  1429. constructor(props: IGraphEditorProps);
  1430. reconnectNewNodes(nodeIndex: number, newNodes: GraphNode[], sourceNodes: GraphNode[], done: boolean[]): void;
  1431. pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number): void;
  1432. zoomToFit(): void;
  1433. buildMaterial(): void;
  1434. build(): void;
  1435. showWaitScreen(): void;
  1436. hideWaitScreen(): void;
  1437. reOrganize(editorData?: BABYLON.Nullable<IEditorData>): void;
  1438. onPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  1439. onPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  1440. resizeColumns(evt: React.PointerEvent<HTMLDivElement>, forLeft?: boolean): void;
  1441. buildColumnLayout(): string;
  1442. emitNewBlock(event: React.DragEvent<HTMLDivElement>): void;
  1443. handlePopUp: () => void;
  1444. handleClosingPopUp: () => void;
  1445. initiatePreviewArea: (canvas?: HTMLCanvasElement) => void;
  1446. createPopUp: () => void;
  1447. createPopupWindow: (title: string, windowVariableName: string, width?: number, height?: number) => Window | null;
  1448. copyStyles: (sourceDoc: HTMLDocument, targetDoc: HTMLDocument) => void;
  1449. createPreviewMeshControlHost: (options: IInternalPreviewAreaOptions, parentControl: HTMLElement | null) => void;
  1450. createPreviewHost: (options: IInternalPreviewAreaOptions, parentControl: HTMLElement | null) => void;
  1451. fixPopUpStyles: (document: Document) => void;
  1452. render(): JSX.Element;
  1453. }
  1454. }
  1455. declare module NODEEDITOR {
  1456. export class Popup {
  1457. static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
  1458. private static _CopyStyles;
  1459. }
  1460. }
  1461. declare module NODEEDITOR {
  1462. /**
  1463. * Interface used to specify creation options for the node editor
  1464. */
  1465. export interface INodeEditorOptions {
  1466. nodeMaterial: BABYLON.NodeMaterial;
  1467. hostElement?: HTMLElement;
  1468. customSave?: {
  1469. label: string;
  1470. action: (data: string) => Promise<void>;
  1471. };
  1472. customLoadObservable?: BABYLON.Observable<any>;
  1473. }
  1474. /**
  1475. * Class used to create a node editor
  1476. */
  1477. export class NodeEditor {
  1478. private static _CurrentState;
  1479. /**
  1480. * Show the node editor
  1481. * @param options defines the options to use to configure the node editor
  1482. */
  1483. static Show(options: INodeEditorOptions): void;
  1484. }
  1485. }