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); }
static private HashSet <IVFXSlotContainer> CollectDescendantOfAttribute(IEnumerable <VFXNodeController> allSlotContainerControllers) { var operatorDependOnAttribute = new HashSet <IVFXSlotContainer>(); foreach (var attributeParameter in allSlotContainerControllers.Where(o => DependOnAttribute(o.model))) { VFXViewController.CollectDescendantOperator(attributeParameter.model as IVFXSlotContainer, operatorDependOnAttribute); } return(operatorDependOnAttribute); }
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); }