babylon.nodeEditor.d.ts 60 KB

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