Преглед на файлове

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

Popov72 преди 5 години
родител
ревизия
d410b13bce
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      src/Materials/Node/nodeMaterialConnectionPointCustomObject.ts

+ 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;
     }