void DoEmissionArea(Material material) { // Emission for GI? if (m_MaterialEditor.EmissionEnabledProperty()) { bool hadEmissionTexture = emissionMapProp.textureValue != null; // Texture and HDR color controls m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionMapLabel, emissionMapProp, emissionColorProp, m_ColorPickerHDRConfig, false); // If texture was assigned and color was black set color to white float brightness = emissionColorProp.colorValue.maxColorComponent; if (emissionMapProp.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorProp.colorValue = Color.white; } // LW does not support RealtimeEmissive. We set it to bake emissive and handle the emissive is black right. material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; if (brightness <= 0f) { material.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } } }
void DoEmissionArea(Material material) { // Emission for GI? if (m_MaterialEditor.EmissionEnabledProperty()) { bool hadEmissionTexture = emissionMap.textureValue != null; // Texture and HDR color controls #if UNITY_2018_1_OR_NEWER m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, false); #else m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false); #endif // 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; } // change the GI flag and fix it up with emissive as black if necessary m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } }
private void DoEmissionArea(Material material) { if (materialEditor.EmissionEnabledProperty()) { bool hasEmissionTexture = emissionMap.textureValue != null; materialEditor.TexturePropertyWithHDRColor(Styles.EmissionText, emissionMap, emissionColorForRendering, false); float brightness = emissionColorForRendering.colorValue.maxColorComponent; if (emissionMap.textureValue != null && !hasEmissionTexture && brightness <= 0.0f) { emissionColorForRendering.colorValue = Color.white; } if (hasEmissionTexture) { material.EnableKeyword("USING_EMISSION_MAP"); } else { material.DisableKeyword("USING_EMISSION_MAP"); } materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } }
public void DrawSection(MaterialEditor materialEditor) { EditorGUI.BeginChangeCheck(); TSFunctions.DrawSelector(Enum.GetNames(typeof(ToonyStandardGUI.BlendMode)), _blendMode, Styles.blendMode, materialEditor); if (EditorGUI.EndChangeCheck()) { foreach (Material mat in _blendMode.targets) { ToonyStandardGUI.SetupMaterialWithBlendMode(mat, (ToonyStandardGUI.BlendMode)_blendMode.floatValue, mat.GetFloat("_OutlineOn") > 0); } } // Draw cull mode materialEditor.ShaderProperty(_Cull, Styles.cullMode); EditorGUILayout.Space(); // Draw main properties materialEditor.TexturePropertySingleLine(Styles.mainTex, _MainTex, _Color); if ((ToonyStandardGUI.BlendMode)_blendMode.floatValue == ToonyStandardGUI.BlendMode.Cutout) { EditorGUI.indentLevel += MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1; materialEditor.ShaderProperty(_Cutoff, Styles.cutOff); EditorGUI.indentLevel -= MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1; } materialEditor.TexturePropertySingleLine(Styles.normal, _BumpMap, _BumpScale); materialEditor.TexturePropertySingleLine(Styles.ramp, _Ramp, _RampColor); materialEditor.ShaderProperty(_RampOffset, Styles.rampOffset); materialEditor.ShaderProperty(_ShadowIntensity, Styles.shadowIntensity); // Emission EditorGUI.BeginChangeCheck(); if (materialEditor.EmissionEnabledProperty()) { materialEditor.TexturePropertySingleLine(Styles.emission, _Emission, _EmissionColor); materialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel); } if (EditorGUI.EndChangeCheck()) { foreach (Material mat in _Emission.targets) { MaterialEditor.FixupEmissiveFlag(mat); bool shouldEmissionBeEnabled = (mat.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; TSFunctions.SetKeyword(mat, "_EMISSION", shouldEmissionBeEnabled); if (shouldEmissionBeEnabled) { mat.SetOverrideTag("IsEmissive", "true"); } else { mat.SetOverrideTag("IsEmissive", "false"); } } } materialEditor.TextureScaleOffsetProperty(_MainTex); EditorGUILayout.Space(); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { materialEditor.PropertiesDefaultGUI(props); Material material = materialEditor.target as Material; if (materialEditor.EmissionEnabledProperty()) { material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; } }
// Dedicated to emissive - for emissive Enlighten/PVR protected void DoEmissionArea(Material material) { // Emission for GI? if (ShouldEmissionBeEnabled(material)) { if (m_MaterialEditor.EmissionEnabledProperty()) { // change the GI flag and fix it up with emissive as black if necessary m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } } }
public void PropertiesDefaultGUI(MaterialEditor materialEditor) { var f = materialEditor.GetType().GetField("m_InfoMessage", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); if (f != null) { string m_InfoMessage = (string)f.GetValue(materialEditor); materialEditor.SetDefaultGUIWidths(); if (m_InfoMessage != null) { EditorGUILayout.HelpBox(m_InfoMessage, MessageType.Info); } else { GUIUtility.GetControlID(s_ControlHash, FocusType.Passive, new Rect(0f, 0f, 0f, 0f)); } } foreach (var props in s_GraphProperty.Values) { MaterialProperty prop = props.title; if ((prop.flags & (MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData)) == MaterialProperty.PropFlags.None) { if (props.child != null && props.child.Count > 0) { //如果发现有面板,使用Foldout来绘制 prop.floatValue = Convert.ToSingle(EditorGUILayout.Foldout(Convert.ToBoolean(prop.floatValue), prop.displayName)); if (prop.floatValue == 1f) { foreach (var child in props.child) { DrawGUI(materialEditor, child.title, true); } } } else { DrawGUI(materialEditor, prop, false); } } } EditorGUILayout.Space(); EditorGUILayout.Space(); if (SupportedRenderingFeatures.active.editableMaterialRenderQueue) { materialEditor.RenderQueueField(); } materialEditor.EnableInstancingField(); materialEditor.DoubleSidedGIField(); //unity 2020 新版本功能 ,老版本需要注释掉 materialEditor.EmissionEnabledProperty(); }
void DoEmissionArea(Material material) { #if UNITY_5_6_OR_NEWER // Emission for GI? if (m_MaterialEditor.EmissionEnabledProperty()) { bool hadEmissionTexture = emissionMap.textureValue != null; // Texture and HDR color controls #if UNITY_2018_1_OR_NEWER m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, false); #else m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false); #endif // 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; } // change the GI flag and fix it up with emissive as black if necessary m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } #else var showHelpBox = !HasValidEmissiveKeyword(material); var 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 var brightness = emissionColorForRendering.colorValue.maxColorComponent; if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorForRendering.colorValue = Color.white; } // Emission for GI? m_MaterialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel + 0); if (showHelpBox) { EditorGUILayout.HelpBox(Styles.emissiveWarning.text, MessageType.Warning); } #endif }
private void DoEmission() { if (m_MaterialEditor.EmissionEnabledProperty()) { bool hadEmissionMap = emissionMapProp.textureValue != null; m_MaterialEditor.TexturePropertySingleLine(Styles.emissionMapLabel, emissionMapProp, emissionColorProp); float maxValue = emissionColorProp.colorValue.maxColorComponent; if (emissionMapProp.textureValue != null && !hadEmissionMap && maxValue <= 0.0f) { emissionColorProp.colorValue = Color.white; } m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { materialEditor.PropertiesDefaultGUI(props); foreach (MaterialProperty prop in props) { if (prop.name == "_EmissionColor") { if (materialEditor.EmissionEnabledProperty()) { materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } return; } } }
public static void DrawEmissionProperties( Material material, MaterialEditor materialEditor, MaterialProperty emissionTextureProp, MaterialProperty emissionColorProp, MaterialProperty emissionBakedMultiplierProp) { // Emission for GI? bool emissive = materialEditor.EmissionEnabledProperty(); bool hadEmissionTexture = emissionTextureProp.textureValue != null; EditorGUI.BeginDisabledGroup(!emissive); { // Texture and HDR color controls materialEditor.TexturePropertyWithHDRColor(Styles.emissionTex, emissionTextureProp, emissionColorProp, false); EditorGUI.BeginChangeCheck(); float emissionBakedMultiplier = EditorGUILayout.FloatField(Styles.emissionBakedMultiplier, emissionBakedMultiplierProp.floatValue); if (EditorGUI.EndChangeCheck()) { emissionBakedMultiplierProp.floatValue = emissionBakedMultiplier; } } EditorGUI.EndDisabledGroup(); // If texture was assigned and color was black set color to white var brightness = emissionColorProp.colorValue.maxColorComponent; if (emissionTextureProp.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorProp.colorValue = Color.white; } // HPSXRP does not support RealtimeEmissive. We set it to bake emissive and handle the emissive is black right. if (emissive) { material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; if (brightness <= 0f) { material.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { materialEditor.PropertiesDefaultGUI(props); if (materialEditor.EmissionEnabledProperty()) { materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true, true); } // Make sure all selected materials are initialized: // Default to disable "MotionVectors" pass when no legacy SubShader tag "MotionVector" is found, // then show and enable "MotionVectors" pass or not based on UI input. string materialTag = "MotionVector"; foreach (var obj in materialEditor.targets) { var material = (Material)obj; string tag = material.GetTag(materialTag, false, "Nothing"); if (tag == "Nothing") { material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, false); material.SetOverrideTag(materialTag, "User"); } } { // If using multi-select, apply toggled material to all materials. bool enabled = ((Material)materialEditor.target).GetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr); EditorGUI.BeginChangeCheck(); enabled = EditorGUILayout.Toggle("Motion Vector For Vertex Animation", enabled); if (EditorGUI.EndChangeCheck()) { foreach (var obj in materialEditor.targets) { var material = (Material)obj; material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, enabled); } } } if (DiffusionProfileMaterialUI.IsSupported(materialEditor)) { DiffusionProfileMaterialUI.OnGUI(FindProperty("_DiffusionProfileAsset", props), FindProperty("_DiffusionProfileHash", props)); } }
void DoEmissionArea(Material material) { // Emission for GI? if (m_MaterialEditor.EmissionEnabledProperty()) { bool hadEmissionTexture = emissionMap.textureValue != null; // Texture and HDR color controls m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, _EmissionColor, false); // If texture was assigned and color was black set color to white float brightness = _EmissionColor.colorValue.maxColorComponent; if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) { _EmissionColor.colorValue = Color.white; } material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; // change the GI flag and fix it up with emissive as black if necessary m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); } }
void DoEmissionArea(Material material) { if (me.EmissionEnabledProperty()) { emissionEnabled = true; bool hadEmissionTexture = emissionMap.textureValue != null; MGUI.ToggleGroup(!emissionEnabled); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); me.LightmapEmissionFlagsProperty(0, true); me.ShaderProperty(audioLinkEmission, Tips.audioLinkEmission); me.ShaderProperty(emissPulseWave, Tips.emissPulseWave); if (audioLinkEmission.floatValue > 0) { me.ShaderProperty(audioLinkEmissionStrength, Tips.audioLinkEmissionStrength); } if (emissPulseWave.floatValue > 0) { me.ShaderProperty(emissPulseStrength, Tips.emissPulseStrength); me.ShaderProperty(emissPulseSpeed, Tips.emissPulseSpeed); } MGUI.Space2(); me.TexturePropertySingleLine(Tips.emissionText, emissionMap, emissionColorForRendering, emissIntensity); MGUI.TexPropLabel("Intensity", 105); MGUI.SpaceN2(); me.TexturePropertySingleLine(Tips.maskText, emissionMask); MGUI.SpaceN4(); }); MGUI.ToggleGroupEnd(); float brightness = emissionColorForRendering.colorValue.maxColorComponent; if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) { emissionColorForRendering.colorValue = Color.white; } } else { emissionEnabled = false; } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { materialEditor.PropertiesDefaultGUI(props); if (materialEditor.EmissionEnabledProperty()) { // Use the overload version of this function once the following PR is merged: Pull request #74105 materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true); //materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true, true); } // Make sure all selected materials are initialized. string materialTag = "MotionVector"; foreach (var obj in materialEditor.targets) { var material = (Material)obj; string tag = material.GetTag(materialTag, false, "Nothing"); if (tag == "Nothing") { material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, false); material.SetOverrideTag(materialTag, "User"); } } { // If using multi-select, apply toggled material to all materials. bool enabled = ((Material)materialEditor.target).GetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr); EditorGUI.BeginChangeCheck(); enabled = EditorGUILayout.Toggle("Enable Motion Vector For Vertex Animation", enabled); if (EditorGUI.EndChangeCheck()) { foreach (var obj in materialEditor.targets) { var material = (Material)obj; material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, enabled); } } } }
public void DrawSection(MaterialEditor materialEditor) { EditorGUI.BeginChangeCheck(); TSFunctions.DrawSelector(Enum.GetNames(typeof(ToonyStandardGUI.BlendMode)), _blendMode, Styles.blendMode, materialEditor); if (EditorGUI.EndChangeCheck()) { foreach (Material mat in _blendMode.targets) { ToonyStandardGUI.SetupMaterialWithBlendMode(mat, (ToonyStandardGUI.BlendMode)_blendMode.floatValue, mat.GetFloat("_OutlineOn") > 0); } } //draw cull mode materialEditor.ShaderProperty(_Cull, Styles.cullMode); EditorGUILayout.Space(); //draw main properties materialEditor.TexturePropertySingleLine(Styles.mainTex, _MainTex, _Color); if ((ToonyStandardGUI.BlendMode)_blendMode.floatValue == ToonyStandardGUI.BlendMode.Cutout) { EditorGUI.indentLevel += MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1; materialEditor.ShaderProperty(_Cutoff, Styles.cutOff); EditorGUI.indentLevel -= MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1; } materialEditor.TexturePropertySingleLine(Styles.normal, _BumpMap, _BumpScale); if (level == InspectorLevel.Normal) { Rect r = TSFunctions.GetControlRectForSingleLine(); EditorGUI.BeginChangeCheck(); materialEditor.TexturePropertyMiniThumbnail(r, _OcclusionMap, Styles.occlusion.text, Styles.occlusion.tooltip); if (EditorGUI.EndChangeCheck()) { gui.RegenerateMSOT(false); } TSFunctions.ProperSlider(MaterialEditor.GetRectAfterLabelWidth(r), ref _Occlusion); } else { materialEditor.ShaderProperty(_Occlusion, Styles.occlusion); } //emission EditorGUI.BeginChangeCheck(); if (materialEditor.EmissionEnabledProperty()) { materialEditor.TexturePropertySingleLine(Styles.emission, _Emission, _EmissionColor); materialEditor.LightmapEmissionProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel); } if (EditorGUI.EndChangeCheck()) { foreach (Material mat in _Emission.targets) { MaterialEditor.FixupEmissiveFlag(mat); bool shouldEmissionBeEnabled = (mat.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; TSFunctions.SetKeyword(mat, "_EMISSION", shouldEmissionBeEnabled); if (shouldEmissionBeEnabled) { mat.SetOverrideTag("IsEmissive", "true"); } else { mat.SetOverrideTag("IsEmissive", "false"); } } } //if in expert mode show the MSOT map and a button for the texture packer if (level == InspectorLevel.Expert) { EditorGUILayout.BeginHorizontal(); materialEditor.TexturePropertySingleLine(Styles.MSOT, _MSOT); if (GUILayout.Button(Styles.TexturePackerButton)) { EditorGUILayout.EndHorizontal(); isTexturePackerOpen = !isTexturePackerOpen; Styles.ToggleTexturePackerContent(isTexturePackerOpen); } else { EditorGUILayout.EndHorizontal(); } if (isTexturePackerOpen) { EditorGUILayout.BeginVertical("box"); packer.DrawGUI(); EditorGUILayout.EndVertical(); if (_MSOT.textureValue != (Texture)packer.resultTex && packer.resultTex != null) { _MSOT.textureValue = packer.resultTex; packer.resultTex = null; } } } EditorGUILayout.Space(); materialEditor.TextureScaleOffsetProperty(_MainTex); //EditorGUILayout.Space(); //materialEditor.RenderQueueField(); EditorGUILayout.Space(); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { this.materialEditor = materialEditor; _properties = properties; _target = materialEditor.target as Material; Debug.Assert(_target != null, "_target != null"); if (_target.shader.name.Equals("FlatKit/Stylized Surface With Outline")) { EditorGUILayout.HelpBox( "'Stylized Surface with Outline' shader has been deprecated. Please use the outline section in the 'Stylized Surface' shader.", MessageType.Warning); } int originalIntentLevel = EditorGUI.indentLevel; int foldoutRemainingItems = 0; bool latestFoldoutState = false; foreach (MaterialProperty property in properties) { string displayName = property.displayName; if (displayName.Contains("[") && !displayName.Contains("FOLDOUT")) { EditorGUI.indentLevel += 1; } bool skipProperty = false; skipProperty |= displayName.Contains("[_CELPRIMARYMODE_SINGLE]") && !_target.IsKeywordEnabled("_CELPRIMARYMODE_SINGLE"); skipProperty |= displayName.Contains("[_CELPRIMARYMODE_STEPS]") && !_target.IsKeywordEnabled("_CELPRIMARYMODE_STEPS"); skipProperty |= displayName.Contains("[_CELPRIMARYMODE_CURVE]") && !_target.IsKeywordEnabled("_CELPRIMARYMODE_CURVE"); skipProperty |= displayName.Contains("[DR_CEL_EXTRA_ON]") && !property.name.Equals("_CelExtraEnabled") && !_target.IsKeywordEnabled("DR_CEL_EXTRA_ON"); skipProperty |= displayName.Contains("[DR_SPECULAR_ON]") && !property.name.Equals("_SpecularEnabled") && !_target.IsKeywordEnabled("DR_SPECULAR_ON"); skipProperty |= displayName.Contains("[DR_RIM_ON]") && !property.name.Equals("_RimEnabled") && !_target.IsKeywordEnabled("DR_RIM_ON"); skipProperty |= displayName.Contains("[DR_GRADIENT_ON]") && !property.name.Equals("_GradientEnabled") && !_target.IsKeywordEnabled("DR_GRADIENT_ON"); skipProperty |= displayName.Contains("[_UNITYSHADOWMODE_MULTIPLY]") && !_target.IsKeywordEnabled("_UNITYSHADOWMODE_MULTIPLY"); skipProperty |= displayName.Contains("[_UNITYSHADOWMODE_COLOR]") && !_target.IsKeywordEnabled("_UNITYSHADOWMODE_COLOR"); skipProperty |= displayName.Contains("[DR_ENABLE_LIGHTMAP_DIR]") && !_target.IsKeywordEnabled("DR_ENABLE_LIGHTMAP_DIR"); skipProperty |= displayName.Contains("[DR_OUTLINE_ON]") && !_target.IsKeywordEnabled("DR_OUTLINE_ON"); if (_target.IsKeywordEnabled("DR_ENABLE_LIGHTMAP_DIR") && displayName.Contains("Override light direction")) { var dirPitch = _target.GetFloat("_LightmapDirectionPitch"); var dirYaw = _target.GetFloat("_LightmapDirectionYaw"); var dirPitchRad = dirPitch * Mathf.Deg2Rad; var dirYawRad = dirYaw * Mathf.Deg2Rad; var direction = new Vector4(Mathf.Sin(dirPitchRad) * Mathf.Sin(dirYawRad), Mathf.Cos(dirPitchRad), Mathf.Sin(dirPitchRad) * Mathf.Cos(dirYawRad), 0.0f); _target.SetVector("_LightmapDirection", direction); } if (displayName.Contains("FOLDOUT")) { string foldoutName = displayName.Split('(', ')')[1]; string foldoutItemCount = displayName.Split('{', '}')[1]; foldoutRemainingItems = Convert.ToInt32(foldoutItemCount); if (!FoldoutStates.ContainsKey(property.name)) { FoldoutStates.Add(property.name, false); } EditorGUILayout.Space(); FoldoutStates[property.name] = EditorGUILayout.Foldout(FoldoutStates[property.name], foldoutName); latestFoldoutState = FoldoutStates[property.name]; } if (foldoutRemainingItems > 0) { skipProperty = skipProperty || !latestFoldoutState; EditorGUI.indentLevel += 1; --foldoutRemainingItems; } if (_target.IsKeywordEnabled("_CELPRIMARYMODE_STEPS") && displayName.Contains("[LAST_PROP_STEPS]")) { EditorGUILayout.HelpBox( "This mode creates a step texture that control the light/shadow transition. To use:\n" + "1. Set the number of steps (e.g. 3 means three steps between lit and shaded regions), \n" + "2. Save the steps as a texture - 'Save Ramp Texture' button", MessageType.Info); int currentNumSteps = _target.GetInt("_CelNumSteps"); if (currentNumSteps != _celShadingNumSteps) { if (GUILayout.Button("Save Ramp Texture")) { _celShadingNumSteps = currentNumSteps; PromptTextureSave(materialEditor, GenerateStepTexture, "_CelStepTexture", FilterMode.Point); } } } if (_target.IsKeywordEnabled("_CELPRIMARYMODE_CURVE") && displayName.Contains("[LAST_PROP_CURVE]")) { EditorGUILayout.HelpBox( "This mode uses arbitrary curves to control the light/shadow transition. How to use:\n" + "1. Set shading curve (generally from 0.0 to 1.0)\n" + "2. [Optional] Save the curve preset\n" + "3. Save the curve as a texture.", MessageType.Info); _gradient = EditorGUILayout.CurveField("Shading curve", _gradient); if (GUILayout.Button("Save Ramp Texture")) { PromptTextureSave(materialEditor, GenerateCurveTexture, "_CelCurveTexture", FilterMode.Trilinear); } } if (!skipProperty && property.type == MaterialProperty.PropType.Color && property.colorValue == HashColor) { property.colorValue = _target.GetColor(ColorPropertyName); } if (!skipProperty && property.name.Contains("_EmissionMap")) { EditorGUILayout.Space(20); bool emission = materialEditor.EmissionEnabledProperty(); if (emission) { _target.EnableKeyword("_EMISSION"); } else { _target.DisableKeyword("_EMISSION"); } } bool hideInInspector = (property.flags & MaterialProperty.PropFlags.HideInInspector) != 0; if (!hideInInspector && !skipProperty) { DrawStandard(property); } EditorGUI.indentLevel = originalIntentLevel; } EditorGUILayout.Space(); FoldoutStates["Rendering options"] = EditorGUILayout.Foldout(FoldoutStates["Rendering options"], "Rendering options"); if (FoldoutStates["Rendering options"]) { EditorGUI.indentLevel += 1; HandleUrpSettings(_target, materialEditor); QueueOffsetProp = FindProperty("_QueueOffset", _properties, false); DrawQueueOffsetField(); materialEditor.EnableInstancingField(); } // Toggle the outline pass. _target.SetShaderPassEnabled("SRPDefaultUnlit", _target.IsKeywordEnabled("DR_OUTLINE_ON")); /* * if (HasProperty("_MainTex")) { * TransferToBaseMap(); * } * //*/ }