public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { base.OnGUI(materialEditor, props); materialEditor.LightmapEmissionProperty(0); foreach (Material target in materialEditor.targets) target.globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; }
void DoEmissionArea(Material material) { float brightness = emissionColorForRendering.colorValue.maxColorComponent; bool showHelpBox = !HasValidEmissiveKeyword(material); bool showEmissionColorAndGIControls = brightness > 0.0f; bool hadEmissionTexture = emissionMap.textureValue != null; // Texture and HDR color controls m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false); // If texture was assigned and color was black set color to white if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorForRendering.colorValue = Color.white; } // Dynamic Lightmapping mode if (showEmissionColorAndGIControls) { bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(emissionColorForRendering.colorValue); EditorGUI.BeginDisabledGroup(!shouldEmissionBeEnabled); m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); EditorGUI.EndDisabledGroup(); } if (showHelpBox) { EditorGUILayout.HelpBox(Styles.emissiveWarning.text, MessageType.Warning); } }
void DoEmissionArea(Material material) { bool showEmissionColorAndGIControls = emissionScaleUI.floatValue > 0f; bool hadEmissionTexture = emissionMap.textureValue != null; // Do controls m_MaterialEditor.TexturePropertySingleLine(Styles.emissionText, emissionMap, showEmissionColorAndGIControls ? emissionColorUI : null, emissionScaleUI); // Set default emissionScaleUI if texture was assigned if (emissionMap.textureValue != null && !hadEmissionTexture && emissionScaleUI.floatValue <= 0f) { emissionScaleUI.floatValue = 1.0f; } // Dynamic Lightmapping mode if (showEmissionColorAndGIControls) { bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(EvalFinalEmissionColor(material)); EditorGUI.BeginDisabledGroup(!shouldEmissionBeEnabled); m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); EditorGUI.EndDisabledGroup(); } if (!HasValidEmissiveKeyword(material)) { EditorGUILayout.HelpBox(Styles.emissiveWarning.text, MessageType.Warning); } }
void DoEmissionArea(Material material) { bool showHelpBox = !HasValidEmissiveKeyword(material); bool hadEmissionTexture = emissionMap.textureValue != null; // Texture and HDR color controls m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false); // If texture was assigned and color was black set color to white float brightness = emissionColorForRendering.colorValue.maxColorComponent; if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorForRendering.colorValue = Color.white; } // Emission for GI? m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); if (showHelpBox) { EditorGUILayout.HelpBox(Styles.emissiveWarning.text, MessageType.Warning); } }
void DoEmissionArea(Material material) { GUILayout.Label(Styles.emissionLabel, EditorStyles.boldLabel); bool showEmissionColorAndGIControls = emissionScaleUI.floatValue > 0f; bool showEmissionColorAndGIControlsTop = emissionScaleUITop.floatValue > 0f; bool showEmissionColorAndGIControlsBottom = emissionScaleUIBottom.floatValue > 0f; // Do controls m_MaterialEditor.TexturePropertySingleLine(Styles.emissionText, emissionMap, showEmissionColorAndGIControls ? emissionColorUI : null, emissionScaleUI); if (material.GetFloat("_TopMultiplier") > MIN_VALUE) { m_MaterialEditor.TexturePropertySingleLine(Styles.emissionTextTop, emissionMapTop, showEmissionColorAndGIControlsTop ? emissionColorUITop : null, emissionScaleUITop); } if (material.GetFloat("_BottomMultiplier") > MIN_VALUE) { m_MaterialEditor.TexturePropertySingleLine(Styles.emissionTextBottom, emissionMapBottom, showEmissionColorAndGIControlsBottom ? emissionColorUIBottom : null, emissionScaleUIBottom); } // Dynamic Lightmapping mode if (showEmissionColorAndGIControls) { bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(EvalFinalEmissionColor(material)); EditorGUI.BeginDisabledGroup(!shouldEmissionBeEnabled); m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); EditorGUI.EndDisabledGroup(); } }
void DoEmissionArea(Material material) { GUILayout.Label(Styles.emissionLabel, EditorStyles.boldLabel); bool showEmissionColorAndGIControls = emissionMultiplier.floatValue > 0f; bool showEmissionColorAndGIControlsTop = topEmissionMultiplier != null && topEmissionMultiplier.floatValue > 0f; bool showEmissionColorAndGIControlsBottom = bottomEmissionMultiplier != null && bottomEmissionMultiplier.floatValue > 0f; // Do controls m_MaterialEditor.TexturePropertySingleLine(Styles.emissionText, emissionMap, showEmissionColorAndGIControls ? emissionColor : null, emissionMultiplier); if (topMultiplier != null && topMultiplier.floatValue > MIN_VALUE) { m_MaterialEditor.TexturePropertySingleLine(Styles.emissionTextTop, topEmissionMap, showEmissionColorAndGIControlsTop ? topEmissionColor : null, topEmissionMultiplier); } if (bottomMultiplier != null && bottomMultiplier.floatValue > MIN_VALUE) { m_MaterialEditor.TexturePropertySingleLine(Styles.emissionTextBottom, bottomEmissionMap, showEmissionColorAndGIControlsBottom ? bottomEmissionColor : null, bottomEmissionMultiplier); } // Dynamic Lightmapping mode if (showEmissionColorAndGIControls) { bool shouldEmissionBeEnabled = showEmissionColorAndGIControls || showEmissionColorAndGIControlsTop || showEmissionColorAndGIControlsBottom; EditorGUI.BeginDisabledGroup(!shouldEmissionBeEnabled); m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); EditorGUI.EndDisabledGroup(); } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { base.OnGUI(materialEditor, props); materialEditor.LightmapEmissionProperty(0); foreach (Material material in materialEditor.targets) { material.globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { base.OnGUI(materialEditor, props); materialEditor.LightmapEmissionProperty(0); UnityEngine.Object[] targets = materialEditor.targets; for (int i = 0; i < targets.Length; i++) { Material material = (Material)targets[i]; material.globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; } }