public void StylingChanged(List <string> styles) { if (styles != null) { foreach (var styleName in styles) { var fieldList = m_StyleFields.GetFieldListForStyleName(styleName); if (fieldList == null) { continue; } foreach (var field in fieldList) { m_StyleFields.RefreshStyleField(styleName, field); } } m_LocalStylesSection.UpdateStyleCategoryFoldoutOverrides(); } else { RefreshUI(); } }
public void StylingChanged(List <string> styles, BuilderStylingChangeType changeType = BuilderStylingChangeType.Default) { if (styles != null) { foreach (var styleName in styles) { var fieldList = m_StyleFields.GetFieldListForStyleName(styleName); if (fieldList == null) { continue; } // Transitions are composed of dynamic elements which can add/remove themselves in the fieldList // when the style is refreshed, so we take a copy of the list to ensure we do not iterate and // mutate the list at the same time. var tempFieldList = ListPool <VisualElement> .Get(); try { tempFieldList.AddRange(fieldList); foreach (var field in tempFieldList) { m_StyleFields.RefreshStyleField(styleName, field); } } finally { ListPool <VisualElement> .Release(tempFieldList); } } m_LocalStylesSection.UpdateStyleCategoryFoldoutOverrides(); } else { RefreshUI(); } }