Browse Source

add isExposedOnFrame property to connection points

Kyle Belfort 5 years ago
parent
commit
181a3559ce

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

@@ -67,7 +67,7 @@ export class NodePort {
     }
 
     public get exposedOnFrame() {
-        if(!!this._exposedOnFrame || this._isConnectedToNodeOutsideOfFrame()) {
+        if(!!this.connectionPoint.isExposedOnFrame || this._isConnectedToNodeOutsideOfFrame()) {
             return true
         } return false;
     }
@@ -76,7 +76,7 @@ export class NodePort {
         if(this.disabled){
             return;
         }
-        this._exposedOnFrame = value;
+        this.connectionPoint.isExposedOnFrame = value;
     }
     
     

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

@@ -678,10 +678,10 @@ export class NodeMaterialBlock {
     public _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {
         this.name = serializationObject.name;
         this.comments = serializationObject.comments;
-        this._deserializePortDisplayNames(serializationObject);
+        this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);
     }
 
-    private _deserializePortDisplayNames(serializationObject: any) {
+    private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {
         const serializedInputs = serializationObject.inputs;
         const serializedOutputs = serializationObject.outputs;
         if (serializedInputs) {
@@ -689,6 +689,9 @@ export class NodeMaterialBlock {
                 if (port.displayName) {
                     this.inputs[i].displayName = port.displayName;
                 }
+                if (port.isExposedOnFrame) {
+                    this.inputs[i].isExposedOnFrame = port.isExposedOnFrame;
+                }
             });
         }
         if (serializedOutputs) {
@@ -696,6 +699,9 @@ export class NodeMaterialBlock {
                 if (port.displayName) {
                     this.outputs[i].displayName = port.displayName;
                 }
+                if (port.isExposedOnFrame) {
+                    this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;
+                }
             });
         }
     }

+ 9 - 0
src/Materials/Node/nodeMaterialBlockConnectionPoint.ts

@@ -147,6 +147,11 @@ export class NodeMaterialConnectionPoint {
     public isOptional: boolean;
 
     /**
+     * Gets or sets a boolean indicating that this connection point is exposed on a frame
+     */
+    public isExposedOnFrame: boolean =  false;
+
+    /**
      * Gets or sets a string indicating that this uniform must be defined under a #ifdef
      */
     public define: string;
@@ -458,6 +463,10 @@ export class NodeMaterialConnectionPoint {
             serializationObject.targetConnectionName = this.connectedPoint.name;
         }
 
+        if (this.isExposedOnFrame) {
+            serializationObject.isExposedOnFrame = this.isExposedOnFrame;
+        }
+
         return serializationObject;
     }