Пример #1
0
        private void DrawTree()
        {
            if (this.targetType == null)
            {
                this.tree = null;
                return;
            }

            if (Event.current.type == EventType.Layout)
            {
                this.currMemberTypes     = this.memberTypes;
                this.currAccessModifiers = this.accessModifiers;
            }

            if (this.tree == null || this.tree.TargetType != this.targetType)
            {
                if (this.targetType.IsGenericType && !this.targetType.IsFullyConstructedGenericType())
                {
                    SirenixEditorGUI.ErrorMessageBox("Cannot statically inspect generic type definitions");
                    return;
                }

                this.tree = PropertyTree.CreateStatic(this.targetType);
            }

            var allowObsoleteMembers        = (this.currMemberTypes & MemberTypeFlags.Obsolete) == MemberTypeFlags.Obsolete;
            var allowObsoleteMembersContext = this.tree.SecretRootProperty.Context.GetGlobal("ALLOW_OBSOLETE_STATIC_MEMBERS", false);

            if (allowObsoleteMembersContext.Value != allowObsoleteMembers)
            {
                allowObsoleteMembersContext.Value = allowObsoleteMembers;
                this.tree.SecretRootProperty.RefreshSetup();
            }

            InspectorUtilities.BeginDrawPropertyTree(tree, false);

            foreach (var prop in tree.EnumerateTree(false))
            {
                if (this.DrawProperty(prop))
                {
                    if (prop.Info.PropertyType != PropertyType.Group && prop.Info.GetMemberInfo() != null && prop.Info.GetMemberInfo().DeclaringType != this.targetType)
                    {
                        prop.Draw(new GUIContent(prop.Info.GetMemberInfo().DeclaringType.GetNiceName() + " -> " + prop.NiceName));
                    }
                    else
                    {
                        prop.Draw();
                    }
                }
                else
                {
                    prop.Update();
                }
            }

            InspectorUtilities.EndDrawPropertyTree(tree);
        }