private void InputSlotsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: { foreach (IGraphicsCompositorSlotViewModel newSlot in e.NewItems) { AddInputSlot(newSlot); } break; } case NotifyCollectionChangedAction.Remove: { foreach (IGraphicsCompositorSlotViewModel oldSlot in e.OldItems) { RemoveInputSlot(oldSlot); } break; } case NotifyCollectionChangedAction.Reset: { InputSlots.Clear(); break; } default: throw new NotSupportedException(); } }
public void AddInput(int slot, string inputVariable) { if (!Inputs.Contains(inputVariable)) { Inputs.Add(inputVariable); if (!InputSlots.ContainsKey(slot)) { InputSlots.Add(slot, 1); } else { InputSlots[slot]++; } } }
/// <summary> /// Attempts to add the provided input variable to the provided slot. /// </summary> /// <param name="slot"></param> /// <param name="inputVariable"></param> /// <returns>Whether the variable was added or not.</returns> public bool AddInput(int slot, string inputVariable) { if (!Inputs.Contains(inputVariable)) { Inputs.Add(inputVariable); if (!InputSlots.ContainsKey(slot)) { InputSlots.Add(slot, 1); } else { InputSlots[slot]++; } } return(true); }
public SharedRendererBlockViewModel([NotNull] GraphicsCompositorEditorViewModel editor, ISharedRenderer sharedRenderer) : base(editor) { this.sharedRenderer = sharedRenderer; sharedRendererNode = editor.Session.AssetNodeContainer.GetOrCreateNode(sharedRenderer); InputSlots.Add(new SharedRendererInputSlotViewModel(this)); }
private void RemoveInputSlot(IGraphicsCompositorSlotViewModel slot) { InputSlots.Remove(slot); }
private void AddInputSlot(IGraphicsCompositorSlotViewModel slot) { InputSlots.Add(slot); }