Example #1
0
        public override void OnInspectorGUI()
        {
            DrawDocumentationIcon();

            serializedObject.Update();

            EditorGUILayout.PropertyField(mode, new GUIContent("Mode"));

            if (!mode.hasMultipleDifferentValues)
            {
                if (mode.enumValueIndex == (int)TimelineMode.Local)
                {
                    if (!serializedObject.isEditingMultipleObjects)
                    {
                        Timeline timeline = (Timeline)serializedObject.targetObject;

                        LocalClock localClock = timeline.GetComponent <LocalClock>();

                        if (localClock == null || !localClock.enabled)
                        {
                            EditorGUILayout.HelpBox("A local timeline requires a local clock.", MessageType.Error);
                        }
                    }
                }
                else if (mode.enumValueIndex == (int)TimelineMode.Global)
                {
                    TimekeeperEditor.GlobalClockKeyPopup("Global Clock", globalClockKey);

                    if (!globalClockKey.hasMultipleDifferentValues &&
                        string.IsNullOrEmpty(globalClockKey.stringValue))
                    {
                        EditorGUILayout.HelpBox("A global timeline requires a global clock reference.", MessageType.Error);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Unsupported timeline mode.", MessageType.Error);
                }
            }

            if (!serializedObject.isEditingMultipleObjects &&
                Application.isPlaying)
            {
                Timeline timeline = (Timeline)serializedObject.targetObject;
                EditorGUILayout.LabelField("Computed Time Scale", timeline.timeScale.ToString("0.00"));
                EditorGUILayout.LabelField("Computed Time", timeline.time.ToString("0.00"));
            }

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        public override void OnInspectorGUI()
        {
            TimekeeperEditor.GlobalClockKeyPopup("Parent", parentKey, serializedObject.targetObjects.OfType <Clock>());

            OnBlendsGUI();

            EditorGUILayout.PropertyField(localTimeScale, new GUIContent("Time Scale"));

            EditorGUILayout.PropertyField(paused, new GUIContent("Paused"));

            if (!serializedObject.isEditingMultipleObjects &&
                Application.isPlaying)
            {
                Clock clock = (Clock)serializedObject.targetObject;

                EditorGUILayout.LabelField("Computed Time Scale", clock.timeScale.ToString("0.00"));
            }
        }