Ejemplo n.º 1
0
        private void OnTargetSettingsInspectorGUI(int platformIndex, MultiTargetSettingState multiState)
        {
            EditorGUI.showMixedValue = multiState.mixedTranscoding;
            EditorGUI.BeginChangeCheck();
            bool transcode = EditorGUILayout.Toggle(s_Styles.transcodeContent, multiState.firstTranscoding);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                {
                    if (m_TargetSettings[i, platformIndex].settings != null)
                    {
                        m_TargetSettings[i, platformIndex].settings.enableTranscoding = transcode;
                        m_ModifiedTargetSettings = true;
                    }
                }
            }

            EditorGUI.indentLevel++;

            using (new EditorGUI.DisabledScope(!(transcode || multiState.mixedTranscoding)))
            {
                FrameSettingsGUI(platformIndex, multiState);
                EncodingSettingsGUI(platformIndex, multiState);
            }

            EditorGUI.indentLevel--;
        }
Ejemplo n.º 2
0
        private void OnTargetInspectorGUI(int platformIndex, string platformName)
        {
            bool enableOverrideSettings = true;

            if (platformIndex != 0)
            {
                bool overrideState;
                EditorGUI.showMixedValue = HasMixedOverrideStatus(platformIndex, out overrideState);
                EditorGUI.BeginChangeCheck();
                overrideState            = EditorGUILayout.Toggle("Override for " + platformName, overrideState);
                enableOverrideSettings   = overrideState || EditorGUI.showMixedValue;
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                    {
                        m_TargetSettings[i, platformIndex].overridePlatform = overrideState;
                        m_ModifiedTargetSettings = true;
                        if (m_TargetSettings[i, platformIndex].settings == null)
                        {
                            m_TargetSettings[i, platformIndex].settings = CloneTargetSettings(m_TargetSettings[i, 0].settings);
                        }
                    }
                }
            }

            EditorGUILayout.Space();

            MultiTargetSettingState multiState = CalculateMultiTargetSettingState(platformIndex);

            using (new EditorGUI.DisabledScope(!enableOverrideSettings))
            {
                OnTargetSettingsInspectorGUI(platformIndex, multiState);
            }
        }
Ejemplo n.º 3
0
        void ResetBackendValues()
        {
            ResetSettingsFromBackend();

            // We need to do this so we can calculate the correct fade state
            MultiTargetSettingState state = CalculateMultiTargetSettingState(0);

            m_ShowResizeModeOptions.valueChanged.AddListener(Repaint);
            m_ShowResizeModeOptions.value = state.mixedResizeMode || (state.firstResizeMode != VideoResizeMode.OriginalSize);
        }
Ejemplo n.º 4
0
        private void EncodingSettingsGUI(int platformIndex, MultiTargetSettingState multiState)
        {
            EditorGUI.showMixedValue = multiState.mixedCodec;
            EditorGUI.BeginChangeCheck();
            VideoCodec codec = (VideoCodec)EditorGUILayout.EnumPopup(s_Styles.codecContent, multiState.firstCodec);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                {
                    if (m_TargetSettings[i, platformIndex].settings != null)
                    {
                        m_TargetSettings[i, platformIndex].settings.codec = codec;
                        m_ModifiedTargetSettings = true;
                    }
                }
            }

            EditorGUI.showMixedValue = multiState.mixedBitrateMode;
            EditorGUI.BeginChangeCheck();
            VideoBitrateMode bitrateMode = (VideoBitrateMode)EditorGUILayout.EnumPopup(s_Styles.bitrateContent, multiState.firstBitrateMode);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                {
                    if (m_TargetSettings[i, platformIndex].settings != null)
                    {
                        m_TargetSettings[i, platformIndex].settings.bitrateMode = bitrateMode;
                        m_ModifiedTargetSettings = true;
                    }
                }
            }

            EditorGUI.showMixedValue = multiState.mixedSpatialQuality;
            EditorGUI.BeginChangeCheck();
            VideoSpatialQuality spatialQuality = (VideoSpatialQuality)EditorGUILayout.EnumPopup(s_Styles.spatialQualityContent, multiState.firstSpatialQuality);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                {
                    if (m_TargetSettings[i, platformIndex].settings != null)
                    {
                        m_TargetSettings[i, platformIndex].settings.spatialQuality = spatialQuality;
                        m_ModifiedTargetSettings = true;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnEnable()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            m_UseLegacyImporter = serializedObject.FindProperty("m_UseLegacyImporter");
            m_Quality           = serializedObject.FindProperty("m_Quality");
            m_IsColorLinear     = serializedObject.FindProperty("m_IsColorLinear");
            m_EncodeAlpha       = serializedObject.FindProperty("m_EncodeAlpha");
            m_Deinterlace       = serializedObject.FindProperty("m_Deinterlace");
            m_FlipVertical      = serializedObject.FindProperty("m_FlipVertical");
            m_FlipHorizontal    = serializedObject.FindProperty("m_FlipHorizontal");
            m_ImportAudio       = serializedObject.FindProperty("m_ImportAudio");

            ResetSettingsFromBackend();

            // We need to do this so we can calculate the correct fade state
            MultiTargetSettingState state = CalculateMultiTargetSettingState(0);

            m_ShowResizeModeOptions.valueChanged.AddListener(Repaint);
            m_ShowResizeModeOptions.value = state.mixedResizeMode || (state.firstResizeMode != VideoResizeMode.OriginalSize);
        }
Ejemplo n.º 6
0
        private void FrameSettingsGUI(int platformIndex, MultiTargetSettingState multiState)
        {
            EditorGUI.showMixedValue = multiState.mixedResizeMode;
            EditorGUI.BeginChangeCheck();
            VideoResizeMode resizeMode = (VideoResizeMode)EditorGUILayout.Popup(s_Styles.dimensionsContent, (int)multiState.firstResizeMode, GetResizeModeList().ToArray());

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                {
                    if (m_TargetSettings[i, platformIndex].settings != null)
                    {
                        m_TargetSettings[i, platformIndex].settings.resizeMode = resizeMode;
                        m_ModifiedTargetSettings = true;
                    }
                }
            }

            // First item is "Original".  Options appear if another resize mode is chosen.
            m_ShowResizeModeOptions.target = resizeMode != VideoResizeMode.OriginalSize;
            if (EditorGUILayout.BeginFadeGroup(m_ShowResizeModeOptions.faded))
            {
                EditorGUI.indentLevel++;

                if (resizeMode == VideoResizeMode.CustomSize)
                {
                    EditorGUI.showMixedValue = multiState.mixedCustomWidth;
                    EditorGUI.BeginChangeCheck();
                    int customWidth = EditorGUILayout.IntField(s_Styles.widthContent, multiState.firstCustomWidth);
                    customWidth = Mathf.Clamp(customWidth, kMinCustomWidth, kMaxCustomWidth);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                        {
                            if (m_TargetSettings[i, platformIndex].settings != null)
                            {
                                m_TargetSettings[i, platformIndex].settings.customWidth = customWidth;
                                m_ModifiedTargetSettings = true;
                            }
                        }
                    }

                    EditorGUI.showMixedValue = multiState.mixedCustomHeight;
                    EditorGUI.BeginChangeCheck();
                    int customHeight = EditorGUILayout.IntField(s_Styles.heightContent, multiState.firstCustomHeight);
                    customHeight             = Mathf.Clamp(customHeight, kMinCustomHeight, kMaxCustomHeight);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                        {
                            if (m_TargetSettings[i, platformIndex].settings != null)
                            {
                                m_TargetSettings[i, platformIndex].settings.customHeight = customHeight;
                                m_ModifiedTargetSettings = true;
                            }
                        }
                    }
                }

                EditorGUI.showMixedValue = multiState.mixedAspectRatio;
                EditorGUI.BeginChangeCheck();
                VideoEncodeAspectRatio aspectRatio = (VideoEncodeAspectRatio)EditorGUILayout.EnumPopup(s_Styles.aspectRatioContent, multiState.firstAspectRatio);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
                    {
                        if (m_TargetSettings[i, platformIndex].settings != null)
                        {
                            m_TargetSettings[i, platformIndex].settings.aspectRatio = aspectRatio;
                            m_ModifiedTargetSettings = true;
                        }
                    }
                }

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.EndFadeGroup();
        }
Ejemplo n.º 7
0
        private MultiTargetSettingState CalculateMultiTargetSettingState(int platformIndex)
        {
            MultiTargetSettingState state = new MultiTargetSettingState();

            state.Init();

            if (m_TargetSettings == null || m_TargetSettings.Length == 0)
            {
                return(state);
            }

            int firstValidIndex = -1;

            for (int i = 0; i < m_TargetSettings.GetLength(0); i++)
            {
                if (m_TargetSettings[i, platformIndex].overridePlatform)
                {
                    if (firstValidIndex == -1)
                    {
                        firstValidIndex = i;

                        state.firstTranscoding    = m_TargetSettings[i, platformIndex].settings.enableTranscoding;
                        state.firstCodec          = m_TargetSettings[i, platformIndex].settings.codec;
                        state.firstResizeMode     = m_TargetSettings[i, platformIndex].settings.resizeMode;
                        state.firstAspectRatio    = m_TargetSettings[i, platformIndex].settings.aspectRatio;
                        state.firstCustomWidth    = m_TargetSettings[i, platformIndex].settings.customWidth;
                        state.firstCustomHeight   = m_TargetSettings[i, platformIndex].settings.customHeight;
                        state.firstBitrateMode    = m_TargetSettings[i, platformIndex].settings.bitrateMode;
                        state.firstSpatialQuality = m_TargetSettings[i, platformIndex].settings.spatialQuality;
                    }
                    else
                    {
                        state.mixedTranscoding    = state.firstTranscoding != m_TargetSettings[i, platformIndex].settings.enableTranscoding;
                        state.mixedCodec          = state.firstCodec != m_TargetSettings[i, platformIndex].settings.codec;
                        state.mixedResizeMode     = state.firstResizeMode != m_TargetSettings[i, platformIndex].settings.resizeMode;
                        state.mixedAspectRatio    = state.firstAspectRatio != m_TargetSettings[i, platformIndex].settings.aspectRatio;
                        state.mixedCustomWidth    = state.firstCustomWidth != m_TargetSettings[i, platformIndex].settings.customWidth;
                        state.mixedCustomHeight   = state.firstCustomHeight != m_TargetSettings[i, platformIndex].settings.customHeight;
                        state.mixedBitrateMode    = state.firstBitrateMode != m_TargetSettings[i, platformIndex].settings.bitrateMode;
                        state.mixedSpatialQuality = state.firstSpatialQuality != m_TargetSettings[i, platformIndex].settings.spatialQuality;
                    }
                }
            }

            // If there are no override settings for this platform for ANY of the targets,
            // then just get the default settings and use those.
            if (firstValidIndex == -1)
            {
                // The default settings are always valid
                state.firstTranscoding    = m_TargetSettings[0, 0].settings.enableTranscoding;
                state.firstCodec          = m_TargetSettings[0, 0].settings.codec;
                state.firstResizeMode     = m_TargetSettings[0, 0].settings.resizeMode;
                state.firstAspectRatio    = m_TargetSettings[0, 0].settings.aspectRatio;
                state.firstCustomWidth    = m_TargetSettings[0, 0].settings.customWidth;
                state.firstCustomHeight   = m_TargetSettings[0, 0].settings.customHeight;
                state.firstBitrateMode    = m_TargetSettings[0, 0].settings.bitrateMode;
                state.firstSpatialQuality = m_TargetSettings[0, 0].settings.spatialQuality;
            }

            return(state);
        }