Exemple #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            Initialize(property);

            m_ImageHeight.intValue = m_HeightSelector.Popup(label, m_ImageHeight.intValue, m_MaxSupportedHeight.intValue);
            var selected = (ImageHeight)m_ImageHeight.intValue;

            if (selected == ImageHeight.Custom)
            {
                var outputDimensions = new int[2];
                outputDimensions[0] = m_CustomWidth.intValue;
                outputDimensions[1] = m_CustomHeight.intValue;

                if (UIElementHelper.MultiIntField(GUIContent.none, Styles.CustomDimensionsLabels, outputDimensions))
                {
                    m_CustomWidth.intValue  = outputDimensions[0];
                    m_CustomHeight.intValue = outputDimensions[1];
                }
            }

            if (selected != ImageHeight.Custom && selected != ImageHeight.Window)
            {
                EditorGUILayout.PropertyField(m_AspectRatio, Styles.ImageAspectLabel);
            }
        }
        internal bool RecordModeGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(m_RecordModeProperty, Styles.RecordModeLabel);

            ++EditorGUI.indentLevel;

            switch ((RecordMode)m_RecordModeProperty.enumValueIndex)
            {
            case RecordMode.Manual:
            {
                // Nothing
                break;
            }

            case RecordMode.SingleFrame:
            {
                var value = EditorGUILayout.IntField(Styles.SingleFrameLabel, m_StartFrameProperty.intValue);
                m_StartFrameProperty.intValue = Mathf.Max(value, 0);

                break;
            }

            case RecordMode.FrameInterval:
            {
                var outputDimensions = new int[2];
                outputDimensions[0] = m_StartFrameProperty.intValue;
                outputDimensions[1] = m_EndFrameProperty.intValue;

                if (UIElementHelper.MultiIntField(GUIContent.none, new[] { Styles.StartLabel, Styles.EndLabel },
                                                  outputDimensions))
                {
                    m_StartFrameProperty.intValue = Mathf.Max(outputDimensions[0], 0);
                    m_EndFrameProperty.intValue   = Mathf.Max(outputDimensions[1], m_StartFrameProperty.intValue);
                }

                break;
            }

            case RecordMode.TimeInterval:
            {
                var outputDimensions = new float[2];
                outputDimensions[0] = m_StartTimeProperty.floatValue;
                outputDimensions[1] = m_EndTimeProperty.floatValue;

                if (UIElementHelper.MultiFloatField(GUIContent.none, new[] { Styles.StartLabel, Styles.EndLabel },
                                                    outputDimensions))
                {
                    m_StartTimeProperty.floatValue = Mathf.Max(outputDimensions[0], 0);
                    m_EndTimeProperty.floatValue   = Mathf.Max(outputDimensions[1], m_StartTimeProperty.floatValue);
                }

                break;
            }
            }

            --EditorGUI.indentLevel;

            serializedObject.ApplyModifiedProperties();

            return(GUI.changed);
        }