Exemplo n.º 1
0
//----------------------------------------------------------------------------------------------------------------------
        void DrawBackgroundTexture(Rect rect, Color color)
        {
            Texture2D bgTexture = EditorTextures.GetOrCreatePreviewBGTexture();

            bgTexture.SetPixelsWithColor(color);
            Graphics.DrawTexture(rect, bgTexture);
        }
//----------------------------------------------------------------------------------------------------------------------    
    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;
            }
            
        }
        
    }
Exemplo n.º 3
0
//----------------------------------------------------------------------------------------------------------------------


        private void DrawLockFramesGUI(TimelineClip timelineClip, PlayableFrameClipData clipData)
        {
            TrackAsset track = timelineClip.GetParentTrack();

            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(clipData);
                    }
                    else
                    {
                        UnlockSISData();
                    }
                }

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