diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 1a865965900..7380239f1be 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -5,11 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [13.0.0] - 2021-09-01 + ### Fixed - Prevent vector truncation error in HDRP Decal template - -Version Updated -The version number for this package has increased due to a version update of a related graphics package. +- Fix potential infinite compilation when using subgraphs [Case 1346576](https://issuetracker.unity3d.com/product/unity/issues/guid/1346576/) +- Prevent out of sync serialization of VFX assets that could cause the asset to be dirtied without reason +- Fix undetermitism in space with LocalToWorld and WorldToLocal operators [Case 1355820](https://issuetracker.unity3d.com/product/unity/issues/guid/1355820/) ## [12.0.0] - 2021-01-11 ### Added diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 6c3b078994a..79d9ab1c257 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -281,6 +281,7 @@ void Update() { VFXGraph.compileReporter = reporter; AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graphView.controller.model)); + graph.SetExpressionGraphDirty(false); // As are implemented subgraph now, compiling dependents chain can reset dirty flag on used subgraphs, which will make an infinite loop, this is bad! VFXGraph.compileReporter = null; } VFXGraph.explicitCompile = false; diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs index 3c4d934bf7a..49cf3896190 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs @@ -203,6 +203,7 @@ private void SynchronizeUndoRedoState() m_reentrant = true; ExpressionGraphDirty = true; model.GetOrCreateGraph().UpdateSubAssets(); + EditorUtility.SetDirty(graph); NotifyUpdate(); m_reentrant = false; m_graphUndoStack.CleanDirtyState(); diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index 701d5866d98..c4f5efbd7ba 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -154,7 +154,7 @@ Controller IControlledElement.controller void DisconnectController() { if (controller.model && controller.graph) - controller.graph.SetCompilationMode(VFXCompilationMode.Runtime); + controller.graph.SetCompilationMode(VFXViewPreference.forceEditionCompilation ? VFXCompilationMode.Edition : VFXCompilationMode.Runtime); m_Controller.UnregisterHandler(this); @@ -1562,7 +1562,10 @@ void OnSave() foreach (var graph in graphToSave) { if (EditorUtility.IsDirty(graph) || UnityEngine.Object.ReferenceEquals(graph, controller.graph)) + { + graph.UpdateSubAssets(); graph.GetResource().WriteAsset(); + } } } diff --git a/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs b/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs index ce58c9d1f54..0165126e0a8 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs @@ -103,6 +103,9 @@ public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) } } } + if (space == (VFXCoordinateSpace)int.MaxValue) + space = outputSlot.space; + return space; } diff --git a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs index 9685e18bc87..508fbd3cec6 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs @@ -179,6 +179,19 @@ override public string name } } + public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) + { + switch (m_BuiltInParameters) + { + case BuiltInFlag.LocalToWorld: + return VFXCoordinateSpace.Local; + case BuiltInFlag.WorldToLocal: + return VFXCoordinateSpace.World; + default: + return (VFXCoordinateSpace)int.MaxValue; + } + } + protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression) { var expressions = builtInParameterEnumerable.Select(b => s_BuiltInInfo[b].expression); diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index da2b9fe688d..d139ac88dbd 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -264,7 +264,7 @@ static string[] OnWillSaveAssets(string[] paths) var vfxResource = VisualEffectResource.GetResourceAtPath(path); if (vfxResource != null) { - var graph = vfxResource.GetOrCreateGraph(); + vfxResource.GetOrCreateGraph().UpdateSubAssets(); vfxResource.WriteAsset(); // write asset as the AssetDatabase won't do it. } }