private static void RenderSelectionGizmo(PlayableDirectorLite _playable, GizmoType _gizmoType)
 {
     if (_playable == playable && Instance != null)
     {
         Instance.OnDrawGizmos();
     }
 }
        protected virtual void OnGUI()
        {
            PlayableDirectorLite tempPlayable = EditorGUILayout.ObjectField(Playable, typeof(PlayableDirectorLite), true) as PlayableDirectorLite;

            if (tempPlayable != null)
            {
                playableInstanceID = tempPlayable.gameObject.GetInstanceID();
            }
            Playable = tempPlayable;

            selectedTabIndex = GUILayout.Toolbar(selectedTabIndex, toolbarLabels, GUILayout.Height(30));
            toolbarTabs[toolbarLabels[selectedTabIndex]]();
            Repaint();
        }
        protected virtual void OnEnable()
        {
            instance     = this;
            titleContent = new GUIContent("TimelineLites");

            EditorApplication.playModeStateChanged += OnPlayModeChanged;

#if UNITY_2019_1_OR_NEWER
            SceneView.duringSceneGui += OnSceneGUI;
#else
            SceneView.onSceneGUIDelegate += OnSceneGUI;
#endif

            Playable = (EditorUtility.InstanceIDToObject(playableInstanceID) as GameObject)?.GetComponent <PlayableDirectorLite>();
            Initialize();
        }
示例#4
0
        public void SceneGUISelected(PlayableDirectorLite _playable, TimelineClip _timelineClip, int _indicator)
        {
            float startFrame = _timelineClip.GetStartFrame();
            float endFrame   = _timelineClip.GetEndFrame();
            float progress   = (_indicator - startFrame) / (endFrame - startFrame);

            if (progress < 0 || progress > 1)
            {
                return;
            }

            Vector3 position = new Vector3(
                Easing.Tween(from.x, to.x, progress, ease),
                Easing.Tween(from.y, to.y, progress, ease),
                Easing.Tween(from.z, to.z, progress, ease)
                );

            Handles.DotHandleCap(0, position, Quaternion.identity, 0.1f, EventType.Repaint);
        }
        void OnPlayModeChanged(PlayModeStateChange obj)
        {
            switch (obj)
            {
            case PlayModeStateChange.EnteredEditMode:
                PlayableDirectorLite tempPlayable = (EditorUtility.InstanceIDToObject(playableInstanceID) as GameObject)?.GetComponent <PlayableDirectorLite>();
                if (tempPlayable != null)
                {
                    playableInstanceID = tempPlayable.gameObject.GetInstanceID();
                }
                Playable = tempPlayable;
                break;

            case PlayModeStateChange.EnteredPlayMode:
                Playable = (EditorUtility.InstanceIDToObject(playableInstanceID) as GameObject)?.GetComponent <PlayableDirectorLite>();
                break;

            default:
                break;
            }
        }
        public void SceneGUISelected(PlayableDirectorLite _playable, TimelineClip _timelineClip, int _indicator)
        {
            float startFrame = _timelineClip.GetStartFrame();
            float endFrame   = _timelineClip.GetEndFrame();
            int   indicator  = TimelineLiteEditorWindow.Instance.IndicatorFrame;
            float progress   = (indicator - startFrame) / (endFrame - startFrame);

            if (progress < 0 || progress > 1)
            {
                return;
            }

            progress = Mathf.Clamp01(progress);
            Quaternion rotation = Quaternion.Euler(new Vector3(
                                                       Easing.Tween(from.x, to.x, progress, ease),
                                                       Easing.Tween(from.y, to.y, progress, ease),
                                                       Easing.Tween(from.z, to.z, progress, ease)
                                                       ));

            Handles.ArrowHandleCap(0, _playable.transform.position, rotation, 3, EventType.Repaint);
        }
 public void SceneGUI(PlayableDirectorLite _playable, TimelineClip _timelineClip, int _indicator)
 {
 }
 protected override void OnEnable()
 {
     base.OnEnable();
     playableDirectorLite      = target as PlayableDirectorLite;
     EditorApplication.update += CustomRepaint;
 }