public void ShaderPropertiesGUI(Material material) { // Use default labelWidth EditorGUIUtility.labelWidth = 0f; // Detect any changes to the material EditorGUI.BeginChangeCheck(); { BlendModePopup(); // Primary properties GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel); DoAlbedoArea(material); DoSpecularMetallicArea(); m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null); DoEmissionArea(material); m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask); EditorGUI.BeginChangeCheck(); m_MaterialEditor.TextureScaleOffsetProperty(albedoMap); if (EditorGUI.EndChangeCheck()) { emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake } EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(heightFogStart, Styles.heightFogStart.text); m_MaterialEditor.ShaderProperty(heightFogEnd, Styles.heightFogEnd.text); //m_MaterialEditor.ShaderProperty (heightFogColor, Styles.heightFogColor.text); m_MaterialEditor.ColorProperty(heightFogColor, Styles.heightFogColor.text); // Secondary properties GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel); m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap); m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale); m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap); m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text); } if (EditorGUI.EndChangeCheck()) { foreach (var obj in blendMode.targets) { MaterialChanged((Material)obj, m_WorkflowMode); } } }
void DoSpecularMetallicArea() { if (m_WorkflowMode == WorkflowMode.Specular) { if (specularMap.textureValue == null) { m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, specularColor); int indent = 3; EditorGUI.indentLevel += indent; if (!SmoothnessInAlbedoToggle()) { m_MaterialEditor.ShaderProperty(smoothness, Styles.smoothnessText.text); } EditorGUI.indentLevel -= indent; } else { m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap); if (specularMapColorTweak != null) { m_MaterialEditor.ColorProperty(specularMapColorTweak, specularMapColorTweak.displayName); } if (smoothnessTweak1 != null && smoothnessTweak2 != null) { m_MaterialEditor.ShaderProperty(smoothnessTweak1, smoothnessTweak1.displayName); m_MaterialEditor.ShaderProperty(smoothnessTweak2, smoothnessTweak2.displayName); } } } else if (m_WorkflowMode == WorkflowMode.Metallic) { if (metallicMap.textureValue == null) { m_MaterialEditor.TexturePropertyTwoLines(Styles.metallicMapText, metallicMap, metallic, Styles.smoothnessText, smoothness); } else { m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap); } } }
private void ShaderPropertiesGUI(Material material) { // Use default labelWidth EditorGUIUtility.labelWidth = 0f; // Detect any changes to the material EditorGUI.BeginChangeCheck(); { // Primary properties GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel); // Albedo, normal and uv scale/offset _materialEditor.TexturePropertySingleLine(Styles.albedoText, _albedoMap); _materialEditor.TexturePropertySingleLine(Styles.normalText, _normalMap); _materialEditor.TextureScaleOffsetProperty(_albedoMap); // Primary properties GUILayout.Label(Styles.crossHatchingText, EditorStyles.boldLabel); // Tonal Art Maps and uv scale/offset _materialEditor.TexturePropertySingleLine(Styles.tam0Text, _tam0); _materialEditor.TexturePropertySingleLine(Styles.tam1Text, _tam1); _materialEditor.TexturePropertySingleLine(Styles.tam2Text, _tam2); _materialEditor.TexturePropertySingleLine(Styles.tam3Text, _tam3); _materialEditor.TexturePropertySingleLine(Styles.tam4Text, _tam4); _materialEditor.TexturePropertySingleLine(Styles.tam5Text, _tam5); _materialEditor.TextureScaleOffsetProperty(_tam0); // Ink color _materialEditor.ColorProperty(_inkColor, "Ink Color"); } // Setup the TAM texture array if (EditorGUI.EndChangeCheck()) { SetupTexArray(material); } }
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) { //Debug.Log("OnGUI: " + label + " RTP_MaterialProp"); if (!parsed) { parsed = true; parsedLabel = RTP_MatPropStringParser.Parse(label); } label = parsedLabel; if (editor is RTP_CustomShaderGUI) { RTP_CustomShaderGUI customEditor = editor as RTP_CustomShaderGUI; if (customEditor.showFlag && (show_for_active_layer == -1 || customEditor.active_layer == show_for_active_layer) && prop.name!= "dummy_end") { EditorGUI.BeginDisabledGroup(customEditor.inactiveFlag); switch (prop.type) { //case MaterialProperty.PropType.Range: // float ranges // { // editor.RangeProperty(position, prop, label); // break; // } //case MaterialProperty.PropType.Float: // floats // { // editor.FloatProperty(position, prop, label); // break; // } case MaterialProperty.PropType.Color: // colors { EditorGUIUtility.labelWidth -= 30; if (noAlphaFlag) { EditorGUI.ColorField(position, new GUIContent(label, ""), prop.colorValue, true, false, false, null); } else { editor.ColorProperty(position, prop, label); } break; } case MaterialProperty.PropType.Texture: // textures { EditorGUI.BeginChangeCheck(); if (miniThumbFlag) { editor.TexturePropertyMiniThumbnail(position, prop, label,""); } else { editor.TextureProperty(position, prop, label, !noTileOffsetFlag); } if (EditorGUI.EndChangeCheck() && prop.textureValue!=null && sharedTextures!=null) { for(int j=0; j<sharedTextures.Length; j++) { foreach(Material mat in editor.targets) { if (mat.HasProperty(sharedTextures[j])) { mat.SetTexture(sharedTextures[j], prop.textureValue); } } } } break; } case MaterialProperty.PropType.Vector: // vectors { if (byLayerFlag) { // // affect single vector component depending on active layer // int layerNum = customEditor.active_layer; float pval = prop.vectorValue[layerNum]; float nval; if (minVal == maxVal) { // float EditorGUIUtility.labelWidth -= 23; nval = EditorGUI.FloatField(position, label, pval); } else { // slider EditorGUIUtility.labelWidth = 160; nval = EditorGUI.Slider(position, label, pval, minVal, maxVal); } if (pval!=nval) { for(int i=0; i< prop.targets.Length; i++) { Material mat = (prop.targets[i] as Material); Vector4 vec = mat.GetVector(prop.name); vec[layerNum] = nval; mat.SetVector(prop.name, vec); } } } else { position.x += 12; position.width -= 12; editor.VectorProperty(position, prop, label); } break; } default: { if (customEditor.nextLabelWidth>0) { EditorGUIUtility.labelWidth = customEditor.nextLabelWidth; customEditor.nextLabelWidth = 0; } else { EditorGUIUtility.labelWidth -= 30; } editor.DefaultShaderProperty(position, prop, label); break; } } EditorGUI.EndDisabledGroup(); } } }
public void ShaderPropertiesGUI(Material material, MaterialProperty[] properties) { EditorGUIUtility.labelWidth = 0f; GUILayout.Label("Leaf form and size", EditorStyles.boldLabel); ShowShapeTypePopUp(); m_MaterialEditor.ShaderProperty(_Size, "Leaf Length"); m_MaterialEditor.RangeProperty(_LowerWidth, "Base width"); m_MaterialEditor.RangeProperty(_UpperWidth, "Upper width"); EditorGUILayout.Space(); GUILayout.Label("Leafs detail", EditorStyles.boldLabel); m_MaterialEditor.RangeProperty(_LeafCuts, "Leaf cuts (Leaf Quality)"); m_MaterialEditor.RangeProperty(_VisibleRange, "Visible range"); m_MaterialEditor.RangeProperty(_LODDistance, "LoD Distance"); m_MaterialEditor.RangeProperty(_DetailReductionFactor, "Detail reduction factor"); ShowLeafsPerTrianglePopUp(); EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(_EnableBasePlane, "Enable mesh base"); EditorGUILayout.Space(); GUILayout.Label("Color", EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(_EnableGradient, "Enable Gradient"); m_MaterialEditor.ColorProperty(_BaseColor, "Base color"); if (_EnableGradient.floatValue == 1) { m_MaterialEditor.ColorProperty(_MiddleColor, "Middle color"); m_MaterialEditor.ColorProperty(_TopColor, "Top color"); m_MaterialEditor.RangeProperty(_GradientCenter, "Gradient center"); } EditorGUILayout.Space(); GUILayout.Label("Noise", EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(_EnableNoise, "Enable Noise"); if (_EnableNoise.floatValue == 1) { m_MaterialEditor.ShaderProperty(_NoiseTex, "Noise texture"); m_MaterialEditor.ShaderProperty(_NoiseStrength, "Noise Strength"); m_MaterialEditor.ShaderProperty(_EnableRandomLength, "Enable Random Length"); if (_EnableRandomLength.floatValue == 1) { m_MaterialEditor.ShaderProperty(_LengthIntensity, "Length Intensity Strength"); m_MaterialEditor.ShaderProperty(_LengthMaxDiference, "Max length difference"); } } EditorGUILayout.Space(); GUILayout.Label("Wind", EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(_EnableWind, "Enable wind"); if (_EnableWind.floatValue == 1.0) { m_MaterialEditor.TextureProperty(_WindTex, "Wind Texture", true); m_MaterialEditor.ShaderProperty(_WindTexCol, "Colors to look for"); m_MaterialEditor.ShaderProperty(_WindStrength, "Strength"); m_MaterialEditor.ShaderProperty(_WindSpeed, "Speed"); } EditorGUILayout.Space(); GUILayout.Label("Mesh Grass Mask", EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(_EnableMask, "Enable mask"); if (_EnableMask.floatValue == 1.0) { m_MaterialEditor.ShaderProperty(_AffectBase, "Affect Mesh Base"); m_MaterialEditor.TextureProperty(_MaskTex, "Mask Texture", true); } GUILayout.Label("Smash", EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(_EnablePressure, "Enable smash"); if (_EnablePressure.floatValue == 1.0) { m_MaterialEditor.TextureProperty(_PressureTex, "Smash texture", true); m_MaterialEditor.RangeProperty(_PressureStrength, "Smash Strength"); } }
void DoSpecularMetallicArea() { // m_MaterialEditor.ColorProperty(lightcol, "_LColor"); // m_MaterialEditor.VectorProperty(lightpos,"_WSLP"); m_MaterialEditor.RangeProperty(giglossiness, "GiGlossiness"); m_MaterialEditor.RangeProperty(gidarkness, "GiDarkness"); if (m_WorkflowMode == WorkflowMode.Skin) { // m_MaterialEditor.ColorProperty(skincolor, "SkinColor"); // m_MaterialEditor.ColorProperty(clothcolor, "ClothColor"); m_MaterialEditor.RangeProperty(hues, "Skin HVS"); m_MaterialEditor.RangeProperty(sats, "Skin SAT"); m_MaterialEditor.RangeProperty(vals, "Skin VAL"); m_MaterialEditor.RangeProperty(huec, "Cloth HVS"); m_MaterialEditor.RangeProperty(satc, "Cloth SAT"); m_MaterialEditor.RangeProperty(valc, "Cloth VAL"); } bool hasGlossMap = false; if (m_WorkflowMode == WorkflowMode.Specular) { hasGlossMap = specularMap.textureValue != null; m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, hasGlossMap ? null : specularColor); } else if (m_WorkflowMode == WorkflowMode.Gloss || m_WorkflowMode == WorkflowMode.Skin) { hasGlossMap = metallicMap.textureValue != null; m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic); } else if (m_WorkflowMode == WorkflowMode.LMap) { hasGlossMap = metallicMap.textureValue != null; m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic); m_MaterialEditor.ColorProperty(lightcol, "_LColor"); m_MaterialEditor.VectorProperty(lightpos, "_WSLP"); } else if (m_WorkflowMode == WorkflowMode.LMap20) { // hasGlossMap = metallicMap.textureValue != null; // m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic); m_MaterialEditor.ColorProperty(lightcol, "_LColor"); m_MaterialEditor.VectorProperty(lightpos, "_WSLP"); } bool showSmoothnessScale = hasGlossMap; if (smoothnessMapChannel != null) { int smoothnessChannel = (int)smoothnessMapChannel.floatValue; if (smoothnessChannel == (int)SmoothnessMapChannel.AlbedoAlpha) { showSmoothnessScale = true; } } //int indentation = 2; // align with labels of texture properties //m_MaterialEditor.ShaderProperty(showSmoothnessScale ? smoothnessScale : smoothness, showSmoothnessScale ? Styles.smoothnessScaleText : Styles.smoothnessText, indentation); // smoothness = 0.8f; // smoothnessScale = 0.8f; m_MaterialEditor.RangeProperty(smoothness, "Smoothness value"); m_MaterialEditor.RangeProperty(smoothnessScale, "Smoothness scale factor"); //++indentation; // if (smoothnessMapChannel != null) // m_MaterialEditor.ShaderProperty(smoothnessMapChannel, Styles.smoothnessMapChannelText, indentation); }
void DoDissolveArea(Material material) { m_MaterialEditor.TexturePropertySingleLine(Styles.dissolveMapText, dissolveMap); EditorGUI.indentLevel += (MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); m_Tiling.x = tilingX.floatValue; m_Tiling.y = tilingY.floatValue; EditorGUI.BeginChangeCheck(); m_Tiling = EditorGUILayout.Vector2Field(Styles.tilingText, m_Tiling); if (EditorGUI.EndChangeCheck()) { tilingX.floatValue = m_Tiling.x; tilingY.floatValue = m_Tiling.y; } EditorGUI.indentLevel -= (MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); m_MaterialEditor.ShaderProperty(dissolveAmount, Styles.dissolveAmountText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); m_MaterialEditor.TexturePropertySingleLine(Styles.directionMapText, directionMap); m_MaterialEditor.TexturePropertySingleLine(Styles.substituteText, substituteMap); EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(dissolveGlow, Styles.burnInText.text); if (material.IsKeywordEnabled("_DISSOLVEGLOW_ON")) { m_MaterialEditor.ShaderProperty(glowFollow, Styles.glowFollowText.text); m_MaterialEditor.ColorProperty(glowColor, Styles.burnColorText.text); m_MaterialEditor.FloatProperty(glowIntensity, Styles.burnIntensity.text); //m_MaterialEditor.FloatProperty(paintGlowPower, Styles.paintGlowPower.text); } EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(edgeGlow, Styles.edgeGlowText.text); if (!material.IsKeywordEnabled("_EDGECOLORRAMP_USE")) { m_MaterialEditor.ShaderProperty(colorBlend, Styles.blendColorsText.text); m_MaterialEditor.ColorProperty(outerEdgeColor, Styles.outerEdgeText.text); if (!material.IsKeywordEnabled("_COLORBLENDING_ON")) { m_MaterialEditor.ShaderProperty(outerEdgeThickness, Styles.edgeThicknessText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); } m_MaterialEditor.ColorProperty(innerEdgeColor, Styles.innerEdgeText.text); if (!material.IsKeywordEnabled("_COLORBLENDING_ON")) { m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); } else { m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessSoloText.text); } } else { m_MaterialEditor.TexturePropertySingleLine(Styles.edgeColorRampText, edgeColorRamp); m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessSoloText.text); } EditorGUILayout.Space(); EditorGUI.indentLevel++; m_AdvancedSettings = EditorGUILayout.Foldout(m_AdvancedSettings, Styles.advancedSettings); if (m_AdvancedSettings) { EditorGUI.indentLevel++; EditorGUILayout.Space(); DoAdvancedArea(material); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; EditorGUILayout.Space(); }
public virtual void DoDissolveArea(Material material) { m_MaterialEditor.TexturePropertySingleLine(Styles.dissolveMapText, dissolveMap); ShowDissolveMap(material); m_MaterialEditor.TexturePropertySingleLine(Styles.directionMapText, directionMap); if (substituteMap != null) { m_MaterialEditor.TexturePropertySingleLine(Styles.substituteText, substituteMap); } if (substituteColor != null) { m_MaterialEditor.ColorProperty(substituteColor, Styles.substituteColorText.text); } m_MaterialEditor.ShaderProperty(dissolveGlow, Styles.burnInText.text); if (material.IsKeywordEnabled("_DISSOLVEGLOW_ON")) { if (glowFollow != null) { m_MaterialEditor.ShaderProperty(glowFollow, Styles.glowFollowText.text); } m_MaterialEditor.ColorProperty(glowColor, Styles.burnColorText.text); m_MaterialEditor.FloatProperty(glowIntensity, Styles.burnIntensity.text); } if (!material.IsKeywordEnabled("_EDGECOLORRAMP_USE")) { m_MaterialEditor.ShaderProperty(colorBlend, Styles.blendColorsText.text); m_MaterialEditor.ColorProperty(outerEdgeColor, Styles.outerEdgeText.text); if (!material.IsKeywordEnabled("_COLORBLENDING_ON")) { m_MaterialEditor.ShaderProperty(outerEdgeThickness, Styles.edgeThicknessText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); } m_MaterialEditor.ColorProperty(innerEdgeColor, Styles.innerEdgeText.text); if (!material.IsKeywordEnabled("_COLORBLENDING_ON")) { m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); } else { m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessSoloText.text); } } else { m_MaterialEditor.TexturePropertySingleLine(Styles.edgeColorRampText, edgeColorRamp); m_MaterialEditor.ShaderProperty(innerEdgeThickness, Styles.edgeThicknessSoloText.text); } EditorGUILayout.Space(); EditorGUI.indentLevel++; m_AdvancedSettings = EditorGUILayout.Foldout(m_AdvancedSettings, Styles.advancedSettings); if (m_AdvancedSettings) { EditorGUI.indentLevel++; EditorGUILayout.Space(); DoAdvancedArea(material); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; }
public void ShaderPropertiesGUI(Material material) { // Use default labelWidth EditorGUIUtility.labelWidth = 0f; // Detect any changes to the material EditorGUI.BeginChangeCheck(); { BlendModePopup(); // Primary properties GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel); DoAlbedoArea(material); DoSpecularMetallicArea(); m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null); DoEmissionArea(material); m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask); EditorGUI.BeginChangeCheck(); m_MaterialEditor.TextureScaleOffsetProperty(albedoMap); if (EditorGUI.EndChangeCheck()) { emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake } EditorGUILayout.Space(); // Secondary properties GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel); m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap); m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale); m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap); m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text); m_MaterialEditor.ColorProperty(sectionColor, "_SectionColor"); if (inverse != null) { m_MaterialEditor.ShaderProperty(inverse, Styles.inverseText); } if (stencilMask != null) { m_MaterialEditor.RangeProperty(stencilMask, "_StencilMask"); } // Third properties GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel); if (highlights != null) { m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText); } if (reflections != null) { m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText); } EditorGUILayout.Space(); if (retractBackfaces != null) { m_MaterialEditor.ShaderProperty(retractBackfaces, Styles.retractBackfacesText); } } if (EditorGUI.EndChangeCheck()) { foreach (var obj in blendMode.targets) { MaterialChanged((Material)obj, m_WorkflowMode); } } EditorGUILayout.Space(); GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel); m_MaterialEditor.RenderQueueField(); m_MaterialEditor.EnableInstancingField(); }
private void DissolveControl(MaterialEditor target) { Header("Dissolve", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:dissolve"); target.TextureProperty(_dissolveMap, "Dissolve Pattern", scaleOffset: false); target.RangeProperty(_dissolveBlend, "Blend"); GUILayout.Space(5f); target.RangeProperty(_dissolveBorderWidth, "Border Width"); target.ColorProperty(_dissolveGlowColor, "Border Glow Tint"); target.RangeProperty(_dissolveGlowStrength, "Border Glow width"); GUILayout.Space(10f); DrawWideBox(1f); if (!_shaderCompileKeywords.Contains(ShaderFeature.Dissolve.GetString())) EditorGUI.EndDisabledGroup(); }
private void EmissionControl(MaterialEditor target, bool noDisablegroup) { Header("Emission", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:emission"); target.RangeProperty(_emissionStrength, "Strength"); if (_hasEmissionTint) { target.ColorProperty(_emissionTint, "Tint"); GUILayout.Space(5f); target.TextureProperty(_emissionMask, "Mask"); } GUILayout.Space(10f); DrawWideBox(1f); //Turn off the Disable group? if (noDisablegroup) return; if (!_shaderCompileKeywords.Contains(ShaderFeature.Emission.GetString())) EditorGUI.EndDisabledGroup(); }
private void CurvatureControl(MaterialEditor target) { Header("Curvature", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:lava#curvature"); target.TextureProperty(_curvatureMap, "Curvature Map"); target.RangeProperty(_curvatureDepth, "Depth"); target.ColorProperty(_curvatureHighlight, "Highlight Color"); target.RangeProperty(_curvatureGloss, "Gloss"); GUILayout.Space(10f); DrawWideBox(1f); if (!_shaderCompileKeywords.Contains(ShaderFeature.Curvature.GetString())) EditorGUI.EndDisabledGroup(); }
private void SpriteControl(MaterialEditor target) { target.TextureProperty(_mainSprite, "Sprite", scaleOffset: false); if (_hasSpriteTint) target.ColorProperty(_mainSpriteTint, "Tint"); GUILayout.Space(10f); DrawWideBox(1f); }
public void ShaderPropertiesGUI(Material material) { // Use default labelWidth EditorGUIUtility.labelWidth = 0f; // Detect any changes to the material EditorGUI.BeginChangeCheck(); { BlendModePopup(); m_MaterialEditor.ShaderProperty(cullMode, Styles.cullText); // Primary properties GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel); DoAlbedoArea(material); DoSpecularMetallicArea(); m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null); m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null); m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask); DoEmissionArea(material); EditorGUI.BeginChangeCheck(); m_MaterialEditor.TextureScaleOffsetProperty(albedoMap); if (EditorGUI.EndChangeCheck()) { emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake } // Stylisation GUILayout.Label(Styles.styleText, EditorStyles.boldLabel); m_MaterialEditor.ShaderProperty(useToonData, Styles.toonDataText); DoLightControlArea(material); // Outline properties m_MaterialEditor.ShaderProperty(outlineEnabled, Styles.outlineText); if (outlineEnabled.floatValue > 0) { m_MaterialEditor.ColorProperty(outlineColor, Styles.outlineColorText.text); m_MaterialEditor.RangeProperty(outlineColorMix, Styles.outlineMixText.text); m_MaterialEditor.RangeProperty(outlineWidth, Styles.outlineWidthText.text); m_MaterialEditor.RangeProperty(outlineFade, Styles.outlineFadeText.text); } // Secondary properties GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel); m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap); m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale); m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap); m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text); // Third properties GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel); if (highlights != null) { m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText); } if (reflections != null) { m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText); } } if (EditorGUI.EndChangeCheck()) { foreach (var obj in blendMode.targets) { MaterialChanged((Material)obj, m_WorkflowMode); } } EditorGUILayout.Space(); // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel); m_MaterialEditor.EnableInstancingField(); m_MaterialEditor.DoubleSidedGIField(); }
//This is the Main view with all shader controlls private void MainView(MaterialEditor materialEditor) { GUILayout.Space(5f); switch (_setPanel) { case SettingsMode.Sprites: EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite"); GUILayout.Space(10f); EditorGUILayout.EndHorizontal(); GUILayout.Space(5f); materialEditor.TextureProperty(_mainSprite, "Sprite", scaleOffset: false); DrawWideBox(); GUILayout.Space(10f); GUILayout.BeginHorizontal(); materialEditor.ColorProperty(_mainSpriteTint, "Tint"); if (GUILayout.Button("Reset Tint")) { _matTarget.SetColor(ShaderColor.Sprite.GetString(), Color.white); } GUILayout.EndHorizontal(); GUILayout.Space(15f); ToggleFeature(_matTarget, "Main Layer Scrolling", ShaderFeature.SpriteScrolling); GUILayout.Space(5f); materialEditor.RangeProperty(_spriteLayer1ScrollingX, "X-Axis"); materialEditor.RangeProperty(_spriteLayer1ScrollingY, "Y-Axis"); GUILayout.BeginHorizontal(); if (GUILayout.Button("Reset Scrolling")) { _matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingX.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingY.GetString(), 0f); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Space(5f); ToggleFeature(_matTarget, "Multi Layer", ShaderFeature.SpriteMultiLayer, disableGroup: false); if (_matTarget.IsKeywordEnabled(ShaderFeature.SpriteMultiLayer.GetString())) { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite#multi_layer"); GUILayout.Space(10f); EditorGUILayout.EndHorizontal(); ToggleFeature(_matTarget, "Stencil Mask", ShaderFeature.SpriteStencil, disableGroup: true); materialEditor.TextureProperty(_spriteLayerStencil, "Stencil Mask"); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.HelpBox("Red: Layer 1# | Green: Layer 2# | Blue: Layer 3#", MessageType.None); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); DrawWideBox(); EditorGUI.EndDisabledGroup(); GUILayout.Box("Layer 1#", EditorStyles.miniButton); materialEditor.TextureProperty(_spriteLayer2Tex, "Sprite"); GUILayout.Space(10f); materialEditor.RangeProperty(_spriteLayer2Opacity, "Opacity"); materialEditor.ColorProperty(_spriteLayer2Color, "Tint"); materialEditor.RangeProperty(_spriteLayer2ScrollingX, "Scrolling X-Axis"); materialEditor.RangeProperty(_spriteLayer2ScrollingY, "Scrolling Y-Axis"); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset")) { _matTarget.SetFloat(ShaderFloat.SpriteLayer1Opacity.GetString(), 1f); _matTarget.SetColor(ShaderColor.SpriteLayer1.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingX.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingY.GetString(), 0f); } GUILayout.EndHorizontal(); GUILayout.Space(10f); DrawWideBox(); GUILayout.Box("Layer 2#", EditorStyles.miniButton); materialEditor.TextureProperty(_spriteLayer3Tex, "Sprite"); GUILayout.Space(10f); materialEditor.RangeProperty(_spriteLayer3Opacity, "Opacity"); materialEditor.ColorProperty(_spriteLayer3Color, "Tint"); materialEditor.RangeProperty(_spriteLayer3ScrollingX, "Scrolling X-Axis"); materialEditor.RangeProperty(_spriteLayer3ScrollingY, "Scrolling Y-Axis"); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset")) { _matTarget.SetFloat(ShaderFloat.SpriteLayer2Opacity.GetString(), 1f); _matTarget.SetColor(ShaderColor.SpriteLayer2.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.SpriteLayer2ScrollingX.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.SpriteLayer2ScrollingY.GetString(), 0f); } GUILayout.EndHorizontal(); GUILayout.Space(10f); DrawWideBox(); GUILayout.Box("Layer 3#", EditorStyles.miniButton); materialEditor.TextureProperty(_spriteLayer4Tex, "Sprite"); GUILayout.Space(10f); materialEditor.RangeProperty(_spriteLayer4Opacity, "Opacity"); materialEditor.ColorProperty(_spriteLayer4Color, "Tint"); materialEditor.RangeProperty(_spriteLayer4ScrollingX, "Scrolling X-Axis"); materialEditor.RangeProperty(_spriteLayer4ScrollingY, "Scrolling Y-Axis"); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset")) { _matTarget.SetFloat(ShaderFloat.SpriteLayer3Opacity.GetString(), 1f); _matTarget.SetColor(ShaderColor.SpriteLayer3.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.SpriteLayer3ScrollingX.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.SpriteLayer3ScrollingY.GetString(), 0f); } GUILayout.EndHorizontal(); } break; case SettingsMode.Curvature: GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Curvature", ShaderFeature.Curvature); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:curvature"); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(5f); materialEditor.TextureProperty(_curvatureMap, "Curvature Map"); GUILayout.Space(10f); DrawWideBox(); GUILayout.Space(10f); materialEditor.ColorProperty(_curvatureHighlight, "Highlight Tint"); GUILayout.Space(10f); DrawWideBox(); GUILayout.Space(10f); materialEditor.RangeProperty(_curvatureDepth, "Depth"); GUILayout.Space(10f); materialEditor.RangeProperty(_curvatureGloss, "Surface Glossiness"); GUILayout.Space(10f); DrawWideBox(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset Properties")) { _matTarget.SetFloat(ShaderFloat.CurvatureDepth.GetString(), 0.5f); _matTarget.SetColor(ShaderColor.Curvature.GetString(), Color.gray); _matTarget.SetFloat(ShaderFloat.CurvatureGloss.GetString(), 0.5f); } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); break; case SettingsMode.Reflection: GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Reflection", ShaderFeature.Reflection); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:reflection"); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(5f); materialEditor.TextureProperty(_reflectionScreenMap, "Reflection"); EditorGUILayout.HelpBox("Texture should have Wrap Mode set to Repeat.", MessageType.None); DrawWideBox(); materialEditor.RangeProperty(_reflectionStrength, "Reflection Strength"); GUILayout.Space(5f); materialEditor.RangeProperty(_reflectionBlur, "Blur"); GUILayout.Space(5f); DrawWideBox(); materialEditor.RangeProperty(_reflectionScrollingX, "Scrolling speed X"); GUILayout.Space(10f); materialEditor.RangeProperty(_reflectionScrollingY, "Scrolling speed Y"); DrawWideBox(); GUILayout.Space(5f); materialEditor.TextureProperty(_reflectionMask, "Mask"); DrawWideBox(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset Properties")) { _matTarget.SetFloat(ShaderFloat.ReflectionScrollSpeedX.GetString(), 0.25f); _matTarget.SetFloat(ShaderFloat.ReflectionScrollSpeedY.GetString(), 0.25f); _matTarget.SetFloat(ShaderFloat.ReflectionStrength.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.ReflectionBlur.GetString(), 0f); } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); break; case SettingsMode.Emission: var animationOn = _matTarget.IsKeywordEnabled(ShaderFeature.EmissionPulse.GetString()); GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Emission", ShaderFeature.Emission); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:emission"); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("Mask Channels\n\nRed: Layer 1#\nGreen: Layer 2#\nBlue: Layer 3#", MessageType.None); materialEditor.TextureProperty(_emissionMask, "Emission Mask"); GUILayout.EndHorizontal(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Box("Layer 1# - Mask Channel Red", EditorStyles.miniButton); GUILayout.Space(10f); materialEditor.RangeProperty(_emissionStrength, "Intensity"); GUILayout.Space(10f); materialEditor.ColorProperty(_emissionTint, "Tint"); GUILayout.Space(5f); EditorGUI.BeginDisabledGroup(!animationOn); materialEditor.RangeProperty(_emissionLayer1AninSpeed, "Pulse Speed"); materialEditor.RangeProperty(_emissionLayer1AninBlend, "Blend Animation"); EditorGUI.EndDisabledGroup(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Box("Layer 2# - Mask Channel Green", EditorStyles.miniButton); GUILayout.Space(10f); materialEditor.RangeProperty(_emissionLayer2Strength, "Intensity"); GUILayout.Space(10f); materialEditor.ColorProperty(_emissionLayer2Tint, "Tint"); GUILayout.Space(5f); EditorGUI.BeginDisabledGroup(!animationOn); materialEditor.RangeProperty(_emissionLayer2AninSpeed, "Pulse Speed"); materialEditor.RangeProperty(_emissionLayer2AninBlend, "Blend Animation"); EditorGUI.EndDisabledGroup(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Box("Layer 3# - Mask Channel Blue", EditorStyles.miniButton); GUILayout.Space(10f); materialEditor.RangeProperty(_emissionLayer3Strength, "Intensity"); GUILayout.Space(10f); materialEditor.ColorProperty(_emissionLayer3Tint, "Tint"); GUILayout.Space(5f); EditorGUI.BeginDisabledGroup(!animationOn); materialEditor.RangeProperty(_emissionLayer3AninSpeed, "Pulse Speed"); materialEditor.RangeProperty(_emissionLayer3AninBlend, "Blend Animation"); EditorGUI.EndDisabledGroup(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Pulse Animation", ShaderFeature.EmissionPulse, disableGroup: false); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset Properties")) { _matTarget.SetFloat(ShaderFloat.EmissionIntensity.GetString(), 0f); _matTarget.SetColor(ShaderColor.Emission.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.EmissionLayer1BlendAnimation.GetString(), 1f); _matTarget.SetFloat(ShaderFloat.EmissionLayer1PulseSpeed.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.EmissionLayer2Intensity.GetString(), 0f); _matTarget.SetColor(ShaderColor.EmissionLayer2.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.EmissionLayer2BlendAnimation.GetString(), 1f); _matTarget.SetFloat(ShaderFloat.EmissionLayer2PulseSpeed.GetString(), 0f); _matTarget.SetFloat(ShaderFloat.EmissionLayer3Intensity.GetString(), 0f); _matTarget.SetColor(ShaderColor.EmissionLayer3.GetString(), Color.white); _matTarget.SetFloat(ShaderFloat.EmissionLayer3BlendAnimation.GetString(), 1f); _matTarget.SetFloat(ShaderFloat.EmissionLayer3PulseSpeed.GetString(), 0f); } GUILayout.EndHorizontal(); break; case SettingsMode.Translucency: GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Transmission", ShaderFeature.Transmission); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:transmission"); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(5f); materialEditor.TextureProperty(_transmissionMap, "Texture"); GUILayout.Space(10f); DrawWideBox(); GUILayout.Space(10f); materialEditor.RangeProperty(_transmissionDensity, "Density"); EditorGUI.EndDisabledGroup(); break; case SettingsMode.Dissolve: GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Dissolve", ShaderFeature.Dissolve); GUILayout.FlexibleSpace(); ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:dissolve"); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(5f); materialEditor.TextureProperty(_dissolveMap, "Dissolve Pattern", scaleOffset: false); DrawWideBox(); GUILayout.Space(15f); materialEditor.RangeProperty(_dissolveBlend, "Blending"); GUILayout.Space(10f); materialEditor.RangeProperty(_dissolveBorderWidth, "Border Width"); GUILayout.Space(10f); materialEditor.RangeProperty(_dissolveGlowStrength, "Border Glow"); GUILayout.Space(10f); materialEditor.ColorProperty(_dissolveGlowColor, "Glow Color"); EditorGUI.EndDisabledGroup(); break; case SettingsMode.Extras: ShaderLightingSelection(_matTarget, materialEditor); GUILayout.Space(5f); //check Shader Keywords for Pixel Snapping GUILayout.BeginHorizontal(); ToggleFeature(_matTarget, "Pixel Snapping", ShaderFeature.PixelSnap, disableGroup: false, height: 30f); ToggleFeature(_matTarget, "Doublesided", ShaderFeature.DoubleSided, disableGroup: false, height: 30f); GUILayout.EndHorizontal(); GUILayout.Space(5f); DrawWideBox(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(_btnWiki, GUILayout.Height(64f), GUILayout.MaxWidth(140f))) EditorApplication.delayCall += ()=> { Application.OpenURL("http://wiki.next-gen-sprites.com/"); }; if (GUILayout.Button(_btnWidget, GUILayout.Height(64f), GUILayout.MaxWidth(140f))) EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("Window/NextGenSprites/Widget"); }; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(_btnSaveCollection, GUILayout.Height(64f), GUILayout.MaxWidth(140f))) EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("Assets/Create/NextGenSprites/Properties Collection from selection"); }; if (GUILayout.Button(_btnLoadCollection, GUILayout.Height(64f), GUILayout.MaxWidth(140f))) EditorApplication.delayCall += ()=> { EditorApplication.ExecuteMenuItem("GameObject/NextGenSprites/Apply Properties Collection to selection"); }; GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(10f); DrawWideBox(); GUILayout.Space(10f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.HelpBox("Version 1.2.1", MessageType.None); EditorGUILayout.HelpBox("Copyright 2015 Ruben de la Torre", MessageType.None); EditorGUILayout.EndHorizontal(); break; } }
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) { bool inactiveFlag = false; if (!checkNormalmapsUsage(editor.target as Material, label)) return; if (!checkDetailUsage(editor.target as Material, label)) return; if (!checkSpecUsage(editor.target as Material, label)) return; #if UNITY_5 if (prop.name=="unity_SpecCube" || prop.name=="unity_SpecCube1") return; #endif if (checkVisible (editor, label, ref inactiveFlag)) { EditorGUI.BeginDisabledGroup(inactiveFlag); switch (prop.type) { case MaterialProperty.PropType.Range: // float ranges { editor.RangeProperty(position, prop, label); break; } case MaterialProperty.PropType.Float: // floats { editor.FloatProperty(position, prop, label); break; } case MaterialProperty.PropType.Color: // colors { editor.ColorProperty(position, prop, label); break; } case MaterialProperty.PropType.Texture: // textures { editor.TextureProperty(position, prop, label, texTileOffset); break; } case MaterialProperty.PropType.Vector: // vectors { position.x+=12; position.width-=12; editor.VectorProperty(position, prop, label); break; } default: { GUILayout.Label("Unknown prop type... ("+label+")"); break; } } EditorGUI.EndDisabledGroup(); } }