public void Reset() { lightProbeProxyVolumeOverride = null; probeAnchor = null; motionVectorGenerationMode = MotionVectorGenerationMode.Object; reflectionProbeUsage = ReflectionProbeUsage.BlendProbes; lightProbeUsage = LightProbeUsage.BlendProbes; allowOcclusionWhenDynamic = true; renderingLayerMask = ~(uint)0; receiveGI = ReceiveGI.LightProbes; #if UNITY_EDITOR lightmapParameters = new UnityEditor.LightmapParameters(); importantGI = false; optimizeUVs = false; ignoreNormalsForChartDetection = false; scaleInLightmap = 1.0f; autoUVMaxDistance = 0.5f; autoUVMaxAngle = 89; minimumChartSize = 4; stitchLightmapSeams = false; #endif }
public void ReadFromGameObject(int rootInstanceId, CombineConditionSettings combineConditions, bool copyBakedLighting, GameObject go, Transform t, MeshRenderer mr, Material mat) { matInstanceId = (combineConditions.sameMaterial ? mat.GetInstanceID() : combineConditions.combineCondition.matInstanceId); lightmapIndex = (copyBakedLighting ? mr.lightmapIndex : lightmapIndex = -1); shadowCastingMode = (combineConditions.sameShadowCastingMode ? mr.shadowCastingMode : combineConditions.combineCondition.shadowCastingMode); receiveShadows = (combineConditions.sameReceiveShadows ? mr.receiveShadows : combineConditions.combineCondition.receiveShadows); lightmapScale = (combineConditions.sameLightmapScale ? GetLightmapScale(mr) : combineConditions.combineCondition.lightmapScale); lightProbeUsage = (combineConditions.sameLightProbeUsage ? mr.lightProbeUsage : combineConditions.combineCondition.lightProbeUsage); reflectionProbeUsage = (combineConditions.sameReflectionProbeUsage ? mr.reflectionProbeUsage : combineConditions.combineCondition.reflectionProbeUsage); probeAnchor = (combineConditions.sameProbeAnchor ? mr.probeAnchor : combineConditions.combineCondition.probeAnchor); motionVectorGenerationMode = (combineConditions.sameMotionVectorGenerationMode ? mr.motionVectorGenerationMode : combineConditions.combineCondition.motionVectorGenerationMode); layer = (combineConditions.sameLayer ? go.layer : combineConditions.combineCondition.layer); #if UNITY_EDITOR #if !UNITY_2017 && !UNITY_2018 && !UNITY_2019_1 receiveGI = (combineConditions.sameReceiveGI ? mr.receiveGI : combineConditions.combineCondition.receiveGI); #endif staticEditorFlags = (combineConditions.sameStaticEditorFlags ? UnityEditor.GameObjectUtility.GetStaticEditorFlags(go) : combineConditions.combineCondition.staticEditorFlags); #endif this.rootInstanceId = rootInstanceId; // Debug.Log(go.name + " " + shadowCastingMode); }
public void RenderSettings(bool showLightmapSettings) { if (m_SerializedObject == null || m_GameObjectsSerializedObject == null || m_GameObjectsSerializedObject.targetObjectsCount == 0) { return; } var settings = Lightmapping.GetLightingSettingsOrDefaultsFallback(); var lightmapper = settings.lightmapper; bool bakedGI = settings.bakedGI; bool realtimeGI = settings.realtimeGI; m_GameObjectsSerializedObject.Update(); ReceiveGI receiveGI = (ReceiveGI)m_ReceiveGI.intValue; bool contributeGI = (m_StaticEditorFlags.intValue & (int)StaticEditorFlags.ContributeGI) != 0; bool showEnlightenSettings = isPrefabAsset || realtimeGI || (bakedGI && lightmapper == LightingSettings.Lightmapper.Enlighten); // m_ReceiveGI might still be set to Lightmaps, but LightProbes is shown in the inspector since the contributeGI if off. // In this case we still have to mark it as "multiple values" even though both have "Lightmaps" as the value, but one is showing a grayed out "Light Probes" in the UI bool showMixedGIValue = m_ReceiveGI.hasMultipleDifferentValues || ((m_StaticEditorFlags.hasMultipleDifferentValuesBitwise & (int)StaticEditorFlags.ContributeGI) != 0); m_ShowLightingSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowLightingSettings.value, Styles.lightingSettings); if (m_ShowLightingSettings.value) { EditorGUI.indentLevel += 1; EditorGUILayout.PropertyField(m_CastShadows, Styles.castShadows, true); bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath(); if (SupportedRenderingFeatures.active.receiveShadows) { using (new EditorGUI.DisabledScope(isDeferredRenderingPath)) EditorGUILayout.PropertyField(m_ReceiveShadows, Styles.receiveShadows, true); } if (!showLightmapSettings) { EditorGUI.indentLevel -= 1; EditorGUILayout.EndFoldoutHeaderGroup(); return; } contributeGI = ContributeGISettings(); if (!(bakedGI || realtimeGI) && !isPrefabAsset && contributeGI) { EditorGUILayout.HelpBox(Styles.giNotEnabledInfo.text, MessageType.Info); EditorGUI.indentLevel -= 1; EditorGUILayout.EndFoldoutHeaderGroup(); return; } if (contributeGI) { var rect = EditorGUILayout.GetControlRect(); EditorGUI.BeginProperty(rect, Styles.receiveGITitle, m_ReceiveGI); EditorGUI.BeginChangeCheck(); receiveGI = (ReceiveGI)EditorGUI.IntPopup(rect, Styles.receiveGITitle, (int)receiveGI, Styles.receiveGILightmapStrings, Styles.receiveGILightmapValues); if (EditorGUI.EndChangeCheck()) { m_ReceiveGI.intValue = (int)receiveGI; } EditorGUI.EndProperty(); if (showEnlightenSettings) { EditorGUILayout.PropertyField(m_ImportantGI, Styles.importantGI); } if (receiveGI == ReceiveGI.LightProbes && !showMixedGIValue) { LightmapScaleGUI(true, Styles.albedoScale, true); } } else { using (new EditorGUI.DisabledScope(true)) { EditorGUI.showMixedValue = showMixedGIValue; receiveGI = (ReceiveGI)EditorGUILayout.IntPopup(Styles.receiveGITitle, (int)ReceiveGI.LightProbes, Styles.receiveGILightmapStrings, Styles.receiveGILightmapValues); EditorGUI.showMixedValue = false; } } EditorGUI.indentLevel -= 1; } EditorGUILayout.EndFoldoutHeaderGroup(); if (showLightmapSettings && contributeGI && receiveGI == ReceiveGI.Lightmaps && !showMixedGIValue) { m_ShowLightmapSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowLightmapSettings.value, Styles.lightmapSettings); if (m_ShowLightmapSettings.value) { EditorGUI.indentLevel += 1; bool showProgressiveSettings = isPrefabAsset || (bakedGI && lightmapper != LightingSettings.Lightmapper.Enlighten); LightmapScaleGUI(true, Styles.scaleInLightmap, false); if (showProgressiveSettings) { EditorGUILayout.PropertyField(m_StitchLightmapSeams, Styles.stitchLightmapSeams); } LightmapParametersGUI(m_LightmapParameters, Styles.lightmapParameters); if (showEnlightenSettings) { RendererUVSettings(); } if ((m_Renderers != null) && (m_Renderers.Length > 0)) { ShowAtlasGUI(m_Renderers[0].GetInstanceID(), true); ShowRealtimeLMGUI(m_Renderers[0]); if (Lightmapping.HasZeroAreaMesh(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.zeroAreaPackingMesh.text, MessageType.Warning); } DisplayMeshWarning(); if (showEnlightenSettings) { if (Lightmapping.HasClampedResolution(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.clampedPackingResolution.text, MessageType.Warning); } } if (showProgressiveSettings) { if (Lightmapping.HasUVOverlaps(m_Renderers[0])) { EditorGUILayout.HelpBox(Styles.uvOverlap.text, MessageType.Warning); } } } EditorGUI.indentLevel -= 1; } EditorGUILayout.EndFoldoutHeaderGroup(); } }