/* ONLY NEEDED BY STYLING DEVS AND DESIGNERS. * [MenuItem("Theme/Refresh Styles &r", priority = 420)] * internal static void RefreshStyles() * { * Unsupported.ClearSkinCache(); * EditorUtility.RequestScriptReload(); * InternalEditorUtility.RepaintAllViews(); * Debug.Log($"Style refreshed {DateTime.Now}"); * } * * [MenuItem("Theme/Switch Theme And Repaint", priority = 420)] * internal static void SwitchTheme() * { * AssetPreview.ClearTemporaryAssetPreviews(); * InternalEditorUtility.SwitchSkinAndRepaintAllViews(); * }*/ private static void UpdateGUIStyleProperties(string name, GUIStyle style) { var sname = GUIStyleExtensions.StyleNameToBlockName(style.name, false); var block = styleCatalog.GetStyle(sname); if (!block.IsValid()) { return; } try { GUIStyleExtensions.PopulateStyle(styleCatalog, style, sname); // The new style extension do not support state backgrounds anymore. // Any background images needs to be defined in the uss data files. ResetDeprecatedBackgroundImage(style.normal); ResetDeprecatedBackgroundImage(style.hover); ResetDeprecatedBackgroundImage(style.active); ResetDeprecatedBackgroundImage(style.focused); ResetDeprecatedBackgroundImage(style.onNormal); ResetDeprecatedBackgroundImage(style.onHover); ResetDeprecatedBackgroundImage(style.onActive); ResetDeprecatedBackgroundImage(style.onFocused); } catch (Exception ex) { Debug.LogWarning($"Failed to parse extended style properties for {sname}\n{ex.Message}"); } }
public static Texture2D GetBackgroundImage(GUIStyle style, StyleState state = StyleState.normal) { var blockName = GUIStyleExtensions.StyleNameToBlockName(style.name, false); var styleBlock = EditorResources.GetStyle(blockName, state); return(styleBlock.GetTexture(StyleCatalogKeyword.backgroundImage)); }
// Methods public override void Init() { if (DeGUI.styles.toolbar.flat == null) { DeGUI.styles.toolbar.Init(); } this.stickyToolbar = new GUIStyle(DeGUI.styles.toolbar.flat); object[] objArray1 = new object[] { FontStyle.Bold, 11 }; this.stickyTitle = GUIStyleExtensions.ContentOffsetX(GUIStyleExtensions.MarginBottom(GUIStyleExtensions.Clone(new GUIStyle(GUI.skin.label), objArray1), 0), -2f); }
public override void Init() { this.stickyToolbar = new GUIStyle(DeGUI.styles.toolbar.flat); this.stickyTitle = GUIStyleExtensions.ContentOffsetX(GUIStyleExtensions.MarginBottom(GUIStyleExtensions.Clone(new GUIStyle(GUI.skin.label), new object[] { FontStyle.Bold, 11 }), 0), -2f); this.warningLabel = GUIStyleExtensions.Background(GUIStyleExtensions.Add(new GUIStyle(GUI.skin.label), new object[] { Color.black, 0 }), DeStylePalette.orangeSquare, null); }
public static GUIStyle FromUSS(GUIStyle baseStyle, string ussStyleRuleName, string ussInPlaceStyleOverride = null) { return(GUIStyleExtensions.FromUSS(baseStyle, ussStyleRuleName, ussInPlaceStyleOverride)); }