void drawShaderHeader(ShaderHeader header, MaterialEditor materialEditor) { header.header = PoiToonUI.Foldout(header); if (header.header.getState()) { EditorGUILayout.Space(); foreach (ShaderPart part in header.parts) { drawShaderPart(part, materialEditor); } EditorGUILayout.Space(); } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { Material material = materialEditor.target as Material; HeaderInit(materialEditor); // map shader properties to script variables FindProperties(props); // set up style for the base look SetupStyle(); // load default toggle values LoadDefaults(material); DrawMasterLabel(); // main section m_mainOptions = PoiToonUI.Foldout("Main", m_mainOptions); if (m_mainOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_color, Styles.Color); materialEditor.ShaderProperty(m_desaturation, Styles.Desaturation); materialEditor.ShaderProperty(m_mainTex, Styles.MainTex); materialEditor.ShaderProperty(m_normalMap, Styles.NormalMap); materialEditor.ShaderProperty(m_normalIntensity, Styles.NormalIntensity); materialEditor.ShaderProperty(m_clip, Styles.Clip); EditorGUILayout.Space(); } m_metallicOptions = PoiToonUI.Foldout("Metallic", m_metallicOptions); if (m_metallicOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_cubeMap, Styles.CubeMap); materialEditor.ShaderProperty(m_sampleWorld, Styles.SampleWorld); materialEditor.ShaderProperty(m_metallicMap, Styles.MetallicMap); materialEditor.ShaderProperty(m_metallic, Styles.Metallic); materialEditor.ShaderProperty(m_roughnessMap, Styles.RoughnessMap); materialEditor.ShaderProperty(m_roughness, Styles.Roughness); EditorGUILayout.Space(); } // outline section m_outlineOptions = PoiToonUI.Foldout("Outline", m_outlineOptions); if (m_outlineOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_lineWidth, Styles.LineWidth); materialEditor.ShaderProperty(m_outlineColor, Styles.OutlineColor); materialEditor.ShaderProperty(m_outlineEmission, Styles.OutlineEmission); materialEditor.ShaderProperty(m_outlineTexture, Styles.OutlineTexture); materialEditor.ShaderProperty(m_speed, Styles.Speed); EditorGUILayout.Space(); } // emissive section m_emissionOptions = PoiToonUI.Foldout("Emission", m_emissionOptions); if (m_emissionOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_emissionColor, Styles.EmissionColor); materialEditor.ShaderProperty(m_emissionMap, Styles.EmissionMap); materialEditor.ShaderProperty(m_emissionScrollSpeed, Styles.EmissionScrollSpeed); materialEditor.ShaderProperty(m_emissionStrength, Styles.EmissionStrength); EditorGUILayout.Space(); materialEditor.ShaderProperty(m_emissiveBlinkMin, Styles.EmissiveBlinkMin); materialEditor.ShaderProperty(m_emissiveBlinkMax, Styles.EmissiveBlinkMax); materialEditor.ShaderProperty(m_emissiveBlinkVelocity, Styles.EmissiveBlinkVelocity); EditorGUILayout.Space(); materialEditor.ShaderProperty(m_emissiveScrollEnabled, Styles.EmissiveScrollEnabled); materialEditor.ShaderProperty(m_emissiveScrollDirection, Styles.EmissiveScrollDirection); materialEditor.ShaderProperty(m_emissiveScrollWidth, Styles.EmissiveScrollWidth); materialEditor.ShaderProperty(m_emissiveScrollVelocity, Styles.EmissiveScrollVelocity); materialEditor.ShaderProperty(m_emissiveScrollInterval, Styles.EmissiveScrollInterval); EditorGUILayout.Space(); } // fake lighting m_fakeLightingOptions = PoiToonUI.Foldout("Fake Lighting", m_fakeLightingOptions); if (m_fakeLightingOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_lightingGradient, Styles.LightingGradient); materialEditor.ShaderProperty(m_lightingShadowStrength, Styles.LightingShadowStrength); materialEditor.ShaderProperty(m_lightingShadowOffset, Styles.LightingShadowOffsett); materialEditor.ShaderProperty(m_forceLightDirection, Styles.ForceLightDirection); materialEditor.ShaderProperty(m_lightingDirection, Styles.LightingDirection); materialEditor.ShaderProperty(m_minBrightness, Styles.MinBrightness); EditorGUILayout.Space(); } // Specular Highlights m_specularHighlightsOptions = PoiToonUI.Foldout("Specular Highlight", m_specularHighlightsOptions); if (m_specularHighlightsOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_specularMap, Styles.SpecularMap); materialEditor.ShaderProperty(m_gloss, Styles.Gloss); materialEditor.ShaderProperty(m_specularColor, Styles.SpecularColor); materialEditor.ShaderProperty(m_specularStrength, Styles.SpecularStrength); materialEditor.ShaderProperty(m_specularBias, Styles.SpecularBias); materialEditor.ShaderProperty(m_hardSpecular, Styles.HardSpecular); materialEditor.ShaderProperty(m_specularSize, Styles.SpecularSize); EditorGUILayout.Space(); } // Rim Lighting m_rimLightOptions = PoiToonUI.Foldout("Rim Lighting", m_rimLightOptions); if (m_rimLightOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_rimColor, Styles.RimColor); materialEditor.ShaderProperty(m_rimStrength, Styles.RimGlowStrength); materialEditor.ShaderProperty(m_rimSharpness, Styles.RimSharpness); materialEditor.ShaderProperty(m_rimWidth, Styles.RimWidth); materialEditor.ShaderProperty(m__rimLightColorBias, Styles.RimColorBias); materialEditor.ShaderProperty(m_rimTex, Styles.RimTexture); materialEditor.ShaderProperty(m_rimTexPanSpeed, Styles.RimTexturePanSpeed); EditorGUILayout.Space(); } m_stencilOptions = PoiToonUI.Foldout("Stencil", m_stencilOptions); if (m_stencilOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_stencilRef, Styles.StencilRef); materialEditor.ShaderProperty(m_stencilCompareFunction, Styles.StencilCompareFunction); materialEditor.ShaderProperty(m_stencilOp, Styles.StencilOp); EditorGUILayout.Space(); } m_miscOptions = PoiToonUI.Foldout("Misc", m_miscOptions); if (m_miscOptions.getState()) { EditorGUILayout.Space(); materialEditor.ShaderProperty(m_cullMode, Styles.CullMode); materialEditor.ShaderProperty(m_lit, Styles.Lit); materialEditor.ShaderProperty(m_srcBlend, Styles.SrcBlend); materialEditor.ShaderProperty(m_dstBlend, Styles.DstBlend); materialEditor.ShaderProperty(m_zTest, Styles.ZTest); EditorGUILayout.Space(); } ToggleDefines(material); }