Exemple #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();

            var currentState = ((ScreenSpaceReflection)target).settings;

            var settingsMode = SettingsMode.Custom;

            if (currentState.Equals(ScreenSpaceReflection.SSRSettings.performanceSettings))
            {
                settingsMode = SettingsMode.Performance;
            }
            else if (currentState.Equals(ScreenSpaceReflection.SSRSettings.defaultSettings))
            {
                settingsMode = SettingsMode.Default;
            }
            else if (currentState.Equals(ScreenSpaceReflection.SSRSettings.highQualitySettings))
            {
                settingsMode = SettingsMode.HighQuality;
            }

            EditorGUI.BeginChangeCheck();
            settingsMode = (SettingsMode)EditorGUILayout.EnumPopup("Preset", settingsMode);
            if (EditorGUI.EndChangeCheck())
            {
                Apply(settingsMode);
            }

            // move into the settings fields...
            var settings = StaticFieldFinder <ScreenSpaceReflection> .GetField(x => x.settings);

            foreach (var setting in settings.FieldType.GetFields())
            {
                var prop             = settings.Name + "." + setting.Name;
                var settingsProperty = serializedObject.FindProperty(prop);
                EditorGUILayout.PropertyField(settingsProperty);
            }
            serializedObject.ApplyModifiedProperties();
        }
Exemple #2
0
        private void Initialize()
        {
            m_Styles = new Styles();
            var categories = Enum.GetValues(typeof(LayoutAttribute.Category)).Cast <LayoutAttribute.Category>();

            foreach (var cat in categories)
            {
                if (m_CategoriesToShow.Any(x => x.category == cat))
                {
                    continue;
                }

                m_CategoriesToShow.Add(new CatFoldoutMap(cat, true));
            }

            var prefix = StaticFieldFinder <ScreenSpaceReflection> .GetField(x => x.settings);

            foreach (var field in typeof(ScreenSpaceReflection.SSRSettings).GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                PopulateMap(prefix, field);
            }

            m_Initialized = true;
        }