public void ShaderPropertiesGUI(Material material) { EditorGUI.BeginChangeCheck(); { m_MaterialEditor.TextureProperty(mainTex, "Texture Main"); m_MaterialEditor.TextureProperty(alphaTex, "Alpha"); } if (EditorGUI.EndChangeCheck()) { MaterialChanged(m_material); } }
void DoTexturesArea(Material material) { if (devMode == null || devMode.floatValue == 0) { dev_RedCtrlTexture.textureValue = null; dev_GreenCtrlTexture.textureValue = null; dev_BlueCtrlTexture.textureValue = null; dev_AlphaCtrlTexture.textureValue = null; } else { m_MaterialEditor.TextureProperty(dev_RedCtrlTexture, "红色通道控制贴图", false); m_MaterialEditor.TextureProperty(dev_GreenCtrlTexture, "绿色通道控制贴图", false); m_MaterialEditor.TextureProperty(dev_BlueCtrlTexture, "蓝色通道控制贴图", false); m_MaterialEditor.TextureProperty(dev_AlphaCtrlTexture, "透明通道控制贴图", false); } PropertyChanged(material); }
private void DoDiffuseLUT(MaterialEditor _materialEditor) { if (!BeginGroup("Diffuse LUT")) return; if (DoKeyword(_materialEditor, m_DiffuseLUTOn, "Use Diffuse LUT")) { _materialEditor.TextureProperty(m_DiffuseLUTTex, "Diffuse LUT (Grayscale)"); } EndGroup(); }
private void DoNormalMap(MaterialEditor _materialEditor) { if (!BeginGroup("Normal Map")) return; if (DoKeyword(_materialEditor, m_NormalMapOn, "Use Normal Map")) { _materialEditor.TextureProperty(m_NormalMapTex, "Normal Map"); } EndGroup(); }
private void DoGeneral(MaterialEditor _materialEditor) { if (!BeginGroup("General")) return; _materialEditor.ShaderProperty(m_FadeOut, "Fade Out"); _materialEditor.TextureProperty(m_BayerTex, "Differ Matrix"); _materialEditor.TextureProperty(m_MainTex, "Main Texture (RGBA)"); if (DoKeyword(_materialEditor, m_DimOn, "Use Dim Texture")) { _materialEditor.TextureProperty(m_DimTex, "Dim Texture (RGB)"); } _materialEditor.TextureProperty(m_DiffuseLUTTex, "Diffuse LUT"); _materialEditor.TextureProperty(m_SpecularLUTTex, "Specular LUT"); EndGroup(); }
void DoMKGlowArea(Material material) { m_MaterialEditor.ColorProperty(mk_glow_system_material_color, "Glow Color"); m_MaterialEditor.ShaderProperty(mk_glow_system_material_glowPower, "Glow Power"); m_MaterialEditor.TextureProperty(mk_glow_system_material_glowtex, "Glow Texture"); m_MaterialEditor.ColorProperty(mk_glow_system_material_glowtexColor, "Glow Texture Color"); m_MaterialEditor.ShaderProperty(mk_glow_system_material_glowtexColorStrength, "Glow Texture Strength"); m_MaterialEditor.ShaderProperty(mk_glow_system_material_glowOffset, "Glow Width"); if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout)) { m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); } }
void DoTexturesArea(Material material) { m_MaterialEditor.TextureProperty(mainTexture, "颜色贴图", false); m_MaterialEditor.TextureProperty(normalTexture, "法线贴图", false); m_MaterialEditor.TextureProperty(environmentReflectTexture, "反射贴图", false); if (other0Texture != null) { m_MaterialEditor.TextureProperty(other0Texture, "other0", false); } if (devMode == null || devMode.floatValue == 0) { m_MaterialEditor.TextureProperty(controlTexture, "控制贴图", false); } else { m_MaterialEditor.TextureProperty(dev_NormalCtrlTexture, "粗糙控制贴图", false); m_MaterialEditor.TextureProperty(dev_MetallicCtrlTexture, "金属控制贴图", false); m_MaterialEditor.TextureProperty(dev_3SCtrlTexture, "3S皮肤贴图", false); m_MaterialEditor.TextureProperty(dev_srCtrlTexture, "高光反射控制贴图", false); } }
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { if (!MaterialTextureToggleDrawer.IsPropertyTypeSuitable(prop)) { GUIContent label2 = new GUIContent("Toggle used on a non-texture property: " + prop.name); EditorGUI.LabelField(position, label2, EditorStyles.helpBox); } else { EditorGUI.BeginChangeCheck(); prop.textureValue = editor.TextureProperty(position, prop, label.text); if (EditorGUI.EndChangeCheck()) { this.SetKeyword(prop, prop.textureValue); } } }
override public void OnGUI(Rect position, MaterialProperty prop, string label, UnityEditor.MaterialEditor editor) { EditorGUI.BeginChangeCheck(); prop.textureValue = editor.TextureProperty(prop, label); if (EditorGUI.EndChangeCheck()) { if (prop.textureValue == null) { (editor.target as Material).DisableKeyword(keywordName + "_ON"); } else { (editor.target as Material).EnableKeyword(keywordName + "_ON"); } } }
void DoHairArea() { m_MaterialEditor.TextureProperty(specularShiftTexture, Styles.specularShiftTexture.text);// EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(specularShift1, Styles.specularShift1, 0); m_MaterialEditor.ShaderProperty(specularColor1, Styles.specularColor1, 0); m_MaterialEditor.ShaderProperty(specularExponent1, Styles.specularExponent1, 0); EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(specularShift2, Styles.specularShift2, 0); m_MaterialEditor.ShaderProperty(specularColor2, Styles.specularColor2, 0); m_MaterialEditor.ShaderProperty(specularExponent2, Styles.specularExponent2, 0); EditorGUILayout.Space(); m_MaterialEditor.ShaderProperty(wrapLightingStrength, Styles.wrapLightingStrength, 0); }
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) { if (checkVisible(editor)) { editor.TextureProperty(position, prop, label, false); } }
//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; } }
private void DoMatCap(MaterialEditor _materialEditor) { if (!BeginGroup("MatCap")) return; if (DoKeyword(_materialEditor, m_MatCapOn, "Use MatCap")) { _materialEditor.TextureProperty(m_MatCapTex, "MatCap"); _materialEditor.ShaderProperty(m_MapCapIntensity, "MatCap Intensity"); DoKeyword(_materialEditor, m_MatCapPlanarOn, "MatCap Planar"); DoKeyword(_materialEditor, m_MatCapAlbedoOn, "MatCap Albedo"); } EndGroup(); }
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); }
private void ReflectionControl(MaterialEditor target, bool noDisablegroup) { Header("Reflection", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:reflection#reflection_texture"); target.TextureProperty(_reflectionScreenMap, "Reflection Texture"); target.RangeProperty(_reflectionStrength, "Strength"); target.RangeProperty(_reflectionBlur, "Blur"); GUILayout.Space(5f); target.TextureProperty(_reflectionMask, "Mask", scaleOffset: false); target.RangeProperty(_reflectionScrollingX, "X-Axis scrolling"); target.RangeProperty(_reflectionScrollingY, "Y-Axis scrolling"); GUILayout.Space(10f); DrawWideBox(1f); //Turn off the Disable group? if (noDisablegroup) return; if (!_shaderCompileKeywords.Contains(ShaderFeature.Reflection.GetString())) EditorGUI.EndDisabledGroup(); }
private void RefractionControl(MaterialEditor target, bool noDisablegroup) { Header("Refraction", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:liquid#refraction_map"); target.TextureProperty(_refractionNormal, "Refraction Map"); target.RangeProperty(_refractionStrength, "Strength"); GUILayout.Space(10f); DrawWideBox(1f); }
private void DoOverlay(MaterialEditor _materialEditor) { if (!BeginGroup("Overlay")) return; if (DoKeyword(_materialEditor, m_OverlayOn, "Use Overlay Texture")) { _materialEditor.TextureProperty(m_OverlayTex, "Overlay Texture (RGBA)"); } EndGroup(); }
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 DoGeneral(MaterialEditor _materialEditor) { if (!BeginGroup("General")) return; _materialEditor.TextureProperty(m_MainTex, "Main Texture (RGB)"); _materialEditor.TextureProperty(m_BayerTex, "Differ Matrix"); _materialEditor.ShaderProperty(m_FadeOut, "Fade Out"); DoKeyword(_materialEditor, m_TextureFadeOutOn, "Fade Out (Tex Alpha)"); if (DoKeyword(_materialEditor, m_IrradianceOn, "Use Irradiance")) { _materialEditor.ShaderProperty(m_IrradianceBoost, "Irradiance Boost"); } DoKeyword(_materialEditor, m_DarkenBackfacesOn, "Use Darken Backfaces"); if (DoKeyword (_materialEditor, m_DimOn, "Use Dim Texture")) { _materialEditor.TextureProperty (m_DimTex, "Dim Texture (RGB)"); } EndGroup(); }
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(); }
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"); } }
private void FlowControl(MaterialEditor target) { Header("Flow", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:liquid#flow_map"); if (_hasCurvatureMap) target.TextureProperty(_curvatureMap, "Curvature Map", scaleOffset: false); target.TextureProperty(_flowMap, "Flow Map", scaleOffset: false); target.RangeProperty(_flowIntensity, "Intensity"); target.RangeProperty(_flowSpeed, "Speed"); GUILayout.Space(10f); ToggleShader(_targetMaterial, "Auto scrolling", ShaderFeature.AutoScrolling.GetString()); target.RangeProperty(_FlowScrollAuto, "Auto scroll Speed"); EditorGUI.EndDisabledGroup(); GUILayout.Space(5f); var modeLbl = (_targetMaterial.IsKeywordEnabled(ShaderFeature.AutoScrolling.GetString()) ? "Automatic" : "By Position"); GUILayout.Box(string.Format("Current Scrolling Mode: {0}", modeLbl)); GUILayout.Space(5f); target.RangeProperty(_FlowScrollX, "Scroll Speed X"); target.RangeProperty(_FlowScrollY, "Scroll Speed Y"); GUILayout.Space(10f); DrawWideBox(1f); }
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(); } } }
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(); } }