Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.shadergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed a bug where shaders fail to compile due to `#pragma target` generation when your system locale uses commas instead of periods.
- Fixed a compilation error when using Hybrid Renderer due to incorrect positioning of macros.
- 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)
- Fixed a bug where depndencies were not getting included when exporting a shadergraph and subgraphs

## [7.1.1] - 2019-09-05
### Added
Expand Down
7 changes: 7 additions & 0 deletions com.unity.shadergraph/Editor/Importers/ShaderGraphImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ public override void OnImportAsset(AssetImportContext ctx)
{
metadata.outputNodeTypeName = graph.outputNode.GetType().FullName;
}
metadata.assetDependencies = new List<UnityEngine.Object>();
var deps = GatherDependenciesFromSourceFile(ctx.assetPath);
foreach (string dependency in deps)
{
metadata.assetDependencies.Add(AssetDatabase.LoadAssetAtPath(dependency, typeof(UnityEngine.Object)));
}

ctx.AddObjectToAsset("Metadata", metadata);

foreach (var sourceAssetDependencyPath in sourceAssetDependencyPaths.Distinct())
Expand Down
2 changes: 2 additions & 0 deletions com.unity.shadergraph/Editor/Importers/ShaderGraphMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using UnityEngine;

namespace UnityEditor.ShaderGraph
{
class ShaderGraphMetadata : ScriptableObject
{
public string outputNodeTypeName;
public List<Object> assetDependencies;
}
}
10 changes: 10 additions & 0 deletions com.unity.shadergraph/Editor/Importers/ShaderSubGraphImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public override void OnImportAsset(AssetImportContext ctx)
Texture2D texture = Resources.Load<Texture2D>("Icons/sg_subgraph_icon@64");
ctx.AddObjectToAsset("MainAsset", graphAsset, texture);
ctx.SetMainObject(graphAsset);

var metadata = ScriptableObject.CreateInstance<ShaderGraphMetadata>();
metadata.hideFlags = HideFlags.HideInHierarchy;
metadata.assetDependencies = new List<UnityEngine.Object>();
var deps = GatherDependenciesFromSourceFile(ctx.assetPath);
foreach (string dependency in deps)
{
metadata.assetDependencies.Add(AssetDatabase.LoadAssetAtPath(dependency, typeof(UnityEngine.Object)));
}
ctx.AddObjectToAsset("Metadata", metadata);
}

static void ProcessSubGraph(SubGraphAsset asset, GraphData graph)
Expand Down
10 changes: 10 additions & 0 deletions com.unity.shadergraph/Editor/Importers/ShaderSubGraphMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using UnityEngine;

namespace UnityEditor.ShaderGraph
{
class ShaderSubGraphMetadata : ScriptableObject
{
public List<Object> assetDependencies;
}
}

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