babylon.nodeEditor.d.ts 58 KB

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