浏览代码

fixed bug

Pamela Wolf 4 年之前
父节点
当前提交
14433bdc34

+ 0 - 1
dist/preview release/babylon.module.d.ts

@@ -21325,7 +21325,6 @@ declare module "babylonjs/Materials/Node/nodeMaterialBlockConnectionPoint" {
         private _type;
         /** @hidden */
         _enforceAssociatedVariableName: boolean;
-        //exposedPortPosition: number;
         /** Gets the direction of the point */
         get direction(): NodeMaterialConnectionPointDirection;
         /** Indicates that this connection point needs dual validation before being connected to another point */

+ 21 - 8
nodeEditor/src/diagram/graphFrame.ts

@@ -1374,14 +1374,14 @@ export class GraphFrame {
     {
         if(exposedPorts.length > 0) {
             for(let i = 0; i < exposedPorts.length; ++i) {
-                //exposedPorts[i].exposedPortPosition = i;
+                exposedPorts[i].exposedPortPosition = i;
             }
         }
     }
 
     public serialize(): IFrameData {
-        //this.serializePortData(this._exposedInPorts);
-        //this.serializePortData(this._exposedOutPorts);
+        this.serializePortData(this._exposedInPorts);
+        this.serializePortData(this._exposedOutPorts);
         return {
             x: this._x,
             y: this._y,
@@ -1426,22 +1426,35 @@ export class GraphFrame {
         } else {
             newFrame.refresh();
         }
-
-        /*for (var node of newFrame.nodes) {
+        
+        
+        for (var node of newFrame.nodes) {
             for (var port of node.outputPorts) { // Output
                 if(port.exposedOnFrame) {
                     port.isExposed = true;
-                    newFrame._exposedOutPorts[port.exposedPortPosition] = port;
+                    if(port.exposedPortPosition) { 
+                        newFrame._exposedOutPorts[port.exposedPortPosition] = port;
+                    }
+                    else {
+                        newFrame._exposedOutPorts.push(port);
+                    }
                 }
             }
 
             for (var port of node.inputPorts) { // Inports
                 if(port.exposedOnFrame) {
                     port.isExposed = true;
-                    newFrame._exposedInPorts[port.exposedPortPosition] = port;
+                    if(port.exposedPortPosition) { 
+                        newFrame._exposedInPorts[port.exposedPortPosition] = port;
+                    }
+                    else {
+                        newFrame._exposedInPorts.push(port);
+                    }
                 }
             }
-        } */       
+        }
+
+        newFrame.isCollapsed = isCollapsed;       
 
         if (isCollapsed) {
             canvas._frameIsMoving = true;

+ 2 - 2
nodeEditor/src/diagram/nodePort.ts

@@ -79,14 +79,14 @@ export class NodePort {
         this.connectionPoint.isExposedOnFrame = value;
     }
     
-    /*public get exposedPortPosition()
+    public get exposedPortPosition()
     {
         return this.connectionPoint.exposedPortPosition;
     }
 
     public set exposedPortPosition(value: number) {
         this.connectionPoint.exposedPortPosition = value;
-    }*/
+    }
     
     private _isConnectedToNodeOutsideOfFrame() {
         const link = this.node.getLinksForConnectionPoint(this.connectionPoint)

+ 2 - 2
src/Materials/Node/nodeMaterialBlock.ts

@@ -741,7 +741,7 @@ export class NodeMaterialBlock {
                 }
                 if (port.isExposedOnFrame) {
                     this.inputs[i].isExposedOnFrame = port.isExposedOnFrame;
-                   // this.inputs[i].exposedPortPosition = port.exposedPortPosition;
+                    this.inputs[i].exposedPortPosition = port.exposedPortPosition;
                 }
             });
         }
@@ -752,7 +752,7 @@ export class NodeMaterialBlock {
                 }
                 if (port.isExposedOnFrame) {
                     this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;
-                   // this.outputs[i].exposedPortPosition = port.exposedPortPosition;
+                    this.outputs[i].exposedPortPosition = port.exposedPortPosition;
                 }
             });
         }

+ 3 - 3
src/Materials/Node/nodeMaterialBlockConnectionPoint.ts

@@ -151,7 +151,7 @@ export class NodeMaterialConnectionPoint {
      */
     public isExposedOnFrame: boolean =  false;
 
-    //public exposedPortPosition: number = -1;
+    public exposedPortPosition: number = -1;
 
     /**
      * Gets or sets a string indicating that this uniform must be defined under a #ifdef
@@ -464,12 +464,12 @@ export class NodeMaterialConnectionPoint {
             serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;
             serializationObject.targetConnectionName = this.connectedPoint.name;
             serializationObject.isExposedOnFrame = true;
-            //serializationObject.exposedPortPosition = this.exposedPortPosition;
+            serializationObject.exposedPortPosition = this.exposedPortPosition;
         }
 
         if (this.isExposedOnFrame) {
             serializationObject.isExposedOnFrame = this.isExposedOnFrame;
-            //serializationObject.exposedPortPosition = this.exposedPortPosition;
+            serializationObject.exposedPortPosition = this.exposedPortPosition;
         }
 
         return serializationObject;