Ejemplo n.º 1
0
 public static void Register(ViewDescriptor descriptor)
 {
     if (!s_AnalysisViewDescriptors.ContainsKey((int)descriptor.category))
     {
         s_AnalysisViewDescriptors.Add((int)descriptor.category, descriptor);
     }
 }
Ejemplo n.º 2
0
        public virtual void Create(ViewDescriptor descriptor, IssueLayout layout, ProjectAuditorConfig config, Preferences prefs, IProjectIssueFilter filter)
        {
            m_Desc        = descriptor;
            m_Config      = config;
            m_Preferences = prefs;
            m_Filter      = filter;
            m_Layout      = layout;

            if (m_Table != null)
            {
                return;
            }

            var state   = new TreeViewState();
            var columns = new MultiColumnHeaderState.Column[layout.properties.Length];

            for (var i = 0; i < layout.properties.Length; i++)
            {
                var property = layout.properties[i];

                var width = 80;
                switch (property.type)
                {
                case PropertyType.Description:
                    width = 300;
                    break;

                case PropertyType.Path:
                    width = 500;
                    break;

                case PropertyType.Severity:
                    width = 24;
                    break;
                }

                columns[i] = new MultiColumnHeaderState.Column
                {
                    headerContent = new GUIContent(property.name, layout.properties[i].longName),
                    width         = width,
                    minWidth      = 20,
                    autoResize    = true
                };
            }

            m_Table = new IssueTable(state,
                                     new MultiColumnHeader(new MultiColumnHeaderState(columns)),
                                     m_Desc,
                                     layout,
                                     m_Config,
                                     m_Filter);

            if (m_Desc.showDependencyView)
            {
                m_DependencyView = new DependencyView(new TreeViewState(), m_Desc.onDoubleClick);
            }

            SetFlatView(m_FlatView);
        }
Ejemplo n.º 3
0
 public IssueTable(TreeViewState state, MultiColumnHeader multicolumnHeader,
                   ViewDescriptor desc, IssueLayout layout, ProjectAuditorConfig config,
                   IProjectIssueFilter filter) : base(state,
                                                      multicolumnHeader)
 {
     m_Config   = config;
     m_Filter   = filter;
     m_Desc     = desc;
     m_Layout   = layout;
     m_FlatView = !desc.groupByDescriptor;
     m_NextId   = k_FirstId;
     m_FontSize = Preferences.k_MinFontSize;
     multicolumnHeader.sortingChanged += OnSortingChanged;
 }
Ejemplo n.º 4
0
 public override void Create(ViewDescriptor desc, IssueLayout layout, ProjectAuditorConfig config, Preferences prefs, IProjectIssueFilter filter)
 {
     m_MainFilter = filter;
     base.Create(desc, layout, config, prefs, this);
 }
Ejemplo n.º 5
0
 public virtual void Create(ViewDescriptor desc, IssueLayout layout, ProjectAuditorConfig config, Preferences prefs, IProjectIssueFilter filter)
 {
     m_AnalysisView.Create(desc, layout, config, prefs, filter);
 }
Ejemplo n.º 6
0
 static void OnLoad()
 {
     ViewDescriptor.Register(new ViewDescriptor
     {
         category       = IssueCategory.MetaData,
         name           = "Summary",
         menuOrder      = -1,
         showActions    = false,
         showFilters    = false,
         showInfoPanel  = true,
         viewType       = typeof(SummaryView),
         analyticsEvent = (int)ProjectAuditorAnalytics.UIButton.Summary
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         category                 = IssueCategory.Assets,
         name                     = "Assets",
         menuLabel                = "Assets/Resources",
         menuOrder                = 1,
         groupByDescriptor        = false,
         descriptionWithIcon      = true,
         showActions              = false,
         showAreaSelection        = false,
         showAssemblySelection    = false,
         showCritical             = false,
         showDependencyView       = true,
         showFilters              = true,
         showMuteOptions          = false,
         showRightPanels          = true,
         dependencyViewGuiContent = new GUIContent("Asset Dependencies"),
         onDoubleClick            = EditorUtil.FocusOnAssetInProjectWindow,
         analyticsEvent           = (int)ProjectAuditorAnalytics.UIButton.Assets
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         category                 = IssueCategory.Shaders,
         name                     = "Shaders",
         menuOrder                = 2,
         menuLabel                = "Assets/Shaders",
         groupByDescriptor        = false,
         descriptionWithIcon      = true,
         showActions              = false,
         showAreaSelection        = false,
         showAssemblySelection    = false,
         showCritical             = false,
         showFilters              = true,
         showMuteOptions          = false,
         showDependencyView       = false,
         showRightPanels          = false,
         onDoubleClick            = EditorUtil.FocusOnAssetInProjectWindow,
         onDrawToolbarDataOptions = () =>
         {
             if (GUILayout.Button(Contents.ShaderVariantsButton, EditorStyles.toolbarButton,
                                  GUILayout.Width(80)))
             {
                 Instance.SelectView(IssueCategory.ShaderVariants);
             }
         },
         analyticsEvent = (int)ProjectAuditorAnalytics.UIButton.Shaders
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         viewType                 = typeof(ShaderVariantsView),
         category                 = IssueCategory.ShaderVariants,
         name                     = "Variants",
         menuOrder                = 3,
         menuLabel                = "Assets/Shader Variants",
         groupByDescriptor        = true,
         descriptionWithIcon      = false,
         showAssemblySelection    = false,
         showCritical             = false,
         showFilters              = true,
         showDependencyView       = false,
         showInfoPanel            = true,
         showMuteOptions          = false,
         showRightPanels          = false,
         onDoubleClick            = EditorUtil.FocusOnAssetInProjectWindow,
         onDrawToolbarDataOptions = () =>
         {
             if (GUILayout.Button(Contents.Shaders, EditorStyles.toolbarButton,
                                  GUILayout.Width(80)))
             {
                 Instance.SelectView(IssueCategory.Shaders);
             }
         },
         analyticsEvent = (int)ProjectAuditorAnalytics.UIButton.Shaders
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         viewType                 = typeof(CodeView),
         category                 = IssueCategory.Code,
         name                     = "Code",
         menuLabel                = "Code/Diagnostics",
         menuOrder                = 0,
         groupByDescriptor        = true,
         descriptionWithIcon      = false,
         showActions              = true,
         showAreaSelection        = true,
         showAssemblySelection    = true,
         showCritical             = true,
         showDependencyView       = true,
         showFilters              = true,
         showInfoPanel            = true,
         showMuteOptions          = true,
         showRightPanels          = true,
         dependencyViewGuiContent = new GUIContent("Inverted Call Hierarchy"),
         onDoubleClick            = EditorUtil.OpenTextFile,
         onOpenDescriptor         = EditorUtil.OpenCodeDescriptor,
         analyticsEvent           = (int)ProjectAuditorAnalytics.UIButton.ApiCalls
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         viewType            = typeof(CompilerMessagesView),
         category            = IssueCategory.CodeCompilerMessages,
         name                = "C# Messages",
         menuOrder           = 98,
         menuLabel           = "Code/C# Compiler Messages",
         groupByDescriptor   = true,
         descriptionWithIcon = false,
         showActions         = false,
         showAreaSelection   = false,
         showCritical        = false,
         showDependencyView  = false,
         showFilters         = true,
         showInfoPanel       = true,
         showMuteOptions     = false,
         showRightPanels     = false,
         onDoubleClick       = EditorUtil.OpenTextFile,
         onOpenDescriptor    = EditorUtil.OpenCompilerMessageDescriptor,
         analyticsEvent      = (int)ProjectAuditorAnalytics.UIButton.CodeCompilerMessages
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         category                 = IssueCategory.Generics,
         name                     = "Generics",
         menuLabel                = "Code/Generic Types Instantiation",
         menuOrder                = 99,
         groupByDescriptor        = true,
         descriptionWithIcon      = false,
         showActions              = false,
         showAreaSelection        = false,
         showAssemblySelection    = true,
         showCritical             = false,
         showDependencyView       = true,
         showFilters              = true,
         showMuteOptions          = false,
         showRightPanels          = false,
         dependencyViewGuiContent = new GUIContent("Inverted Call Hierarchy"),
         onDoubleClick            = EditorUtil.OpenTextFile,
         analyticsEvent           = (int)ProjectAuditorAnalytics.UIButton.Generics
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         category              = IssueCategory.ProjectSettings,
         name                  = "Settings",
         menuLabel             = "Settings/Diagnostics",
         menuOrder             = 1,
         groupByDescriptor     = false,
         descriptionWithIcon   = false,
         showActions           = true,
         showAreaSelection     = true,
         showAssemblySelection = false,
         showCritical          = false,
         showFilters           = true,
         showMuteOptions       = true,
         showDependencyView    = false,
         showRightPanels       = true,
         onDoubleClick         = EditorUtil.OpenProjectSettings,
         analyticsEvent        = (int)ProjectAuditorAnalytics.UIButton.ProjectSettings
     });
     ViewDescriptor.Register(new ViewDescriptor
     {
         viewType              = typeof(BuildReportView),
         category              = IssueCategory.BuildFiles,
         name                  = "Build",
         menuLabel             = "Build Report",
         menuOrder             = 98,
         groupByDescriptor     = false,
         descriptionWithIcon   = true,
         showActions           = false,
         showAssemblySelection = false,
         showCritical          = false,
         showDependencyView    = false,
         showFilters           = true,
         showInfoPanel         = true,
         showRightPanels       = false,
         onDoubleClick         = EditorUtil.FocusOnAssetInProjectWindow,
         analyticsEvent        = (int)ProjectAuditorAnalytics.UIButton.BuildFiles
     });
 }
Ejemplo n.º 7
0
        void OnEnable()
        {
            var currentState = m_AnalysisState;

            m_AnalysisState = AnalysisState.Initializing;

            ProjectAuditorAnalytics.EnableAnalytics();

            m_ProjectAuditor = new ProjectAuditor();

            UpdateAreaSelection();
            UpdateAssemblySelection();

            if (m_TextFilter == null)
            {
                m_TextFilter = new TextFilter();
            }

            var viewDescriptors = ViewDescriptor.GetAll();

            Array.Sort(viewDescriptors, (a, b) => a.menuOrder.CompareTo(b.menuOrder));

            m_ViewDropdownItems = new Utility.DropdownItem[viewDescriptors.Length];
            m_Views             = new AnalysisView[viewDescriptors.Length];
            for (int i = 0; i < viewDescriptors.Length; i++)
            {
                var desc        = viewDescriptors[i];
                var layout      = m_ProjectAuditor.GetLayout(desc.category);
                var isSupported = layout != null;

                m_ViewDropdownItems[i] = new Utility.DropdownItem
                {
                    Content          = new GUIContent(string.IsNullOrEmpty(desc.menuLabel) ? desc.name : desc.menuLabel),
                    SelectionContent = new GUIContent("View: " + desc.name),
                    Enabled          = isSupported
                };

                if (!isSupported)
                {
                    Debug.Log("Project Auditor module " + desc.category + " is not supported.");
                    continue;
                }

                var view = desc.viewType != null ? (AnalysisView)Activator.CreateInstance(desc.viewType) : new AnalysisView();
                view.Create(desc, layout, m_ProjectAuditor.config, m_Preferences, this);

                if (currentState == AnalysisState.Valid)
                {
                    view.AddIssues(m_ProjectReport.GetIssues(desc.category));
                }

                m_Views[i] = view;
            }

            if (currentState != AnalysisState.Valid)
            {
                m_ProjectReport = new ProjectReport();
            }

            AnalysisView.SetReport(m_ProjectReport);
            AnalysisView.OnChangeView = SelectView;

            GetView <ShaderVariantsView>().SetShadersAuditor(m_ProjectAuditor.GetAuditor <ShadersAuditor>());

            // are we reloading from a valid state?
            if (currentState == AnalysisState.Valid && m_ActiveViewIndex < viewDescriptors.Length)
            {
                m_AnalysisState = currentState;
            }
            else
            {
                m_AnalysisState = AnalysisState.Initialized;
            }

            RefreshDisplay();

            Instance = this;
        }