Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized we assumed the previous AssetDatabase.ImportAsset was synchronous here. I don't think it's possible to have an asynchronous import of the vfx anyway.

VFXGraph.compileReporter = null;
}
VFXGraph.explicitCompile = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ private void SynchronizeUndoRedoState()
m_reentrant = true;
ExpressionGraphDirty = true;
model.GetOrCreateGraph().UpdateSubAssets();
EditorUtility.SetDirty(graph);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I observed this behavior locally (without your change) :
_undo_test_missing_dirty
Was there another case where it causes an issue ?

NotifyUpdate();
m_reentrant = false;
m_graphUndoStack.CleanDirtyState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1562,7 +1562,10 @@ void OnSave()
foreach (var graph in graphToSave)
{
if (EditorUtility.IsDirty(graph) || UnityEngine.Object.ReferenceEquals(graph, controller.graph))
{
graph.UpdateSubAssets();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing UpdateSubAssets reminds me an old debug, see this conversation
At that time, I experimented a C++ workaround
For sure, even this bug : https://fogbugz.unity3d.com/f/cases/1322919/ isn't reproducible anymore, this change will avoid unexpected orphan references saved in VisualEffectAsset.

graph.GetResource().WriteAsset();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot)
}
}
}
if (space == (VFXCoordinateSpace)int.MaxValue)
space = outputSlot.space;

return space;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally, if outputSlot.spaceable and you reach the default state, you could throw an invalid operation exception.

}
}

protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
var expressions = builtInParameterEnumerable.Select(b => s_BuiltInInfo[b].expression);
Expand Down
2 changes: 1 addition & 1 deletion com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
Expand Down