Пример #1
0
        protected static void Drawer_Toolbars(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUI.changed = false;

            foreach (ToolBar toolBar in s.toolBars)
            {
                List <EditMode.SceneViewEditMode> listMode = new List <EditMode.SceneViewEditMode>();
                List <GUIContent> listContent = new List <GUIContent>();
                if ((toolBar & ToolBar.InfluenceShape) > 0)
                {
                    listMode.Add(toolbar_Mode[ToolBar.InfluenceShape]);
                    listContent.Add(toolbar_Contents[ToolBar.InfluenceShape]);
                }
                if ((toolBar & ToolBar.Blend) > 0)
                {
                    listMode.Add(toolbar_Mode[ToolBar.Blend]);
                    listContent.Add(toolbar_Contents[ToolBar.Blend]);
                }
                if ((toolBar & ToolBar.NormalBlend) > 0)
                {
                    listMode.Add(toolbar_Mode[ToolBar.NormalBlend]);
                    listContent.Add(toolbar_Contents[ToolBar.NormalBlend]);
                }
                if ((toolBar & ToolBar.CapturePosition) > 0)
                {
                    listMode.Add(toolbar_Mode[ToolBar.CapturePosition]);
                    listContent.Add(toolbar_Contents[ToolBar.CapturePosition]);
                }
                EditMode.DoInspectorToolbar(listMode.ToArray(), listContent.ToArray(), GetBoundsGetter(o), o);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
Пример #2
0
#pragma warning restore 618

        //temporary to lock UI on realtime until other mode than realtime are usable
        new static void Drawer_ReflectionProbeMode(HDProbeUI s, SerializedHDProbe p, Editor owner)
        {
            using (new EditorGUI.DisabledScope(true))
            {
                HDProbeUI.Drawer_ReflectionProbeMode(s, p, owner);
            }
        }
 protected static void Drawer_SectionProbeModeRealtimeSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
 {
     GUI.enabled = false;
     EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode|Only EveryFrame supported at the moment"));
     GUI.enabled = true;
     EditorGUILayout.Space();
 }
Пример #4
0
        internal static void DrawHandles(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            HDProbe probe = d.target as HDProbe;
            var     mat   = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);

            switch (EditMode.editMode)
            {
            case EditBaseShape:
                //important: following will init the container for box.
                //This must be done before drawing the contained handles
                if (o is PlanarReflectionProbeEditor && (InfluenceShape)d.influenceVolume.shape.intValue == InfluenceShape.Box)
                {
                    //Planar need to update its transform position.
                    //Let PlanarReflectionProbeUI.Handle do this work.
                    break;
                }
                InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditInfluenceShape:
                InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditInfluenceNormalShape:
                InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditCenter:
            {
                if (o is PlanarReflectionProbeEditor && (InfluenceShape)d.influenceVolume.shape.intValue == InfluenceShape.Box)
                {
                    //Planar need to update its transform position.
                    //Let PlanarReflectionProbeUI.Handle do this work.
                    break;
                }
                using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one)))
                {
                    EditorGUI.BeginChangeCheck();
                    var newCapturePosition = Handles.PositionHandle(probe.transform.position, probe.transform.rotation);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Vector3 newOffset = Quaternion.Inverse(probe.transform.rotation) * (newCapturePosition - probe.transform.position);
                        Undo.RecordObjects(new Object[] { probe, probe.transform }, "Translate Influence Position");
                        Vector3   delta           = newCapturePosition - probe.transform.position;
                        Matrix4x4 oldLocalToWorld = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);

                        //call modification to legacy ReflectionProbe
                        probe.influenceVolume.offset = newOffset;

                        probe.transform.position = newCapturePosition;
                        d.influenceVolume.offset.vector3Value -= oldLocalToWorld.inverse.MultiplyVector(delta);
                        d.influenceVolume.Apply();
                    }
                }
                break;
            }
            }
        }
Пример #5
0
            public static void DrawCustomSettings(SerializedHDProbe serialized, Editor owner)
            {
                var provider = new TProvider();

                ProbeSettingsUI.Draw(
                    serialized.probeSettings, owner,
                    serialized.probeSettingsOverride,
                    provider.displayedAdvancedSettings, provider.overrideableAdvancedSettings
                    );
            }
 protected static void Drawer_SectionBakeButton(HDProbeUI s, SerializedHDProbe d, Editor o)
 {
     if (d.target is HDAdditionalReflectionData)
     {
         EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, ((HDAdditionalReflectionData)d.target).reflectionProbe);
     }
     else //PlanarReflectionProbe
     {
         EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, d.target as PlanarReflectionProbe);
     }
 }
Пример #7
0
        protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            EditorGUILayout.PropertyField(d.weight, weightContent);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(d.multiplier, multiplierContent);
            if (EditorGUI.EndChangeCheck())
            {
                d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue);
            }
        }
 protected static void Drawer_ReflectionProbeMode(HDProbeUI s, SerializedHDProbe p, Editor owner)
 {
     EditorGUI.BeginChangeCheck();
     EditorGUI.showMixedValue = p.mode.hasMultipleDifferentValues;
     EditorGUILayout.IntPopup(p.mode, k_ModeContents, k_ModeValues, CoreEditorUtils.GetContent("Type|'Baked Cubemap' uses the 'Auto Baking' mode from the Lighting window. If it is enabled then baking is automatic otherwise manual bake is needed (use the bake button below). \n'Custom' can be used if a custom cubemap is wanted. \n'Realtime' can be used to dynamically re-render the cubemap during runtime (via scripting)."));
     EditorGUI.showMixedValue = false;
     if (EditorGUI.EndChangeCheck())
     {
         s.SetModeTarget(p.mode.intValue);
         p.Apply();
     }
 }
Пример #9
0
            // Drawers
            public static void DrawPrimarySettings(SerializedHDProbe serialized, Editor owner)
            {
                const string modeTooltip = "'Baked' uses the 'Auto Baking' mode from the Lighting window. " +
                                           "If it is enabled then baking is automatic otherwise manual bake is needed (use the bake button below). \n" +
                                           "'Custom' can be used if a custom capture is wanted. \n" +
                                           "'Realtime' can be used to dynamically re-render the capture during runtime (every frame).";

                var provider = new TProvider();

#if !ENABLE_BAKED_PLANAR
                if (serialized is SerializedPlanarReflectionProbe)
                {
                    serialized.probeSettings.mode.intValue = (int)ProbeSettings.Mode.Realtime;
                }
                else
                {
#endif

                // Probe Mode
                EditorGUI.showMixedValue = serialized.probeSettings.mode.hasMultipleDifferentValues;
                EditorGUILayout.IntPopup(serialized.probeSettings.mode, k_ModeContents, k_ModeValues, EditorGUIUtility.TrTextContent("Type", modeTooltip));
                EditorGUI.showMixedValue = false;

#if !ENABLE_BAKED_PLANAR
            }
#endif

                switch ((ProbeSettings.Mode)serialized.probeSettings.mode.intValue)
                {
                case ProbeSettings.Mode.Realtime:
                {
                    EditorGUI.showMixedValue = serialized.probeSettings.realtimeMode.hasMultipleDifferentValues;
                    EditorGUILayout.PropertyField(serialized.probeSettings.realtimeMode);
                    EditorGUI.showMixedValue = false;
                    break;
                }

                case ProbeSettings.Mode.Custom:
                {
                    EditorGUI.showMixedValue = serialized.customTexture.hasMultipleDifferentValues;
                    EditorGUI.BeginChangeCheck();
                    var customTexture = EditorGUILayout.ObjectField(
                        EditorGUIUtility.TrTextContent("Texture"), serialized.customTexture.objectReferenceValue, provider.customTextureType, false
                        );
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        serialized.customTexture.objectReferenceValue = customTexture;
                    }
                    break;
                }
                }
            }
        static void Drawer_CaptureSettings(HDProbeUI s, SerializedHDProbe p, Editor owner)
        {
            var renderPipelineAsset = (HDRenderPipelineAsset)GraphicsSettings.renderPipelineAsset;

            p.resolution.intValue = (int)renderPipelineAsset.GetRenderPipelineSettings().lightLoopSettings.reflectionCubemapSize;
            EditorGUILayout.LabelField(resolutionContent, CoreEditorUtils.GetContent(p.resolution.intValue.ToString()));

            EditorGUILayout.PropertyField(p.shadowDistance, shadowDistanceContent);
            EditorGUILayout.PropertyField(p.cullingMask, cullingMaskContent);
            EditorGUILayout.PropertyField(p.useOcclusionCulling, useOcclusionCullingContent);
            EditorGUILayout.PropertyField(p.nearClip, nearClipCullingContent);
            EditorGUILayout.PropertyField(p.farClip, farClipCullingContent);
        }
Пример #11
0
        protected static void Drawer_ModeSettingsCustom(HDProbeUI s, SerializedHDProbe p, Editor owner)
        {
            EditorGUILayout.PropertyField(p.renderDynamicObjects, CoreEditorUtils.GetContent("Dynamic Objects|If enabled dynamic objects are also rendered into the cubemap"));

            EditorGUI.showMixedValue = p.customBakedTexture.hasMultipleDifferentValues;
            EditorGUI.BeginChangeCheck();
            var customTexture = EditorGUILayout.ObjectField(CoreEditorUtils.GetContent("Cubemap"), p.customBakedTexture.objectReferenceValue, typeof(Cubemap), false);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                p.customBakedTexture.objectReferenceValue = customTexture;
            }
        }
Пример #12
0
        protected static void Drawer_DifferentShapeError(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent;

            if (proxy != null &&
                (int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex &&
                proxy.proxyVolume.shape != ProxyShape.Infinite)
            {
                EditorGUILayout.HelpBox(
                    proxyInfluenceShapeMismatchHelpBoxText,
                    MessageType.Error,
                    true
                    );
            }
        }
Пример #13
0
        static internal void Drawer_DifferentShapeError(SerializedHDProbe serialized, Editor owner)
        {
            var proxy = serialized.proxyVolume.objectReferenceValue as ReflectionProxyVolumeComponent;

            if (proxy != null &&
                (int)proxy.proxyVolume.shape != serialized.probeSettings.influence.shape.enumValueIndex &&
                proxy.proxyVolume.shape != ProxyShape.Infinite)
            {
                EditorGUILayout.HelpBox(
                    k_ProxyInfluenceShapeMismatchHelpBoxText,
                    MessageType.Error,
                    true
                    );
            }
        }
Пример #14
0
            // Tool bars
            public static void DrawToolbars(SerializedHDProbe serialized, Editor owner)
            {
                var provider = new TProvider();

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.changed = false;

                for (int i = 0; i < k_ListModes.Length; ++i)
                {
                    EditMode.DoInspectorToolbar(k_ListModes[i], k_ListContent[i], HDEditorUtils.GetBoundsGetter(owner), owner);
                }

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
Пример #15
0
        protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            using (new EditorGUI.DisabledScope(!HDUtils.hdrpSettings.supportLightLayers))
            {
                d.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(lightLayersContent, (LightLayerEnum)d.lightLayers.intValue));
            }

            EditorGUILayout.PropertyField(d.weight, weightContent);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(d.multiplier, multiplierContent);
            if (EditorGUI.EndChangeCheck())
            {
                d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue);
            }
        }
Пример #16
0
        internal static void DrawHandles(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            HDProbe probe = d.target as HDProbe;
            var     mat   = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);

            switch (EditMode.editMode)
            {
            case EditBaseShape:
                InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditInfluenceShape:
                InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditInfluenceNormalShape:
                InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, d.influenceVolume, o, mat, probe);
                break;

            case EditCenter:
            {
                using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one)))
                {
                    //Vector3 offsetWorld = probe.transform.position + probe.transform.rotation * probe.influenceVolume.offset;
                    EditorGUI.BeginChangeCheck();
                    var newCapturePosition = Handles.PositionHandle(probe.transform.position, probe.transform.rotation);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Vector3 newOffset = Quaternion.Inverse(probe.transform.rotation) * (newCapturePosition - probe.transform.position);
                        Undo.RecordObjects(new Object[] { probe, probe.transform }, "Translate Influence Position");
                        Vector3   delta           = newCapturePosition - probe.transform.position;
                        Matrix4x4 oldLocalToWorld = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);

                        //call modification to legacy ReflectionProbe
                        probe.influenceVolume.offset = newOffset;

                        probe.transform.position = newCapturePosition;
                        d.influenceVolume.offset.vector3Value -= oldLocalToWorld.inverse.MultiplyVector(delta);
                        d.influenceVolume.Apply();
                    }
                }
                break;
            }
            }
        }
Пример #17
0
        protected static void Drawer_SectionCustomSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;

            using (new EditorGUI.DisabledScope(!hdPipeline.asset.renderPipelineSettings.supportLightLayers))
            {
                d.lightLayers.intValue = Convert.ToInt32(EditorGUILayout.EnumFlagsField(lightLayersContent, (LightLayerEnum)d.lightLayers.intValue));
            }

            EditorGUILayout.PropertyField(d.weight, weightContent);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(d.multiplier, multiplierContent);
            if (EditorGUI.EndChangeCheck())
            {
                d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue);
            }
        }
        protected static void Drawer_SectionCaptureSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            SerializedPlanarReflectionProbe serialized = (SerializedPlanarReflectionProbe)d;
            var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;

            GUI.enabled = false;
            EditorGUILayout.LabelField(
                CoreEditorUtils.GetContent("Probe Texture Size (Set By HDRP)"),
                CoreEditorUtils.GetContent(hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionTextureSize.ToString()),
                EditorStyles.label);
            EditorGUILayout.Toggle(
                CoreEditorUtils.GetContent("Probe Compression (Set By HDRP)"),
                hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed);
            GUI.enabled = true;

            bool on = serialized.overrideFieldOfView.boolValue;

            EditorGUI.BeginChangeCheck();
            on = EditorGUILayout.Toggle(overrideFieldOfViewContent, on);
            if (on)
            {
                serialized.fieldOfViewOverride.floatValue = EditorGUILayout.FloatField(fieldOfViewSolidAngleContent, serialized.fieldOfViewOverride.floatValue);
            }
            if (EditorGUI.EndChangeCheck())
            {
                serialized.overrideFieldOfView.boolValue = on;
                serialized.Apply();
            }

            //GUI.enabled = false;
            //EditorGUILayout.LabelField(resolutionContent, CoreEditorUtils.GetContent(((int)hdrp.GetRenderPipelineSettings().lightLoopSettings.reflectionCubemapSize).ToString()));
            //EditorGUILayout.LabelField(shadowDistanceContent, EditorStyles.label);
            //EditorGUILayout.LabelField(cullingMaskContent, EditorStyles.label);
            //EditorGUILayout.LabelField(useOcclusionCullingContent, EditorStyles.label);
            //EditorGUILayout.LabelField(nearClipCullingContent, EditorStyles.label);
            //EditorGUILayout.LabelField(farClipCullingContent, EditorStyles.label);
            //GUI.enabled = true;
        }
Пример #19
0
            public static void DrawProjectionSettings(SerializedHDProbe serialized, Editor owner)
            {
                EditorGUILayout.PropertyField(serialized.proxyVolume, k_ProxyVolumeContent);

                if (serialized.target.proxyVolume == null)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(serialized.probeSettings.proxyUseInfluenceVolumeAsProxyVolume);
                    if (EditorGUI.EndChangeCheck())
                    {
                        serialized.Apply();
                    }
                }

                if (serialized.proxyVolume.objectReferenceValue != null)
                {
                    var proxy = (ReflectionProxyVolumeComponent)serialized.proxyVolume.objectReferenceValue;
                    if ((int)proxy.proxyVolume.shape != serialized.probeSettings.influence.shape.enumValueIndex &&
                        proxy.proxyVolume.shape != ProxyShape.Infinite)
                    {
                        EditorGUILayout.HelpBox(
                            k_ProxyInfluenceShapeMismatchHelpBoxText,
                            MessageType.Error,
                            true
                            );
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox(
                        serialized.probeSettings.proxyUseInfluenceVolumeAsProxyVolume.boolValue ? k_NoProxyHelpBoxText : k_NoProxyInfiniteHelpBoxText,
                        MessageType.Info,
                        true
                        );
                }
            }
Пример #20
0
        protected static void Drawer_SectionProxySettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            EditorGUILayout.PropertyField(d.proxyVolumeReference, proxyVolumeContent);

            if (d.target.proxyVolume == null)
            {
                EditorGUI.BeginChangeCheck();
                d.infiniteProjection.boolValue = !EditorGUILayout.Toggle(useInfiniteProjectionContent, !d.infiniteProjection.boolValue);
                if (EditorGUI.EndChangeCheck())
                {
                    d.Apply();
                }
            }

            if (d.proxyVolumeReference.objectReferenceValue != null)
            {
                var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue;
                if ((int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex &&
                    proxy.proxyVolume.shape != ProxyShape.Infinite)
                {
                    EditorGUILayout.HelpBox(
                        proxyInfluenceShapeMismatchHelpBoxText,
                        MessageType.Error,
                        true
                        );
                }
            }
            else
            {
                EditorGUILayout.HelpBox(
                    d.infiniteProjection.boolValue ? noProxyInfiniteHelpBoxText : noProxyHelpBoxText,
                    MessageType.Info,
                    true
                    );
            }
        }
        internal static void DrawHandles(SerializedHDProbe serialized, Editor owner)
        {
            var probe = serialized.target;

            switch (EditMode.editMode)
            {
            case EditBaseShape:
                InfluenceVolumeUI.DrawHandles_EditBase(serialized.probeSettings.influence, owner, probe.transform);
                break;

            case EditInfluenceShape:
                InfluenceVolumeUI.DrawHandles_EditInfluence(serialized.probeSettings.influence, owner, probe.transform);
                break;

            case EditInfluenceNormalShape:
                InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(serialized.probeSettings.influence, owner, probe.transform);
                break;

            case EditCapturePosition:
            case EditMirrorPosition:
            {
                var proxyToWorldMatrix = probe.proxyToWorld;

                SerializedProperty target;
                switch (EditMode.editMode)
                {
                case EditCapturePosition: target = serialized.probeSettings.proxyCapturePositionProxySpace; break;

                case EditMirrorPosition: target = serialized.probeSettings.proxyMirrorPositionProxySpace; break;

                default: throw new ArgumentOutOfRangeException();
                }

                var position = proxyToWorldMatrix.MultiplyPoint(target.vector3Value);
                EditorGUI.BeginChangeCheck();
                position = Handles.PositionHandle(position, proxyToWorldMatrix.rotation);
                if (EditorGUI.EndChangeCheck())
                {
                    target.vector3Value = proxyToWorldMatrix.inverse.MultiplyPoint(position);
                }
                break;
            }

            case EditMirrorRotation:
            {
                var proxyToWorldMatrix = probe.proxyToWorld;

                var target   = serialized.probeSettings.proxyMirrorRotationProxySpace;
                var position = serialized.probeSettings.proxyMirrorPositionProxySpace.vector3Value;

                using (new Handles.DrawingScope(proxyToWorldMatrix))
                {
                    var rotation = target.quaternionValue;
                    EditorGUI.BeginChangeCheck();
                    rotation = Handles.RotationHandle(rotation, position);
                    if (EditorGUI.EndChangeCheck())
                    {
                        target.quaternionValue = rotation;
                    }
                }
                break;
            }
            }
        }
 protected override void Draw(HDProbeUI s, SerializedHDProbe serialized, Editor owner)
 {
     PlanarReflectionProbeUI.Inspector.Draw(s, serialized, owner);
 }
Пример #23
0
 static void Drawer_FieldCaptureType(HDProbeUI s, SerializedHDProbe d, Editor o)
 {
     GUI.enabled = false;
     EditorGUILayout.PropertyField(d.mode, fieldCaptureTypeContent);
     GUI.enabled = true;
 }
Пример #24
0
            public static void DrawBakeButton(SerializedHDProbe serialized, Editor owner)
            {
                // Disable baking of multiple probes with different modes
                if (serialized.probeSettings.mode.hasMultipleDifferentValues)
                {
                    EditorGUILayout.HelpBox(
                        "Baking is not possible when selecting probe with different modes",
                        MessageType.Info
                        );
                    return;
                }

                // Check if current mode support baking
                var mode = (ProbeSettings.Mode)serialized.probeSettings.mode.intValue;
                var doesModeSupportBaking = mode == ProbeSettings.Mode.Custom || mode == ProbeSettings.Mode.Baked;

                if (!doesModeSupportBaking)
                {
                    return;
                }

                // Check if all scene are saved to a file (requirement to bake probes)
                foreach (var target in serialized.serializedObject.targetObjects)
                {
                    var comp  = (Component)target;
                    var go    = comp.gameObject;
                    var scene = go.scene;
                    if (string.IsNullOrEmpty(scene.path))
                    {
                        EditorGUILayout.HelpBox(
                            "Baking is possible only if all open scenes are saved on disk. " +
                            "Please save the scenes before baking.",
                            MessageType.Info
                            );
                        return;
                    }
                }

                switch (mode)
                {
                case ProbeSettings.Mode.Custom:
                {
                    if (ButtonWithDropdownList(
                            EditorGUIUtility.TrTextContent(
                                "Bake", "Bakes Probe's texture, overwriting the existing texture asset (if any)."
                                ),
                            k_BakeCustomOptionText,
                            data =>
                        {
                            switch ((int)data)
                            {
                            case 0:
                                RenderInCustomAsset(serialized.target, false);
                                break;
                            }
                        }))
                    {
                        RenderInCustomAsset(serialized.target, true);
                    }
                    break;
                }

                case ProbeSettings.Mode.Baked:
                {
                    if (UnityEditor.Lightmapping.giWorkflowMode
                        != UnityEditor.Lightmapping.GIWorkflowMode.OnDemand)
                    {
                        EditorGUILayout.HelpBox("Baking of this probe is automatic because this probe's type is 'Baked' and the Lighting window is using 'Auto Baking'. The texture created is stored in the GI cache.", MessageType.Info);
                        break;
                    }

                    GUI.enabled = serialized.target.enabled;

                    // Bake button in non-continous mode
                    if (ButtonWithDropdownList(
                            EditorGUIUtility.TrTextContent("Bake"),
                            k_BakeButtonsText,
                            data =>
                        {
                            if ((int)data == 0)
                            {
                                var system = ScriptableBakedReflectionSystemSettings.system;
                                system.BakeAllReflectionProbes();
                            }
                        },
                            GUILayout.ExpandWidth(true)))
                    {
                        HDBakedReflectionSystem.BakeProbes(new HDProbe[] { serialized.target });
                        GUIUtility.ExitGUI();
                    }

                    GUI.enabled = true;
                    break;
                }

                case ProbeSettings.Mode.Realtime:
                    break;

                default: throw new ArgumentOutOfRangeException();
                }
            }
Пример #25
0
            public static void DrawInfluenceSettings(SerializedHDProbe serialized, Editor owner)
            {
                var provider = new TProvider();

                InfluenceVolumeUI.Draw <TProvider>(serialized.probeSettings.influence, owner);
            }
Пример #26
0
 static void Drawer_SectionProbeModeRealtimeSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
 {
     GUI.enabled = false;
     EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode"));
     GUI.enabled = true;
 }
 static void Drawer_ModeSettingsRealtime(HDProbeUI s, SerializedHDProbe p, Editor owner)
 {
     SerializedHDReflectionProbe probe = (SerializedHDReflectionProbe)p;
     //EditorGUILayout.PropertyField(p.refreshMode, CoreEditorUtils.GetContent("Refresh Mode|Controls how this probe refreshes in the Player"));
     //EditorGUILayout.PropertyField(probe.timeSlicingMode, CoreEditorUtils.GetContent("Time Slicing|If enabled this probe will update over several frames, to help reduce the impact on the frame rate"));
 }
Пример #28
0
 protected abstract void Draw(HDProbeUI s, SerializedHDProbe serialized, Editor owner);
        protected override void Draw(HDProbeUI s, SerializedHDProbe serialized, Editor owner)
        {
#pragma warning disable 612 //Draw
            HDReflectionProbeUI.Inspector.Draw(s, serialized, owner);
#pragma warning restore 612
        }