babylon.nodeEditor.d.ts 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506
  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 | BABYLON.RefractionBlock | BABYLON.SubSurfaceBlock | 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. connectionPoint: BABYLON.NodeMaterialConnectionPoint;
  261. node: GraphNode;
  262. protected _element: HTMLDivElement;
  263. protected _img: HTMLImageElement;
  264. protected _globalState: GlobalState;
  265. protected _portLabelElement: Element;
  266. protected _onCandidateLinkMovedObserver: BABYLON.Nullable<BABYLON.Observer<BABYLON.Nullable<BABYLON.Vector2>>>;
  267. protected _onSelectionChangedObserver: BABYLON.Nullable<BABYLON.Observer<BABYLON.Nullable<GraphFrame | GraphNode | NodeLink | NodePort | FramePortData>>>;
  268. protected _exposedOnFrame: boolean;
  269. delegatedPort: BABYLON.Nullable<FrameNodePort>;
  270. get element(): HTMLDivElement;
  271. get portName(): string;
  272. set portName(newName: string);
  273. get disabled(): boolean;
  274. hasLabel(): boolean;
  275. get exposedOnFrame(): boolean;
  276. set exposedOnFrame(value: boolean);
  277. private _isConnectedToNodeOutsideOfFrame;
  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. isDisabled?: boolean;
  824. }> {
  825. private static _UniqueIdSeed;
  826. private _uniqueId;
  827. private _localChange;
  828. constructor(props: ICheckBoxLineComponentProps);
  829. shouldComponentUpdate(nextProps: ICheckBoxLineComponentProps, nextState: {
  830. isSelected: boolean;
  831. isDisabled: boolean;
  832. }): boolean;
  833. onChange(): void;
  834. render(): JSX.Element;
  835. }
  836. }
  837. declare module NODEEDITOR {
  838. export class GenericPropertyComponent extends React.Component<IPropertyComponentProps> {
  839. constructor(props: IPropertyComponentProps);
  840. render(): JSX.Element;
  841. }
  842. export class GeneralPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  843. constructor(props: IPropertyComponentProps);
  844. render(): JSX.Element;
  845. }
  846. export class GenericPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  847. constructor(props: IPropertyComponentProps);
  848. forceRebuild(notifiers?: {
  849. "rebuild"?: boolean;
  850. "update"?: boolean;
  851. }): void;
  852. render(): JSX.Element;
  853. }
  854. }
  855. declare module NODEEDITOR {
  856. export interface IColor4LineComponentProps {
  857. label: string;
  858. target: any;
  859. propertyName: string;
  860. onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
  861. onChange?: () => void;
  862. globalState: GlobalState;
  863. }
  864. export class Color4LineComponent extends React.Component<IColor4LineComponentProps, {
  865. isExpanded: boolean;
  866. color: BABYLON.Color4;
  867. }> {
  868. private _localChange;
  869. constructor(props: IColor4LineComponentProps);
  870. shouldComponentUpdate(nextProps: IColor4LineComponentProps, nextState: {
  871. color: BABYLON.Color4;
  872. }): boolean;
  873. onChange(newValue: string): void;
  874. switchExpandState(): void;
  875. raiseOnPropertyChanged(previousValue: BABYLON.Color4): void;
  876. updateStateR(value: number): void;
  877. updateStateG(value: number): void;
  878. updateStateB(value: number): void;
  879. updateStateA(value: number): void;
  880. copyToClipboard(): void;
  881. render(): JSX.Element;
  882. }
  883. }
  884. declare module NODEEDITOR {
  885. interface IColor4PropertyTabComponentProps {
  886. globalState: GlobalState;
  887. inputBlock: BABYLON.InputBlock;
  888. }
  889. export class Color4PropertyTabComponent extends React.Component<IColor4PropertyTabComponentProps> {
  890. render(): JSX.Element;
  891. }
  892. }
  893. declare module NODEEDITOR {
  894. export class InputPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  895. private onValueChangedObserver;
  896. constructor(props: IPropertyComponentProps);
  897. componentDidMount(): void;
  898. componentWillUnmount(): void;
  899. renderValue(globalState: GlobalState): JSX.Element | null;
  900. setDefaultValue(): void;
  901. render(): JSX.Element;
  902. }
  903. }
  904. declare module NODEEDITOR {
  905. export class TransformPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  906. constructor(props: IPropertyComponentProps);
  907. render(): JSX.Element;
  908. }
  909. }
  910. declare module NODEEDITOR {
  911. interface IGradientStepComponentProps {
  912. globalState: GlobalState;
  913. step: BABYLON.GradientBlockColorStep;
  914. lineIndex: number;
  915. onDelete: () => void;
  916. onUpdateStep: () => void;
  917. onCheckForReOrder: () => void;
  918. }
  919. export class GradientStepComponent extends React.Component<IGradientStepComponentProps, {
  920. gradient: number;
  921. }> {
  922. constructor(props: IGradientStepComponentProps);
  923. updateColor(color: string): void;
  924. updateStep(gradient: number): void;
  925. onPointerUp(): void;
  926. render(): JSX.Element;
  927. }
  928. }
  929. declare module NODEEDITOR {
  930. export interface IButtonLineComponentProps {
  931. label: string;
  932. onClick: () => void;
  933. }
  934. export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
  935. constructor(props: IButtonLineComponentProps);
  936. render(): JSX.Element;
  937. }
  938. }
  939. declare module NODEEDITOR {
  940. export class GradientPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  941. constructor(props: IPropertyComponentProps);
  942. forceRebuild(): void;
  943. deleteStep(step: BABYLON.GradientBlockColorStep): void;
  944. addNewStep(): void;
  945. checkForReOrder(): void;
  946. render(): JSX.Element;
  947. }
  948. }
  949. declare module NODEEDITOR {
  950. export class LightPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  951. render(): JSX.Element;
  952. }
  953. }
  954. declare module NODEEDITOR {
  955. export class LightInformationPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  956. render(): JSX.Element;
  957. }
  958. }
  959. declare module NODEEDITOR {
  960. interface IFileButtonLineComponentProps {
  961. label: string;
  962. onClick: (file: File) => void;
  963. accept: string;
  964. }
  965. export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
  966. private uploadRef;
  967. constructor(props: IFileButtonLineComponentProps);
  968. onChange(evt: any): void;
  969. render(): JSX.Element;
  970. }
  971. }
  972. declare module NODEEDITOR {
  973. type ReflectionTexture = BABYLON.ReflectionTextureBlock | BABYLON.ReflectionBlock | BABYLON.RefractionBlock;
  974. export class TexturePropertyTabComponent extends React.Component<IPropertyComponentProps, {
  975. isEmbedded: boolean;
  976. loadAsCubeTexture: boolean;
  977. }> {
  978. get textureBlock(): BABYLON.TextureBlock | ReflectionTexture;
  979. constructor(props: IPropertyComponentProps);
  980. UNSAFE_componentWillUpdate(nextProps: IPropertyComponentProps, nextState: {
  981. isEmbedded: boolean;
  982. loadAsCubeTexture: boolean;
  983. }): void;
  984. private _generateRandomForCache;
  985. updateAfterTextureLoad(): void;
  986. removeTexture(): void;
  987. _prepareTexture(): void;
  988. /**
  989. * Replaces the texture of the node
  990. * @param file the file of the texture to use
  991. */
  992. replaceTexture(file: File): void;
  993. replaceTextureWithUrl(url: string): void;
  994. render(): JSX.Element;
  995. }
  996. }
  997. declare module NODEEDITOR {
  998. export class TrigonometryPropertyTabComponent extends React.Component<IPropertyComponentProps> {
  999. constructor(props: IPropertyComponentProps);
  1000. render(): JSX.Element;
  1001. }
  1002. }
  1003. declare module NODEEDITOR {
  1004. export class PropertyLedger {
  1005. static RegisteredControls: {
  1006. [key: string]: React.ComponentClass<IPropertyComponentProps>;
  1007. };
  1008. }
  1009. }
  1010. declare module NODEEDITOR {
  1011. export class InputDisplayManager implements IDisplayManager {
  1012. getHeaderClass(block: BABYLON.NodeMaterialBlock): "" | "constant" | "inspector";
  1013. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1014. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1015. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1016. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1017. }
  1018. }
  1019. declare module NODEEDITOR {
  1020. export class OutputDisplayManager implements IDisplayManager {
  1021. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1022. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1023. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1024. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1025. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1026. }
  1027. }
  1028. declare module NODEEDITOR {
  1029. export class ClampDisplayManager implements IDisplayManager {
  1030. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1031. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1032. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1033. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1034. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1035. }
  1036. }
  1037. declare module NODEEDITOR {
  1038. export class GradientDisplayManager implements IDisplayManager {
  1039. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1040. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1041. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1042. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1043. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1044. }
  1045. }
  1046. declare module NODEEDITOR {
  1047. export class RemapDisplayManager implements IDisplayManager {
  1048. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1049. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1050. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1051. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1052. private _extractInputValue;
  1053. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1054. }
  1055. }
  1056. declare module NODEEDITOR {
  1057. export class TrigonometryDisplayManager implements IDisplayManager {
  1058. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1059. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1060. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1061. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1062. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1063. }
  1064. }
  1065. declare module NODEEDITOR {
  1066. interface ITextureLineComponentProps {
  1067. texture: BABYLON.BaseTexture;
  1068. width: number;
  1069. height: number;
  1070. globalState?: any;
  1071. hideChannelSelect?: boolean;
  1072. }
  1073. export interface ITextureLineComponentState {
  1074. displayRed: boolean;
  1075. displayGreen: boolean;
  1076. displayBlue: boolean;
  1077. displayAlpha: boolean;
  1078. face: number;
  1079. }
  1080. export class TextureLineComponent extends React.Component<ITextureLineComponentProps, ITextureLineComponentState> {
  1081. private canvasRef;
  1082. constructor(props: ITextureLineComponentProps);
  1083. shouldComponentUpdate(nextProps: ITextureLineComponentProps, nextState: {
  1084. displayRed: boolean;
  1085. displayGreen: boolean;
  1086. displayBlue: boolean;
  1087. displayAlpha: boolean;
  1088. face: number;
  1089. }): boolean;
  1090. componentDidMount(): void;
  1091. componentDidUpdate(): void;
  1092. updatePreview(): void;
  1093. static UpdatePreview(previewCanvas: HTMLCanvasElement, texture: BABYLON.BaseTexture, width: number, options: ITextureLineComponentState, onReady?: () => void, globalState?: any): void;
  1094. render(): JSX.Element;
  1095. }
  1096. }
  1097. declare module NODEEDITOR {
  1098. export class TextureDisplayManager implements IDisplayManager {
  1099. private _previewCanvas;
  1100. private _previewImage;
  1101. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1102. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1103. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1104. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1105. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1106. }
  1107. }
  1108. declare module NODEEDITOR {
  1109. export class DiscardDisplayManager implements IDisplayManager {
  1110. getHeaderClass(block: BABYLON.NodeMaterialBlock): string;
  1111. shouldDisplayPortLabels(block: BABYLON.NodeMaterialBlock): boolean;
  1112. getHeaderText(block: BABYLON.NodeMaterialBlock): string;
  1113. getBackgroundColor(block: BABYLON.NodeMaterialBlock): string;
  1114. updatePreviewContent(block: BABYLON.NodeMaterialBlock, contentArea: HTMLDivElement): void;
  1115. }
  1116. }
  1117. declare module NODEEDITOR {
  1118. export class DisplayLedger {
  1119. static RegisteredControls: {
  1120. [key: string]: any;
  1121. };
  1122. }
  1123. }
  1124. declare module NODEEDITOR {
  1125. export class GraphNode {
  1126. block: BABYLON.NodeMaterialBlock;
  1127. private _visual;
  1128. private _header;
  1129. private _connections;
  1130. private _inputsContainer;
  1131. private _outputsContainer;
  1132. private _content;
  1133. private _comments;
  1134. private _inputPorts;
  1135. private _outputPorts;
  1136. private _links;
  1137. private _x;
  1138. private _y;
  1139. private _gridAlignedX;
  1140. private _gridAlignedY;
  1141. private _mouseStartPointX;
  1142. private _mouseStartPointY;
  1143. private _globalState;
  1144. private _onSelectionChangedObserver;
  1145. private _onSelectionBoxMovedObserver;
  1146. private _onFrameCreatedObserver;
  1147. private _onUpdateRequiredObserver;
  1148. private _ownerCanvas;
  1149. private _isSelected;
  1150. private _displayManager;
  1151. private _isVisible;
  1152. private _enclosingFrameId;
  1153. get isVisible(): boolean;
  1154. set isVisible(value: boolean);
  1155. private _upateNodePortNames;
  1156. get outputPorts(): NodePort[];
  1157. get inputPorts(): NodePort[];
  1158. get links(): NodeLink[];
  1159. get gridAlignedX(): number;
  1160. get gridAlignedY(): number;
  1161. get x(): number;
  1162. set x(value: number);
  1163. get y(): number;
  1164. set y(value: number);
  1165. get width(): number;
  1166. get height(): number;
  1167. get id(): number;
  1168. get name(): string;
  1169. get isSelected(): boolean;
  1170. get enclosingFrameId(): number;
  1171. set enclosingFrameId(value: number);
  1172. set isSelected(value: boolean);
  1173. constructor(block: BABYLON.NodeMaterialBlock, globalState: GlobalState);
  1174. isOverlappingFrame(frame: GraphFrame): boolean;
  1175. getPortForConnectionPoint(point: BABYLON.NodeMaterialConnectionPoint): BABYLON.Nullable<NodePort>;
  1176. getLinksForConnectionPoint(point: BABYLON.NodeMaterialConnectionPoint): NodeLink[];
  1177. private _refreshFrames;
  1178. _refreshLinks(): void;
  1179. refresh(): void;
  1180. private _onDown;
  1181. cleanAccumulation(useCeil?: boolean): void;
  1182. private _onUp;
  1183. private _onMove;
  1184. renderProperties(): BABYLON.Nullable<JSX.Element>;
  1185. appendVisual(root: HTMLDivElement, owner: GraphCanvasComponent): void;
  1186. dispose(): void;
  1187. }
  1188. }
  1189. declare module NODEEDITOR {
  1190. export class GlobalState {
  1191. nodeMaterial: BABYLON.NodeMaterial;
  1192. hostElement: HTMLElement;
  1193. hostDocument: HTMLDocument;
  1194. hostWindow: Window;
  1195. onSelectionChangedObservable: BABYLON.Observable<BABYLON.Nullable<GraphNode | NodePort | GraphFrame | NodeLink | FramePortData>>;
  1196. onRebuildRequiredObservable: BABYLON.Observable<void>;
  1197. onBuiltObservable: BABYLON.Observable<void>;
  1198. onResetRequiredObservable: BABYLON.Observable<void>;
  1199. onUpdateRequiredObservable: BABYLON.Observable<void>;
  1200. onZoomToFitRequiredObservable: BABYLON.Observable<void>;
  1201. onReOrganizedRequiredObservable: BABYLON.Observable<void>;
  1202. onLogRequiredObservable: BABYLON.Observable<LogEntry>;
  1203. onErrorMessageDialogRequiredObservable: BABYLON.Observable<string>;
  1204. onIsLoadingChanged: BABYLON.Observable<boolean>;
  1205. onPreviewCommandActivated: BABYLON.Observable<void>;
  1206. onLightUpdated: BABYLON.Observable<void>;
  1207. onPreviewBackgroundChanged: BABYLON.Observable<void>;
  1208. onBackFaceCullingChanged: BABYLON.Observable<void>;
  1209. onDepthPrePassChanged: BABYLON.Observable<void>;
  1210. onAnimationCommandActivated: BABYLON.Observable<void>;
  1211. onCandidateLinkMoved: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector2>>;
  1212. onSelectionBoxMoved: BABYLON.Observable<DOMRect | ClientRect>;
  1213. onFrameCreatedObservable: BABYLON.Observable<GraphFrame>;
  1214. onCandidatePortSelectedObservable: BABYLON.Observable<BABYLON.Nullable<FrameNodePort | NodePort>>;
  1215. onGraphNodeRemovalObservable: BABYLON.Observable<GraphNode>;
  1216. onGetNodeFromBlock: (block: BABYLON.NodeMaterialBlock) => GraphNode;
  1217. onGridSizeChanged: BABYLON.Observable<void>;
  1218. onExposePortOnFrameObservable: BABYLON.Observable<GraphNode>;
  1219. previewMeshType: PreviewMeshType;
  1220. previewMeshFile: File;
  1221. listOfCustomPreviewMeshFiles: File[];
  1222. rotatePreview: boolean;
  1223. backgroundColor: BABYLON.Color4;
  1224. backFaceCulling: boolean;
  1225. depthPrePass: boolean;
  1226. blockKeyboardEvents: boolean;
  1227. hemisphericLight: boolean;
  1228. directionalLight0: boolean;
  1229. directionalLight1: boolean;
  1230. controlCamera: boolean;
  1231. storeEditorData: (serializationObject: any) => void;
  1232. customSave?: {
  1233. label: string;
  1234. action: (data: string) => Promise<void>;
  1235. };
  1236. constructor();
  1237. }
  1238. }
  1239. declare module NODEEDITOR {
  1240. export interface IButtonLineComponentProps {
  1241. data: string;
  1242. tooltip: string;
  1243. }
  1244. export class DraggableLineComponent extends React.Component<IButtonLineComponentProps> {
  1245. constructor(props: IButtonLineComponentProps);
  1246. render(): JSX.Element;
  1247. }
  1248. }
  1249. declare module NODEEDITOR {
  1250. interface INodeListComponentProps {
  1251. globalState: GlobalState;
  1252. }
  1253. export class NodeListComponent extends React.Component<INodeListComponentProps, {
  1254. filter: string;
  1255. }> {
  1256. private static _Tooltips;
  1257. constructor(props: INodeListComponentProps);
  1258. filterContent(filter: string): void;
  1259. render(): JSX.Element;
  1260. }
  1261. }
  1262. declare module NODEEDITOR {
  1263. export interface IFramePropertyTabComponentProps {
  1264. globalState: GlobalState;
  1265. frame: GraphFrame;
  1266. }
  1267. export class FramePropertyTabComponent extends React.Component<IFramePropertyTabComponentProps> {
  1268. private onFrameExpandStateChangedObserver;
  1269. constructor(props: IFramePropertyTabComponentProps);
  1270. componentDidMount(): void;
  1271. componentWillUnmount(): void;
  1272. render(): JSX.Element;
  1273. }
  1274. }
  1275. declare module NODEEDITOR {
  1276. export interface IFrameNodePortPropertyTabComponentProps {
  1277. globalState: GlobalState;
  1278. frameNodePort: FrameNodePort;
  1279. frame: GraphFrame;
  1280. }
  1281. export class FrameNodePortPropertyTabComponent extends React.Component<IFrameNodePortPropertyTabComponentProps, {
  1282. port: FrameNodePort;
  1283. }> {
  1284. private _onFramePortPositionChangedObserver;
  1285. private _onSelectionChangedObserver;
  1286. constructor(props: IFrameNodePortPropertyTabComponentProps);
  1287. componentWillUnmount(): void;
  1288. render(): JSX.Element;
  1289. }
  1290. }
  1291. declare module NODEEDITOR {
  1292. export interface IFrameNodePortPropertyTabComponentProps {
  1293. globalState: GlobalState;
  1294. nodePort: NodePort;
  1295. }
  1296. export class NodePortPropertyTabComponent extends React.Component<IFrameNodePortPropertyTabComponentProps> {
  1297. private _onSelectionChangedObserver;
  1298. constructor(props: IFrameNodePortPropertyTabComponentProps);
  1299. componentWillUnmount(): void;
  1300. toggleExposeOnFrame(value: boolean): void;
  1301. render(): JSX.Element;
  1302. }
  1303. }
  1304. declare module NODEEDITOR {
  1305. interface IPropertyTabComponentProps {
  1306. globalState: GlobalState;
  1307. }
  1308. interface IPropertyTabComponentState {
  1309. currentNode: BABYLON.Nullable<GraphNode>;
  1310. currentFrame: BABYLON.Nullable<GraphFrame>;
  1311. currentFrameNodePort: BABYLON.Nullable<FrameNodePort>;
  1312. currentNodePort: BABYLON.Nullable<NodePort>;
  1313. }
  1314. export class PropertyTabComponent extends React.Component<IPropertyTabComponentProps, IPropertyTabComponentState> {
  1315. private _onBuiltObserver;
  1316. constructor(props: IPropertyTabComponentProps);
  1317. componentDidMount(): void;
  1318. componentWillUnmount(): void;
  1319. processInputBlockUpdate(ib: BABYLON.InputBlock): void;
  1320. renderInputBlock(block: BABYLON.InputBlock): JSX.Element | null;
  1321. load(file: File): void;
  1322. save(): void;
  1323. customSave(): void;
  1324. saveToSnippetServer(): void;
  1325. loadFromSnippet(): void;
  1326. render(): JSX.Element;
  1327. }
  1328. }
  1329. declare module NODEEDITOR {
  1330. interface IPortalProps {
  1331. globalState: GlobalState;
  1332. }
  1333. export class Portal extends React.Component<IPortalProps> {
  1334. render(): React.ReactPortal;
  1335. }
  1336. }
  1337. declare module NODEEDITOR {
  1338. interface IMessageDialogComponentProps {
  1339. globalState: GlobalState;
  1340. }
  1341. export class MessageDialogComponent extends React.Component<IMessageDialogComponentProps, {
  1342. message: string;
  1343. isError: boolean;
  1344. }> {
  1345. constructor(props: IMessageDialogComponentProps);
  1346. render(): JSX.Element | null;
  1347. }
  1348. }
  1349. declare module NODEEDITOR {
  1350. export class PreviewManager {
  1351. private _nodeMaterial;
  1352. private _onBuildObserver;
  1353. private _onPreviewCommandActivatedObserver;
  1354. private _onAnimationCommandActivatedObserver;
  1355. private _onUpdateRequiredObserver;
  1356. private _onPreviewBackgroundChangedObserver;
  1357. private _onBackFaceCullingChangedObserver;
  1358. private _onDepthPrePassChangedObserver;
  1359. private _onLightUpdatedObserver;
  1360. private _engine;
  1361. private _scene;
  1362. private _meshes;
  1363. private _camera;
  1364. private _material;
  1365. private _globalState;
  1366. private _currentType;
  1367. private _lightParent;
  1368. constructor(targetCanvas: HTMLCanvasElement, globalState: GlobalState);
  1369. private _handleAnimations;
  1370. private _prepareLights;
  1371. private _prepareMeshes;
  1372. private _refreshPreviewMesh;
  1373. private _forceCompilationAsync;
  1374. private _updatePreview;
  1375. dispose(): void;
  1376. }
  1377. }
  1378. declare module NODEEDITOR {
  1379. interface IPreviewMeshControlComponent {
  1380. globalState: GlobalState;
  1381. togglePreviewAreaComponent: () => void;
  1382. }
  1383. export class PreviewMeshControlComponent extends React.Component<IPreviewMeshControlComponent> {
  1384. private colorInputRef;
  1385. private filePickerRef;
  1386. constructor(props: IPreviewMeshControlComponent);
  1387. changeMeshType(newOne: PreviewMeshType): void;
  1388. useCustomMesh(evt: any): void;
  1389. onPopUp(): void;
  1390. changeAnimation(): void;
  1391. changeBackground(value: string): void;
  1392. changeBackgroundClick(): void;
  1393. render(): JSX.Element;
  1394. }
  1395. }
  1396. declare module NODEEDITOR {
  1397. interface IPreviewAreaComponentProps {
  1398. globalState: GlobalState;
  1399. width: number;
  1400. }
  1401. export class PreviewAreaComponent extends React.Component<IPreviewAreaComponentProps, {
  1402. isLoading: boolean;
  1403. }> {
  1404. private _onIsLoadingChangedObserver;
  1405. constructor(props: IPreviewAreaComponentProps);
  1406. componentWillUnmount(): void;
  1407. changeBackFaceCulling(value: boolean): void;
  1408. changeDepthPrePass(value: boolean): void;
  1409. render(): JSX.Element;
  1410. }
  1411. }
  1412. declare module NODEEDITOR {
  1413. interface IGraphEditorProps {
  1414. globalState: GlobalState;
  1415. }
  1416. interface IGraphEditorState {
  1417. showPreviewPopUp: boolean;
  1418. }
  1419. interface IInternalPreviewAreaOptions extends BABYLON.IInspectorOptions {
  1420. popup: boolean;
  1421. original: boolean;
  1422. explorerWidth?: string;
  1423. inspectorWidth?: string;
  1424. embedHostWidth?: string;
  1425. }
  1426. export class GraphEditor extends React.Component<IGraphEditorProps, IGraphEditorState> {
  1427. private readonly NodeWidth;
  1428. private _graphCanvas;
  1429. private _startX;
  1430. private _moveInProgress;
  1431. private _leftWidth;
  1432. private _rightWidth;
  1433. private _blocks;
  1434. private _previewManager;
  1435. private _copiedNodes;
  1436. private _copiedFrame;
  1437. private _mouseLocationX;
  1438. private _mouseLocationY;
  1439. private _onWidgetKeyUpPointer;
  1440. private _previewHost;
  1441. private _popUpWindow;
  1442. /**
  1443. * Creates a node and recursivly creates its parent nodes from it's input
  1444. * @param nodeMaterialBlock
  1445. */
  1446. createNodeFromObject(block: BABYLON.NodeMaterialBlock, recursion?: boolean): GraphNode;
  1447. addValueNode(type: string): GraphNode;
  1448. componentDidMount(): void;
  1449. componentWillUnmount(): void;
  1450. constructor(props: IGraphEditorProps);
  1451. reconnectNewNodes(nodeIndex: number, newNodes: GraphNode[], sourceNodes: GraphNode[], done: boolean[]): void;
  1452. pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number): void;
  1453. zoomToFit(): void;
  1454. buildMaterial(): void;
  1455. build(): void;
  1456. showWaitScreen(): void;
  1457. hideWaitScreen(): void;
  1458. reOrganize(editorData?: BABYLON.Nullable<IEditorData>): void;
  1459. onPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
  1460. onPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
  1461. resizeColumns(evt: React.PointerEvent<HTMLDivElement>, forLeft?: boolean): void;
  1462. buildColumnLayout(): string;
  1463. emitNewBlock(event: React.DragEvent<HTMLDivElement>): void;
  1464. handlePopUp: () => void;
  1465. handleClosingPopUp: () => void;
  1466. initiatePreviewArea: (canvas?: HTMLCanvasElement) => void;
  1467. createPopUp: () => void;
  1468. createPopupWindow: (title: string, windowVariableName: string, width?: number, height?: number) => Window | null;
  1469. copyStyles: (sourceDoc: HTMLDocument, targetDoc: HTMLDocument) => void;
  1470. createPreviewMeshControlHost: (options: IInternalPreviewAreaOptions, parentControl: HTMLElement | null) => void;
  1471. createPreviewHost: (options: IInternalPreviewAreaOptions, parentControl: HTMLElement | null) => void;
  1472. fixPopUpStyles: (document: Document) => void;
  1473. render(): JSX.Element;
  1474. }
  1475. }
  1476. declare module NODEEDITOR {
  1477. export class Popup {
  1478. static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
  1479. private static _CopyStyles;
  1480. }
  1481. }
  1482. declare module NODEEDITOR {
  1483. /**
  1484. * Interface used to specify creation options for the node editor
  1485. */
  1486. export interface INodeEditorOptions {
  1487. nodeMaterial: BABYLON.NodeMaterial;
  1488. hostElement?: HTMLElement;
  1489. customSave?: {
  1490. label: string;
  1491. action: (data: string) => Promise<void>;
  1492. };
  1493. customLoadObservable?: BABYLON.Observable<any>;
  1494. }
  1495. /**
  1496. * Class used to create a node editor
  1497. */
  1498. export class NodeEditor {
  1499. private static _CurrentState;
  1500. /**
  1501. * Show the node editor
  1502. * @param options defines the options to use to configure the node editor
  1503. */
  1504. static Show(options: INodeEditorOptions): void;
  1505. }
  1506. }