Inheritance: UnityEngine.MonoBehaviour
コード例 #1
0
        void OnEnable()
        {
            InitializedPrefsIfNeeded();

            _recordVideo = FindOrCreateRecordVideo();

            _gui = new GUIVertical();

            _gui.Add(new GUIButton(new GUIContent(FFmpegPathButtonText(), FFmpegPathButtonText()), PickFFmpegPathClicked));
            _gui.Add(new GUIButton(new GUIContent(OutputFolderButtonText(), OutputFolderButtonText()), PickOutputFolderClicked));
            _gui.Add(new GUIIntSlider(new GUIContent("Super Size",
                                                     "Frames will be rendered at this multiple of the current resolution"),
                                      _recordVideo.superSize, 1, 4, SuperSizeChanged));
            _gui.Add(new GUIIntSlider(new GUIContent("Framerate",
                                                     "The fixed framerate of recorded video"),
                                      _recordVideo.captureFramerate, 10, 60, FramerateChanged));
            _gui.Add(new GUIEnumPopup(new GUIContent("Output Format"),
                                      (OutputFormat)EditorPrefs.GetInt(OutputFormatPrefsKey),
                                      OutputFormatChanged));
            GUIToggle deleteFrames = _gui.Add(new GUIToggle(new GUIContent("Delete Frames",
                                                                           "Delete all frames after compiling videos"),
                                                            DeleteFramesChanged)) as GUIToggle;

            deleteFrames.isToggled = EditorPrefs.GetBool(DeleteFramesPrefsKey);
            _gui.Add(new GUISpace());
            _gui.Add(new GUIEnumPopup(new GUIContent("Record Hotkey", "The key that will toggle recording during play mode"),
                                      (KeyCode)EditorPrefs.GetInt(RecordHotkeyPrefsKey),
                                      RecordHotkeyChanged));
            _recordButton           = _gui.Add(new GUIButton(new GUIContent("Record"), RecordClicked)) as GUIButton;
            _recordButton.isEnabled = EditorApplication.isPlaying;

            EditorApplication.playmodeStateChanged += PlayModeStateChanged;
        }
コード例 #2
0
		void OnEnable()
		{
			InitializedPrefsIfNeeded();

			_recordVideo = FindOrCreateRecordVideo();

			_gui = new GUIVertical();

			_gui.Add( new GUIButton( new GUIContent( FFmpegPathButtonText(), FFmpegPathButtonText()), PickFFmpegPathClicked));
			_gui.Add( new GUIButton( new GUIContent( OutputFolderButtonText(), OutputFolderButtonText()), PickOutputFolderClicked));
			_gui.Add( new GUIIntSlider( new GUIContent( "Super Size", 
														"Frames will be rendered at this multiple of the current resolution"), 
										_recordVideo.superSize, 1, 4, SuperSizeChanged));
			_gui.Add( new GUIIntSlider( new GUIContent( "Framerate", 
														"The fixed framerate of recorded video"), 
										_recordVideo.captureFramerate, 10, 60, FramerateChanged));
			_gui.Add( new GUIEnumPopup( new GUIContent( "Output Format"), 
										(OutputFormat) EditorPrefs.GetInt( OutputFormatPrefsKey), 
										OutputFormatChanged));
			GUIToggle deleteFrames = _gui.Add( new GUIToggle( new GUIContent( "Delete Frames", 
																			  "Delete all frames after compiling videos"), 
											   DeleteFramesChanged)) as GUIToggle;
			deleteFrames.isToggled = EditorPrefs.GetBool( DeleteFramesPrefsKey);
			_gui.Add( new GUISpace());
			_gui.Add( new GUIEnumPopup( new GUIContent( "Record Hotkey", "The key that will toggle recording during play mode"),
										(KeyCode) EditorPrefs.GetInt( RecordHotkeyPrefsKey), 
										RecordHotkeyChanged));
			_recordButton = _gui.Add( new GUIButton( new GUIContent( "Record"), RecordClicked)) as GUIButton;
			_recordButton.isEnabled = EditorApplication.isPlaying;

			EditorApplication.playmodeStateChanged += PlayModeStateChanged;
		}
コード例 #3
0
        void OnDisable()
        {
            _gui          = null;
            _recordButton = null;
            _recordVideo  = null;

            EditorApplication.playmodeStateChanged -= PlayModeStateChanged;
        }
コード例 #4
0
        void PlayModeStateChanged()
        {
            _recordVideo = FindOrCreateRecordVideo();
            _recordVideo.StopRecording();
            _recordButton.isEnabled = EditorApplication.isPlaying;
            UpdateRecordButtonText();

            if (EditorApplication.isPlayingOrWillChangePlaymode == false && EditorApplication.isPlaying == false)
            {
                CompileVideos();
            }
        }
コード例 #5
0
        RecordVideo FindOrCreateRecordVideo()
        {
            RecordVideo recordVideo = FindObjectOfType <RecordVideo>();

            if (recordVideo == null)
            {
                GameObject gameObject = new GameObject("RecordVideo");
                gameObject.hideFlags = HideFlags.HideAndDontSave;
                recordVideo          = gameObject.AddComponent <RecordVideo>();
            }

            recordVideo.folderPath       = EditorPrefs.GetString(OutputFolderPrefsKey);
            recordVideo.superSize        = EditorPrefs.GetInt(SuperSizePrefsKey);
            recordVideo.captureFramerate = EditorPrefs.GetInt(FrameratePrefsKey);

            return(recordVideo);
        }
コード例 #6
0
		void OnDisable()
		{
			_gui = null;
			_recordButton = null;
			_recordVideo = null;

			EditorApplication.playmodeStateChanged -= PlayModeStateChanged;
		}
コード例 #7
0
		void PlayModeStateChanged()
		{
			_recordVideo = FindOrCreateRecordVideo();
			_recordVideo.StopRecording();
			_recordButton.isEnabled = EditorApplication.isPlaying;
			UpdateRecordButtonText();

			if( EditorApplication.isPlayingOrWillChangePlaymode == false && EditorApplication.isPlaying == false)
			{
				CompileVideos();
			}
		}