BakeReflectionProbeSnapshot() private method

private BakeReflectionProbeSnapshot ( ReflectionProbe probe ) : bool
probe UnityEngine.ReflectionProbe
return bool
コード例 #1
0
        void DoBakeButton()
        {
            if (reflectionProbeTarget.mode == ReflectionProbeMode.Realtime)
            {
                EditorGUILayout.HelpBox("Baking of this reflection probe should be initiated from the scripting API because the type is 'Realtime'", MessageType.Info);

                if (!QualitySettings.realtimeReflectionProbes)
                {
                    EditorGUILayout.HelpBox("Realtime reflection probes are disabled in Quality Settings", MessageType.Warning);
                }
                return;
            }

            if (reflectionProbeTarget.mode == ReflectionProbeMode.Baked && Lightmapping.giWorkflowMode != Lightmapping.GIWorkflowMode.OnDemand)
            {
                EditorGUILayout.HelpBox("Baking of this reflection probe is automatic because this probe's type is 'Baked' and the Lighting window is using 'Auto Baking'. The cubemap created is stored in the GI cache.", MessageType.Info);
                return;
            }

            GUILayout.BeginHorizontal();

            GUILayout.Space(EditorGUIUtility.labelWidth);
            switch (reflectionProbeMode)
            {
            case ReflectionProbeMode.Custom:
                if (EditorGUI.ButtonWithDropdownList(Styles.bakeCustomButtonText, Styles.bakeCustomOptionText, OnBakeCustomButton))
                {
                    BakeCustomReflectionProbe(reflectionProbeTarget, true);
                    GUIUtility.ExitGUI();
                }
                break;

            case ReflectionProbeMode.Baked:
                using (new EditorGUI.DisabledScope(!reflectionProbeTarget.enabled))
                {
                    // Bake button in non-continous mode
                    if (EditorGUI.ButtonWithDropdownList(Styles.bakeButtonText, Styles.bakeButtonsText, OnBakeButton))
                    {
                        Lightmapping.BakeReflectionProbeSnapshot(reflectionProbeTarget);
                        GUIUtility.ExitGUI();
                    }
                }

                break;

            case ReflectionProbeMode.Realtime:
                // Not showing bake button in realtime
                break;
            }

            GUILayout.EndHorizontal();
        }
コード例 #2
0
 private void DoBakeButton()
 {
     if (this.reflectionProbeTarget.mode == ReflectionProbeMode.Realtime)
     {
         EditorGUILayout.HelpBox("Baking of this reflection probe should be initiated from the scripting API because the type is 'Realtime'", MessageType.Info);
         if (!QualitySettings.realtimeReflectionProbes)
         {
             EditorGUILayout.HelpBox("Realtime reflection probes are disabled in Quality Settings", MessageType.Warning);
         }
     }
     else if (this.reflectionProbeTarget.mode == ReflectionProbeMode.Baked && Lightmapping.giWorkflowMode != Lightmapping.GIWorkflowMode.OnDemand)
     {
         EditorGUILayout.HelpBox("Baking of this reflection probe is automatic because this probe's type is 'Baked' and the Lighting window is using 'Auto Baking'. The cubemap created is stored in the GI cache.", MessageType.Info);
     }
     else
     {
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Space(EditorGUIUtility.labelWidth);
         ReflectionProbeMode reflectionProbeMode = this.reflectionProbeMode;
         if (reflectionProbeMode != ReflectionProbeMode.Custom)
         {
             if (reflectionProbeMode != ReflectionProbeMode.Baked)
             {
                 if (reflectionProbeMode != ReflectionProbeMode.Realtime)
                 {
                 }
             }
             else
             {
                 using (new EditorGUI.DisabledScope(!this.reflectionProbeTarget.enabled))
                 {
                     if (EditorGUI.ButtonWithDropdownList(ReflectionProbeEditor.Styles.bakeButtonText, ReflectionProbeEditor.Styles.bakeButtonsText, new GenericMenu.MenuFunction2(this.OnBakeButton), new GUILayoutOption[0]))
                     {
                         Lightmapping.BakeReflectionProbeSnapshot(this.reflectionProbeTarget);
                         GUIUtility.ExitGUI();
                     }
                 }
             }
         }
         else if (EditorGUI.ButtonWithDropdownList(ReflectionProbeEditor.Styles.bakeCustomButtonText, ReflectionProbeEditor.Styles.bakeCustomOptionText, new GenericMenu.MenuFunction2(this.OnBakeCustomButton), new GUILayoutOption[0]))
         {
             this.BakeCustomReflectionProbe(this.reflectionProbeTarget, true);
             GUIUtility.ExitGUI();
         }
         GUILayout.EndHorizontal();
     }
 }