diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index 42c3dc1f996..c3fc3b736ff 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -1099,7 +1099,6 @@ public IEnumerator ConvertToSubGraphOperator_And_ModifySubgraph() Assert.AreNotEqual(oneOutputState, twoOutputState); Assert.IsTrue(twoOutputState.Contains(otherParamName)); - window.graphView.controller = null; for (int i = 0; i < 16; ++i) yield return null; diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 00219be1a39..c231fff6e3e 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -105,6 +105,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Prevent VFX Graph compilation each time a property's min/max value is changed - Exposed Camera property fails to upgrade and is converted to a float type [Case 1357685](https://issuetracker.unity3d.com/product/unity/issues/guid/1357685/) - Fix SDF Baker fail on PS4 & PS5 [Case 1351595](https://fogbugz.unity3d.com/f/cases/1351595/) +- 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/) - Added a missing paste option in the context menu for VFX contexts. Also the paste options is now disabled when uneffective ## [11.0.0] - 2020-10-21 diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 38f2866754f..4bca4ee7f89 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -283,6 +283,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 3d08ddb78c5..0c4627a7f2d 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -214,7 +214,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); @@ -1655,7 +1655,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 bdd344ea646..9d70f283dc6 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. } }