///
declare module NODEEDITOR {
export class GlobalState {
nodeMaterial?: BABYLON.NodeMaterial;
hostDocument?: BABYLON.Nullable;
}
}
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;
static idCounter: number;
constructor(name: string, type?: string);
syncWithNodeMaterialConnectionPoint(connection: BABYLON.NodeMaterialConnectionPoint): void;
getNodeModel(): GenericNodeModel;
link(outPort: GenericPortModel): LinkModel;
getInputFromBlock(): void;
createLinkModel(): LinkModel;
getValue: Function;
static SortInputOutput(a: BABYLON.Nullable, b: BABYLON.Nullable): {
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;
/**
* Labels for the block
*/
headerLabels: Array<{
text: string;
}>;
/**
* BABYLON.Texture for the node if it exists
*/
texture: BABYLON.Nullable;
/**
* BABYLON.Vector2 for the node if it exists
*/
vector2: BABYLON.Nullable;
/**
* BABYLON.Vector3 for the node if it exists
*/
vector3: BABYLON.Nullable;
/**
* BABYLON.Vector4 for the node if it exists
*/
vector4: BABYLON.Nullable;
/**
* BABYLON.Matrix for the node if it exists
*/
matrix: BABYLON.Nullable;
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 {
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 {
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 {
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;
}
export class Vector2LineComponent extends React.Component {
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;
}
export class Vector3LineComponent extends React.Component {
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;
}
/**
* GenericNodeWidgetState
*/
export interface GenericNodeWidgetState {
}
/**
* Used to display a node block for the node editor
*/
export class GenericNodeWidget extends React.Component {
/**
* 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 {
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 {
constructor(props: IButtonLineComponentProps);
render(): JSX.Element;
}
}
declare module NODEEDITOR {
interface IGraphEditorProps {
globalState: GlobalState;
}
export class GraphEditor extends React.Component {
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;
}
}