Skip to content

Commit 0532529

Browse files
Sg/fix quotations in property names (#66)
* Fix so that properties/keyword display names with a " in them dont break the shadergraph, but get sanitized out * Update CHANGELOG.md * Update Blackboard.md Adding note to docs about quotation stripping
1 parent 10d6cc4 commit 0532529

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

com.unity.shadergraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9191
- Fixed a compilation error when using Hybrid Renderer due to incorrect positioning of macros.
9292
- Fixed a bug where the `Create Node Menu` lagged on load. Entries are now only generated when property, keyword, or subgraph changes are detected. [1209567](https://issuetracker.unity3d.com/issues/shadergraph-opening-node-search-window-is-unnecessarily-slow).
9393
- Fixed a bug with the `Transform` node where converting from `Absolute World` space in a sub graph causes invalid subscript errors. [1190813](https://issuetracker.unity3d.com/issues/shadergraph-invalid-subscript-errors-are-thrown-when-connecting-a-subgraph-with-transform-node-with-unlit-master-node)
94+
- Fixed a bug where adding a " to a property display name would cause shader compilation errors and show all nodes as broken
9495
- Fixed a bug where the `Position` node would change coordinate spaces from `World` to `Absolute World` when shaders recompile. [1184617](https://issuetracker.unity3d.com/product/unity/issues/guid/1184617/)
9596
- Fixed a bug where instanced shaders wouldn't compile on PS4.
9697
- Optimized loading a large Shader Graph. [1209047](https://issuetracker.unity3d.com/issues/shader-graph-unresponsive-editor-when-using-large-graphs)

com.unity.shadergraph/Documentation~/Blackboard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ You can move the Blackboard anywhere in the [Shader Graph Window](Shader-Graph-W
1111

1212
To create a new Property or Keyword, click the **Add (+)** button on the Blackboard's title bar, and select a Property or Keyword type.
1313

14-
To reorder items listed on the Blackboard, drag and drop them. To delete items, use the Delete key on Windows, or the Command + Backspace key combination on OS X. To rename an item, double-click on its name, and enter a new name. Drag Properties and Keywords from the Blackboard to the graph to create a corresponding node.
14+
To reorder items listed on the Blackboard, drag and drop them. To delete items, use the Delete key on Windows, or the Command + Backspace key combination on OS X. To rename an item, double-click on its name, and enter a new name (note: quotation marks in display names will get stripped and replaced with underscores). Drag Properties and Keywords from the Blackboard to the graph to create a corresponding node.
1515

16-
For a full list of Property types, see [Property Types](Property-Types).
16+
For a full list of Property types, see [Property Types](Property-Types).

com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ static void Visit(List<AbstractMaterialNode> outputList, Dictionary<Guid, Abstra
249249
/// </returns>
250250
internal static string SanitizeName(IEnumerable<string> existingNames, string duplicateFormat, string name)
251251
{
252+
//.shader files are not cool with " in the middle of a property name (eg. Vector1_81B203C2("fo"o"o", Float) = 0)
253+
name = name.Replace("\"", "_");
252254
if (!existingNames.Contains(name))
253255
return name;
254256

0 commit comments

Comments
 (0)