public void Setup(string systemName, VFXBoundsRecorder boundsRecorder) { m_BoundsRecorder = boundsRecorder; m_CurrentMode = m_BoundsRecorder.GetSystemBoundsSettingMode(systemName); m_SystemName = systemName; m_SystemNameButton = this.Query <VFXBoundsRecorderField>("system-field"); var initContextUI = m_BoundsRecorder.GetInitContextController(m_SystemName); m_SystemNameButton.Setup(initContextUI, m_BoundsRecorder.view); m_SystemNameButton.text = m_SystemName; m_BoundsMode = this.Query <Button>("bounds-mode"); m_BoundsMode.AddStyleSheetPathWithSkinVariant("VFXControls"); m_BoundsMode.clickable.clicked += OnBoundsModeMenu; m_BoundsMode.text = m_BoundsRecorder.GetSystemBoundsSettingMode(systemName).ToString(); m_Colors = new Dictionary <string, StyleColor>() { { "included", m_SystemNameButton.style.color }, { "excluded", new StyleColor(Color.gray * 0.8f) } }; if (!m_BoundsRecorder.NeedsToBeRecorded(m_SystemName, out VFXBoundsRecorder.ExclusionCause cause)) { m_SystemNameButton.text = $"{m_SystemName} {VFXBoundsRecorder.exclusionCauseString[cause]}"; m_SystemNameButton.tooltip = $"This system will not be taken into account in the recording because {VFXBoundsRecorder.exclusionCauseTooltip[cause]}"; m_SystemNameButton.style.color = m_Colors["excluded"]; m_SystemNameButton.SetEnabled(false); } }
void DeleteBoundsRecorder() { if (m_BoundsRecorder != null) { m_BoundsRecorder.isRecording = false; m_BoundsRecorder = null; } }
void UpdateBoundsRecorder() { if (m_AttachedComponent != null) { controller.RecompileExpressionGraphIfNeeded(); bool wasRecording = false; if (m_BoundsRecorder != null) { wasRecording = m_BoundsRecorder.isRecording; m_BoundsRecorder.CleanUp(); } m_BoundsRecorder = new VFXBoundsRecorder(m_AttachedComponent, m_View); if (wasRecording && !m_View.controller.isReentrant) //If this is called during an Undo/Redo, toggling the recording will cause a reentrant invalidation { m_BoundsRecorder.ToggleRecording(); } var systemNames = m_BoundsRecorder.systemNames; if (m_SystemBoundsContainer != null) { foreach (var elem in m_SystemBoundsContainer.Children()) { if (elem is VFXComponentBoardBoundsSystemUI) { (elem as VFXComponentBoardBoundsSystemUI).ReleaseBoundsRecorder(); } } m_SystemBoundsContainer.Clear(); m_SystemBoundsContainer.AddStyleSheetPath("VFXComponentBoard-bounds-list"); } foreach (var system in systemNames) { var tpl = VFXView.LoadUXML("VFXComponentBoard-bounds-list"); tpl.CloneTree(m_SystemBoundsContainer); VFXComponentBoardBoundsSystemUI newUI = m_SystemBoundsContainer.Children().Last() as VFXComponentBoardBoundsSystemUI; if (newUI != null) { newUI.Setup(system, m_BoundsRecorder); } } } }