コード例 #1
0
        private bool ValidateAABB(ref Vector3 center, ref Vector3 size)
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
            Vector3         point           = ReflectionProbeEditor.GetLocalSpace(reflectionProbe).inverse.MultiplyPoint3x4(reflectionProbe.transform.position);
            Bounds          bounds          = new Bounds(center, size);
            bool            result;

            if (bounds.Contains(point))
            {
                result = false;
            }
            else
            {
                bounds.Encapsulate(point);
                center = bounds.center;
                size   = bounds.size;
                result = true;
            }
            return(result);
        }
コード例 #2
0
        private void DoToolbar()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.changed = false;
            EditMode.SceneViewEditMode editMode = EditMode.editMode;
            EditorGUI.BeginChangeCheck();
            EditMode.DoInspectorToolbar(ReflectionProbeEditor.Styles.sceneViewEditModes, ReflectionProbeEditor.Styles.toolContents, this.GetBounds(), this);
            if (EditorGUI.EndChangeCheck())
            {
                ReflectionProbeEditor.s_LastInteractedEditor = this;
            }
            if (editMode != EditMode.editMode)
            {
                EditMode.SceneViewEditMode editMode2 = EditMode.editMode;
                if (editMode2 == EditMode.SceneViewEditMode.ReflectionProbeOrigin)
                {
                    this.UpdateOldLocalSpace();
                }
                if (Toolbar.get != null)
                {
                    Toolbar.get.Repaint();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            string text = ReflectionProbeEditor.Styles.baseSceneEditingToolText;

            if (this.sceneViewEditing)
            {
                int num = ArrayUtility.IndexOf <EditMode.SceneViewEditMode>(ReflectionProbeEditor.Styles.sceneViewEditModes, EditMode.editMode);
                if (num >= 0)
                {
                    text = ReflectionProbeEditor.Styles.toolNames[num].text;
                }
            }
            GUILayout.Label(text, ReflectionProbeEditor.Styles.richTextMiniLabel, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            EditorGUILayout.Space();
        }
コード例 #3
0
        private void DoToolbar()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.changed = false;
            UnityEditorInternal.EditMode.SceneViewEditMode editMode = UnityEditorInternal.EditMode.editMode;
            EditorGUI.BeginChangeCheck();
            UnityEditorInternal.EditMode.DoInspectorToolbar(Styles.sceneViewEditModes, Styles.toolContents, this.GetBounds(), this);
            if (EditorGUI.EndChangeCheck())
            {
                s_LastInteractedEditor = this;
            }
            if (editMode != UnityEditorInternal.EditMode.editMode)
            {
                if (UnityEditorInternal.EditMode.editMode == UnityEditorInternal.EditMode.SceneViewEditMode.ReflectionProbeOrigin)
                {
                    this.m_OldTransformPosition = ((ReflectionProbe)this.target).transform.position;
                }
                if (Toolbar.get != null)
                {
                    Toolbar.get.Repaint();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            string baseSceneEditingToolText = Styles.baseSceneEditingToolText;

            if (this.sceneViewEditing)
            {
                int index = ArrayUtility.IndexOf <UnityEditorInternal.EditMode.SceneViewEditMode>(Styles.sceneViewEditModes, UnityEditorInternal.EditMode.editMode);
                if (index >= 0)
                {
                    baseSceneEditingToolText = Styles.toolNames[index].text;
                }
            }
            GUILayout.Label(baseSceneEditingToolText, Styles.richTextMiniLabel, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            EditorGUILayout.Space();
        }
コード例 #4
0
        private void DoBoxEditing()
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;

            using (new Handles.DrawingScope(ReflectionProbeEditor.GetLocalSpace(reflectionProbe)))
            {
                this.m_BoundsHandle.center = reflectionProbe.center;
                this.m_BoundsHandle.size   = reflectionProbe.size;
                EditorGUI.BeginChangeCheck();
                this.m_BoundsHandle.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(reflectionProbe, "Modified Reflection Probe AABB");
                    Vector3 center = this.m_BoundsHandle.center;
                    Vector3 size   = this.m_BoundsHandle.size;
                    this.ValidateAABB(ref center, ref size);
                    reflectionProbe.center = center;
                    reflectionProbe.size   = size;
                    EditorUtility.SetDirty(base.target);
                }
            }
        }
コード例 #5
0
        private void DoOriginEditing()
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
            Vector3         position        = reflectionProbe.transform.position;
            Vector3         size            = reflectionProbe.size;

            EditorGUI.BeginChangeCheck();
            Vector3 v = Handles.PositionHandle(position, ReflectionProbeEditor.GetLocalSpaceRotation(reflectionProbe));

            if (EditorGUI.EndChangeCheck() || this.m_OldLocalSpace != ReflectionProbeEditor.GetLocalSpace((ReflectionProbe)base.target))
            {
                Vector3 vector = this.m_OldLocalSpace.inverse.MultiplyPoint3x4(v);
                Bounds  bounds = new Bounds(reflectionProbe.center, size);
                vector = bounds.ClosestPoint(vector);
                Undo.RecordObject(reflectionProbe.transform, "Modified Reflection Probe Origin");
                reflectionProbe.transform.position = this.m_OldLocalSpace.MultiplyPoint3x4(vector);
                Undo.RecordObject(reflectionProbe, "Modified Reflection Probe Origin");
                reflectionProbe.center = ReflectionProbeEditor.GetLocalSpace(reflectionProbe).inverse.MultiplyPoint3x4(this.m_OldLocalSpace.MultiplyPoint3x4(reflectionProbe.center));
                EditorUtility.SetDirty(base.target);
                this.UpdateOldLocalSpace();
            }
        }
コード例 #6
0
        private static Matrix4x4 GetLocalSpace(ReflectionProbe probe)
        {
            Vector3 position = probe.transform.position;

            return(Matrix4x4.TRS(position, ReflectionProbeEditor.GetLocalSpaceRotation(probe), Vector3.one));
        }
コード例 #7
0
 private void UpdateOldLocalSpace()
 {
     this.m_OldLocalSpace = ReflectionProbeEditor.GetLocalSpace((ReflectionProbe)base.target);
 }
コード例 #8
0
        private void DrawGUI()
        {
            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                // ambient GI - realtime / baked
                bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool bakedGISupported    = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported))
                {
                    int[] modeVals = { 0, 1 };

                    if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue)
                    {
                        // if the user has selected the only state that is supported, then gray it out
                        using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported)))
                        {
                            EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode);
                        }

                        // if they have selected a state that isnt supported, show dialog, and still make the box editable
                        if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ||
                            ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning);
                        }
                    }
                    // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.)
                    else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals);
                        }
                    }
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
コード例 #9
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            if (base.targets.Length == 1)
            {
                this.DoToolbar();
            }
            this.m_ShowProbeModeRealtimeOptions.target = (this.reflectionProbeMode == ReflectionProbeMode.Realtime);
            this.m_ShowProbeModeCustomOptions.target   = (this.reflectionProbeMode == ReflectionProbeMode.Custom);
            EditorGUILayout.IntPopup(this.m_Mode, ReflectionProbeEditor.Styles.reflectionProbeMode, ReflectionProbeEditor.Styles.reflectionProbeModeValues, ReflectionProbeEditor.Styles.typeText, new GUILayoutOption[0]);
            if (!this.m_Mode.hasMultipleDifferentValues)
            {
                EditorGUI.indentLevel++;
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeCustomOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_RenderDynamicObjects, ReflectionProbeEditor.Styles.renderDynamicObjects, new GUILayoutOption[0]);
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = this.m_CustomBakedTexture.hasMultipleDifferentValues;
                    UnityEngine.Object objectReferenceValue = EditorGUILayout.ObjectField(ReflectionProbeEditor.Styles.customCubemapText, this.m_CustomBakedTexture.objectReferenceValue, typeof(Cubemap), false, new GUILayoutOption[0]);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_CustomBakedTexture.objectReferenceValue = objectReferenceValue;
                    }
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowProbeModeRealtimeOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_RefreshMode, ReflectionProbeEditor.Styles.refreshMode, new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_TimeSlicingMode, ReflectionProbeEditor.Styles.timeSlicing, new GUILayoutOption[0]);
                    EditorGUILayout.Space();
                }
                EditorGUILayout.EndFadeGroup();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Space();
            GUILayout.Label(ReflectionProbeEditor.Styles.runtimeSettingsHeader, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(this.m_Importance, ReflectionProbeEditor.Styles.importanceText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_IntensityMultiplier, ReflectionProbeEditor.Styles.intensityText, new GUILayoutOption[0]);
            if (!EditorGraphicsSettings.GetCurrentTierSettings().reflectionProbeBoxProjection)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.Toggle(ReflectionProbeEditor.Styles.boxProjectionText, false, new GUILayoutOption[0]);
                }
            }
            else
            {
                EditorGUILayout.PropertyField(this.m_BoxProjection, ReflectionProbeEditor.Styles.boxProjectionText, new GUILayoutOption[0]);
            }
            bool flag  = SceneView.IsUsingDeferredRenderingPath();
            bool flag2 = flag && GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled;

            using (new EditorGUI.DisabledScope(!flag2))
            {
                EditorGUILayout.PropertyField(this.m_BlendDistance, ReflectionProbeEditor.Styles.blendDistanceText, new GUILayoutOption[0]);
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBoxOptions.faded))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_BoxSize, ReflectionProbeEditor.Styles.sizeText, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_BoxOffset, ReflectionProbeEditor.Styles.centerText, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    Vector3 vector3Value  = this.m_BoxOffset.vector3Value;
                    Vector3 vector3Value2 = this.m_BoxSize.vector3Value;
                    if (this.ValidateAABB(ref vector3Value, ref vector3Value2))
                    {
                        this.m_BoxOffset.vector3Value = vector3Value;
                        this.m_BoxSize.vector3Value   = vector3Value2;
                    }
                }
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            GUILayout.Label(ReflectionProbeEditor.Styles.captureCubemapHeaderText, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            int[]        optionValues     = null;
            GUIContent[] displayedOptions = null;
            ReflectionProbeEditor.GetResolutionArray(ref optionValues, ref displayedOptions);
            EditorGUILayout.IntPopup(this.m_Resolution, displayedOptions, optionValues, ReflectionProbeEditor.Styles.resolutionText, new GUILayoutOption[]
            {
                GUILayout.MinWidth(40f)
            });
            EditorGUILayout.PropertyField(this.m_HDR, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ShadowDistance, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_ClearFlags, ReflectionProbeEditor.Styles.clearFlags, ReflectionProbeEditor.Styles.clearFlagsValues, ReflectionProbeEditor.Styles.clearFlagsText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_BackgroundColor, ReflectionProbeEditor.Styles.backgroundColorText, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_UseOcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarProperties, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            if (base.targets.Length == 1)
            {
                ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
                if (reflectionProbe.mode == ReflectionProbeMode.Custom && reflectionProbe.customBakedTexture != null)
                {
                    Cubemap cubemap = reflectionProbe.customBakedTexture as Cubemap;
                    if (cubemap && cubemap.mipmapCount == 1)
                    {
                        EditorGUILayout.HelpBox("No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.", MessageType.Warning);
                    }
                }
            }
            this.DoBakeButton();
            EditorGUILayout.Space();
            base.serializedObject.ApplyModifiedProperties();
        }
コード例 #10
0
        private void DrawGUI()
        {
            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(m_SubtractiveShadowColor, Styles.SubtractiveColor);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
コード例 #11
0
 private void DoToolbar()
 {
   GUILayout.BeginHorizontal();
   GUILayout.FlexibleSpace();
   GUI.changed = false;
   UnityEditorInternal.EditMode.SceneViewEditMode editMode = UnityEditorInternal.EditMode.editMode;
   EditorGUI.BeginChangeCheck();
   UnityEditorInternal.EditMode.DoInspectorToolbar(ReflectionProbeEditor.Styles.sceneViewEditModes, ReflectionProbeEditor.Styles.toolContents, this.GetBounds(), (Editor) this);
   if (EditorGUI.EndChangeCheck())
     ReflectionProbeEditor.s_LastInteractedEditor = this;
   if (editMode != UnityEditorInternal.EditMode.editMode)
   {
     if (UnityEditorInternal.EditMode.editMode == UnityEditorInternal.EditMode.SceneViewEditMode.ReflectionProbeOrigin)
       this.m_OldTransformPosition = ((Component) this.target).transform.position;
     if ((UnityEngine.Object) Toolbar.get != (UnityEngine.Object) null)
       Toolbar.get.Repaint();
   }
   GUILayout.FlexibleSpace();
   GUILayout.EndHorizontal();
   GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
   string text = ReflectionProbeEditor.Styles.baseSceneEditingToolText;
   if (this.sceneViewEditing)
   {
     int index = ArrayUtility.IndexOf<UnityEditorInternal.EditMode.SceneViewEditMode>(ReflectionProbeEditor.Styles.sceneViewEditModes, UnityEditorInternal.EditMode.editMode);
     if (index >= 0)
       text = ReflectionProbeEditor.Styles.toolNames[index].text;
   }
   GUILayout.Label(text, ReflectionProbeEditor.Styles.richTextMiniLabel, new GUILayoutOption[0]);
   GUILayout.EndVertical();
   EditorGUILayout.Space();
 }
コード例 #12
0
		private void DoToolbar()
		{
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);
			GUILayout.FlexibleSpace();
			GUI.changed = false;
			EditMode.SceneViewEditMode editMode = EditMode.editMode;
			EditorGUI.BeginChangeCheck();
			EditMode.DoInspectorToolbar(ReflectionProbeEditor.Styles.sceneViewEditModes, ReflectionProbeEditor.Styles.toolContents, this.GetBounds(), this);
			if (EditorGUI.EndChangeCheck())
			{
				ReflectionProbeEditor.s_LastInteractedEditor = this;
			}
			if (editMode != EditMode.editMode)
			{
				EditMode.SceneViewEditMode editMode2 = EditMode.editMode;
				if (editMode2 == EditMode.SceneViewEditMode.ReflectionProbeOrigin)
				{
					this.m_OldTransformPosition = ((ReflectionProbe)this.target).transform.position;
				}
				if (Toolbar.get != null)
				{
					Toolbar.get.Repaint();
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
			string text = ReflectionProbeEditor.Styles.baseSceneEditingToolText;
			if (this.sceneViewEditing)
			{
				int num = ArrayUtility.IndexOf<EditMode.SceneViewEditMode>(ReflectionProbeEditor.Styles.sceneViewEditModes, EditMode.editMode);
				if (num >= 0)
				{
					text = ReflectionProbeEditor.Styles.toolNames[num].text;
				}
			}
			GUILayout.Label(text, ReflectionProbeEditor.Styles.richTextMiniLabel, new GUILayoutOption[0]);
			GUILayout.EndVertical();
			EditorGUILayout.Space();
		}
コード例 #13
0
        private void DrawGUI()
        {
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true);
            if (this.m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]);
                if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
                {
                    EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
                }
                EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]);
                AmbientMode intValue = (AmbientMode)this.m_AmbientSource.intValue;
                if (intValue != AmbientMode.Trilight)
                {
                    if (intValue != AmbientMode.Flat)
                    {
                        if (intValue == AmbientMode.Skybox)
                        {
                            if (material == null)
                            {
                                EditorGUI.BeginChangeCheck();
                                Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    this.m_AmbientSkyColor.colorValue = colorValue;
                                }
                            }
                            else
                            {
                                EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.env_amb_int, new GUILayoutOption[0]);
                            }
                        }
                    }
                    else
                    {
                        EditorGUI.BeginChangeCheck();
                        Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            this.m_AmbientSkyColor.colorValue = colorValue2;
                        }
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_AmbientSkyColor.colorValue     = colorValue3;
                        this.m_AmbientEquatorColor.colorValue = colorValue4;
                        this.m_AmbientGroundColor.colorValue  = colorValue5;
                    }
                }
                bool flag  = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool flag2 = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);
                if ((this.m_EnabledBakedGI.boolValue || this.m_EnabledRealtimeGI.boolValue) && (flag2 || flag))
                {
                    int[] optionValues = new int[]
                    {
                        0,
                        1
                    };
                    if (this.m_EnabledBakedGI.boolValue && this.m_EnabledRealtimeGI.boolValue)
                    {
                        using (new EditorGUI.DisabledScope((this.m_AmbientLightingMode.intValue == 0 && flag && !flag2) || (this.m_AmbientLightingMode.intValue == 1 && flag2 && !flag)))
                        {
                            EditorGUILayout.IntPopup(this.m_AmbientLightingMode, LightingEditor.Styles.AmbientLightingModes, optionValues, LightingEditor.Styles.AmbientLightingMode, new GUILayoutOption[0]);
                        }
                        if ((this.m_AmbientLightingMode.intValue == 0 && !flag) || (this.m_AmbientLightingMode.intValue == 1 && !flag2))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + ((this.m_AmbientLightingMode.intValue != 0 || flag) ? "Realtime" : "Baked"), MessageType.Warning);
                        }
                    }
                    else if ((this.m_EnabledBakedGI.boolValue && flag2) || (this.m_EnabledRealtimeGI.boolValue && flag))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, (!this.m_EnabledBakedGI.boolValue) ? 0 : 1, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]);
                DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
                if (intValue2 != DefaultReflectionMode.FromSkybox)
                {
                    if (intValue2 == DefaultReflectionMode.Custom)
                    {
                        EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                    }
                }
                else
                {
                    int[]        optionValues2    = null;
                    GUIContent[] displayedOptions = null;
                    ReflectionProbeEditor.GetResolutionArray(ref optionValues2, ref displayedOptions);
                    EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, displayedOptions, optionValues2, LightingEditor.Styles.env_refl_res, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(40f)
                    });
                }
                EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]);
                EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }