Skip to content

Commit 0b6b83c

Browse files
[10.x.x][VFX] Importer and compilation various fixes (#5372)
* Fix edit only compilation mode * Fix infinite compile (case 1346576) * Fix dirty on undo/redo + add guards to prevent out of sync serializarion (case 1327805) * Fix undertiminism with LocaToWorld and WorldToLocal (case 1355820) * Fix dirty + determinism issue with operators * Remove private bug referenced from changelog
1 parent 851dca1 commit 0b6b83c

File tree

7 files changed

+27
-3
lines changed

7 files changed

+27
-3
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- Extract position from a transform is wrong on GPU [Case 1353533](https://issuetracker.unity3d.com/product/unity/issues/guid/1353533/)
1313
- Fix rendering artifacts on some mobile devices [Case 1149057](https://issuetracker.unity3d.com/product/unity/issues/guid/1149057/)
1414
- Fix compilation failure on OpenGLES [Case 1348666](https://issuetracker.unity3d.com/product/unity/issues/guid/1348666/)
15+
- Fix potential infinite compilation when using subgraphs [Case 1346576](https://issuetracker.unity3d.com/product/unity/issues/guid/1346576/)
16+
- Prevent out of sync serialization of VFX assets that could cause the asset to be dirtied without reason
17+
- Fix undetermitism in space with LocalToWorld and WorldToLocal operators [Case 1355820](https://issuetracker.unity3d.com/product/unity/issues/guid/1355820/)
1518

1619
## [10.6.0] - 2021-04-29
1720
### Fixed
@@ -56,7 +59,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
5659
- Deleting a context node and a block while both are selected throws a null ref exception. [Case 315578](https://issuetracker.unity3d.com/product/unity/issues/guid/1315578/)
5760
- Fixed shader compilation errors with textures in shader graph [Case 1309219](https://issuetracker.unity3d.com/product/unity/issues/guid/1309219/)
5861
- Fixed issue with VFX using incorrect buffer type for strip data
59-
62+
6063
## [10.3.1] - 2021-01-26
6164

6265
Version Updated

com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ void Update()
278278
{
279279
VFXGraph.compileReporter = reporter;
280280
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graphView.controller.model));
281+
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!
281282
VFXGraph.compileReporter = null;
282283
}
283284
VFXGraph.explicitCompile = false;

com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ private void SynchronizeUndoRedoState()
201201
m_reentrant = true;
202202
ExpressionGraphDirty = true;
203203
model.GetOrCreateGraph().UpdateSubAssets();
204+
EditorUtility.SetDirty(graph);
204205
NotifyUpdate();
205206
m_reentrant = false;
206207
m_graphUndoStack.CleanDirtyState();

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Controller IControlledElement.controller
139139
void DisconnectController()
140140
{
141141
if (controller.model && controller.graph)
142-
controller.graph.SetCompilationMode(VFXCompilationMode.Runtime);
142+
controller.graph.SetCompilationMode(VFXViewPreference.forceEditionCompilation ? VFXCompilationMode.Edition : VFXCompilationMode.Runtime);
143143

144144

145145
m_Controller.UnregisterHandler(this);
@@ -1441,7 +1441,10 @@ void OnSave()
14411441
foreach(var graph in graphToSave)
14421442
{
14431443
if (EditorUtility.IsDirty(graph) || UnityEngine.Object.ReferenceEquals(graph, controller.graph))
1444+
{
1445+
graph.UpdateSubAssets();
14441446
graph.GetResource().WriteAsset();
1447+
}
14451448
}
14461449
}
14471450

com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot)
103103
}
104104
}
105105
}
106+
if (space == (VFXCoordinateSpace)int.MaxValue)
107+
space = outputSlot.space;
108+
106109
return space;
107110
}
108111

com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,19 @@ override public string name
179179
}
180180
}
181181

182+
public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot)
183+
{
184+
switch (m_BuiltInParameters)
185+
{
186+
case BuiltInFlag.LocalToWorld:
187+
return VFXCoordinateSpace.Local;
188+
case BuiltInFlag.WorldToLocal:
189+
return VFXCoordinateSpace.World;
190+
default:
191+
return (VFXCoordinateSpace)int.MaxValue;
192+
}
193+
}
194+
182195
protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
183196
{
184197
var expressions = builtInParameterEnumerable.Select(b => s_BuiltInInfo[b].expression);

com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static string[] OnWillSaveAssets(string[] paths)
158158
var vfxResource = VisualEffectResource.GetResourceAtPath(path);
159159
if (vfxResource != null)
160160
{
161-
var graph = vfxResource.GetOrCreateGraph();
161+
vfxResource.GetOrCreateGraph().UpdateSubAssets();
162162
vfxResource.WriteAsset(); // write asset as the AssetDatabase won't do it.
163163
}
164164
}

0 commit comments

Comments
 (0)