public override void OnInspectorGUI()
        {
            // User can begin "recording" in editor, but LateUpdate() will only be called during play
            EditorGUILayout.HelpBox("Recording will be saved at Assets/StreamingAssets after finishing capture and then unfocusing and refocusing Unity as an app", MessageType.Info);
            if (!UnityEditor.EditorApplication.isPlaying)
            {
                EditorGUILayout.HelpBox("Recording is only recommended during editor play mode", MessageType.Info);
            }

#if !UNITY_2017_3_OR_NEWER
            EditorGUILayout.HelpBox("Use Unity 2017.3+ to record video", MessageType.Warning);
#endif
            EditorGUILayout.PropertyField(lmr_recordingCondition);
            EditorGUILayout.PropertyField(lmr_recordingFormat);
            EditorGUILayout.PropertyField(lmr_frameRate);

            // since we convert value to string, we do not have to worry about pre-2017.3 vs post-2017.3 issues
            string condition = ((LeiaLoft.LeiaMediaRecorder.RecordingCondition)lmr_recordingCondition.enumValueIndex).ToString();

            if (lmr != null && lmr_recordingFormat.enumValueIndex == -1)
            {
                Debug.LogWarningFormat("Project was rolled back to version predating MediaEncoder. Change {0}.LeiaMediaRecorder.recordingCondition to be png or jpg", lmr.transform.name);
            }
            if (lmr != null && condition.Equals("frame"))
            {
                UndoableInputFieldUtils.ImmediateFloatField(
                    () => { return(lmr.startTime); },
                    (float f) => { lmr.startTime = f; },
                    "Start time (sec)"
                    );
                UndoableInputFieldUtils.ImmediateFloatField(
                    () => { return(lmr.endTime); },
                    (float f) => { lmr.endTime = f; },
                    "End time (sec)"
                    );
            }

            // inactive: offer to start recording
            if (lmr != null && !lmr.GetActive() && condition.Equals("button_click") && GUILayout.Button("Start recording"))
            {
                lmr.BeginRecording();
            }
            // active: offer to stop recording
            if (lmr != null && lmr.GetActive() && condition.Equals("button_click") && GUILayout.Button("Stop recording"))
            {
                lmr.EndRecording();
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #2
0
 private void ShowMaxFocusDistance()
 {
     UndoableInputFieldUtils.ImmediateFloatField(() => _controller.MaxFocusDistance, v => _controller.MaxFocusDistance = v, "Max Focus Distance", _controller);
 }
Пример #3
0
 private void ShowFocusSmoothing()
 {
     UndoableInputFieldUtils.ImmediateFloatField(() => _controller.FocusSpeed, v => _controller.FocusSpeed = v, "Focus Speed", _controller);
 }
Пример #4
0
 private void ShowFocalOffset()
 {
     UndoableInputFieldUtils.ImmediateFloatField(() => _controller.FocusOffset, v => _controller.FocusOffset = v, "Focus Offset", _controller);
 }
Пример #5
0
 private void ShowSphereRadius()
 {
     UndoableInputFieldUtils.ImmediateFloatField(() => _controller.SphereRadius, v => _controller.SphereRadius = v, "Sphere Radius", _controller);
 }
Пример #6
0
        public override void OnInspectorGUI()
        {
            if (_controller == null)
            {
                _controller = (LeiaCamera)target;
            }

            if (!_controller.enabled)
            {
                return;
            }

            EditorGUI.BeginChangeCheck();

            // allow multi-object editing
            // display object properties in sequence when multiple objects selected
            for (int i = 0; i < targets.Length; i++)
            {
                _controller = (LeiaCamera)targets[i];

                if (targets.Length > 1)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.ObjectField(_controller, typeof(LeiaCamera), true);
                }

                UndoableInputFieldUtils.ImmediateFloatField(() => _controller.ConvergenceDistance, v => _controller.ConvergenceDistance = v, ConvergenceDistanceFieldLabel, _controller);
                UndoableInputFieldUtils.ImmediateFloatField(() => _controller.BaselineScaling, v => _controller.BaselineScaling         = v, BaselineScalingFieldLabel, _controller);
                UndoableInputFieldUtils.BoolField(() => _controller.DrawCameraBounds, v => _controller.DrawCameraBounds = v, DrawCameraBoundsFieldLabel, _controller);

                EditorGUILayout.Separator();

                if (EditorApplication.isPlaying)
                {
                    if (!LeiaDisplay.InstanceIsNull)
                    {
                        EditorGUILayout.BeginHorizontal();
                        if (GUILayout.Button(UpdateEffectsButtonLabel))
                        {
                            _controller.UpdateEffects();
                        }

                        EditorGUILayout.HelpBox(UpdateEffectsHelpText, MessageType.Info);
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.HelpBox(NoEffectsControllerHelpText, MessageType.Info);
                    }
                }

                if (targets.Length > 1)
                {
                    EditorGUILayout.Separator();
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                foreach (Object obj in targets)
                {
                    EditorUtility.SetDirty(obj);
                }
            }
        }