static void DrawLabel(QlistMarker point, MarkerUIStates uiState, MarkerOverlayRegion region)
        {
            if (string.IsNullOrEmpty(point.stateName))
            {
                return;
            }

            var colorScale = uiState.HasFlag(MarkerUIStates.Selected) ? 1.0f : 0.85f;

            var textStyle = EditorStyles.whiteMiniLabel;

            s_Temp.text = point.stateName;

            var labelRect = region.markerRegion;

            labelRect.width = textStyle.CalcSize(s_Temp).x + 5;
            labelRect.x    -= labelRect.width; // bring it to the left
            var shadowRect = Rect.MinMaxRect(labelRect.xMin + 1, labelRect.yMin + 1, labelRect.xMax + 1, labelRect.yMax + 1);

            var oldColor = GUI.color;

            // GUI.color = Color.white * colorScale;
            // GUI.Label(shadowRect, s_Temp, textStyle);
            GUI.color = Color.black;
            GUI.Label(labelRect, s_Temp, textStyle);
            GUI.color = oldColor;
        }
        public override void DrawOverlay(IMarker marker, MarkerUIStates uiState, MarkerOverlayRegion region)
        {
            var snapPoint = (QlistMarker)marker;

            // DrawSnapLine(snapPoint, uiState, region);
            DrawLabel(snapPoint, uiState, region);
        }
        // Draws a vertical line on top of the Timeline window's contents.
        public override void DrawOverlay(IMarker marker, MarkerUIStates uiState, MarkerOverlayRegion region)
        {
            // The `marker argument needs to be cast as the appropriate type, usually the one specified in the `CustomTimelineEditor` attribute
            AnnotationMarker annotation = marker as AnnotationMarker;

            if (annotation == null)
            {
                return;
            }

            if (annotation.showLineOverlay)
            {
                DrawLineOverlay(annotation.color, region);
            }

            DrawColorOverlay(region, annotation.color, uiState);
        }
//----------------------------------------------------------------------------------------------------------------------    
    public override void DrawOverlay(IMarker m, MarkerUIStates uiState, MarkerOverlayRegion region)
    {
        FrameMarker marker = m as FrameMarker;
        if (null == marker)
            return;

        SISPlayableFrame playableFrame = marker.GetOwner();
        
        //Check invalid PlayableFrame/ClipData. Perhaps because of unsupported Duplicate operation ?
        PlayableFrameClipData clipData = playableFrame?.GetOwner();
        if (clipData == null)
            return;
        
        PlayableFramePropertyID inspectedPropertyID = clipData.GetInspectedProperty();
        switch (inspectedPropertyID) {
            case PlayableFramePropertyID.USED: {
                
                if (playableFrame.IsLocked()) {
                    //At the moment, all locked frames are regarded as inactive 
                    if (playableFrame.IsUsed()) {
                        Graphics.DrawTexture(region.markerRegion, EditorTextures.GetInactiveCheckedTexture());
                    }
                    Rect lockRegion = region.markerRegion;
                    lockRegion.x -= 5;
                    lockRegion.y -= 8;
                    Graphics.DrawTexture(lockRegion, EditorTextures.GetLockTexture());                    
                } else {
                    if (playableFrame.IsUsed()) {
                        Graphics.DrawTexture(region.markerRegion, EditorTextures.GetCheckedTexture());
                    }
                    
                }
                break;
            }
            case PlayableFramePropertyID.LOCKED: {
                if (playableFrame.IsLocked()) {
                    Graphics.DrawTexture(region.markerRegion, EditorTextures.GetLockTexture());                    
                }
                break;
            }
            
        }
        
    }
//----------------------------------------------------------------------------------------------------------------------    
    public override void DrawOverlay(IMarker m, MarkerUIStates uiState, MarkerOverlayRegion region)
    {
        FrameMarker marker = m as FrameMarker;
        if (null == marker)
            return;


        SISPlayableFrame playableFrame = marker.GetOwner();
        TimelineClipSISData timelineClipSISData = playableFrame.GetOwner();
        PlayableFramePropertyID inspectedPropertyID = timelineClipSISData.GetInspectedProperty();
        switch (inspectedPropertyID) {
            case PlayableFramePropertyID.USED: {
                
                if (playableFrame.IsLocked()) {
                    //At the moment, all locked frames are regarded as inactive 
                    if (playableFrame.IsUsed()) {
                        Graphics.DrawTexture(region.markerRegion, EditorTextures.GetInactiveCheckedTexture());
                    }
                    Rect lockRegion = region.markerRegion;
                    lockRegion.x -= 5;
                    lockRegion.y -= 8;
                    Graphics.DrawTexture(lockRegion, EditorTextures.GetLockTexture());                    
                } else {
                    if (playableFrame.IsUsed()) {
                        Graphics.DrawTexture(region.markerRegion, EditorTextures.GetCheckedTexture());
                    }
                    
                }
                break;
            }
            case PlayableFramePropertyID.LOCKED: {
                if (playableFrame.IsLocked()) {
                    Graphics.DrawTexture(region.markerRegion, EditorTextures.GetLockTexture());                    
                }
                break;
            }
            
        }
        
    }
        static void DrawColorOverlay(MarkerOverlayRegion region, Color color, MarkerUIStates state)
        {
            // Save the Editor's overlay color before changing it
            Color oldColor = GUI.color;

            GUI.color = color;

            if (state.HasFlag(MarkerUIStates.Selected))
            {
                GUI.DrawTexture(region.markerRegion, s_OverlaySelectedTexture);
            }
            else if (state.HasFlag(MarkerUIStates.Collapsed))
            {
                GUI.DrawTexture(region.markerRegion, s_OverlayCollapsedTexture);
            }
            else if (state.HasFlag(MarkerUIStates.None))
            {
                GUI.DrawTexture(region.markerRegion, s_OverlayTexture);
            }

            // Restore the previous Editor's overlay color
            GUI.color = oldColor;
        }
Beispiel #7
0
 /// <summary>
 /// Draws additional overlays for a marker.
 /// </summary>
 /// <param name="marker">The marker to draw.</param>
 /// <param name="uiState">The visual state of the marker.</param>
 /// <param name="region">The on-screen area where the marker is being drawn.</param>
 /// <remarks>
 /// Notes:
 /// * It is only called during TimelineWindow's Repaint step.
 /// * If there are multiple markers on top of each other, only the topmost marker receives the DrawOverlay call.
 /// </remarks>
 public virtual void DrawOverlay(IMarker marker, MarkerUIStates uiState, MarkerOverlayRegion region)
 {
 }