Explorar o código

Allow the two points to not have the same name when checking for compatibility

Popov72 %!s(int64=5) %!d(string=hai) anos
pai
achega
d410b13bce

+ 6 - 2
src/Materials/Node/nodeMaterialConnectionPointCustomObject.ts

@@ -14,9 +14,13 @@ export class NodeMaterialConnectionPointCustomObject<T extends NodeMaterialBlock
      * @param direction defines the direction of the connection point
      */
     public constructor(name: string, ownerBlock: NodeMaterialBlock, direction: NodeMaterialConnectionPointDirection,
-            private _blockType: new (...args: any[]) => T, private _blockName: string) {
+            private _blockType: new (...args: any[]) => T, private _blockName: string, private _nameForCheking?: string) {
         super(name, ownerBlock, direction);
 
+        if (!this._nameForCheking) {
+            this._nameForCheking = name;
+        }
+
         this.needDualDirectionValidation = true;
     }
 
@@ -26,7 +30,7 @@ export class NodeMaterialConnectionPointCustomObject<T extends NodeMaterialBlock
      * @returns a number defining the compatibility state
      */
     public checkCompatibilityState(connectionPoint: NodeMaterialConnectionPoint): NodeMaterialConnectionPointCompatibilityStates {
-        return connectionPoint instanceof NodeMaterialConnectionPointCustomObject && connectionPoint.name === this.name ?
+        return connectionPoint instanceof NodeMaterialConnectionPointCustomObject && connectionPoint.name === this._nameForCheking ?
                 NodeMaterialConnectionPointCompatibilityStates.Compatible : NodeMaterialConnectionPointCompatibilityStates.TypeIncompatible;
     }