123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- /// <reference types="react" />
- declare module NODEEDITOR {
- export class GlobalState {
- nodeMaterial?: BABYLON.NodeMaterial;
- hostDocument?: BABYLON.Nullable<Document>;
- }
- }
- declare module NODEEDITOR {
- /**
- * Port model for the generic node
- */
- export class GenericPortModel extends PortModel {
- /**
- * If the port is input or output
- */
- position: string | "input" | "output";
- /**
- * What the port is connected to
- */
- connection: BABYLON.Nullable<BABYLON.NodeMaterialConnectionPoint>;
- static idCounter: number;
- constructor(name: string, type?: string);
- syncWithNodeMaterialConnectionPoint(connection: BABYLON.NodeMaterialConnectionPoint): void;
- getNodeModel(): GenericNodeModel;
- link(outPort: GenericPortModel): LinkModel<import("storm-react-diagrams").LinkModelListener>;
- getInputFromBlock(): void;
- createLinkModel(): LinkModel;
- getValue: Function;
- static SortInputOutput(a: BABYLON.Nullable<GenericPortModel>, b: BABYLON.Nullable<GenericPortModel>): {
- input: GenericPortModel;
- output: GenericPortModel;
- } | null;
- }
- }
- declare module NODEEDITOR {
- /**
- * Generic node model which stores information about a node editor block
- */
- export class GenericNodeModel extends NodeModel {
- /**
- * The babylon block this node represents
- */
- block: BABYLON.Nullable<BABYLON.NodeMaterialBlock>;
- /**
- * Labels for the block
- */
- headerLabels: Array<{
- text: string;
- }>;
- /**
- * BABYLON.Texture for the node if it exists
- */
- texture: BABYLON.Nullable<BABYLON.Texture>;
- /**
- * BABYLON.Vector2 for the node if it exists
- */
- vector2: BABYLON.Nullable<BABYLON.Vector2>;
- /**
- * BABYLON.Vector3 for the node if it exists
- */
- vector3: BABYLON.Nullable<BABYLON.Vector3>;
- /**
- * BABYLON.Vector4 for the node if it exists
- */
- vector4: BABYLON.Nullable<BABYLON.Vector4>;
- /**
- * BABYLON.Matrix for the node if it exists
- */
- matrix: BABYLON.Nullable<BABYLON.Matrix>;
- ports: {
- [s: string]: GenericPortModel;
- };
- /**
- * Constructs the node model
- */
- constructor();
- }
- }
- declare module NODEEDITOR {
- interface ITextureLineComponentProps {
- texture: BABYLON.BaseTexture;
- width: number;
- height: number;
- globalState?: any;
- hideChannelSelect?: boolean;
- }
- export class TextureLineComponent extends React.Component<ITextureLineComponentProps, {
- displayRed: boolean;
- displayGreen: boolean;
- displayBlue: boolean;
- displayAlpha: boolean;
- face: number;
- }> {
- constructor(props: ITextureLineComponentProps);
- shouldComponentUpdate(nextProps: ITextureLineComponentProps, nextState: {
- displayRed: boolean;
- displayGreen: boolean;
- displayBlue: boolean;
- displayAlpha: boolean;
- face: number;
- }): boolean;
- componentDidMount(): void;
- componentDidUpdate(): void;
- updatePreview(): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- interface IFileButtonLineComponentProps {
- label: string;
- onClick: (file: File) => void;
- accept: string;
- }
- export class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
- constructor(props: IFileButtonLineComponentProps);
- onChange(evt: any): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- interface INumericInputComponentProps {
- label: string;
- value: number;
- step?: number;
- onChange: (value: number) => void;
- }
- export class NumericInputComponent extends React.Component<INumericInputComponentProps, {
- value: string;
- }> {
- static defaultProps: {
- step: number;
- };
- private _localChange;
- constructor(props: INumericInputComponentProps);
- shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
- value: string;
- }): boolean;
- updateValue(evt: any): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- export class PropertyChangedEvent {
- object: any;
- property: string;
- value: any;
- initialValue: any;
- }
- }
- declare module NODEEDITOR {
- interface IVector2LineComponentProps {
- label: string;
- target: any;
- propertyName: string;
- step?: number;
- onChange?: (newvalue: BABYLON.Vector2) => void;
- onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
- }
- export class Vector2LineComponent extends React.Component<IVector2LineComponentProps, {
- isExpanded: boolean;
- value: BABYLON.Vector2;
- }> {
- static defaultProps: {
- step: number;
- };
- private _localChange;
- constructor(props: IVector2LineComponentProps);
- shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: {
- isExpanded: boolean;
- value: BABYLON.Vector2;
- }): boolean;
- switchExpandState(): void;
- raiseOnPropertyChanged(previousValue: BABYLON.Vector2): void;
- updateStateX(value: number): void;
- updateStateY(value: number): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- interface IVector3LineComponentProps {
- label: string;
- target: any;
- propertyName: string;
- step?: number;
- onChange?: (newvalue: BABYLON.Vector3) => void;
- onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
- }
- export class Vector3LineComponent extends React.Component<IVector3LineComponentProps, {
- isExpanded: boolean;
- value: BABYLON.Vector3;
- }> {
- static defaultProps: {
- step: number;
- };
- private _localChange;
- constructor(props: IVector3LineComponentProps);
- shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: {
- isExpanded: boolean;
- value: BABYLON.Vector3;
- }): boolean;
- switchExpandState(): void;
- raiseOnPropertyChanged(previousValue: BABYLON.Vector3): void;
- updateVector3(): void;
- updateStateX(value: number): void;
- updateStateY(value: number): void;
- updateStateZ(value: number): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- /**
- * GenericNodeWidgetProps
- */
- export interface GenericNodeWidgetProps {
- node: BABYLON.Nullable<GenericNodeModel>;
- }
- /**
- * GenericNodeWidgetState
- */
- export interface GenericNodeWidgetState {
- }
- /**
- * Used to display a node block for the node editor
- */
- export class GenericNodeWidget extends React.Component<GenericNodeWidgetProps, GenericNodeWidgetState> {
- /**
- * Creates a GenericNodeWidget
- * @param props
- */
- constructor(props: GenericNodeWidgetProps);
- /**
- * Replaces the texture of the node
- * @param file the file of the texture to use
- */
- replaceTexture(file: File): void;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- /**
- * Node factory which creates editor nodes
- */
- export class GenericNodeFactory extends SRD.AbstractNodeFactory {
- /**
- * Constructs a GenericNodeFactory
- */
- constructor();
- /**
- * Generates a node widget
- * @param diagramEngine diagram engine
- * @param node node to generate
- * @returns node widget jsx
- */
- generateReactWidget(diagramEngine: SRD.DiagramEngine, node: GenericNodeModel): JSX.Element;
- /**
- * Gets a new instance of a node model
- * @returns generic node model
- */
- getNewInstance(): GenericNodeModel;
- }
- }
- declare module NODEEDITOR {
- interface ILineContainerComponentProps {
- globalState?: any;
- title: string;
- children: any[] | any;
- closed?: boolean;
- }
- export class LineContainerComponent extends React.Component<ILineContainerComponentProps, {
- isExpanded: boolean;
- isHighlighted: boolean;
- }> {
- private static _InMemoryStorage;
- constructor(props: ILineContainerComponentProps);
- switchExpandedState(): void;
- componentDidMount(): void;
- renderHeader(): JSX.Element;
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- export interface IButtonLineComponentProps {
- label: string;
- onClick: () => void;
- }
- export class ButtonLineComponent extends React.Component<IButtonLineComponentProps> {
- constructor(props: IButtonLineComponentProps);
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- interface IGraphEditorProps {
- globalState: GlobalState;
- }
- export class GraphEditor extends React.Component<IGraphEditorProps> {
- private _engine;
- private _model;
- private _nodes;
- /**
- * Current row/column position used when adding new nodes
- */
- private _rowPos;
- /**
- * Creates a node and recursivly creates its parent nodes from it's input
- * @param nodeMaterialBlock
- */
- createNodeFromObject(options: {
- column: number;
- nodeMaterialBlock?: BABYLON.NodeMaterialBlock;
- }): GenericNodeModel;
- componentDidMount(): void;
- componentWillUnmount(): void;
- constructor(props: IGraphEditorProps);
- addNodeFromClass(ObjectClass: typeof BABYLON.NodeMaterialBlock): GenericNodeModel;
- addValueNode(type: string, column?: number, connection?: BABYLON.NodeMaterialConnectionPoint): GenericNodeModel;
- allBlocks: {
- Fragment: (typeof BABYLON.AlphaTestBlock | typeof BABYLON.FragmentOutputBlock | typeof BABYLON.ImageProcessingBlock | typeof BABYLON.RGBAMergerBlock | typeof BABYLON.RGBASplitterBlock | typeof BABYLON.TextureBlock)[];
- Vertex: (typeof BABYLON.BonesBlock | typeof BABYLON.InstancesBlock | typeof BABYLON.MorphTargetsBlock | typeof BABYLON.VertexOutputBlock)[];
- Dual: (typeof BABYLON.FogBlock)[];
- Other: (typeof BABYLON.AddBlock | typeof BABYLON.ClampBlock | typeof BABYLON.MatrixMultiplicationBlock | typeof BABYLON.MultiplyBlock | typeof BABYLON.Vector2TransformBlock | typeof BABYLON.Vector3TransformBlock | typeof BABYLON.Vector4TransformBlock)[];
- Value: string[];
- };
- render(): JSX.Element;
- }
- }
- declare module NODEEDITOR {
- export class Popup {
- static CreatePopup(title: string, windowVariableName: string, width?: number, height?: number): HTMLDivElement | null;
- private static _CopyStyles;
- }
- }
- declare module NODEEDITOR {
- /**
- * Interface used to specify creation options for the node editor
- */
- export interface INodeEditorOptions {
- /**
- * Defines the DOM element that will host the node editor
- */
- hostElement?: HTMLDivElement;
- nodeMaterial?: BABYLON.NodeMaterial;
- }
- /**
- * Class used to create a node editor
- */
- export class NodeEditor {
- /**
- * Show the node editor
- * @param options defines the options to use to configure the node editor
- */
- static Show(options: INodeEditorOptions): void;
- }
- }
|