8 static ShaderFeature s_OutlineFeature, s_UnderlayFeature, s_BevelFeature, s_GlowFeature, s_MaskFeature;
10 static bool s_Face =
true, s_Outline =
true, s_Underlay, s_Lighting, s_Glow, s_Bevel, s_Light, s_Bump, s_Env;
13 s_FaceUvSpeedNames = {
"_FaceUVSpeedX",
"_FaceUVSpeedY" },
14 s_OutlineUvSpeedNames = {
"_OutlineUVSpeedX",
"_OutlineUVSpeedY" };
18 s_OutlineFeature =
new ShaderFeature()
20 undoLabel =
"Outline",
21 keywords =
new[] {
"OUTLINE_ON" }
24 s_UnderlayFeature =
new ShaderFeature()
26 undoLabel =
"Underlay",
27 keywords =
new[] {
"UNDERLAY_ON",
"UNDERLAY_INNER" },
28 label =
new GUIContent(
"Underlay Type"),
31 new GUIContent(
"None"),
new GUIContent(
"Normal"),
new GUIContent(
"Inner")
35 s_BevelFeature =
new ShaderFeature()
38 keywords =
new[] {
"BEVEL_ON" }
41 s_GlowFeature =
new ShaderFeature()
44 keywords =
new[] {
"GLOW_ON" }
47 s_MaskFeature =
new ShaderFeature()
50 keywords =
new[] {
"MASK_HARD",
"MASK_SOFT" },
51 label =
new GUIContent(
"Mask"),
54 new GUIContent(
"Mask Off"),
new GUIContent(
"Mask Hard"),
new GUIContent(
"Mask Soft")
61 s_Face = BeginPanel(
"Face", s_Face);
69 s_Outline = m_Material.HasProperty(ShaderUtilities.ID_OutlineTex) ? BeginPanel(
"Outline", s_Outline) : BeginPanel(
"Outline", s_OutlineFeature, s_Outline);
77 if (m_Material.HasProperty(ShaderUtilities.ID_UnderlayColor))
79 s_Underlay = BeginPanel(
"Underlay", s_UnderlayFeature, s_Underlay);
88 if (m_Material.HasProperty(
"_SpecularColor"))
90 s_Lighting = BeginPanel(
"Lighting", s_BevelFeature, s_Lighting);
93 s_Bevel = BeginPanel(
"Bevel", s_Bevel);
101 s_Light = BeginPanel(
"Local Lighting", s_Light);
104 DoLocalLightingPanel();
109 s_Bump = BeginPanel(
"Bump Map", s_Bump);
117 s_Env = BeginPanel(
"Environment Map", s_Env);
128 else if (m_Material.HasProperty(
"_SpecColor"))
130 s_Bevel = BeginPanel(
"Bevel", s_Bevel);
138 s_Light = BeginPanel(
"Surface Lighting", s_Light);
141 DoSurfaceLightingPanel();
146 s_Bump = BeginPanel(
"Bump Map", s_Bump);
154 s_Env = BeginPanel(
"Environment Map", s_Env);
163 if (m_Material.HasProperty(ShaderUtilities.ID_GlowColor))
165 s_Glow = BeginPanel(
"Glow", s_GlowFeature, s_Glow);
174 s_DebugExtended = BeginPanel(
"Debug Settings", s_DebugExtended);
185 EditorGUI.indentLevel += 1;
186 DoColor(
"_FaceColor",
"Color");
187 if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
189 if (m_Material.HasProperty(
"_FaceUVSpeedX"))
191 DoTexture2D(
"_FaceTex",
"Texture",
true, s_FaceUvSpeedNames);
195 DoTexture2D(
"_FaceTex",
"Texture",
true);
199 DoSlider(
"_OutlineSoftness",
"Softness");
200 DoSlider(
"_FaceDilate",
"Dilate");
201 if (m_Material.HasProperty(ShaderUtilities.ID_Shininess))
203 DoSlider(
"_FaceShininess",
"Gloss");
206 EditorGUI.indentLevel -= 1;
207 EditorGUILayout.Space();
210 void DoOutlinePanel()
212 EditorGUI.indentLevel += 1;
213 DoColor(
"_OutlineColor",
"Color");
214 if (m_Material.HasProperty(ShaderUtilities.ID_OutlineTex))
216 if (m_Material.HasProperty(
"_OutlineUVSpeedX"))
218 DoTexture2D(
"_OutlineTex",
"Texture",
true, s_OutlineUvSpeedNames);
222 DoTexture2D(
"_OutlineTex",
"Texture",
true);
226 DoSlider(
"_OutlineWidth",
"Thickness");
227 if (m_Material.HasProperty(
"_OutlineShininess"))
229 DoSlider(
"_OutlineShininess",
"Gloss");
232 EditorGUI.indentLevel -= 1;
233 EditorGUILayout.Space();
236 void DoUnderlayPanel()
238 EditorGUI.indentLevel += 1;
239 s_UnderlayFeature.DoPopup(m_Editor, m_Material);
240 DoColor(
"_UnderlayColor",
"Color");
241 DoSlider(
"_UnderlayOffsetX",
"Offset X");
242 DoSlider(
"_UnderlayOffsetY",
"Offset Y");
243 DoSlider(
"_UnderlayDilate",
"Dilate");
244 DoSlider(
"_UnderlaySoftness",
"Softness");
245 EditorGUI.indentLevel -= 1;
246 EditorGUILayout.Space();
249 static GUIContent[] s_BevelTypeLabels =
251 new GUIContent(
"Outer Bevel"),
252 new GUIContent(
"Inner Bevel")
257 EditorGUI.indentLevel += 1;
258 DoPopup(
"_ShaderFlags",
"Type", s_BevelTypeLabels);
259 DoSlider(
"_Bevel",
"Amount");
260 DoSlider(
"_BevelOffset",
"Offset");
261 DoSlider(
"_BevelWidth",
"Width");
262 DoSlider(
"_BevelRoundness",
"Roundness");
263 DoSlider(
"_BevelClamp",
"Clamp");
264 EditorGUI.indentLevel -= 1;
265 EditorGUILayout.Space();
268 void DoLocalLightingPanel()
270 EditorGUI.indentLevel += 1;
271 DoSlider(
"_LightAngle",
"Light Angle");
272 DoColor(
"_SpecularColor",
"Specular Color");
273 DoSlider(
"_SpecularPower",
"Specular Power");
274 DoSlider(
"_Reflectivity",
"Reflectivity Power");
275 DoSlider(
"_Diffuse",
"Diffuse Shadow");
276 DoSlider(
"_Ambient",
"Ambient Shadow");
277 EditorGUI.indentLevel -= 1;
278 EditorGUILayout.Space();
281 void DoSurfaceLightingPanel()
283 EditorGUI.indentLevel += 1;
284 DoColor(
"_SpecColor",
"Specular Color");
285 EditorGUI.indentLevel -= 1;
286 EditorGUILayout.Space();
289 void DoBumpMapPanel()
291 EditorGUI.indentLevel += 1;
292 DoTexture2D(
"_BumpMap",
"Texture");
293 DoSlider(
"_BumpFace",
"Face");
294 DoSlider(
"_BumpOutline",
"Outline");
295 EditorGUI.indentLevel -= 1;
296 EditorGUILayout.Space();
301 EditorGUI.indentLevel += 1;
302 DoColor(
"_ReflectFaceColor",
"Face Color");
303 DoColor(
"_ReflectOutlineColor",
"Outline Color");
304 DoCubeMap(
"_Cube",
"Texture");
305 DoVector3(
"_EnvMatrixRotation",
"Rotation");
306 EditorGUI.indentLevel -= 1;
307 EditorGUILayout.Space();
312 EditorGUI.indentLevel += 1;
313 DoColor(
"_GlowColor",
"Color");
314 DoSlider(
"_GlowOffset",
"Offset");
315 DoSlider(
"_GlowInner",
"Inner");
316 DoSlider(
"_GlowOuter",
"Outer");
317 DoSlider(
"_GlowPower",
"Power");
318 EditorGUI.indentLevel -= 1;
319 EditorGUILayout.Space();
324 EditorGUI.indentLevel += 1;
325 DoTexture2D(
"_MainTex",
"Font Atlas");
326 DoFloat(
"_GradientScale",
"Gradient Scale");
327 DoFloat(
"_TextureWidth",
"Texture Width");
328 DoFloat(
"_TextureHeight",
"Texture Height");
329 EditorGUILayout.Space();
330 DoFloat(
"_ScaleX",
"Scale X");
331 DoFloat(
"_ScaleY",
"Scale Y");
332 DoSlider(
"_PerspectiveFilter",
"Perspective Filter");
333 EditorGUILayout.Space();
334 DoFloat(
"_VertexOffsetX",
"Offset X");
335 DoFloat(
"_VertexOffsetY",
"Offset Y");
337 if (m_Material.HasProperty(ShaderUtilities.ID_MaskCoord))
339 EditorGUILayout.Space();
340 s_MaskFeature.ReadState(m_Material);
341 s_MaskFeature.DoPopup(m_Editor, m_Material);
342 if (s_MaskFeature.Active)
347 EditorGUILayout.Space();
348 DoVector(
"_ClipRect",
"Clip Rect", s_LbrtVectorLabels);
350 else if (m_Material.HasProperty(
"_MaskTex"))
354 else if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
356 EditorGUILayout.Space();
357 DoFloat(
"_MaskSoftnessX",
"Softness X");
358 DoFloat(
"_MaskSoftnessY",
"Softness Y");
359 DoVector(
"_ClipRect",
"Clip Rect", s_LbrtVectorLabels);
362 if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
364 EditorGUILayout.Space();
365 DoFloat(
"_Stencil",
"Stencil ID");
366 DoFloat(
"_StencilComp",
"Stencil Comp");
369 EditorGUILayout.Space();
371 EditorGUI.BeginChangeCheck();
372 bool useRatios = EditorGUILayout.Toggle(
"Use Ratios", !m_Material.IsKeywordEnabled(
"RATIOS_OFF"));
373 if (EditorGUI.EndChangeCheck())
375 m_Editor.RegisterPropertyChangeUndo(
"Use Ratios");
378 m_Material.DisableKeyword(
"RATIOS_OFF");
382 m_Material.EnableKeyword(
"RATIOS_OFF");
386 EditorGUI.BeginDisabledGroup(
true);
387 DoFloat(
"_ScaleRatioA",
"Scale Ratio A");
388 DoFloat(
"_ScaleRatioB",
"Scale Ratio B");
389 DoFloat(
"_ScaleRatioC",
"Scale Ratio C");
390 EditorGUI.EndDisabledGroup();
391 EditorGUI.indentLevel -= 1;
392 EditorGUILayout.Space();
395 void DoMaskSubgroup()
397 DoVector(
"_MaskCoord",
"Mask Bounds", s_XywhVectorLabels);
398 if (Selection.activeGameObject !=
null)
400 Renderer renderer = Selection.activeGameObject.GetComponent<Renderer>();
401 if (renderer !=
null)
403 Rect rect = EditorGUILayout.GetControlRect();
404 rect.x += EditorGUIUtility.labelWidth;
405 rect.width -= EditorGUIUtility.labelWidth;
406 if (GUI.Button(rect,
"Match Renderer Bounds"))
408 FindProperty(
"_MaskCoord", m_Properties).vectorValue =
new Vector4(
411 Mathf.Round(renderer.bounds.extents.x * 1000) / 1000,
412 Mathf.Round(renderer.bounds.extents.y * 1000) / 1000
418 if (s_MaskFeature.State == 1)
420 DoFloat(
"_MaskSoftnessX",
"Softness X");
421 DoFloat(
"_MaskSoftnessY",
"Softness Y");
425 void DoMaskTexSubgroup()
427 EditorGUILayout.Space();
428 DoTexture2D(
"_MaskTex",
"Mask Texture");
429 DoToggle(
"_MaskInverse",
"Inverse Mask");
430 DoColor(
"_MaskEdgeColor",
"Edge Color");
431 DoSlider(
"_MaskEdgeSoftness",
"Edge Softness");
432 DoSlider(
"_MaskWipeControl",
"Wipe Position");
433 DoFloat(
"_MaskSoftnessX",
"Softness X");
434 DoFloat(
"_MaskSoftnessY",
"Softness Y");
435 DoVector(
"_ClipRect",
"Clip Rect", s_LbrtVectorLabels);
override void DoGUI()
Override this method to create the specific shader GUI.
Base class for TextMesh Pro shader GUIs.