示例#1
0
        public override void OnInspectorGUI()
        {
            AddProperty(m_Source, () =>
            {
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    if (m_MaskedSourceNames == null)
                    {
                        m_MaskedSourceNames = EnumHelper.MaskOutEnumNames <EImageSource>((int)m_SupportedSources);
                    }
                    var index = EnumHelper.GetMaskedIndexFromEnumValue <EImageSource>(m_Source.intValue, (int)m_SupportedSources);
                    index     = EditorGUILayout.Popup("Source", index, m_MaskedSourceNames);

                    if (check.changed)
                    {
                        m_Source.intValue = EnumHelper.GetEnumValueFromMaskedIndex <EImageSource>(index, (int)m_SupportedSources);
                    }
                }
            });

            var inputType = (EImageSource)m_Source.intValue;

            if ((EImageSource)m_Source.intValue == EImageSource.TaggedCamera)
            {
                ++EditorGUI.indentLevel;
                AddProperty(m_CameraTag, () => EditorGUILayout.PropertyField(m_CameraTag, new GUIContent("Tag")));
                --EditorGUI.indentLevel;
            }


            if (inputType != EImageSource.RenderTexture)
            {
                AddProperty(m_RenderSize, () =>
                {
                    m_ResSelector.OnInspectorGUI((target as ImageInputSettings).maxSupportedSize, m_RenderSize);
                });

                if (m_RenderSize.intValue > (int)EImageDimension.Window)
                {
                    AddProperty(m_RenderAspect, () => EditorGUILayout.PropertyField(m_RenderAspect, new GUIContent("Aspect Ratio")));
                }

                if (inputType == EImageSource.ActiveCameras)
                {
                    AddProperty(m_CaptureUI, () => EditorGUILayout.PropertyField(m_CaptureUI, new GUIContent("Capture UI")));
                }
            }

            AddProperty(m_Transparency, () => EditorGUILayout.PropertyField(m_Transparency, new GUIContent("Capture alpha")));

            if (Verbose.enabled)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.PropertyField(m_FlipFinalOutput, new GUIContent("Flip output"));
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            AddProperty(m_RenderSize, () =>
            {
                m_ResSelector.OnInspectorGUI((target as ImageInputSettings).maxSupportedSize, m_RenderSize);
            });

            if (m_RenderSize.intValue > (int)EImageDimension.Window)
            {
                AddProperty(m_RenderAspect, () => EditorGUILayout.PropertyField(m_RenderAspect, new GUIContent("Aspect Ratio")));
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            AddProperty(m_Source, () =>
            {
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    if (m_MaskedSourceNames == null)
                    {
                        m_MaskedSourceNames = EnumHelper.MaskOutEnumNames <EImageSource>((int)m_SupportedSources);
                    }
                    var index = EnumHelper.GetMaskedIndexFromEnumValue <EImageSource>(m_Source.intValue, (int)m_SupportedSources);
                    index     = EditorGUILayout.Popup("Object(s) of interest", index, m_MaskedSourceNames);

                    if (check.changed)
                    {
                        m_Source.intValue = EnumHelper.GetEnumValueFromMaskedIndex <EImageSource>(index, (int)m_SupportedSources);
                    }
                }
            });

            var inputType = (EImageSource)m_Source.intValue;

            if ((EImageSource)m_Source.intValue == EImageSource.TaggedCamera)
            {
                ++EditorGUI.indentLevel;
                AddProperty(m_CameraTag, () => EditorGUILayout.PropertyField(m_CameraTag, new GUIContent("Tag")));
                --EditorGUI.indentLevel;
            }

            AddProperty(m_AspectRatio, () => EditorGUILayout.PropertyField(m_AspectRatio, new GUIContent("Aspect Ratio")));
            AddProperty(m_SuperSampling, () => EditorGUILayout.PropertyField(m_SuperSampling, new GUIContent("Super sampling")));

            var renderSize = m_RenderSize;

            AddProperty(m_RenderSize, () =>
            {
                if (inputType != EImageSource.RenderTexture)
                {
                    EditorGUILayout.PropertyField(m_RenderSize, new GUIContent("Rendering resolution"));
                    if (m_FinalSize.intValue > renderSize.intValue)
                    {
                        m_FinalSize.intValue = renderSize.intValue;
                    }
                }
            });

            AddProperty(m_FinalSize, () =>
            {
                m_ResSelector.OnInspectorGUI((target as ImageInputSettings).maxSupportedSize, m_FinalSize);
                if (m_FinalSize.intValue == (int)EImageDimension.Window)
                {
                    m_FinalSize.intValue = (int)EImageDimension.x720p_HD;
                }
                if (m_FinalSize.intValue > renderSize.intValue)
                {
                    renderSize.intValue = m_FinalSize.intValue;
                }
            });

            EditorGUILayout.PropertyField(m_FlipFinalOutput, new GUIContent("Flip image vertically"));
            if (Verbose.enabled)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.TextField("Color Space", (target as RenderTextureSamplerSettings).m_ColorSpace.ToString());
                }
            }

            serializedObject.ApplyModifiedProperties();
        }