فهرست منبع

removing code

msDestiny14 4 سال پیش
والد
کامیت
86e7047f43

+ 0 - 28
guiEditor/src/diagram/display/clampDisplayManager.ts

@@ -1,28 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { ClampBlock } from 'babylonjs/Materials/Node/Blocks/clampBlock';
-
-export class ClampDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return false;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "#4086BB";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        const clampBlock = block as ClampBlock;
-
-        contentArea.classList.add("clamp-block");
-        contentArea.innerHTML = `[${clampBlock.minimum}, ${clampBlock.maximum}]`;
-    }
-}

+ 0 - 24
guiEditor/src/diagram/display/discardDisplayManager.ts

@@ -1,24 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-
-export class DiscardDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return true;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "#540b0b";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        contentArea.classList.add("discard-block");
-    }
-}

+ 0 - 9
guiEditor/src/diagram/display/displayManager.ts

@@ -1,9 +0,0 @@
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-
-export interface IDisplayManager {
-    getHeaderClass(block: NodeMaterialBlock): string;
-    shouldDisplayPortLabels(block: NodeMaterialBlock): boolean;
-    updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void;
-    getBackgroundColor(block: NodeMaterialBlock): string;
-    getHeaderText(block: NodeMaterialBlock): string;
-}

+ 0 - 29
guiEditor/src/diagram/display/gradientDisplayManager.ts

@@ -1,29 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { GradientBlock } from 'babylonjs/Materials/Node/Blocks/gradientBlock';
-
-export class GradientDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return false;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        let gradientBlock = block as GradientBlock;
-
-        let gradients = gradientBlock.colorSteps.map(c => `rgb(${c.color.r * 255}, ${c.color.g * 255}, ${c.color.b * 255}) ${c.step * 100}%`);
-
-        return gradients.length ? `linear-gradient(90deg, ${gradients.join(", ")})` : 'black';
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        contentArea.classList.add("gradient-block");
-    }
-}

+ 0 - 141
guiEditor/src/diagram/display/inputDisplayManager.ts

@@ -1,141 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { InputBlock } from 'babylonjs/Materials/Node/Blocks/Input/inputBlock';
-import { NodeMaterialSystemValues } from 'babylonjs/Materials/Node/Enums/nodeMaterialSystemValues';
-import { NodeMaterialBlockConnectionPointTypes } from 'babylonjs/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes';
-import { AnimatedInputBlockTypes } from 'babylonjs/Materials/Node/Blocks/Input/animatedInputBlockTypes';
-import { Vector2, Vector3, Vector4 } from 'babylonjs/Maths/math.vector';
-import { Color3 } from 'babylonjs/Maths/math.color';
-import { StringTools } from '../../stringTools';
-
-const inputNameToAttributeValue: { [name: string] : string } = {
-    "position2d" : "position",
-    "particle_uv" : "uv",
-    "particle_color" : "color",
-    "particle_texturemask": "textureMask",
-    "particle_positionw" : "positionW",
-};
-
-const inputNameToAttributeName: { [name: string] : string } = {
-    "position2d" : "screen",
-    "particle_uv" : "particle",
-    "particle_color" : "particle",
-    "particle_texturemask": "particle",
-    "particle_positionw": "particle",
-};
-
-export class InputDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        let inputBlock = block as InputBlock;
-
-        if (inputBlock.isConstant) {
-            return "constant";
-        }
-
-        if (inputBlock.visibleInInspector) {
-            return "inspector";
-        }
-
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return false;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        let inputBlock = block as InputBlock;
-        let name = `${inputBlock.name} (${StringTools.GetBaseType(inputBlock.output.type)})`;
-
-        if (inputBlock.isAttribute) {
-            name = StringTools.GetBaseType(inputBlock.output.type);
-        }
-
-        return name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        let color = "";
-        let inputBlock = block as InputBlock;
-
-        switch (inputBlock.type) {
-            case NodeMaterialBlockConnectionPointTypes.Color3:
-            case NodeMaterialBlockConnectionPointTypes.Color4: {
-                if (inputBlock.value) {
-                    color = (inputBlock.value as Color3).toHexString();
-                    break;
-                }
-            }
-            default:
-                break;
-        }
-
-        return color;
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {
-        let value = "";
-        let inputBlock = block as InputBlock;
-
-        if (inputBlock.isAttribute) {
-            const attrVal = inputNameToAttributeValue[inputBlock.name] ?? inputBlock.name;
-            const attrName = inputNameToAttributeName[inputBlock.name] ?? 'mesh';
-            value = attrName + "." + attrVal;
-        } else if (inputBlock.isSystemValue) {
-            switch (inputBlock.systemValue) {
-                case NodeMaterialSystemValues.World:
-                    value = "World";
-                    break;
-                case NodeMaterialSystemValues.WorldView:
-                    value = "World x View";
-                    break;
-                case NodeMaterialSystemValues.WorldViewProjection:
-                    value = "World x View x Projection";
-                    break;
-                case NodeMaterialSystemValues.View:
-                    value = "View";
-                    break;
-                case NodeMaterialSystemValues.ViewProjection:
-                    value = "View x Projection";
-                    break;
-                case NodeMaterialSystemValues.Projection:
-                    value = "Projection";
-                    break;
-                case NodeMaterialSystemValues.CameraPosition:
-                    value = "Camera position";
-                    break;
-                case NodeMaterialSystemValues.FogColor:
-                    value = "Fog color";
-                    break;
-                case NodeMaterialSystemValues.DeltaTime:
-                    value = "Delta time";
-                    break;
-            }
-        } else {
-            switch (inputBlock.type) {
-                case NodeMaterialBlockConnectionPointTypes.Float:
-                    if (inputBlock.animationType !== AnimatedInputBlockTypes.None) {
-                        value = AnimatedInputBlockTypes[inputBlock.animationType];
-                    } else {
-                        value = inputBlock.value.toFixed(2);
-                    }
-                    break;
-                case NodeMaterialBlockConnectionPointTypes.Vector2:
-                    let vec2Value = inputBlock.value as Vector2;
-                    value = `(${vec2Value.x.toFixed(2)}, ${vec2Value.y.toFixed(2)})`;
-                    break;
-                case NodeMaterialBlockConnectionPointTypes.Vector3:
-                    let vec3Value = inputBlock.value as Vector3;
-                    value = `(${vec3Value.x.toFixed(2)}, ${vec3Value.y.toFixed(2)}, ${vec3Value.z.toFixed(2)})`;
-                    break;
-                case NodeMaterialBlockConnectionPointTypes.Vector4:
-                    let vec4Value = inputBlock.value as Vector4;
-                    value = `(${vec4Value.x.toFixed(2)}, ${vec4Value.y.toFixed(2)}, ${vec4Value.z.toFixed(2)}, ${vec4Value.w.toFixed(2)})`;
-                    break;
-            }
-        }
-
-        contentArea.innerHTML = value;
-        contentArea.classList.add("input-block");
-    }
-}

+ 0 - 24
guiEditor/src/diagram/display/outputDisplayManager.ts

@@ -1,24 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-
-export class OutputDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return true;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "rgb(106, 44, 131)";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        contentArea.classList.add("output-block");
-    }
-}

+ 0 - 49
guiEditor/src/diagram/display/remapDisplayManager.ts

@@ -1,49 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { InputBlock } from 'babylonjs/Materials/Node/Blocks/Input/inputBlock';
-import { RemapBlock } from 'babylonjs/Materials/Node/Blocks/remapBlock';
-import { NodeMaterialConnectionPoint } from 'babylonjs/Materials/Node/nodeMaterialBlockConnectionPoint';
-
-export class RemapDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return true;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "#4086BB";
-    }
-
-    private _extractInputValue(connectionPoint: NodeMaterialConnectionPoint) {
-        let connectedBlock = connectionPoint.connectedPoint!.ownerBlock;
-
-        if (connectedBlock.isInput) {
-            let inputBlock = connectedBlock as InputBlock;
-
-            if (inputBlock.isUniform && !inputBlock.isSystemValue) {
-                return inputBlock.value;
-            }
-        }
-
-        return "?";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        const remapBlock = block as RemapBlock;
-
-        let sourceRangeX = remapBlock.sourceMin.isConnected ? this._extractInputValue(remapBlock.sourceMin) : remapBlock.sourceRange.x;
-        let sourceRangeY = remapBlock.sourceMax.isConnected ? this._extractInputValue(remapBlock.sourceMax) : remapBlock.sourceRange.y;
-        let targetRangeX = remapBlock.targetMin.isConnected ? this._extractInputValue(remapBlock.targetMin) : remapBlock.targetRange.x;
-        let targetRangeY = remapBlock.targetMax.isConnected ? this._extractInputValue(remapBlock.targetMax) : remapBlock.targetRange.y;        
-
-        contentArea.classList.add("remap-block");
-        contentArea.innerHTML = `[${sourceRangeX}, ${sourceRangeY}] -> [${targetRangeX}, ${targetRangeY}]`;
-    }
-}

+ 0 - 42
guiEditor/src/diagram/display/textureDisplayManager.ts

@@ -1,42 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { TextureBlock } from 'babylonjs/Materials/Node/Blocks/Dual/textureBlock';
-import { CurrentScreenBlock } from 'babylonjs/Materials/Node/Blocks/Dual/currentScreenBlock';
-import { ParticleTextureBlock } from 'babylonjs/Materials/Node/Blocks/Particle/particleTextureBlock';
-
-export class TextureDisplayManager implements IDisplayManager {
-    private _previewCanvas: HTMLCanvasElement;
-    private _previewImage: HTMLImageElement;
-
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return true;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "#323232";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {
-       
-        if (!this._previewCanvas) {
-            contentArea.classList.add("texture-block");
-            if (block instanceof TextureBlock || block instanceof CurrentScreenBlock || block instanceof ParticleTextureBlock) {
-                contentArea.classList.add("regular-texture-block");
-            }
-
-            this._previewCanvas = contentArea.ownerDocument!.createElement("canvas");
-            this._previewImage = contentArea.ownerDocument!.createElement("img");
-            contentArea.appendChild(this._previewImage);
-            this._previewImage.classList.add("empty");
-        }
-
-    }
-}

+ 0 - 28
guiEditor/src/diagram/display/trigonometryDisplayManager.ts

@@ -1,28 +0,0 @@
-import { IDisplayManager } from './displayManager';
-import { NodeMaterialBlock } from 'babylonjs/Materials/Node/nodeMaterialBlock';
-import { TrigonometryBlock, TrigonometryBlockOperations } from 'babylonjs/Materials/Node/Blocks/trigonometryBlock';
-
-export class TrigonometryDisplayManager implements IDisplayManager {
-    public getHeaderClass(block: NodeMaterialBlock) {
-        return "";
-    }
-
-    public shouldDisplayPortLabels(block: NodeMaterialBlock): boolean {
-        return false;
-    }
-
-    public getHeaderText(block: NodeMaterialBlock): string {
-        return block.name;
-    }
-
-    public getBackgroundColor(block: NodeMaterialBlock): string {
-        return "#405C86";
-    }
-
-    public updatePreviewContent(block: NodeMaterialBlock, contentArea: HTMLDivElement): void {       
-        const trigonometryBlock = block as TrigonometryBlock;
-
-        contentArea.classList.add("trigonometry-block");
-        contentArea.innerHTML = TrigonometryBlockOperations[trigonometryBlock.operation];
-    }
-}

+ 0 - 27
guiEditor/src/diagram/displayLedger.ts

@@ -1,27 +0,0 @@
-import { InputDisplayManager } from './display/inputDisplayManager';
-import { OutputDisplayManager } from './display/outputDisplayManager';
-import { ClampDisplayManager } from './display/clampDisplayManager';
-import { GradientDisplayManager } from './display/gradientDisplayManager';
-import { RemapDisplayManager } from './display/remapDisplayManager';
-import { TrigonometryDisplayManager } from './display/trigonometryDisplayManager';
-import { TextureDisplayManager } from './display/textureDisplayManager';
-import { DiscardDisplayManager } from './display/discardDisplayManager';
-
-export class DisplayLedger {
-    public static RegisteredControls: {[key: string] : any} = {};
-}
-
-DisplayLedger.RegisteredControls["InputBlock"] = InputDisplayManager;
-DisplayLedger.RegisteredControls["VertexOutputBlock"] = OutputDisplayManager;
-DisplayLedger.RegisteredControls["FragmentOutputBlock"] = OutputDisplayManager;
-DisplayLedger.RegisteredControls["ClampBlock"] = ClampDisplayManager;
-DisplayLedger.RegisteredControls["GradientBlock"] = GradientDisplayManager;
-DisplayLedger.RegisteredControls["RemapBlock"] = RemapDisplayManager;
-DisplayLedger.RegisteredControls["TrigonometryBlock"] = TrigonometryDisplayManager;
-DisplayLedger.RegisteredControls["TextureBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["ReflectionTextureBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["ReflectionBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["RefractionBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["CurrentScreenBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["ParticleTextureBlock"] = TextureDisplayManager;
-DisplayLedger.RegisteredControls["DiscardBlock"] = DiscardDisplayManager;

+ 0 - 0
guiEditor/src/diagram/graphFrame.ts


+ 0 - 6
guiEditor/src/diagram/workbench.tsx

@@ -5,7 +5,6 @@ import * as dagre from 'dagre';
 import { Nullable } from 'babylonjs/types';
 
 import { DataStorage } from 'babylonjs/Misc/dataStorage';
-import { IEditorData} from '../nodeLocationInfo';
 
 import 'babylonjs-gui/2D/';
 
@@ -485,11 +484,6 @@ export class WorkbenchComponent extends React.Component<IWorkbenchComponentProps
         this.y = 0;
     }
 
-    processEditorData(editorData: IEditorData) {
-        this.x = editorData.x || 0;
-        this.y = editorData.y || 0;
-        this.zoom = editorData.zoom || 1;
-    }
 
     public createGUICanvas()
     {

+ 0 - 1
guiEditor/src/globalState.ts

@@ -8,7 +8,6 @@ import { GUINode } from './diagram/guiNode';
 import { Vector2 } from 'babylonjs/Maths/math.vector';
 import { FramePortData, WorkbenchComponent } from './diagram/workbench';
 
-
 export class GlobalState {
     guiTexture: BABYLON.GUI.AdvancedDynamicTexture;
     hostElement: HTMLElement;

+ 19 - 5
guiEditor/src/workbenchEditor.tsx

@@ -63,6 +63,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
         // Graph
         const node = null;// this._workbenchCanvas.appendBlock(block);
 
+
         return node;
     }
 
@@ -75,13 +76,17 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
         if (navigator.userAgent.indexOf("Mobile") !== -1) {
             ((this.props.globalState.hostDocument || document).querySelector(".blocker") as HTMLElement).style.visibility = "visible";
         }
+
+
     }
 
     componentWillUnmount() {
         if (this.props.globalState.hostDocument) {
             this.props.globalState.hostDocument!.removeEventListener("keyup", this._onWidgetKeyUpPointer, false);
         }
+
     }
+
     constructor(props: IGraphEditorProps) {
         super(props);
 
@@ -115,6 +120,8 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
             this.reOrganize();
         });
 
+
+
         this.props.globalState.hostDocument!.addEventListener("keydown", evt => {
             if ((evt.keyCode === 46 || evt.keyCode === 8) && !this.props.globalState.blockKeyboardEvents) { // Delete                
                 let selectedItems = this._workbenchCanvas.selectedGuiNodes;
@@ -256,7 +263,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
                 }
                 
                 if (!isImportingAFrame){
-                    this._workbenchCanvas.processEditorData(editorData);
+                 //   this._workbenchCanvas.processEditorData(editorData);
                 }
             }
 
@@ -456,7 +463,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
 
     createPreviewMeshControlHost = (options: IInternalPreviewAreaOptions, parentControl: Nullable<HTMLElement>) => {
         // Prepare the preview control host
-        if (parentControl) {
+       /* if (parentControl) {
 
             const host = parentControl.ownerDocument!.createElement("div");
 
@@ -464,12 +471,12 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
             host.style.width = options.embedHostWidth || "auto";
 
             parentControl.appendChild(host);
-            /*const PreviewMeshControlComponentHost = React.createElement(PreviewMeshControlComponent, {
+            const PreviewMeshControlComponentHost = React.createElement(PreviewMeshControlComponent, {
                 globalState: this.props.globalState,
                 togglePreviewAreaComponent: this.handlePopUp
             });
-            ReactDOM.render(PreviewMeshControlComponentHost, host);*/
-        }
+            ReactDOM.render(PreviewMeshControlComponentHost, host);
+        }*/
     }
 
     createPreviewHost = (options: IInternalPreviewAreaOptions, parentControl: Nullable<HTMLElement>) => {
@@ -492,6 +499,13 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
             }
         }
 
+        /*if (this._previewHost) {
+            const PreviewAreaComponentHost = React.createElement(PreviewAreaComponent, {
+                globalState: this.props.globalState,
+                width: 200
+            });
+            ReactDOM.render(PreviewAreaComponentHost, this._previewHost);
+        }*/
     }
 
     fixPopUpStyles = (document: Document) => {