babylon.nodeEditor.d.ts 59 KB

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