public override bool UpdateSlots()
        {
            var externalReferences = SharedRendererReferenceVisitor.GetExternalReferences(Editor.Asset.PropertyGraph.Definition, GetNodesContainingReferences());

            // Check if our list of slots has changed
            var shouldRegenerate = outputSlotMap.Any(x => !externalReferences.ContainsKey(x.Key)) || externalReferences.Any(x => !outputSlotMap.ContainsKey(x.Key));

            if (shouldRegenerate)
            {
                // If so, regenerate all of them (to easily handle insertion, index changes, etc. - in the future we could handle fine-update)
                foreach (var slot in OutputSlots.Cast <GraphicsCompositorSlotViewModel>().ToList())
                {
                    slot.Destroy();
                }
                OutputSlots.Clear();
                outputSlotMap.Clear();
                foreach (var externalReference in externalReferences)
                {
                    var name = SharedRendererOutputSlotViewModel.ComputeName(externalReference.Key);
                    var slot = new SharedRendererOutputSlotViewModel(this, name, externalReference.Key);
                    outputSlotMap.Add(externalReference.Key, slot);
                    OutputSlots.Add(slot);
                }
            }
            return(shouldRegenerate);
        }
Ejemplo n.º 2
0
 private void AddOutputSlot(IGraphicsCompositorSlotViewModel slot)
 {
     OutputSlots.Add(slot);
     foreach (var link in slot.Links)
     {
         graph.CreateEdge(link);
     }
     slot.Links.CollectionChanged += LinksCollectionChanged;
 }
Ejemplo n.º 3
0
        public void AddConnection(BocsSlotBase slot)
        {
            if (slot == this)
            {
                return;
            }
            if (Node == slot.Node)
            {
                return;
            }

            slot.InputSlot = this;
            foreach (BocsSlotBase s in OutputSlots)
            {
                //if (s._slotType ==	BocsSlotType.)
                if (s == slot)
                {
                    return;
                }
            }
            OutputSlots.Add(slot);
        }