Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.2.0-pre.1] - 2021-08-06
  • Loading branch information
Unity Technologies committed Aug 6, 2021
1 parent 5671be3 commit 9737d20
Show file tree
Hide file tree
Showing 95 changed files with 8,254 additions and 1,386 deletions.
115 changes: 80 additions & 35 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Editor Resources/Shaders/TMP_SDF_SSD.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
float4 position : POSITION;
float3 normal : NORMAL;
float4 color : COLOR;
float2 texcoord0 : TEXCOORD0;
float4 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};

Expand Down Expand Up @@ -34,7 +34,7 @@ pixel_t VertShader(vertex_t input)
{
pixel_t output;

float bold = step(input.texcoord1.y, 0);
float bold = step(input.texcoord0.w, 0);

float4 vert = input.position;
vert.x += _VertexOffsetX;
Expand Down
Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
Binary file modified Package Resources/TMP Examples & Extras.unitypackage
Binary file not shown.
Binary file added Package Resources/TMP Shaders.unitypackage
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Scripts/Editor/DropdownOptionListDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private void Init(SerializedProperty property)
m_ReorderableList = new ReorderableList(property.serializedObject, array);
m_ReorderableList.drawElementCallback = DrawOptionData;
m_ReorderableList.drawHeaderCallback = DrawHeader;
m_ReorderableList.elementHeight += 16;
m_ReorderableList.elementHeight += 40;
}

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Expand All @@ -40,14 +40,17 @@ private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
SerializedProperty itemData = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
SerializedProperty itemText = itemData.FindPropertyRelative("m_Text");
SerializedProperty itemImage = itemData.FindPropertyRelative("m_Image");
SerializedProperty itemColor = itemData.FindPropertyRelative("m_Color");

RectOffset offset = new RectOffset(0, 0, -1, -3);
rect = offset.Add(rect);
rect.height = EditorGUIUtility.singleLineHeight;

EditorGUI.PropertyField(rect, itemText, GUIContent.none);
rect.y += EditorGUIUtility.singleLineHeight;
rect.y += EditorGUIUtility.singleLineHeight + 2;
EditorGUI.PropertyField(rect, itemImage, GUIContent.none);
rect.y += EditorGUIUtility.singleLineHeight + 2;
EditorGUI.PropertyField(rect, itemColor, GUIContent.none);
}

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Editor/GlyphMetricsPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace TMPro.EditorUtilities
{

[CustomPropertyDrawer(typeof(GlyphMetrics))]
public class GlyphMetricsPropertyDrawer : PropertyDrawer
internal class GlyphMetricsPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
Expand Down
8 changes: 8 additions & 0 deletions Scripts/Editor/HDRP.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions Scripts/Editor/HDRP/HDRP_LitShaderGUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#if HDRP_7_5_OR_NEWER
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor.Rendering.HighDefinition;

// Include material common properties names
using static UnityEngine.Rendering.HighDefinition.HDMaterialProperties;

namespace TMPro.EditorUtilities
{
/// <summary>
/// Common GUI for Lit ShaderGraphs
/// </summary>
internal class HDRP_LitShaderGUI : HDShaderGUI
{
// For surface option shader graph we only want all unlit features but alpha clip and back then front rendering
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Lit
| SurfaceOptionUIBlock.Features.ShowDepthOffsetOnly;

const EmissionUIBlock.Features emissionFeatures = EmissionUIBlock.Features.All ^ EmissionUIBlock.Features.EnableEmissionForGI;

MaterialUIBlockList m_UIBlocks = new MaterialUIBlockList
{
new SurfaceOptionUIBlock(MaterialUIBlock.Expandable.Base, features: surfaceOptionFeatures),
new ShaderGraphUIBlock(MaterialUIBlock.Expandable.ShaderGraph),
//new EmissionUIBlock(MaterialUIBlock.Expandable.Emissive),
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, ~AdvancedOptionsUIBlock.Features.SpecularOcclusion)
};

protected MaterialUIBlockList uiBlocks => m_UIBlocks;

/// <summary>
/// Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlock.
/// </summary>
/// <param name="materialEditor">The current material editor.</param>
/// <param name="props">The list of properties the material has.</param>
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props)
{
using (var changed = new EditorGUI.ChangeCheckScope())
{
m_UIBlocks.OnGUI(materialEditor, props);
ApplyKeywordsAndPassesIfNeeded(changed.changed, m_UIBlocks.materials);
}
}

//const string kUVEmissive = "_UVEmissive";

/// <summary>
/// Sets up the keywords and passes for a Lit Shader Graph material.
/// </summary>
/// <param name="material">The target material.</param>
public static void SetupMaterialKeywordsAndPass(Material material)
{
SynchronizeShaderGraphProperties(material);

BaseLitGUI.SetupBaseLitKeywords(material);
BaseLitGUI.SetupBaseLitMaterialPass(material);

bool receiveSSR = false;
if (material.GetSurfaceType() == SurfaceType.Transparent)
receiveSSR = material.HasProperty(kReceivesSSRTransparent) ? material.GetFloat(kReceivesSSRTransparent) != 0 : false;
else
receiveSSR = material.HasProperty(kReceivesSSR) ? material.GetFloat(kReceivesSSR) != 0 : false;
bool useSplitLighting = material.HasProperty(kUseSplitLighting) ? material.GetInt(kUseSplitLighting) != 0: false;
BaseLitGUI.SetupStencil(material, receiveSSR, useSplitLighting);

if (material.HasProperty(kAddPrecomputedVelocity))
CoreUtils.SetKeyword(material, "_ADD_PRECOMPUTED_VELOCITY", material.GetInt(kAddPrecomputedVelocity) != 0);

/*if (material.HasProperty(kUVEmissive) && material.HasProperty(kEmissiveColorMap))
{
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_PLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Planar && material.GetTexture(kEmissiveColorMap));
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_TRIPLANAR", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.Triplanar && material.GetTexture(kEmissiveColorMap));
CoreUtils.SetKeyword(material, "_EMISSIVE_MAPPING_BASE", ((UVEmissiveMapping)material.GetFloat(kUVEmissive)) == UVEmissiveMapping.SameAsBase && material.GetTexture(kEmissiveColorMap));
CoreUtils.SetKeyword(material, "_EMISSIVE_COLOR_MAP", material.GetTexture(kEmissiveColorMap));
}*/
}

protected override void SetupMaterialKeywordsAndPassInternal(Material material) => SetupMaterialKeywordsAndPass(material);
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions Scripts/Editor/HDRP/HDRP_UnlitShaderGUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#if HDRP_7_5_OR_NEWER
using UnityEditor;
using UnityEngine;
using UnityEditor.Rendering.HighDefinition;


namespace TMPro.EditorUtilities
{
/// <summary>
/// Common GUI for Lit ShaderGraphs
/// </summary>
internal class HDRP_UnlitShaderGUI : HDShaderGUI
{
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit;

MaterialUIBlockList m_UIBlocks = new MaterialUIBlockList
{
new SurfaceOptionUIBlock(MaterialUIBlock.Expandable.Base, features: surfaceOptionFeatures),
new ShaderGraphUIBlock(MaterialUIBlock.Expandable.ShaderGraph, ShaderGraphUIBlock.Features.Unlit),
new AdvancedOptionsUIBlock(MaterialUIBlock.Expandable.Advance, ~AdvancedOptionsUIBlock.Features.SpecularOcclusion)
};

/// <summary>List of UI Blocks used to render the material inspector.</summary>
protected MaterialUIBlockList uiBlocks => m_UIBlocks;

/// <summary>
/// Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlockList.
/// </summary>
/// <param name="materialEditor">The current material editor.</param>
/// <param name="props">The list of properties the material has.</param>
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props)
{
using (var changed = new EditorGUI.ChangeCheckScope())
{
m_UIBlocks.OnGUI(materialEditor, props);
ApplyKeywordsAndPassesIfNeeded(changed.changed, m_UIBlocks.materials);
}
}

/// <summary>
/// Sets up the keywords and passes for the Unlit Shader Graph material you pass in.
/// </summary>
/// <param name="material">The target material.</param>
public static void SetupUnlitKeywordsAndPass(Material material)
{
SynchronizeShaderGraphProperties(material);
UnlitGUI.SetupUnlitMaterialKeywordsAndPass(material);
}

/// <summary>
/// Sets up the keywords and passes for the current selected material.
/// </summary>
/// <param name="material">The selected material.</param>
protected override void SetupMaterialKeywordsAndPassInternal(Material material) => SetupUnlitKeywordsAndPass(material);
}
}
#endif
11 changes: 11 additions & 0 deletions Scripts/Editor/HDRP/HDRP_UnlitShaderGUI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9737d20

Please sign in to comment.