//----------------------------------------------------------------------------------------------------------------------    
    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;
            }
            
        }
        
    }
//----------------------------------------------------------------------------------------------------------------------

        private static string ShowSelectFolderButton(string title, string folderPath, Func <string, string> onValidFolderSelected)
        {
            Texture folderTex     = EditorTextures.GetOrLoadFolderTexture();
            bool    buttonPressed = false;
            float   lineHeight    = EditorGUIUtility.singleLineHeight;

            if (null == folderTex)
            {
                buttonPressed = GUILayout.Button("Select", GUILayout.Width(32), GUILayout.Height(lineHeight));
            }
            else
            {
                buttonPressed = GUILayout.Button(folderTex, GUILayout.Width(32), GUILayout.Height(lineHeight));
            }
            if (buttonPressed)
            {
                string folderSelected = EditorUtility.OpenFolderPanel(title, folderPath, "");
                if (!string.IsNullOrEmpty(folderSelected))
                {
                    string newDirPath = null;
                    if (onValidFolderSelected != null)
                    {
                        newDirPath = onValidFolderSelected(folderSelected);
                    }
                    else
                    {
                        newDirPath = folderSelected;
                    }

                    return(newDirPath);
                }
                else
                {
                    GUIUtility.ExitGUI(); //prevent error when cancel is pressed
                }
            }

            return(folderPath);
        }
//----------------------------------------------------------------------------------------------------------------------


        private void ShowLockFramesGUI(TimelineClip timelineClip, TimelineClipSISData timelineClipSISData)
        {
            TrackAsset track = timelineClip.parentTrack;

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("Lock Frames");

                bool lockMode = GUILayout.Toggle(m_lockMode, EditorTextures.GetLockTexture(), "Button",
                                                 GUILayout.Height(20f), GUILayout.Width(30f));
                if (lockMode != m_lockMode) //lock state changed
                {
                    if (lockMode)
                    {
                        LockSISData(timelineClipSISData);
                    }
                    else
                    {
                        UnlockSISData();
                    }
                }

                GUILayout.FlexibleSpace();
                EditorGUI.BeginDisabledGroup(!m_lockMode);
                if (GUILayout.Button("Lock All", GUILayout.Width(80)))
                {
                    Undo.RegisterCompleteObjectUndo(track, "RenderCachePlayableAsset: Locking all frames");
                    timelineClipSISData.SetAllPlayableFramesProperty(PlayableFramePropertyID.LOCKED, true);
                }
                if (GUILayout.Button("Reset", GUILayout.Width(50)))
                {
                    Undo.RegisterCompleteObjectUndo(track, "RenderCachePlayableAsset: Locking no frame");
                    timelineClipSISData.SetAllPlayableFramesProperty(PlayableFramePropertyID.LOCKED, false);
                }
                EditorGUI.EndDisabledGroup();
            }
        }