コード例 #1
0
        public static GUIStyle UssStyleForType(Type type)
        {
            ClearCacheIfInvalid();

            GUIStyle cachedStyle;

            if (s_CustomStyles.TryGetValue(type, out cachedStyle))
            {
                return(cachedStyle);
            }

            var style = new GUIStyle(DirectorStyles.markerDefaultStyle);

            var customStyleForType = CustomStyleForType(type);

            if (customStyleForType != null)
            {
                if (IsStyleValid(customStyleForType))
                {
                    style = EditorStyles.FromUSS(customStyleForType);
                }
                else
                {
                    Debug.LogWarningFormat(k_ErrorCannotFindStyle, customStyleForType, type.Name);
                }
            }

            s_CustomStyles.Add(type, style);
            return(style);
        }
コード例 #2
0
 public static GUIStyle FromUSS(string ussStyleRuleName, string ussInPlaceStyleOverride = null, GUISkin srcSkin = null)
 {
     return(EditorStyles.FromUSS(ussStyleRuleName));
 }
コード例 #3
0
 public static GUIStyle GetGUIStyle(string s)
 {
     return(EditorStyles.FromUSS(s));
 }
コード例 #4
0
        void LoadStyles()
        {
            endmarker         = GetStyle("Icon.Endmarker");
            handLeft          = GetStyle("MeTransitionHandleLeft");
            handRight         = GetStyle("MeTransitionHandleRight");
            groupBackground   = GetStyle("groupBackground");
            displayBackground = GetStyle("sequenceClip");
            fontClip          = GetStyle("Font.Clip");
            trackHeaderFont   = GetStyle("sequenceTrackHeaderFont");
            groupFont         = GetStyle("sequenceGroupFont");
            timeCursor        = GetStyle("Icon.TimeCursor");
            tinyFont          = GetStyle("tinyFont");
            foldout           = GetStyle("Icon.Foldout");
            mute                  = GetStyle("Icon.Mute");
            locked                = GetStyle("Icon.Locked");
            autoKey               = GetStyle("Icon.AutoKey");
            playTimeRangeStart    = GetStyle("Icon.PlayAreaStart");
            playTimeRangeEnd      = GetStyle("Icon.PlayAreaEnd");
            options               = GetStyle("Icon.Options");
            selectedStyle         = GetStyle("Color.Selected");
            trackSwatchStyle      = GetStyle("Icon.TrackHeaderSwatch");
            connector             = GetStyle("Icon.Connector");
            keyframe              = GetStyle("Icon.Keyframe");
            warning               = GetStyle("Icon.Warning");
            extrapolationHold     = GetStyle("Icon.ExtrapolationHold");
            extrapolationLoop     = GetStyle("Icon.ExtrapolationLoop");
            extrapolationPingPong = GetStyle("Icon.ExtrapolationPingPong");
            extrapolationContinue = GetStyle("Icon.ExtrapolationContinue");
            outlineBorder         = GetStyle("Icon.OutlineBorder");
            timelineClip          = GetStyle("Icon.Clip");
            timelineClipSelected  = GetStyle("Icon.ClipSelected");
            bottomShadow          = GetStyle("Icon.Shadow");
            trackOptions          = GetStyle("Icon.TrackOptions");
            infiniteTrack         = GetStyle("Icon.InfiniteTrack");
            blendMixIn            = GetStyle("Icon.BlendMixIn");
            blendMixOut           = GetStyle("Icon.BlendMixOut");
            blendEaseIn           = GetStyle("Icon.BlendEaseIn");
            blendEaseOut          = GetStyle("Icon.BlendEaseOut");
            clipOut               = GetStyle("Icon.ClipOut");
            clipIn                = GetStyle("Icon.ClipIn");
            curves                = GetStyle("Icon.Curves");
            lockedBG              = GetStyle("Icon.LockedBG");
            activation            = GetStyle("Icon.Activation");
            playrange             = GetStyle("Icon.Playrange");
            lockButton            = GetStyle("IN LockButton");
            avatarMaskOn          = GetStyle("Icon.AvatarMaskOn");
            avatarMaskOff         = GetStyle("Icon.AvatarMaskOff");
            editModesToolbar      = GetStyle("EditModeToolbar");
            collapseMarkers       = "TrackCollapseMarkerButton";
            markerMultiOverlay    = "MarkerMultiOverlay";

            playrangeContent         = new GUIContent(playrange.normal.background);
            playrangeContent.tooltip = "Toggle play range markers.";

            fontClipLoop = new GUIStyle(fontClip)
            {
                fontStyle = FontStyle.Bold
            };

            // temporary until in package uss styles are working
            markerWarning = EditorStyles.FromUSS("MarkerMultiOverlay",
                                                 "height: 13; width: 14; background-image: resource(\"Packages/com.unity.timeline/Editor/StyleSheets/Images/Timeline-Marker-Warning-Overlay.png\");"
                                                 );
        }