internal static void BuildCatalog()
        {
            styleCatalog = new StyleCatalog();
            var paths = GetDefaultStyleCatalogPaths();

            foreach (var editorUssPath in AssetDatabase.FindAssets("t:StyleSheet").Select(AssetDatabase.GUIDToAssetPath).Where(IsEditorStyleSheet))
            {
                paths.Add(editorUssPath);
            }

            styleCatalog.Load(paths);
            if (CanEnableExtendedStyles())
            {
                // Update gui skin style layouts
                var skin = GUIUtility.GetDefaultSkin();
                if (skin != null)
                {
                    // TODO: Emit OnStyleCatalogLoaded
                    if (Path.GetFileName(Path.GetDirectoryName(Application.dataPath)) == "editor_resources")
                    {
                        ConverterUtils.ResetSkinToPristine(skin, EditorGUIUtility.isProSkin ? SkinTarget.Dark : SkinTarget.Light);
                    }
                    UpdateGUIStyleProperties(skin);
                }
            }
        }
示例#2
0
        internal static void RefreshSkin()
        {
            using (new EditorPerformanceTracker(nameof(RefreshSkin)))
            {
                if (!CanEnableExtendedStyles())
                {
                    return;
                }

                GUIStyle.onDraw = StylePainter.DrawStyle;

                // Update gui skin style layouts
                var skin = GUIUtility.GetDefaultSkin();
                if (skin != null)
                {
                    // TODO: Emit OnStyleCatalogLoaded
                    if (Path.GetFileName(Path.GetDirectoryName(Application.dataPath)) == "editor_resources")
                    {
                        ConverterUtils.ResetSkinToPristine(skin, EditorGUIUtility.isProSkin ? SkinTarget.Dark : SkinTarget.Light);
                    }
                    skin.font = GetFont(FontDef.Style.Normal);
                    UpdateGUIStyleProperties(skin);
                }
            }
        }
        internal static void BuildCatalog()
        {
            styleCatalog = new StyleCatalog();
            var paths = GetDefaultStyleCatalogPaths();

            foreach (var editorUssPath in AssetDatabase.GetAllAssetPaths().Where(IsEditorStyleSheet))
            {
                paths.Add(editorUssPath);
            }

            styleCatalog.Load(paths);
            if (CanEnableExtendedStyles())
            {
                // Update gui skin style layouts
                var skin = GUIUtility.GetDefaultSkin();
                if (skin != null)
                {
                    ConverterUtils.ResetSkinToPristine(skin, EditorGUIUtility.isProSkin ? SkinTarget.Dark : SkinTarget.Light);
                    UpdateGUIStyleProperties(skin);
                }
            }
        }