public bool CanLinkToNode(VFXNodeController nodeController, CanLinkCache cache) { if (nodeController == sourceNode) { return(false); } if (cache == null) { cache = new CanLinkCache(); } cache.localChildrenOperator.Clear(); cache.localParentOperator.Clear(); bool result; if (direction != Direction.Input) { VFXViewController.CollectAncestorOperator(sourceNode.slotContainer, cache.localParentOperator); result = !cache.localParentOperator.Contains(nodeController.slotContainer); } else { VFXViewController.CollectDescendantOperator(sourceNode.slotContainer, cache.localChildrenOperator); result = !cache.localChildrenOperator.Contains(nodeController.slotContainer); } return(result); }
public bool CanLinkToNode(VFXNodeController nodeController, CanLinkCache cache) { if (nodeController == sourceNode) { return(false); } if (cache == null) { cache = new CanLinkCache(); } cache.localChildrenOperator.Clear(); cache.localParentOperator.Clear(); bool result; if (direction != Direction.Input) { VFXViewController.CollectAncestorOperator(sourceNode.slotContainer, cache.localParentOperator); #if _RESTRICT_ATTRIBUTE_ACCESS if (cache.localParentOperator.Any(o => DependOnAttribute(o))) { if (cache.ancestorOfSpawners == null) { cache.ancestorOfSpawners = CollectAnscestorOfSpawner(viewController.AllSlotContainerControllers); } var additionnalExcludeOperator = cache.ancestorOfSpawners; cache.localChildrenOperator.UnionWith(additionnalExcludeOperator); } #endif result = !cache.localParentOperator.Contains(nodeController.slotContainer); } else { VFXViewController.CollectDescendantOperator(sourceNode.slotContainer, cache.localChildrenOperator); #if _RESTRICT_ATTRIBUTE_ACCESS var contextTypeInChildren = cache.localChildrenOperator.OfType <VFXBlock>().Select(o => o.GetParent().contextType); if (contextTypeInChildren.Any(o => o == VFXContextType.Spawner)) { if (cache.descendantOfAttribute == null) { cache.descendantOfAttribute = CollectDescendantOfAttribute(viewController.AllSlotContainerControllers); } var additionnalExcludeOperator = cache.descendantOfAttribute; return(!cache.localParentOperator.Contains(sourceNode.slotContainer) && !additionnalExcludeOperator.Contains(nodeController.slotContainer)); } #endif result = !cache.localChildrenOperator.Contains(nodeController.slotContainer); } return(result); }
public virtual bool CanLink(VFXDataAnchorController controller, CanLinkCache cache = null) { if (controller.model != null) { if (model.CanLink(controller.model) && controller.model.CanLink(model)) { if (!CanLinkToNode(controller.sourceNode, cache)) { return(false); } return(true); } return(sourceNode.CouldLink(this, controller, cache)); } return(controller.CanLink(this, cache)); }
public override bool CanLink(VFXDataAnchorController controller, CanLinkCache cache = null) { var op = (sourceNode as VFXCascadedOperatorController); if (op == null) { return(false); } if (controller is VFXUpcommingDataAnchorController) { return(false); } if (!CanLinkToNode(controller.sourceNode, cache)) { return(false); } return(op.model.GetBestAffinityType(controller.model.property.type) != null); }