Skip to content

Commit 145a398

Browse files
iTris666GitHub Enterprise
authored andcommitted
"Create new VisualEffect Graph" creates a graph from the default template [Case 1279999](https://fogbugz.unity3d.com/f/cases/1279999/) (#113)
1 parent 0f6037d commit 145a398

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3535
- Random Per-Component on Set Attribute in Spawn Context [Case 1279294](https://issuetracker.unity3d.com/product/unity/issues/guid/1279294/)
3636
- Fix corrupted UI in nodes due to corrupted point cache files [Case 1232867](https://fogbugz.unity3d.com/f/cases/1232867/)
3737
- Fix InvalidCastException when using byte properties in point cache files [Case 1276623](https://fogbugz.unity3d.com/f/cases/1276623/)
38+
- "Create new VisualEffect Graph" creates a graph from the default template [Case 1279999](https://fogbugz.unity3d.com/f/cases/1279999/)
3839
- Fix https://issuetracker.unity3d.com/issues/ux-cant-drag-a-noodle-out-of-trigger-blocks
3940
- Fix [Case 1114281](https://issuetracker.unity3d.com/product/unity/issues/guid/1114281/)
4041
- Fix [Case 1268977](https://issuetracker.unity3d.com/product/unity/issues/guid/1268977/)

com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void OnCreateAsset()
376376
string filePath = EditorUtility.SaveFilePanelInProject("", "New Graph", "vfx", "Create new VisualEffect Graph");
377377
if (!string.IsNullOrEmpty(filePath))
378378
{
379-
VisualEffectAssetEditorUtility.CreateNewAsset(filePath);
379+
VisualEffectAssetEditorUtility.CreateTemplateAsset(filePath);
380380

381381
VFXViewWindow.currentWindow.LoadAsset(AssetDatabase.LoadAssetAtPath<VisualEffectAsset>(filePath), null);
382382
}

com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,28 @@ public static bool IsCreateVisualEffectDefaultsActive()
128128
return resources == null || resources.Length == 0;
129129
}
130130

131-
internal class DoCreateNewVFX : EndNameEditAction
131+
132+
public static void CreateTemplateAsset(string pathName)
132133
{
133-
public override void Action(int instanceId, string pathName, string resourceFile)
134+
135+
try
134136
{
135-
try
136-
{
137-
var templateString = System.IO.File.ReadAllText(templatePath + templateAssetName);
138-
System.IO.File.WriteAllText(pathName, templateString);
139-
}
140-
catch (FileNotFoundException)
141-
{
142-
CreateNewAsset(pathName);
143-
}
137+
var templateString = System.IO.File.ReadAllText(templatePath + templateAssetName);
138+
System.IO.File.WriteAllText(pathName, templateString);
139+
}
140+
catch (FileNotFoundException)
141+
{
142+
CreateNewAsset(pathName);
143+
}
144144

145-
AssetDatabase.ImportAsset(pathName);
145+
AssetDatabase.ImportAsset(pathName);
146+
}
146147

148+
internal class DoCreateNewVFX : EndNameEditAction
149+
{
150+
public override void Action(int instanceId, string pathName, string resourceFile)
151+
{
152+
CreateTemplateAsset(pathName);
147153
var resource = VisualEffectResource.GetResourceAtPath(pathName);
148154
ProjectWindowUtil.FrameObjectInProjectWindow(resource.asset.GetInstanceID());
149155
}

0 commit comments

Comments
 (0)