private void OnTargetInspectorGUI(int platformIndex, string platformName) { bool flag = true; if (platformIndex != 0) { bool flag2; EditorGUI.showMixedValue = this.HasMixedOverrideStatus(platformIndex, out flag2); EditorGUI.BeginChangeCheck(); flag2 = EditorGUILayout.Toggle("Override for " + platformName, flag2, new GUILayoutOption[0]); flag = (flag2 || EditorGUI.showMixedValue); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < this.m_TargetSettings.GetLength(0); i++) { this.m_TargetSettings[i, platformIndex].overridePlatform = flag2; this.m_ModifiedTargetSettings = true; if (this.m_TargetSettings[i, platformIndex].settings == null) { this.m_TargetSettings[i, platformIndex].settings = this.CloneTargetSettings(this.m_TargetSettings[i, 0].settings); } } } } EditorGUILayout.Space(); VideoClipImporterInspector.MultiTargetSettingState multiState = this.CalculateMultiTargetSettingState(platformIndex); using (new EditorGUI.DisabledScope(!flag)) { this.OnTargetSettingsInspectorGUI(platformIndex, multiState); } }
private void OnTargetSettingsInspectorGUI(int platformIndex, VideoClipImporterInspector.MultiTargetSettingState multiState) { EditorGUI.showMixedValue = multiState.mixedTranscoding; EditorGUI.BeginChangeCheck(); bool flag = EditorGUILayout.Toggle(VideoClipImporterInspector.s_Styles.transcodeContent, multiState.firstTranscoding, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < this.m_TargetSettings.GetLength(0); i++) { if (this.m_TargetSettings[i, platformIndex].settings != null) { this.m_TargetSettings[i, platformIndex].settings.enableTranscoding = flag; this.m_ModifiedTargetSettings = true; } } } EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!flag && !multiState.mixedTranscoding)) { this.FrameSettingsGUI(platformIndex, multiState); this.EncodingSettingsGUI(platformIndex, multiState); } EditorGUI.indentLevel--; }
private VideoClipImporterInspector.MultiTargetSettingState CalculateMultiTargetSettingState(int platformIndex) { VideoClipImporterInspector.MultiTargetSettingState multiTargetSettingState = default(VideoClipImporterInspector.MultiTargetSettingState); multiTargetSettingState.Init(); VideoClipImporterInspector.MultiTargetSettingState result; if (this.m_TargetSettings == null || this.m_TargetSettings.Length == 0) { result = multiTargetSettingState; } else { int num = -1; for (int i = 0; i < this.m_TargetSettings.GetLength(0); i++) { if (this.m_TargetSettings[i, platformIndex].overridePlatform) { if (num == -1) { num = i; multiTargetSettingState.firstTranscoding = this.m_TargetSettings[i, platformIndex].settings.enableTranscoding; multiTargetSettingState.firstCodec = this.m_TargetSettings[i, platformIndex].settings.codec; multiTargetSettingState.firstResizeMode = this.m_TargetSettings[i, platformIndex].settings.resizeMode; multiTargetSettingState.firstAspectRatio = this.m_TargetSettings[i, platformIndex].settings.aspectRatio; multiTargetSettingState.firstCustomWidth = this.m_TargetSettings[i, platformIndex].settings.customWidth; multiTargetSettingState.firstCustomHeight = this.m_TargetSettings[i, platformIndex].settings.customHeight; multiTargetSettingState.firstBitrateMode = this.m_TargetSettings[i, platformIndex].settings.bitrateMode; multiTargetSettingState.firstSpatialQuality = this.m_TargetSettings[i, platformIndex].settings.spatialQuality; } else { multiTargetSettingState.mixedTranscoding = (multiTargetSettingState.firstTranscoding != this.m_TargetSettings[i, platformIndex].settings.enableTranscoding); multiTargetSettingState.mixedCodec = (multiTargetSettingState.firstCodec != this.m_TargetSettings[i, platformIndex].settings.codec); multiTargetSettingState.mixedResizeMode = (multiTargetSettingState.firstResizeMode != this.m_TargetSettings[i, platformIndex].settings.resizeMode); multiTargetSettingState.mixedAspectRatio = (multiTargetSettingState.firstAspectRatio != this.m_TargetSettings[i, platformIndex].settings.aspectRatio); multiTargetSettingState.mixedCustomWidth = (multiTargetSettingState.firstCustomWidth != this.m_TargetSettings[i, platformIndex].settings.customWidth); multiTargetSettingState.mixedCustomHeight = (multiTargetSettingState.firstCustomHeight != this.m_TargetSettings[i, platformIndex].settings.customHeight); multiTargetSettingState.mixedBitrateMode = (multiTargetSettingState.firstBitrateMode != this.m_TargetSettings[i, platformIndex].settings.bitrateMode); multiTargetSettingState.mixedSpatialQuality = (multiTargetSettingState.firstSpatialQuality != this.m_TargetSettings[i, platformIndex].settings.spatialQuality); } } } if (num == -1) { multiTargetSettingState.firstTranscoding = this.m_TargetSettings[0, 0].settings.enableTranscoding; multiTargetSettingState.firstCodec = this.m_TargetSettings[0, 0].settings.codec; multiTargetSettingState.firstResizeMode = this.m_TargetSettings[0, 0].settings.resizeMode; multiTargetSettingState.firstAspectRatio = this.m_TargetSettings[0, 0].settings.aspectRatio; multiTargetSettingState.firstCustomWidth = this.m_TargetSettings[0, 0].settings.customWidth; multiTargetSettingState.firstCustomHeight = this.m_TargetSettings[0, 0].settings.customHeight; multiTargetSettingState.firstBitrateMode = this.m_TargetSettings[0, 0].settings.bitrateMode; multiTargetSettingState.firstSpatialQuality = this.m_TargetSettings[0, 0].settings.spatialQuality; } result = multiTargetSettingState; } return(result); }
private void EncodingSettingsGUI(int platformIndex, VideoClipImporterInspector.MultiTargetSettingState multiState) { EditorGUI.showMixedValue = multiState.mixedCodec; EditorGUI.BeginChangeCheck(); VideoCodec codec = (VideoCodec)EditorGUILayout.EnumPopup(VideoClipImporterInspector.s_Styles.codecContent, multiState.firstCodec, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < this.m_TargetSettings.GetLength(0); i++) { if (this.m_TargetSettings[i, platformIndex].settings != null) { this.m_TargetSettings[i, platformIndex].settings.codec = codec; this.m_ModifiedTargetSettings = true; } } } EditorGUI.showMixedValue = multiState.mixedBitrateMode; EditorGUI.BeginChangeCheck(); VideoBitrateMode bitrateMode = (VideoBitrateMode)EditorGUILayout.EnumPopup(VideoClipImporterInspector.s_Styles.bitrateContent, multiState.firstBitrateMode, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int j = 0; j < this.m_TargetSettings.GetLength(0); j++) { if (this.m_TargetSettings[j, platformIndex].settings != null) { this.m_TargetSettings[j, platformIndex].settings.bitrateMode = bitrateMode; this.m_ModifiedTargetSettings = true; } } } EditorGUI.showMixedValue = multiState.mixedSpatialQuality; EditorGUI.BeginChangeCheck(); VideoSpatialQuality spatialQuality = (VideoSpatialQuality)EditorGUILayout.EnumPopup(VideoClipImporterInspector.s_Styles.spatialQualityContent, multiState.firstSpatialQuality, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int k = 0; k < this.m_TargetSettings.GetLength(0); k++) { if (this.m_TargetSettings[k, platformIndex].settings != null) { this.m_TargetSettings[k, platformIndex].settings.spatialQuality = spatialQuality; this.m_ModifiedTargetSettings = true; } } } }
public override void OnEnable() { if (VideoClipImporterInspector.s_Styles == null) { VideoClipImporterInspector.s_Styles = new VideoClipImporterInspector.Styles(); } this.m_UseLegacyImporter = base.serializedObject.FindProperty("m_UseLegacyImporter"); this.m_Quality = base.serializedObject.FindProperty("m_Quality"); this.m_IsColorLinear = base.serializedObject.FindProperty("m_IsColorLinear"); this.m_EncodeAlpha = base.serializedObject.FindProperty("m_EncodeAlpha"); this.m_Deinterlace = base.serializedObject.FindProperty("m_Deinterlace"); this.m_FlipVertical = base.serializedObject.FindProperty("m_FlipVertical"); this.m_FlipHorizontal = base.serializedObject.FindProperty("m_FlipHorizontal"); this.m_ImportAudio = base.serializedObject.FindProperty("m_ImportAudio"); this.ResetSettingsFromBackend(); VideoClipImporterInspector.MultiTargetSettingState multiTargetSettingState = this.CalculateMultiTargetSettingState(0); this.m_ShowResizeModeOptions.valueChanged.AddListener(new UnityAction(base.Repaint)); this.m_ShowResizeModeOptions.value = (multiTargetSettingState.mixedResizeMode || multiTargetSettingState.firstResizeMode != VideoResizeMode.OriginalSize); }
private void FrameSettingsGUI(int platformIndex, VideoClipImporterInspector.MultiTargetSettingState multiState) { EditorGUI.showMixedValue = multiState.mixedResizeMode; EditorGUI.BeginChangeCheck(); VideoResizeMode videoResizeMode = (VideoResizeMode)EditorGUILayout.Popup(VideoClipImporterInspector.s_Styles.dimensionsContent, (int)multiState.firstResizeMode, this.GetResizeModeList().ToArray(), new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < this.m_TargetSettings.GetLength(0); i++) { if (this.m_TargetSettings[i, platformIndex].settings != null) { this.m_TargetSettings[i, platformIndex].settings.resizeMode = videoResizeMode; this.m_ModifiedTargetSettings = true; } } } this.m_ShowResizeModeOptions.target = (videoResizeMode != VideoResizeMode.OriginalSize); if (EditorGUILayout.BeginFadeGroup(this.m_ShowResizeModeOptions.faded)) { EditorGUI.indentLevel++; if (videoResizeMode == VideoResizeMode.CustomSize) { EditorGUI.showMixedValue = multiState.mixedCustomWidth; EditorGUI.BeginChangeCheck(); int num = EditorGUILayout.IntField(VideoClipImporterInspector.s_Styles.widthContent, multiState.firstCustomWidth, new GUILayoutOption[0]); num = Mathf.Clamp(num, 1, 16384); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int j = 0; j < this.m_TargetSettings.GetLength(0); j++) { if (this.m_TargetSettings[j, platformIndex].settings != null) { this.m_TargetSettings[j, platformIndex].settings.customWidth = num; this.m_ModifiedTargetSettings = true; } } } EditorGUI.showMixedValue = multiState.mixedCustomHeight; EditorGUI.BeginChangeCheck(); int num2 = EditorGUILayout.IntField(VideoClipImporterInspector.s_Styles.heightContent, multiState.firstCustomHeight, new GUILayoutOption[0]); num2 = Mathf.Clamp(num2, 1, 16384); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int k = 0; k < this.m_TargetSettings.GetLength(0); k++) { if (this.m_TargetSettings[k, platformIndex].settings != null) { this.m_TargetSettings[k, platformIndex].settings.customHeight = num2; this.m_ModifiedTargetSettings = true; } } } } EditorGUI.showMixedValue = multiState.mixedAspectRatio; EditorGUI.BeginChangeCheck(); VideoEncodeAspectRatio aspectRatio = (VideoEncodeAspectRatio)EditorGUILayout.EnumPopup(VideoClipImporterInspector.s_Styles.aspectRatioContent, multiState.firstAspectRatio, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { for (int l = 0; l < this.m_TargetSettings.GetLength(0); l++) { if (this.m_TargetSettings[l, platformIndex].settings != null) { this.m_TargetSettings[l, platformIndex].settings.aspectRatio = aspectRatio; this.m_ModifiedTargetSettings = true; } } } EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); }