public VFXContextController(VFXModel model, VFXViewController viewController) : base(model, viewController) { UnregisterAnchors(); if (this.model.inputType != VFXDataType.kNone) { for (int slot = 0; slot < this.model.inputFlowSlot.Length; ++slot) { var inAnchor = new VFXFlowInputAnchorController(); inAnchor.Init(this, slot); m_FlowInputAnchors.Add(inAnchor); viewController.RegisterFlowAnchorController(inAnchor); } } if (this.model.outputType != VFXDataType.kNone) { for (int slot = 0; slot < this.model.outputFlowSlot.Length; ++slot) { var outAnchor = new VFXFlowOutputAnchorController(); outAnchor.Init(this, slot); m_FlowOutputAnchors.Add(outAnchor); viewController.RegisterFlowAnchorController(outAnchor); } } SyncControllers(); }
private void SyncFlowAnchors() { if (this.model.inputType != VFXDataType.None) { for (int slot = m_FlowInputAnchors.Count; slot < this.model.inputFlowSlot.Length; ++slot) { var inAnchor = new VFXFlowInputAnchorController(); inAnchor.Init(this, slot); m_FlowInputAnchors.Add(inAnchor); viewController.RegisterFlowAnchorController(inAnchor); } while (this.model.inputFlowSlot.Length < m_FlowInputAnchors.Count) { var removedAnchor = m_FlowInputAnchors[m_FlowInputAnchors.Count - 1]; removedAnchor.OnDisable(); viewController.UnregisterFlowAnchorController(removedAnchor); m_FlowInputAnchors.RemoveAt(m_FlowInputAnchors.Count - 1); } } if (this.model.outputType != VFXDataType.None) { for (int slot = m_FlowOutputAnchors.Count; slot < this.model.outputFlowSlot.Length; ++slot) { var outAnchor = new VFXFlowOutputAnchorController(); outAnchor.Init(this, slot); m_FlowOutputAnchors.Add(outAnchor); viewController.RegisterFlowAnchorController(outAnchor); } while (this.model.outputFlowSlot.Length < m_FlowOutputAnchors.Count) { var removedAnchor = m_FlowOutputAnchors[m_FlowOutputAnchors.Count - 1]; removedAnchor.OnDisable(); viewController.UnregisterFlowAnchorController(removedAnchor); m_FlowOutputAnchors.RemoveAt(m_FlowOutputAnchors.Count - 1); } } }