public override void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { base.HierarchyChanged(element, changeType); UpdateNewSelectorFieldEnabledStateFromDocument(); UpdateSubtitleFromActiveUSS(); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { if (changeType.HasFlag(BuilderHierarchyChangeType.FullRefresh)) { RefreshPreviewIfVisible(); } }
public void NotifyOfHierarchyChange( IBuilderSelectionNotifier source = null, VisualElement element = null, BuilderHierarchyChangeType changeType = BuilderHierarchyChangeType.All) { if (m_Notifiers == null || m_Notifiers.Count == 0) { return; } VisualElementAsset vea = element?.GetVisualElementAsset(); if (vea != null && vea.ruleIndex >= 0 && changeType.HasFlag(BuilderHierarchyChangeType.InlineStyle)) { var vta = m_PaneWindow.document.visualTreeAsset; var rule = vta.GetOrCreateInlineStyleRule(vea); #if UNITY_2020_1_OR_NEWER element.SetInlineRule(vta.inlineSheet, rule); // Need to enforce this specific style is updated. element.IncrementVersion(VersionChangeType.Opacity | VersionChangeType.Overflow); #elif UNITY_2019_3_OR_NEWER var stylesData = new UnityEngine.UIElements.StyleSheets.VisualElementStylesData(false); element.m_Style = stylesData; s_StylePropertyReader.SetInlineContext(vta.inlineSheet, rule, vea.ruleIndex); stylesData.ApplyProperties(s_StylePropertyReader, null); // Need to enforce this specific style is updated. element.IncrementVersion(VersionChangeType.Opacity | VersionChangeType.Overflow); #else var stylesData = new UnityEngine.UIElements.StyleSheets.VisualElementStylesData(false); element.m_Style = stylesData; var propIds = UnityEngine.UIElements.StyleSheets.StyleSheetCache.GetPropertyIDs(vta.inlineSheet, vea.ruleIndex); element.specifiedStyle.ApplyRule(vta.inlineSheet, Int32.MaxValue, rule, propIds); // Need to enforce this specific style is updated. element.IncrementVersion(VersionChangeType.Overflow); #endif } if (m_DocumentElement != null) { m_PaneWindow.document.RefreshStyle(m_DocumentElement); } // This is so anyone interested can refresh their use of this UXML with // the latest (unsaved to disk) changes. EditorUtility.SetDirty(m_PaneWindow.document.visualTreeAsset); foreach (var notifier in m_Notifiers) { if (notifier != source) { notifier.HierarchyChanged(element, changeType); } } }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { if (element == null || changeType.HasFlag(BuilderHierarchyChangeType.ChildrenAdded) || changeType.HasFlag(BuilderHierarchyChangeType.ChildrenRemoved) || changeType.HasFlag(BuilderHierarchyChangeType.Name) || changeType.HasFlag(BuilderHierarchyChangeType.ClassList)) { UpdateHierarchyAndSelection(); } }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { if (element == null || changeType.HasFlag(BuilderHierarchyChangeType.ChildrenAdded) || changeType.HasFlag(BuilderHierarchyChangeType.ChildrenRemoved) || changeType.HasFlag(BuilderHierarchyChangeType.Name) || changeType.HasFlag(BuilderHierarchyChangeType.ClassList)) { UpdateHierarchyAndSelection(m_Selection.hasUnsavedChanges); m_ShouldRebuildHierarchyOnStyleChange = !m_Selection.hasUnsavedChanges; } }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { hasUnsavedChanges = true; if (element != null) // Add StyleSheet to this element's root element. { AddStyleSheetToRootIfNeeded(element); } else // Add StyleSheet to all root elements since one might match this new selector. { AddStyleSheetToAllRootElements(); } }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { if (m_Target == null) { return; } if (!changeType.HasFlag(BuilderHierarchyChangeType.InlineStyle)) { return; } SetStylesFromTargetStyles(); ResizeSelfFromTarget(m_Target.layout); }
public void NotifyOfHierarchyChange( IBuilderSelectionNotifier source = null, VisualElement element = null, BuilderHierarchyChangeType changeType = BuilderHierarchyChangeType.All) { if (m_Notifiers == null || m_Notifiers.Count == 0) { return; } VisualElementAsset vea = element?.GetVisualElementAsset(); if (vea != null && vea.ruleIndex >= 0 && changeType.HasFlag(BuilderHierarchyChangeType.InlineStyle)) { var vta = m_PaneWindow.document.visualTreeAsset; var rule = vta.GetOrCreateInlineStyleRule(vea); element.UpdateInlineRule(vta.inlineSheet, rule); // Need to enforce this specific style is updated. element.IncrementVersion(VersionChangeType.Opacity | VersionChangeType.Overflow); } if (m_DocumentRootElement != null) { m_PaneWindow.document.RefreshStyle(m_DocumentRootElement); } // This is so anyone interested can refresh their use of this UXML with // the latest (unsaved to disk) changes. EditorUtility.SetDirty(m_PaneWindow.document.visualTreeAsset); m_LiveReloadTriggerMethod?.Invoke(null, null); foreach (var notifier in m_Notifiers) { if (notifier != source) { notifier.HierarchyChanged(element, changeType); } } }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { m_BuilderSelectionIndicator.OnHierarchyChanged(element); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { m_AttributesSection.Refresh(); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { RefreshUSS(); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { SetToolbarBreadCrumbs(); SetCanvasTitle(); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { SetToolbarBreadCrumbs(); UpdateHasUnsavedChanges(); }
public void HierarchyChanged(VisualElement element, BuilderHierarchyChangeType changeType) { SetViewportSubTitle(); }