private IEnumerable <IValueEntity> EnumerateMembersWithBaseNode(IObjectValueRole <TValue> valueRole, IPresentationOptions options, CancellationToken token, IValueServicesFacade <TValue> valueServices) { var baseRole = FindNextBaseRoleWithVisibleMembers(valueRole); if (baseRole != null) { yield return(new ConcreteObjectRoleReference <TValue>(baseRole, "base", false, ValueOriginKind.Base, ValueFlags.None).ToValue(valueServices)); } var propertiesAndFields = GetPropertiesAndFields(valueRole) .Where(IsAllowedReference) .OrderBy(IdentityFunc <IValueReference <TValue> > .Instance, ByNameReferenceComparer <TValue> .Instance); foreach (var member in ChildrenRenderingUtil.RenderReferencesWithVisibilityGroups(propertiesAndFields, options, token, valueServices)) { yield return(member); } foreach (var staticMember in ChildrenRenderingUtil.EnumerateStaticMembersIfNeeded(valueRole, options, token, valueServices)) { yield return(staticMember); } }
protected IEnumerable <IValueEntity> RenderChildren(IObjectValueRole <TValue> valueRole, IEnumerable <IValueReference <TValue> > references, IPresentationOptions options, CancellationToken token) { if (!options.FlattenHierarchy) { // Add when rendering to avoid sorting issues var baseRole = FindNextBaseRoleWithVisibleMembers(valueRole); if (baseRole != null) { yield return(new ConcreteObjectRoleReference <TValue>(baseRole, "base", false, ValueOriginKind.Base, ValueFlags.None).ToValue(ValueServices)); } } foreach (var memberValue in ChildrenRenderingUtil.RenderReferencesWithVisibilityGroups(references, options, token, ValueServices)) { yield return(memberValue); } foreach (var staticMember in ChildrenRenderingUtil.EnumerateStaticMembersIfNeeded(valueRole, options, token, ValueServices)) { yield return(staticMember); } }
protected IEnumerable <IValueReference <TValue> > EnumerateChildren([NotNull] IObjectValueRole <TValue> valueRole, IPresentationOptions options, CancellationToken token) { // This is essentially the same as ChildrenRenderingUtil.EnumerateMembersFlat and EnumerateMembersWithBaseNode // but allows us to split enumerating, sorting, and rendering into separate steps so we can also insert // filtering. return(options.FlattenHierarchy ? ChildrenRenderingUtil.CollectMembersByOverridingRules(valueRole, options, token) : GetPropertiesAndFields(valueRole)); }
private IEnumerable <IValueEntity> EnumerateMembersFlat(IObjectValueRole <TValue> valueRole, IPresentationOptions options, CancellationToken token, IValueServicesFacade <TValue> valueServices) { var sortedReferences = ChildrenRenderingUtil.CollectMembersByOverridingRules(valueRole, token) .Where(IsAllowedReference) .OrderBy(IdentityFunc <IValueReference <TValue> > .Instance, ByNameReferenceComparer <TValue> .Instance); foreach (var memberValue in ChildrenRenderingUtil.RenderReferencesWithVisibilityGroups(sortedReferences, options, token, valueServices)) { yield return(memberValue); } foreach (var staticMember in ChildrenRenderingUtil.EnumerateStaticMembersIfNeeded(valueRole, options, token, valueServices)) { yield return(staticMember); } }
private IEnumerable <IValueReference <TValue> > FilterChildren(IEnumerable <IValueReference <TValue> > references, ISet <string> propertySpecificFields, bool isArray, bool isFixedBuffer) { return(references.Where(r => { // Include all fields for the current property type if (propertySpecificFields.Contains(r.DefaultName)) { return true; } // Ignore non-public fields. Look at the Raw View if you need more details if (!(ChildrenRenderingUtil.GetVisibilityOwner(r)?.IsPublic ?? true)) { return false; } // Show the array or fixed buffer fields if applicable if (isArray && myPerTypeFieldNames[SerializedPropertyKind.ArrayModifier].Contains(r.DefaultName)) { return true; } if (isFixedBuffer && myPerTypeFieldNames[SerializedPropertyKind.FixedBufferModifier].Contains(r.DefaultName)) { return true; } // Exclude property specific fields for other property types if (myKnownFieldNames.Contains(r.DefaultName)) { return false; } // Exclude children flags. We'll show a "Children" group if hasChildren is true. Non-visible children // seems to be fields marked with [HiddenInInspector] return r.DefaultName != "hasChildren" && r.DefaultName != "hasVisibleChildren"; })); }