Skip to content

Commit

Permalink
remove duplicate properties in live preview
Browse files Browse the repository at this point in the history
  • Loading branch information
z3y committed Sep 15, 2024
1 parent f35bda9 commit 5575af0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Editor/Generation/ShaderBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,17 @@ private void AppendProperties()
{
var allProperties = passBuilders.SelectMany(x => x.properties).ToList();

var addedProps = new List<string>();

if (unlocked)
{
foreach (var property in properties.Union(ShaderGraphView.graphData.properties).Union(subgraphProperties).Distinct())
{
if (property.ShouldDeclare())
{
_sb.AppendLine(property.GetPropertyDeclaration(GenerationMode.Final));
addedProps.Add(property.GetReferenceName(GenerationMode.Final));
}
}
}

Expand All @@ -403,8 +408,15 @@ private void AppendProperties()
{
continue;
}
if (unlocked && addedProps.Contains(property.GetReferenceName(GenerationMode.Preview)))
{
continue;
}
if (property.ShouldDeclare())
{
_sb.AppendLine(property.GetPropertyDeclaration(GenerationMode.Preview));
addedProps.Add(property.GetReferenceName(GenerationMode.Preview));
}
}
}
else
Expand Down

0 comments on commit 5575af0

Please sign in to comment.