public void Maps() { if (LightingWindowLightmapPreviewTab.s_Styles == null) { LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles(); } GUI.changed = false; if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand) { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty property = serializedObject.FindProperty("m_LightingDataAsset"); EditorGUILayout.PropertyField(property, LightingWindowLightmapPreviewTab.s_Styles.LightingDataAsset, new GUILayoutOption[0]); serializedObject.ApplyModifiedProperties(); } GUILayout.Space(10f); LightmapData[] lightmaps = LightmapSettings.lightmaps; this.m_ScrollPositionMaps = GUILayout.BeginScrollView(this.m_ScrollPositionMaps, new GUILayoutOption[0]); EditorGUI.BeginDisabledGroup(true); for (int i = 0; i < lightmaps.Length; i++) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(i.ToString(), new GUILayoutOption[0]); GUILayout.Space(5f); lightmaps[i].lightmapFar = this.LightmapField(lightmaps[i].lightmapFar, i); GUILayout.Space(10f); lightmaps[i].lightmapNear = this.LightmapField(lightmaps[i].lightmapNear, i); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } EditorGUI.EndDisabledGroup(); GUILayout.EndScrollView(); }
public void Maps() { if (s_Styles == null) { s_Styles = new Styles(); } GUI.changed = false; if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand) { SerializedObject obj2 = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); EditorGUILayout.PropertyField(obj2.FindProperty("m_LightingDataAsset"), s_Styles.LightingDataAsset, new GUILayoutOption[0]); obj2.ApplyModifiedProperties(); } GUILayout.Space(10f); LightmapData[] lightmaps = LightmapSettings.lightmaps; this.m_ScrollPositionMaps = GUILayout.BeginScrollView(this.m_ScrollPositionMaps, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(true)) { for (int i = 0; i < lightmaps.Length; i++) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(i.ToString(), new GUILayoutOption[0]); GUILayout.Space(5f); lightmaps[i].lightmapLight = this.LightmapField(lightmaps[i].lightmapLight, i); GUILayout.Space(10f); lightmaps[i].lightmapDir = this.LightmapField(lightmaps[i].lightmapDir, i); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); }
public LightingSettingsInspector(SerializedObject serializedObject) { m_SerializedObject = serializedObject; m_GameObjectsSerializedObject = new SerializedObject(serializedObject.targetObjects.Select(t => ((Component)t).gameObject).ToArray()); m_ImportantGI = m_SerializedObject.FindProperty("m_ImportantGI"); m_StitchLightmapSeams = m_SerializedObject.FindProperty("m_StitchLightmapSeams"); m_LightmapParameters = m_SerializedObject.FindProperty("m_LightmapParameters"); m_LightmapIndex = m_SerializedObject.FindProperty("m_LightmapIndex"); m_LightmapTilingOffsetX = m_SerializedObject.FindProperty("m_LightmapTilingOffset.x"); m_LightmapTilingOffsetY = m_SerializedObject.FindProperty("m_LightmapTilingOffset.y"); m_LightmapTilingOffsetZ = m_SerializedObject.FindProperty("m_LightmapTilingOffset.z"); m_LightmapTilingOffsetW = m_SerializedObject.FindProperty("m_LightmapTilingOffset.w"); m_PreserveUVs = m_SerializedObject.FindProperty("m_PreserveUVs"); m_AutoUVMaxDistance = m_SerializedObject.FindProperty("m_AutoUVMaxDistance"); m_IgnoreNormalsForChartDetection = m_SerializedObject.FindProperty("m_IgnoreNormalsForChartDetection"); m_AutoUVMaxAngle = m_SerializedObject.FindProperty("m_AutoUVMaxAngle"); m_MinimumChartSize = m_SerializedObject.FindProperty("m_MinimumChartSize"); m_LightmapScale = m_SerializedObject.FindProperty("m_ScaleInLightmap"); m_CastShadows = serializedObject.FindProperty("m_CastShadows"); m_ReceiveShadows = serializedObject.FindProperty("m_ReceiveShadows"); m_MotionVectors = serializedObject.FindProperty("m_MotionVectors"); m_Renderers = m_SerializedObject.targetObjects.OfType <Renderer>().ToArray(); m_Terrains = m_SerializedObject.targetObjects.OfType <Terrain>().ToArray(); m_StaticEditorFlags = m_GameObjectsSerializedObject.FindProperty("m_StaticEditorFlags"); m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); m_EnabledBakedGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); m_EnabledRealtimeGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); }
private void InitSettings() { if (m_LightmapSettings == null || m_LightmapSettings.targetObject == null || m_LightmapSettings.targetObject != LightmapEditorSettings.GetLightmapSettings()) { m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); } }
private bool CheckCachedObject() { UnityEngine.Object lightmapSettings = LightmapEditorSettings.GetLightmapSettings(); bool result; if (lightmapSettings == null) { result = false; } else if (lightmapSettings == this.m_cachedObject) { this.m_so.UpdateIfRequiredOrScript(); result = true; } else { this.m_cachedObject = lightmapSettings; this.m_so = new SerializedObject(lightmapSettings); this.m_enableRealtimeGI = this.m_so.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); this.m_mixedBakeMode = this.m_so.FindProperty("m_LightmapEditorSettings.m_MixedBakeMode"); this.m_useShadowmask = this.m_so.FindProperty("m_UseShadowmask"); this.m_enabledBakedGI = this.m_so.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.m_workflowMode = this.m_so.FindProperty("m_GIWorkflowMode"); this.m_environmentMode = this.m_so.FindProperty("m_GISettings.m_EnvironmentLightingMode"); result = true; } return(result); }
public override void OnOpen() { SerializedObject obj2 = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_EnableRealtimeGI = obj2.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); this.m_EnableBakedGI = obj2.FindProperty("m_GISettings.m_EnableBakedLightmaps"); }
private void InitSettings() { if (m_LightmapSettings == null || m_LightmapSettings.targetObject == null || m_LightmapSettings.targetObject != LightmapEditorSettings.GetLightmapSettings()) { m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); m_LightingDataAsset = m_LightmapSettings.FindProperty("m_LightingDataAsset"); } }
public override void OnOpen() { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_EnableRealtimeGI = serializedObject.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); this.m_EnableBakedGI = serializedObject.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.m_PathTracerBackend = (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer); }
void InitLightmapSettings() { if (m_LightmapSettings == null || m_LightmapSettings.targetObject == null) { m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); m_EnabledBakedGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); m_WorkflowMode = m_LightmapSettings.FindProperty("m_GIWorkflowMode"); } }
private void EnlightenBakeSettings() { SerializedObject so = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty property1 = so.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); SerializedProperty property2 = so.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.RealtimeGUI(so, property1, property2); this.BakedGUI(so, property1, property2); this.GeneralSettingsGUI(so, property1, property2); so.ApplyModifiedProperties(); }
private void EnlightenBakeSettings() { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty enableRealtimeGI = serializedObject.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); SerializedProperty enableBakedGI = serializedObject.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.RealtimeGUI(serializedObject, enableRealtimeGI, enableBakedGI); this.BakedGUI(serializedObject, enableRealtimeGI, enableBakedGI); this.GeneralSettingsGUI(serializedObject, enableRealtimeGI, enableBakedGI); serializedObject.ApplyModifiedProperties(); }
public void OnGUI() { if (this.m_LightmapSettings == null || this.m_LightmapSettings != LightmapEditorSettings.GetLightmapSettings()) { this.InitSettings(); } this.m_LightmapSettingsSO.UpdateIfRequiredOrScript(); this.RealtimeLightingGUI(); this.MixedLightingGUI(); this.GeneralLightmapSettingsGUI(); this.m_LightmapSettingsSO.ApplyModifiedProperties(); }
private void InitSettings() { Object renderSettings = RenderSettings.GetRenderSettings(); SerializedObject rso = m_RenderSettingsSO = new SerializedObject(renderSettings); m_SubtractiveShadowColor = rso.FindProperty("m_SubtractiveShadowColor"); m_LightmapSettings = LightmapEditorSettings.GetLightmapSettings(); SerializedObject so = m_LightmapSettingsSO = new SerializedObject(m_LightmapSettings); //realtime GI m_EnableRealtimeGI = so.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); m_Resolution = so.FindProperty("m_LightmapEditorSettings.m_Resolution"); //baked m_MixedBakeMode = so.FindProperty("m_LightmapEditorSettings.m_MixedBakeMode"); m_EnabledBakedGI = so.FindProperty("m_GISettings.m_EnableBakedLightmaps"); m_AlbedoBoost = so.FindProperty("m_GISettings.m_AlbedoBoost"); m_IndirectOutputScale = so.FindProperty("m_GISettings.m_IndirectOutputScale"); m_LightmapParameters = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); m_LightmapDirectionalMode = so.FindProperty("m_LightmapEditorSettings.m_LightmapsBakeMode"); m_BakeResolution = so.FindProperty("m_LightmapEditorSettings.m_BakeResolution"); m_Padding = so.FindProperty("m_LightmapEditorSettings.m_Padding"); m_AmbientOcclusion = so.FindProperty("m_LightmapEditorSettings.m_AO"); m_AOMaxDistance = so.FindProperty("m_LightmapEditorSettings.m_AOMaxDistance"); m_CompAOExponent = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponent"); m_CompAOExponentDirect = so.FindProperty("m_LightmapEditorSettings.m_CompAOExponentDirect"); m_TextureCompression = so.FindProperty("m_LightmapEditorSettings.m_TextureCompression"); m_FinalGather = so.FindProperty("m_LightmapEditorSettings.m_FinalGather"); m_FinalGatherRayCount = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherRayCount"); m_FinalGatherFiltering = so.FindProperty("m_LightmapEditorSettings.m_FinalGatherFiltering"); m_LightmapSize = so.FindProperty("m_LightmapEditorSettings.m_AtlasSize"); m_BakeBackend = so.FindProperty("m_LightmapEditorSettings.m_BakeBackend"); //m_PVRSampling = so.FindProperty("m_LightmapEditorSettings.m_PVRSampling"); // TODO(PVR): make non-fixed sampling modes work. m_PVRSampleCount = so.FindProperty("m_LightmapEditorSettings.m_PVRSampleCount"); m_PVRDirectSampleCount = so.FindProperty("m_LightmapEditorSettings.m_PVRDirectSampleCount"); m_PVRBounces = so.FindProperty("m_LightmapEditorSettings.m_PVRBounces"); m_PVRCulling = so.FindProperty("m_LightmapEditorSettings.m_PVRCulling"); m_PVRFilteringMode = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringMode"); m_PVRFilterTypeDirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilterTypeDirect"); m_PVRFilterTypeIndirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilterTypeIndirect"); m_PVRFilterTypeAO = so.FindProperty("m_LightmapEditorSettings.m_PVRFilterTypeAO"); m_PVRFilteringGaussRadiusDirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusDirect"); m_PVRFilteringGaussRadiusIndirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusIndirect"); m_PVRFilteringGaussRadiusAO = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusAO"); m_PVRFilteringAtrousPositionSigmaDirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringAtrousPositionSigmaDirect"); m_PVRFilteringAtrousPositionSigmaIndirect = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringAtrousPositionSigmaIndirect"); m_PVRFilteringAtrousPositionSigmaAO = so.FindProperty("m_LightmapEditorSettings.m_PVRFilteringAtrousPositionSigmaAO"); //dev debug properties m_BounceScale = so.FindProperty("m_GISettings.m_BounceScale"); m_UpdateThreshold = so.FindProperty("m_GISettings.m_TemporalCoherenceThreshold"); }
static public bool LightmapParametersGUI(SerializedProperty prop, GUIContent content) { EditorGUILayout.BeginHorizontal(); EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Scene Default Parameters"); string label = "Edit..."; if (isBuiltIn(prop)) { label = "View"; } bool editClicked = false; // If object is null, then get the scene parameter setting and view this instead. if (prop.objectReferenceValue == null) { SerializedObject so = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty lightmapParameters = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); using (new EditorGUI.DisabledScope(lightmapParameters == null)) { if (isBuiltIn(lightmapParameters)) { label = "View"; } else { label = "Edit..."; } if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false))) { Selection.activeObject = lightmapParameters.objectReferenceValue; editClicked = true; } } } else { if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false))) { Selection.activeObject = prop.objectReferenceValue; editClicked = true; } } EditorGUILayout.EndHorizontal(); return(editClicked); }
private void EnlightenBakeSettings() { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty serializedProperty = serializedObject.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); SerializedProperty serializedProperty2 = serializedObject.FindProperty("m_GISettings.m_EnableBakedLightmaps"); bool boolValue = serializedProperty.boolValue; this.RealtimeGUI(serializedObject, serializedProperty); this.BakedGUI(serializedObject, serializedProperty.boolValue, serializedProperty2); this.GeneralSettingsGUI(serializedObject, serializedProperty.boolValue, serializedProperty2.boolValue); if (serializedProperty2.boolValue && serializedProperty.boolValue && !boolValue) { Lightmapping.ClearPrecompSetIsDone(); } serializedObject.ApplyModifiedProperties(); }
private void EnlightenBakeSettings() { SerializedObject so = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty enableRealtimeGI = so.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); SerializedProperty enableBakedGI = so.FindProperty("m_GISettings.m_EnableBakedLightmaps"); bool boolValue = enableRealtimeGI.boolValue; this.RealtimeGUI(so, enableRealtimeGI); this.BakedGUI(so, enableRealtimeGI.boolValue, enableBakedGI); this.GeneralSettingsGUI(so, enableRealtimeGI.boolValue, enableBakedGI.boolValue); if ((enableBakedGI.boolValue && enableRealtimeGI.boolValue) && !boolValue) { Lightmapping.ClearPrecompSetIsDone(); } so.ApplyModifiedProperties(); }
public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Scene Default Parameters"); string text = "Edit..."; if (LightingSettingsInspector.isBuiltIn(prop)) { text = "View"; } bool result = false; if (prop.objectReferenceValue == null) { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty serializedProperty = serializedObject.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); using (new EditorGUI.DisabledScope(serializedProperty == null)) { if (LightingSettingsInspector.isBuiltIn(serializedProperty)) { text = "View"; } else { text = "Edit..."; } if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { Selection.activeObject = serializedProperty.objectReferenceValue; result = true; } } } else if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { Selection.activeObject = prop.objectReferenceValue; result = true; } EditorGUILayout.EndHorizontal(); return(result); }
void InitLightmapSettings() { // the target gets destroyed and recreated when we setup a new scene, or when hitting play if (m_LightmapSettings == null || m_LightmapSettings.targetObject == null) { if (m_LightmapSettings != null) { m_LightmapSettings.Dispose(); m_EnabledBakedGI.Dispose(); m_WorkflowMode.Dispose(); } m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); m_EnabledBakedGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); m_WorkflowMode = m_LightmapSettings.FindProperty("m_GIWorkflowMode"); } }
private void InitLightmapSettings() { Scene activeScene = SceneManager.GetActiveScene(); if (this.m_LastActiveScene != activeScene) { if (this.m_LightmapSettings != null) { this.m_LightmapSettings.Dispose(); this.m_EnabledBakedGI.Dispose(); this.m_WorkflowMode.Dispose(); } this.m_LastActiveScene = activeScene; this.m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_EnabledBakedGI = this.m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.m_WorkflowMode = this.m_LightmapSettings.FindProperty("m_GIWorkflowMode"); } }
public virtual void OnEnable() { this.m_Sun = base.serializedObject.FindProperty("m_Sun"); this.m_AmbientMode = base.serializedObject.FindProperty("m_AmbientMode"); this.m_AmbientSkyColor = base.serializedObject.FindProperty("m_AmbientSkyColor"); this.m_AmbientEquatorColor = base.serializedObject.FindProperty("m_AmbientEquatorColor"); this.m_AmbientGroundColor = base.serializedObject.FindProperty("m_AmbientGroundColor"); this.m_AmbientIntensity = base.serializedObject.FindProperty("m_AmbientIntensity"); this.m_ReflectionIntensity = base.serializedObject.FindProperty("m_ReflectionIntensity"); this.m_ReflectionBounces = base.serializedObject.FindProperty("m_ReflectionBounces"); this.m_SkyboxMaterial = base.serializedObject.FindProperty("m_SkyboxMaterial"); this.m_DefaultReflectionMode = base.serializedObject.FindProperty("m_DefaultReflectionMode"); this.m_DefaultReflectionResolution = base.serializedObject.FindProperty("m_DefaultReflectionResolution"); this.m_CustomReflection = base.serializedObject.FindProperty("m_CustomReflection"); this.m_lightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_EnvironmentLightingMode = this.m_lightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode"); this.m_ShowEditor = InspectorState.GetBool("ShowLightingEditor", true); }
public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content, bool advancedParameters) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (advancedParameters) { EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default scene parameter"); } else { EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default-Medium"); } string text = "Edit..."; if (isBuiltIn(prop)) { text = "View"; } bool flag = false; if (prop.objectReferenceValue == null) { SerializedProperty property = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()).FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); using (new EditorGUI.DisabledScope(property == null)) { GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) }; if (GUILayout.Button(text, EditorStyles.miniButton, options)) { Selection.activeObject = property.objectReferenceValue; flag = true; } } } else { GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) }; if (GUILayout.Button(text, EditorStyles.miniButton, optionArray2)) { Selection.activeObject = prop.objectReferenceValue; flag = true; } } EditorGUILayout.EndHorizontal(); return(flag); }
public virtual void OnEnable() { this.m_Sun = this.serializedObject.FindProperty("m_Sun"); this.m_AmbientMode = this.serializedObject.FindProperty("m_AmbientMode"); this.m_AmbientSkyColor = this.serializedObject.FindProperty("m_AmbientSkyColor"); this.m_AmbientEquatorColor = this.serializedObject.FindProperty("m_AmbientEquatorColor"); this.m_AmbientGroundColor = this.serializedObject.FindProperty("m_AmbientGroundColor"); this.m_AmbientIntensity = this.serializedObject.FindProperty("m_AmbientIntensity"); this.m_ReflectionIntensity = this.serializedObject.FindProperty("m_ReflectionIntensity"); this.m_ReflectionBounces = this.serializedObject.FindProperty("m_ReflectionBounces"); this.m_SkyboxMaterial = this.serializedObject.FindProperty("m_SkyboxMaterial"); this.m_DefaultReflectionMode = this.serializedObject.FindProperty("m_DefaultReflectionMode"); this.m_DefaultReflectionResolution = this.serializedObject.FindProperty("m_DefaultReflectionResolution"); this.m_CustomReflection = this.serializedObject.FindProperty("m_CustomReflection"); this.m_lightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_EnvironmentLightingMode = this.m_lightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode"); this.m_ReflectionCompression = this.m_lightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression"); this.m_ShowEditor = SessionState.GetBool("ShowLightingEditor", true); this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField(); }
public virtual void OnEnable() { this.m_Sun = base.serializedObject.FindProperty("m_Sun"); this.m_AmbientSource = base.serializedObject.FindProperty("m_AmbientMode"); this.m_AmbientSkyColor = base.serializedObject.FindProperty("m_AmbientSkyColor"); this.m_AmbientEquatorColor = base.serializedObject.FindProperty("m_AmbientEquatorColor"); this.m_AmbientGroundColor = base.serializedObject.FindProperty("m_AmbientGroundColor"); this.m_AmbientIntensity = base.serializedObject.FindProperty("m_AmbientIntensity"); this.m_ReflectionIntensity = base.serializedObject.FindProperty("m_ReflectionIntensity"); this.m_ReflectionBounces = base.serializedObject.FindProperty("m_ReflectionBounces"); this.m_SkyboxMaterial = base.serializedObject.FindProperty("m_SkyboxMaterial"); this.m_DefaultReflectionMode = base.serializedObject.FindProperty("m_DefaultReflectionMode"); this.m_DefaultReflectionResolution = base.serializedObject.FindProperty("m_DefaultReflectionResolution"); this.m_CustomReflection = base.serializedObject.FindProperty("m_CustomReflection"); this.m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); this.m_ReflectionCompression = this.m_LightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression"); this.m_AmbientLightingMode = this.m_LightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode"); this.m_EnabledBakedGI = this.m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); this.m_EnabledRealtimeGI = this.m_LightmapSettings.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); this.m_bShowEnvironment = SessionState.GetBool("ShowEnvironment", true); }
private void InitSettings() { UnityEngine.Object renderSettings = RenderSettings.GetRenderSettings(); SerializedObject serializedObject = this.m_RenderSettingsSO = new SerializedObject(renderSettings); this.m_SubtractiveShadowColor = serializedObject.FindProperty("m_SubtractiveShadowColor"); this.m_LightmapSettings = LightmapEditorSettings.GetLightmapSettings(); SerializedObject serializedObject2 = this.m_LightmapSettingsSO = new SerializedObject(this.m_LightmapSettings); this.m_Resolution = serializedObject2.FindProperty("m_LightmapEditorSettings.m_Resolution"); this.m_AlbedoBoost = serializedObject2.FindProperty("m_GISettings.m_AlbedoBoost"); this.m_IndirectOutputScale = serializedObject2.FindProperty("m_GISettings.m_IndirectOutputScale"); this.m_LightmapParameters = serializedObject2.FindProperty("m_LightmapEditorSettings.m_LightmapParameters"); this.m_LightmapDirectionalMode = serializedObject2.FindProperty("m_LightmapEditorSettings.m_LightmapsBakeMode"); this.m_BakeResolution = serializedObject2.FindProperty("m_LightmapEditorSettings.m_BakeResolution"); this.m_Padding = serializedObject2.FindProperty("m_LightmapEditorSettings.m_Padding"); this.m_AmbientOcclusion = serializedObject2.FindProperty("m_LightmapEditorSettings.m_AO"); this.m_AOMaxDistance = serializedObject2.FindProperty("m_LightmapEditorSettings.m_AOMaxDistance"); this.m_CompAOExponent = serializedObject2.FindProperty("m_LightmapEditorSettings.m_CompAOExponent"); this.m_CompAOExponentDirect = serializedObject2.FindProperty("m_LightmapEditorSettings.m_CompAOExponentDirect"); this.m_TextureCompression = serializedObject2.FindProperty("m_LightmapEditorSettings.m_TextureCompression"); this.m_FinalGather = serializedObject2.FindProperty("m_LightmapEditorSettings.m_FinalGather"); this.m_FinalGatherRayCount = serializedObject2.FindProperty("m_LightmapEditorSettings.m_FinalGatherRayCount"); this.m_FinalGatherFiltering = serializedObject2.FindProperty("m_LightmapEditorSettings.m_FinalGatherFiltering"); this.m_LightmapSize = serializedObject2.FindProperty("m_LightmapEditorSettings.m_TextureWidth"); this.m_BakeBackend = serializedObject2.FindProperty("m_LightmapEditorSettings.m_BakeBackend"); this.m_PVRSampleCount = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRSampleCount"); this.m_PVRDirectSampleCount = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRDirectSampleCount"); this.m_PVRBounces = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRBounces"); this.m_PVRCulling = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRCulling"); this.m_PVRFilteringMode = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRFilteringMode"); this.m_PVRFilteringGaussRadiusDirect = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusDirect"); this.m_PVRFilteringGaussRadiusIndirect = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusIndirect"); this.m_PVRFilteringGaussRadiusAO = serializedObject2.FindProperty("m_LightmapEditorSettings.m_PVRFilteringGaussRadiusAO"); this.m_BounceScale = serializedObject2.FindProperty("m_GISettings.m_BounceScale"); this.m_UpdateThreshold = serializedObject2.FindProperty("m_GISettings.m_TemporalCoherenceThreshold"); }
private void InitSettings() { m_RenderSettings = new SerializedObject(RenderSettings.GetRenderSettings()); m_Sun = m_RenderSettings.FindProperty("m_Sun"); m_AmbientSource = m_RenderSettings.FindProperty("m_AmbientMode"); m_AmbientSkyColor = m_RenderSettings.FindProperty("m_AmbientSkyColor"); m_AmbientEquatorColor = m_RenderSettings.FindProperty("m_AmbientEquatorColor"); m_AmbientGroundColor = m_RenderSettings.FindProperty("m_AmbientGroundColor"); m_AmbientIntensity = m_RenderSettings.FindProperty("m_AmbientIntensity"); m_ReflectionIntensity = m_RenderSettings.FindProperty("m_ReflectionIntensity"); m_ReflectionBounces = m_RenderSettings.FindProperty("m_ReflectionBounces"); m_SkyboxMaterial = m_RenderSettings.FindProperty("m_SkyboxMaterial"); m_DefaultReflectionMode = m_RenderSettings.FindProperty("m_DefaultReflectionMode"); m_DefaultReflectionResolution = m_RenderSettings.FindProperty("m_DefaultReflectionResolution"); m_CustomReflection = m_RenderSettings.FindProperty("m_CustomReflection"); m_LightmapSettings = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); m_ReflectionCompression = m_LightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression"); m_AmbientLightingMode = m_LightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode"); m_EnabledBakedGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps"); m_EnabledRealtimeGI = m_LightmapSettings.FindProperty("m_GISettings.m_EnableRealtimeLightmaps"); m_bShowEnvironment = SessionState.GetBool(kShowEnvironment, true); }
public override void OnInspectorGUI() { if (m_RenderSettings == null || m_RenderSettings.targetObject != RenderSettings.GetRenderSettings() || m_LightmapSettings == null || m_LightmapSettings.targetObject != LightmapEditorSettings.GetLightmapSettings()) { InitSettings(); } m_RenderSettings.Update(); m_LightmapSettings.Update(); DrawGUI(); m_RenderSettings.ApplyModifiedProperties(); m_LightmapSettings.ApplyModifiedProperties(); }
public void Maps() { if (LightingWindowLightmapPreviewTab.s_Styles == null) { LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles(); } GUI.changed = false; if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand) { SerializedObject serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty property = serializedObject.FindProperty("m_LightingDataAsset"); EditorGUILayout.PropertyField(property, LightingWindowLightmapPreviewTab.s_Styles.LightingDataAsset, new GUILayoutOption[0]); serializedObject.ApplyModifiedProperties(); } GUILayout.Space(10f); LightmapData[] lightmaps = LightmapSettings.lightmaps; this.m_ScrollPositionMaps = GUILayout.BeginScrollView(this.m_ScrollPositionMaps, new GUILayoutOption[0]); using (new EditorGUI.DisabledScope(true)) { bool flag = false; bool flag2 = false; LightmapData[] array = lightmaps; for (int i = 0; i < array.Length; i++) { LightmapData lightmapData = array[i]; if (lightmapData.lightmapDir != null) { flag = true; } if (lightmapData.shadowMask != null) { flag2 = true; } } for (int j = 0; j < lightmaps.Length; j++) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(5f); lightmaps[j].lightmapColor = this.LightmapField(lightmaps[j].lightmapColor, j); if (flag) { GUILayout.Space(10f); lightmaps[j].lightmapDir = this.LightmapField(lightmaps[j].lightmapDir, j); } if (flag2) { GUILayout.Space(10f); lightmaps[j].shadowMask = this.LightmapField(lightmaps[j].shadowMask, j); } GUILayout.Space(5f); LightmapConvergence lightmapConvergence = Lightmapping.GetLightmapConvergence(j); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label("Index: " + j, EditorStyles.miniBoldLabel, new GUILayoutOption[0]); if (lightmapConvergence.IsValid()) { GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString((ulong)((long)lightmapConvergence.occupiedTexelCount)), EditorStyles.miniLabel, new GUILayoutOption[0]); GUIContent content = EditorGUIUtility.TextContent(string.Concat(new object[] { "Direct: ", lightmapConvergence.minDirectSamples, " / ", lightmapConvergence.maxDirectSamples, " / ", lightmapConvergence.avgDirectSamples, "|min / max / avg samples per texel" })); GUILayout.Label(content, EditorStyles.miniLabel, new GUILayoutOption[0]); GUIContent content2 = EditorGUIUtility.TextContent(string.Concat(new object[] { "GI: ", lightmapConvergence.minGISamples, " / ", lightmapConvergence.maxGISamples, " / ", lightmapConvergence.avgGISamples, "|min / max / avg samples per texel" })); GUILayout.Label(content2, EditorStyles.miniLabel, new GUILayoutOption[0]); } else { GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.Label("Direct: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.Label("GI: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]); } float lightmapBakePerformance = Lightmapping.GetLightmapBakePerformance(j); if ((double)lightmapBakePerformance >= 0.0) { GUILayout.Label(lightmapBakePerformance.ToString("0.00") + " mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]); } else { GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); }
public void ObjectPreview(Rect r) { if (r.height > 0f) { if (s_Styles == null) { s_Styles = new Styles(); } List <Texture2D> list = new List <Texture2D>(); foreach (GITextureType type in this.kObjectPreviewTextureTypes) { list.Add(LightmapVisualizationUtility.GetGITexture(type)); } if (list.Count != 0) { Rect rect3; Rect rect9; if (this.m_ZoomablePreview == null) { this.m_ZoomablePreview = new ZoomableArea(true); this.m_ZoomablePreview.hRangeMin = 0f; this.m_ZoomablePreview.vRangeMin = 0f; this.m_ZoomablePreview.hRangeMax = 1f; this.m_ZoomablePreview.vRangeMax = 1f; this.m_ZoomablePreview.SetShownHRange(0f, 1f); this.m_ZoomablePreview.SetShownVRange(0f, 1f); this.m_ZoomablePreview.uniformScale = true; this.m_ZoomablePreview.scaleWithWindow = true; } GUI.Box(r, string.Empty, "PreBackground"); Rect position = new Rect(r); position.y++; position.height = 18f; GUI.Box(position, string.Empty, EditorStyles.toolbar); Rect rect2 = new Rect(r); rect2.y++; rect2.height = 18f; rect2.width = 120f; rect3 = new Rect(r) { yMin = rect3.yMin + rect2.height, yMax = rect3.yMax - 14f, width = rect3.width - 11f }; int index = Array.IndexOf <GUIContent>(kObjectPreviewTextureOptions, this.m_SelectedObjectPreviewTexture); if (index < 0) { index = 0; } index = EditorGUI.Popup(rect2, index, kObjectPreviewTextureOptions, EditorStyles.toolbarPopup); if (index >= kObjectPreviewTextureOptions.Length) { index = 0; } this.m_SelectedObjectPreviewTexture = kObjectPreviewTextureOptions[index]; LightmapType lightmapType = ((this.kObjectPreviewTextureTypes[index] != GITextureType.Baked) && (this.kObjectPreviewTextureTypes[index] != GITextureType.BakedDirectional)) ? LightmapType.DynamicLightmap : LightmapType.StaticLightmap; SerializedProperty property = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()).FindProperty("m_LightmapsMode"); bool flag = ((this.kObjectPreviewTextureTypes[index] == GITextureType.Baked) || (this.kObjectPreviewTextureTypes[index] == GITextureType.BakedDirectional)) && (property.intValue == 2); if (flag) { GUIContent content = GUIContent.Temp("Indirect"); Rect rect4 = rect2; rect4.x += rect2.width; rect4.width = EditorStyles.toolbarButton.CalcSize(content).x; this.m_HasSeparateIndirectUV = GUI.Toggle(rect4, this.m_HasSeparateIndirectUV, content.text, EditorStyles.toolbarButton); } switch (Event.current.type) { case EventType.ValidateCommand: case EventType.ExecuteCommand: if (Event.current.commandName == "FrameSelected") { Rect rect5; Vector4 lightmapTilingOffset = LightmapVisualizationUtility.GetLightmapTilingOffset(lightmapType); Vector2 lhs = new Vector2(lightmapTilingOffset.z, lightmapTilingOffset.w); Vector2 vector3 = lhs + new Vector2(lightmapTilingOffset.x, lightmapTilingOffset.y); lhs = Vector2.Max(lhs, Vector2.zero); vector3 = Vector2.Min(vector3, Vector2.one); float num3 = 1f - lhs.y; lhs.y = 1f - vector3.y; vector3.y = num3; rect5 = new Rect(lhs.x, lhs.y, vector3.x - lhs.x, vector3.y - lhs.y) { x = rect5.x - (Mathf.Clamp(rect5.height - rect5.width, 0f, float.MaxValue) / 2f), y = rect5.y - (Mathf.Clamp(rect5.width - rect5.height, 0f, float.MaxValue) / 2f) }; float num5 = Mathf.Max(rect5.width, rect5.height); rect5.height = num5; rect5.width = num5; if (flag && this.m_HasSeparateIndirectUV) { rect5.x += 0.5f; } this.m_ZoomablePreview.shownArea = rect5; Event.current.Use(); } break; case EventType.Repaint: { Texture2D texture = list[index]; if ((texture != null) && (Event.current.type == EventType.Repaint)) { Rect rect7; Rect rect8; Rect rect = new Rect(0f, 0f, (float)texture.width, (float)texture.height); rect = this.ResizeRectToFit(rect, rect3); rect = this.CenterToRect(rect, rect3); rect = this.ScaleRectByZoomableArea(rect, this.m_ZoomablePreview); rect7 = new Rect(rect) { x = rect7.x + 3f, y = rect7.y + (rect3.y + 20f) }; rect8 = new Rect(rect3) { y = rect8.y + (rect2.height + 3f) }; float num4 = rect8.y - 14f; rect7.y -= num4; rect8.y -= num4; UnityEngine.FilterMode filterMode = texture.filterMode; texture.filterMode = UnityEngine.FilterMode.Point; GITextureType textureType = this.kObjectPreviewTextureTypes[index]; bool drawSpecularUV = flag && this.m_HasSeparateIndirectUV; LightmapVisualizationUtility.DrawTextureWithUVOverlay(texture, Selection.activeGameObject, rect8, rect7, textureType, drawSpecularUV); texture.filterMode = filterMode; } break; } } if (this.m_PreviousSelection != Selection.activeInstanceID) { this.m_PreviousSelection = Selection.activeInstanceID; this.m_ZoomablePreview.SetShownHRange(0f, 1f); this.m_ZoomablePreview.SetShownVRange(0f, 1f); } rect9 = new Rect(r) { yMin = rect9.yMin + rect2.height }; this.m_ZoomablePreview.rect = rect9; this.m_ZoomablePreview.BeginViewGUI(); this.m_ZoomablePreview.EndViewGUI(); GUILayoutUtility.GetRect(r.width, r.height); } } }
void ResetSettings(object userData, string[] options, int selected) { Undo.RecordObjects(new[] { RenderSettings.GetRenderSettings(), LightmapEditorSettings.GetLightmapSettings() }, "Reset Lighting Settings"); Unsupported.SmartReset(RenderSettings.GetRenderSettings()); Unsupported.SmartReset(LightmapEditorSettings.GetLightmapSettings()); }
public void Maps() { if (s_Styles == null) { s_Styles = new Styles(); } GUI.changed = false; if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand) { SerializedObject so = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()); SerializedProperty LightingDataAsset = so.FindProperty("m_LightingDataAsset"); EditorGUILayout.PropertyField(LightingDataAsset, s_Styles.LightingDataAsset); so.ApplyModifiedProperties(); } GUILayout.Space(10); GlobalMapsViewType viewType = GlobalMapsViewType.Performance; if (EditorPrefs.GetBool("DeveloperMode", false)) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); viewType = (GlobalMapsViewType)EditorPrefs.GetInt("LightingWindowGlobalMapsViewType", (int)viewType); EditorGUI.BeginChangeCheck(); { viewType = (GlobalMapsViewType)GUILayout.Toolbar((int)viewType, new string[] { "Performance", "Memory" }, EditorStyles.miniButton, GUILayout.ExpandWidth(false)); } if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetInt("LightingWindowGlobalMapsViewType", (int)viewType); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } LightmapData[] lightmaps = LightmapSettings.lightmaps; m_ScrollPositionMaps = GUILayout.BeginScrollView(m_ScrollPositionMaps); { bool showDirLightmap = false; bool showShadowMask = false; foreach (LightmapData lightmapData in lightmaps) { if (lightmapData.lightmapDir != null) { showDirLightmap = true; } if (lightmapData.shadowMask != null) { showShadowMask = true; } } if (viewType == GlobalMapsViewType.Performance) { PerformanceCentricView(lightmaps, showDirLightmap, showShadowMask, viewType); } else { MemoryCentricView(lightmaps, showDirLightmap, showShadowMask, viewType); } } GUILayout.EndScrollView(); }