protected override void VisitContainer <TContainer>(ref TContainer target) { if (Inspector.TryGetTarget(out TContainer currentTarget) && RuntimeTypeInfoCache <TContainer> .CanBeNull && EqualityComparer <TContainer> .Default.Equals(currentTarget, target)) { return; } Inspector.SetTarget(target); // In the inspector, the size of the content will depend on the size of the children (there is // intentionally no "expand to take all available size"), while in an editor window, you can expand your // content to take the full size of the window. For this window, users can choose between the default // window behaviour and the inspector behaviour. To support this, we will force the root to fully expand. // When a custom inspector is provided, we need to adjust the CustomInspectorElement to also fully expand. if (Inspector.childCount == 1 && Inspector[0] is CustomInspectorElement customInspector && customInspector.IsRootInspector) { customInspector.style.flexGrow = 1; } if (Content.InspectionContext.ApplyInspectorStyling) { StylingUtility.AlignInspectorLabelWidth(Inspector); } Content.Save(); }
void SetNotReadyContent() { // Removing from the hierarchy here for consistency with the SetTarget() above. m_ContentRoot.RemoveFromHierarchy(); m_ContentNotReadyRoot.RemoveFromHierarchy(); m_ContentNotReadyRoot.SetTarget(new ContentNotReady(Provider)); Root.contentContainer.Add(m_ContentNotReadyRoot); }
public override VisualElement Build() { var root = new VisualElement(); root.StretchToParentSize(); Resources.Templates.Explorer.PropertyBagExplorer.Clone(root); var pooled = ListPool <BindingContextElement> .Get(); try { root.Query <BindingContextElement>().ToList(pooled); foreach (var binding in pooled) { binding.AddContext(Target.InspectionContext); } } finally { ListPool <BindingContextElement> .Release(pooled); } var split = root.Q <TwoPaneSplitView>(className: k_Splitter); split.fixedPaneInitialDimension = Target.InspectionContext.SplitPosition; split.schedule.Execute(() => { if (null != split.fixedPane) { Target.InspectionContext.SplitPosition = split.fixedPane.resolvedStyle.width; } }).Every(0); Target.InspectionContext.OnPropertyBagSelected += detail => { m_CurrentPropertyBag.ClearTarget(); m_CurrentPropertyBag.SetTarget(detail); }; m_CurrentPropertyBag = root.Q <InspectorElement>(className: k_Detail); return(root); }