private void OnInspectorGUI_Subtitles() { // TODO: add support for multiple targets? MediaPlayer media = (this.target) as MediaPlayer; //EditorGUILayout.BeginVertical(); EditorGUILayout.PropertyField(_propSubtitles, new GUIContent("Sideload Subtitles")); EditorGUI.BeginDisabledGroup(!_propSubtitles.boolValue); EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.PropertyField(_propSubtitlePath); //if (!Application.isPlaying) { GUI.color = Color.white; GUILayout.BeginHorizontal(); if (Application.isPlaying) { if (GUILayout.Button("Load")) { MediaPath mediaPath = new MediaPath(_propSubtitlePath.FindPropertyRelative("_path").stringValue, (MediaPathType)_propSubtitlePath.FindPropertyRelative("_pathType").enumValueIndex); media.EnableSubtitles(mediaPath); } if (GUILayout.Button("Clear")) { media.DisableSubtitles(); } } else { GUILayout.FlexibleSpace(); } MediaPathDrawer.ShowBrowseSubtitlesButtonIcon(_propSubtitlePath); GUILayout.EndHorizontal(); if (_propSubtitles.boolValue) { ///MediaPath mediaPath = new MediaPath(_propSubtitlePath.FindPropertyRelative("_path").stringValue, (MediaPathType)_propSubtitlePath.FindPropertyRelative("_pathType").enumValueIndex); //ShowFileWarningMessages(mediaPath, media.AutoOpen, Platform.Unknown); //GUI.color = Color.white; } } //EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty propSourceType = property.FindPropertyRelative("sourceType"); EditorGUILayout.PropertyField(propSourceType); if (propSourceType.enumValueIndex == 0) { EditorGUILayout.PropertyField(property.FindPropertyRelative("mediaPath")); MediaPathDrawer.ShowBrowseButton(property.FindPropertyRelative("mediaPath")); } else { //EditorGUILayout.PropertyField(property.FindPropertyRelative("texture")); //EditorGUILayout.PropertyField(property.FindPropertyRelative("textureDuration")); } EditorGUILayout.Space(); //EditorGUILayout.PropertyField(property.FindPropertyRelative("stereoPacking")); //EditorGUILayout.PropertyField(property.FindPropertyRelative("alphaPacking")); EditorGUILayout.Space(); EditorGUILayout.PropertyField(property.FindPropertyRelative("loop")); EditorGUILayout.PropertyField(property.FindPropertyRelative("startMode")); SerializedProperty propProgressMode = property.FindPropertyRelative("progressMode"); EditorGUILayout.PropertyField(propProgressMode); if (propProgressMode.enumValueIndex == (int)PlaylistMediaPlayer.ProgressMode.BeforeFinish) { EditorGUILayout.PropertyField(property.FindPropertyRelative("progressTimeSeconds")); } EditorGUILayout.Space(); SerializedProperty propIsOverrideTransition = property.FindPropertyRelative("isOverrideTransition"); EditorGUILayout.PropertyField(propIsOverrideTransition, _guiTextOverrideTransition); if (propIsOverrideTransition.boolValue) { EditorGUI.indentLevel++; SerializedProperty propTransitionMode = property.FindPropertyRelative("overrideTransition"); EditorGUILayout.PropertyField(propTransitionMode, _guiTextTransition); if (propTransitionMode.enumValueIndex != (int)PlaylistMediaPlayer.Transition.None) { EditorGUILayout.PropertyField(property.FindPropertyRelative("overrideTransitionDuration"), _guiTextDuration); EditorGUILayout.PropertyField(property.FindPropertyRelative("overrideTransitionEasing"), _guiTextEasing); } EditorGUI.indentLevel--; } }
private void OnInspectorGUI_Source() { // Display the file name and buttons to load new files MediaPlayer mediaPlayer = (this.target) as MediaPlayer; EditorGUILayout.PropertyField(_propMediaSource); if (MediaSource.Reference == (MediaSource)_propMediaSource.enumValueIndex) { EditorGUILayout.PropertyField(_propMediaReference); } EditorGUILayout.BeginVertical(GUI.skin.box); if (MediaSource.Reference != (MediaSource)_propMediaSource.enumValueIndex) { OnInspectorGUI_CopyableFilename(mediaPlayer.MediaPath.Path); EditorGUILayout.PropertyField(_propMediaPath); } //if (!Application.isPlaying) { GUI.color = Color.white; GUILayout.BeginHorizontal(); if (_allowDeveloperMode) { if (GUILayout.Button("Rewind")) { mediaPlayer.Rewind(true); } if (GUILayout.Button("Preroll")) { mediaPlayer.RewindPrerollPause(); } if (GUILayout.Button("End")) { mediaPlayer.Control.Seek(mediaPlayer.Info.GetDuration()); } } if (GUILayout.Button("Close")) { mediaPlayer.CloseMedia(); } if (GUILayout.Button("Load")) { if (mediaPlayer.MediaSource == MediaSource.Path) { mediaPlayer.OpenMedia(mediaPlayer.MediaPath.PathType, mediaPlayer.MediaPath.Path, mediaPlayer.AutoStart); } else if (mediaPlayer.MediaSource == MediaSource.Reference) { mediaPlayer.OpenMedia(mediaPlayer.MediaReference, mediaPlayer.AutoStart); } } /*if (media.Control != null) * { * if (GUILayout.Button("Unload")) * { * media.CloseVideo(); * } * }*/ if (EditorGUIUtility.GetObjectPickerControlID() == 100 && Event.current.commandName == "ObjectSelectorClosed") { MediaReference mediaRef = (MediaReference)EditorGUIUtility.GetObjectPickerObject(); if (mediaRef) { _propMediaSource.enumValueIndex = (int)MediaSource.Reference; _propMediaReference.objectReferenceValue = mediaRef; } } GUI.color = Color.green; MediaPathDrawer.ShowBrowseButtonIcon(_propMediaPath, _propMediaSource); GUI.color = Color.white; GUILayout.EndHorizontal(); //MediaPath mediaPath = new MediaPath(_propMediaPath.FindPropertyRelative("_path").stringValue, (MediaPathType)_propMediaPath.FindPropertyRelative("_pathType").enumValueIndex); //ShowFileWarningMessages((MediaSource)_propMediaSource.enumValueIndex, mediaPath, (MediaReference)_propMediaReference.objectReferenceValue, mediaPlayer.AutoOpen, Platform.Unknown); GUI.color = Color.white; } if (MediaSource.Reference != (MediaSource)_propMediaSource.enumValueIndex) { GUILayout.Label("Fallback Media Hints", EditorStyles.boldLabel); EditorGUILayout.PropertyField(_propFallbackMediaHints); } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { //MediaPlayer media = (this.target) as MediaPlayer; //this.DrawDefaultInspector(); serializedObject.Update(); GUILayout.Label("Media Reference"); EditorGUILayout.Space(); //EditorGUILayout.PropertyField(_propAlias); //EditorGUILayout.Space(); { string mediaName = _propMediaPath.FindPropertyRelative("_path").stringValue; GUILayout.BeginVertical(GUI.skin.box); MediaPlayerEditor.OnInspectorGUI_CopyableFilename(mediaName); GUILayout.EndVertical(); } EditorGUILayout.PropertyField(_propMediaPath); MediaPathDrawer.ShowBrowseButton(_propMediaPath); EditorGUILayout.Space(); //GUILayout.Label("Media Hints", EditorStyles.boldLabel); EditorGUILayout.PropertyField(_propHints); EditorGUILayout.PropertyField(_propPlatformMacOS, new GUIContent("macOS")); EditorGUILayout.PropertyField(_propPlatformWindows, new GUIContent("Windows")); EditorGUILayout.PropertyField(_propPlatformAndroid, new GUIContent("Android")); EditorGUILayout.PropertyField(_propPlatformIOS, new GUIContent("iOS")); EditorGUILayout.PropertyField(_propPlatformTvOS, new GUIContent("tvOS")); EditorGUILayout.PropertyField(_propPlatformWindowsUWP, new GUIContent("UWP")); EditorGUILayout.PropertyField(_propPlatformWebGL, new GUIContent("WebGL")); EditorGUILayout.Space(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); bool beginGenerateThumbnails = false; GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(IsGeneratingThumbnails()); GUILayout.BeginHorizontal(); _thumbnailTime = GUILayout.HorizontalSlider(_thumbnailTime, 0f, 1f, GUILayout.ExpandWidth(true)); _zoomToFill = GUILayout.Toggle(_zoomToFill, "Zoom And Crop", GUI.skin.button, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (GUILayout.Button("Generate Thumbnail")) { beginGenerateThumbnails = true; } EditorGUI.EndDisabledGroup(); if (beginGenerateThumbnails) { BeginGenerateThumbnails(); } if (IsGeneratingThumbnails()) { ShowProgress(); } if (!IsGeneratingThumbnails()) { RemoveProgress(); } }