Przeglądaj źródła

Allow for dual direction check when connecting two points

Popov72 5 lat temu
rodzic
commit
76f3ea8968

+ 3 - 0
nodeEditor/src/diagram/graphCanvas.tsx

@@ -779,6 +779,9 @@ export class GraphCanvasComponent extends React.Component<IGraphCanvasComponentP
         // Check compatibility
         let isFragmentOutput = pointB.ownerBlock.getClassName() === "FragmentOutputBlock";
         let compatibilityState = pointA.checkCompatibilityState(pointB);
+        if ((pointA.needDualDirectionValidation || pointB.needDualDirectionValidation) && compatibilityState === NodeMaterialConnectionPointCompatibilityStates.Compatible && !(pointA instanceof InputBlock)) {
+            compatibilityState = pointB.checkCompatibilityState(pointA);
+        }
         if (compatibilityState === NodeMaterialConnectionPointCompatibilityStates.Compatible) {
             if (isFragmentOutput) {
                 let fragmentBlock = pointB.ownerBlock as FragmentOutputBlock;

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

@@ -57,6 +57,9 @@ export class NodeMaterialConnectionPoint {
         return this._direction;
     }
 
+    /** Indicates that this connection point needs dual validation before being connected to another point */
+    public needDualDirectionValidation: boolean = false;
+
     /**
      * Gets or sets the additional types supported by this connection point
      */