From 01e8e4298296613fd5ee0cc854ea406c37516bfa Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 17 Jun 2021 14:30:08 +0200 Subject: [PATCH 01/38] Add regression test on basic sanitize See https://unity.slack.com/archives/G1BTWN88Z/p1623825854027500 --- .../Editor/Tests/VFXSerializationTests.cs | 32 + .../VFXSerializationTests_GetSpawnCount.vfx_ | 997 ++++++++++++++++++ ...SerializationTests_GetSpawnCount.vfx_.meta | 7 + 3 files changed, 1036 insertions(+) create mode 100644 TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_ create mode 100644 TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_.meta diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests.cs index a8610929007..4d91fcd3205 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests.cs @@ -28,6 +28,38 @@ private VisualEffectAsset CreateAssetAtPath(string path) return VisualEffectAssetEditorUtility.CreateNewAsset(path); } + [Test] + public void Sanitize_GetSpawnCount() + { + string kSourceAsset = "Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_"; + var graph = VFXTestCommon.CopyTemporaryGraph(kSourceAsset); + + Assert.AreEqual(5, graph.children.OfType().Count()); + Assert.AreEqual(5, graph.children.OfType().Where(o => o.type == typeof(uint)).Count()); + Assert.AreEqual(1, graph.children.OfType().Where(o => o.type == typeof(float)).Count()); + Assert.AreEqual(1, graph.children.OfType().Count()); + Assert.AreEqual(1, graph.children.OfType().Where(o => o.type == typeof(Color)).Count()); + + foreach (var attribute in graph.children.OfType()) + Assert.IsTrue(attribute.outputSlots[0].HasLink()); + + foreach (var inlineUInt in graph.children.OfType().Where(o => o.type == typeof(uint))) + Assert.IsTrue(inlineUInt.inputSlots[0].HasLink()); + + foreach (var inlineFloat in graph.children.OfType().Where(o => o.type == typeof(float))) + Assert.IsTrue(inlineFloat.inputSlots[0].HasLink()); + + foreach (var inlineColor in graph.children.OfType().Where(o => o.type == typeof(Color))) + Assert.IsTrue(inlineColor.inputSlots[0].HasLink()); + + foreach (var add in graph.children.OfType()) + { + Assert.AreEqual(2, add.operandCount); + Assert.IsTrue(add.inputSlots[0].HasLink()); + Assert.IsTrue(add.inputSlots[1].HasLink()); + } + } + [OneTimeSetUpAttribute] public void OneTimeSetUpAttribute() { diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_ new file mode 100644 index 00000000000..74ad7613f06 --- /dev/null +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_ @@ -0,0 +1,997 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &114340500867371532 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d01270efd3285ea4a9d6c555cb0a8027, type: 3} + m_Name: VFXUI + m_EditorClassIdentifier: + groupInfos: [] + stickyNoteInfos: + - title: ========> + position: + serializedVersion: 2 + x: 690 + y: 717 + width: 137 + height: 100 + contents: 'Suppose to have 4 Get Spawn Count here. + +' + theme: Classic + textSize: Small + categories: [] + uiBounds: + serializedVersion: 2 + x: 888 + y: 692 + width: 568 + height: 400 +--- !u!114 &114350483966674976 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7d4c867f6b72b714dbb5fd1780afe208, type: 3} + m_Name: GetSpawnCount + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: + - {fileID: 8926484042661614598} + - {fileID: 8926484042661614600} + - {fileID: 8926484042661614602} + - {fileID: 8926484042661614604} + - {fileID: 8926484042661614607} + - {fileID: 8926484042661614612} + - {fileID: 8926484042661614616} + - {fileID: 8926484042661614618} + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_UIInfos: {fileID: 114340500867371532} + m_ParameterInfo: [] + m_ImportDependencies: [] + m_GraphVersion: 8 + m_ResourceVersion: 1 + m_SubgraphDependencies: [] + m_CategoryPath: +--- !u!2058629511 &8926484042661614527 +VisualEffectResource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GetSpawnCount + m_Graph: {fileID: 114350483966674976} + m_Infos: + m_RendererSettings: + motionVectorGenerationMode: 0 + shadowCastingMode: 0 + receiveShadows: 0 + reflectionProbeUsage: 0 + lightProbeUsage: 0 + m_CullingFlags: 3 + m_UpdateMode: 0 + m_PreWarmDeltaTime: 0.05 + m_PreWarmStepCount: 0 + m_InitialEventName: OnPlay +--- !u!114 &8926484042661614598 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0d725da0583a0e4fa477585f4b1194f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 888, y: 692} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: [] + m_OutputSlots: + - {fileID: 8926484042661614599} +--- !u!114 &8926484042661614599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614599} + m_MasterData: + m_Owner: {fileID: 8926484042661614598} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: SpawnCount + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614600 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0d725da0583a0e4fa477585f4b1194f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 888, y: 780} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: [] + m_OutputSlots: + - {fileID: 8926484042661614601} +--- !u!114 &8926484042661614601 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614601} + m_MasterData: + m_Owner: {fileID: 8926484042661614600} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: SpawnCount + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: + - {fileID: 8926484042661614605} +--- !u!114 &8926484042661614602 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0d725da0583a0e4fa477585f4b1194f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 888, y: 858} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: [] + m_OutputSlots: + - {fileID: 8926484042661614603} +--- !u!114 &8926484042661614603 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614603} + m_MasterData: + m_Owner: {fileID: 8926484042661614602} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: SpawnCount + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: + - {fileID: 8926484042661614611} +--- !u!114 &8926484042661614604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 955b0c175a6f3bb4582e92f3de8f0626, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 1121, y: 741} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: + - {fileID: 8926484042661614605} + m_OutputSlots: + - {fileID: 8926484042661614606} + m_Type: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 +--- !u!114 &8926484042661614605 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614605} + m_MasterData: + m_Owner: {fileID: 8926484042661614604} + m_Value: + m_Type: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: + - {fileID: 8926484042661614601} +--- !u!114 &8926484042661614606 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614606} + m_MasterData: + m_Owner: {fileID: 8926484042661614604} + m_Value: + m_Type: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614607 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c7acf5424f3655744af4b8f63298fa0f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 1121, y: 832} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: + - {fileID: 8926484042661614611} + - {fileID: 8926484042661614614} + m_OutputSlots: + - {fileID: 8926484042661614615} + m_Operands: + - name: a + type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + - name: b + type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 +--- !u!114 &8926484042661614610 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614610} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614611} + m_MasterData: + m_Owner: {fileID: 8926484042661614607} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: a + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: + - {fileID: 8926484042661614603} +--- !u!114 &8926484042661614612 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0d725da0583a0e4fa477585f4b1194f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 888, y: 936} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: [] + m_OutputSlots: + - {fileID: 8926484042661614613} +--- !u!114 &8926484042661614613 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614613} + m_MasterData: + m_Owner: {fileID: 8926484042661614612} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: SpawnCount + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: + - {fileID: 8926484042661614614} +--- !u!114 &8926484042661614614 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614614} + m_MasterData: + m_Owner: {fileID: 8926484042661614607} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: b + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: + - {fileID: 8926484042661614613} +--- !u!114 &8926484042661614615 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614615} + m_MasterData: + m_Owner: {fileID: 8926484042661614607} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614616 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0d725da0583a0e4fa477585f4b1194f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 888, y: 1014} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: [] + m_OutputSlots: + - {fileID: 8926484042661614617} +--- !u!114 &8926484042661614617 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c52d920e7fff73b498050a6b3c4404ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614617} + m_MasterData: + m_Owner: {fileID: 8926484042661614616} + m_Value: + m_Type: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_SerializableObject: 0 + m_Space: 2147483647 + m_Property: + name: SpawnCount + m_serializedType: + m_SerializableType: System.UInt32, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: + - {fileID: 8926484042661614619} +--- !u!114 &8926484042661614618 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 955b0c175a6f3bb4582e92f3de8f0626, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 114350483966674976} + m_Children: [] + m_UIPosition: {x: 1121, y: 966} + m_UICollapsed: 0 + m_UISuperCollapsed: 0 + m_InputSlots: + - {fileID: 8926484042661614619} + m_OutputSlots: + - {fileID: 8926484042661614624} + m_Type: + m_SerializableType: UnityEngine.Color, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &8926484042661614619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c82227d5759e296488798b1554a72a15, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: + - {fileID: 8926484042661614620} + - {fileID: 8926484042661614621} + - {fileID: 8926484042661614622} + - {fileID: 8926484042661614623} + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614619} + m_MasterData: + m_Owner: {fileID: 8926484042661614618} + m_Value: + m_Type: + m_SerializableType: UnityEngine.Color, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: UnityEngine.Color, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + m_Direction: 0 + m_LinkedSlots: + - {fileID: 8926484042661614617} +--- !u!114 &8926484042661614620 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614619} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614619} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: r + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: [] +--- !u!114 &8926484042661614621 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614619} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614619} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: g + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: [] +--- !u!114 &8926484042661614622 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614619} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614619} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: b + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: [] +--- !u!114 &8926484042661614623 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614619} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614619} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: a + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 0 + m_LinkedSlots: [] +--- !u!114 &8926484042661614624 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c82227d5759e296488798b1554a72a15, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: + - {fileID: 8926484042661614625} + - {fileID: 8926484042661614626} + - {fileID: 8926484042661614627} + - {fileID: 8926484042661614628} + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614624} + m_MasterData: + m_Owner: {fileID: 8926484042661614618} + m_Value: + m_Type: + m_SerializableType: UnityEngine.Color, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: + m_serializedType: + m_SerializableType: UnityEngine.Color, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614625 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614624} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614624} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: r + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614626 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614624} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614624} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: g + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614627 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614624} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614624} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: b + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] +--- !u!114 &8926484042661614628 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 8926484042661614624} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + m_MasterSlot: {fileID: 8926484042661614624} + m_MasterData: + m_Owner: {fileID: 0} + m_Value: + m_Type: + m_SerializableType: + m_SerializableObject: + m_Space: 2147483647 + m_Property: + name: a + m_serializedType: + m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + m_Direction: 1 + m_LinkedSlots: [] diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_.meta b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_.meta new file mode 100644 index 00000000000..0b236ff0383 --- /dev/null +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSerializationTests_GetSpawnCount.vfx_.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cbad9e9da51a90e49b5311ce7e1a450d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 43b48324b1c0a6e94a5b1d766c3a6428e089c595 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 24 Jun 2021 14:41:51 +0200 Subject: [PATCH 02/38] Move SanitizeForImport See this conversation : https://unity.slack.com/archives/C47JPNNTZ/p1624277477261600?thread_ts=1623913383.239100&cid=C47JPNNTZ However, some concerns : - No idea about side effects of this solution - It will lead to a double compilation of sanitized files (if there is a sanitize needed, we will have a new reimport) - OnPostprocessAllAssets can't be filtered efficiently on the VisualEffectAsset --- .../Editor/Models/VFXGraph.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 0acb2e9bbce..77a535396ea 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -21,19 +21,22 @@ namespace UnityEditor.VFX [InitializeOnLoad] class VFXGraphPreprocessor : AssetPostprocessor { - void OnPreprocessAsset() + static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { - bool isVFX = VisualEffectAssetModicationProcessor.HasVFXExtension(assetPath); - if (isVFX) + foreach (var assetPath in importedAssets) { - VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); - if (resource == null) - return; - VFXGraph graph = resource.graph as VFXGraph; - if (graph != null) - graph.SanitizeForImport(); - else - Debug.LogError("VisualEffectGraphResource without graph"); + bool isVFX = VisualEffectAssetModicationProcessor.HasVFXExtension(assetPath); + if (isVFX) + { + VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); + if (resource == null) + return; + VFXGraph graph = resource.graph as VFXGraph; + if (graph != null) + graph.SanitizeForImport(); + else + Debug.LogError("VisualEffectGraphResource without graph"); + } } } From e228f63c369c8284b42a8b0cadef8b9721142a86 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 24 Jun 2021 14:45:48 +0200 Subject: [PATCH 03/38] *Minor : Missing InvariantCultureIgnoreCase flag in EndsWith --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 77a535396ea..c951815607a 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -185,9 +185,9 @@ public static bool HasVFXExtension(string filePath) { if (string.IsNullOrEmpty(filePath)) return false; - return filePath.EndsWith(VisualEffectResource.Extension) - || filePath.EndsWith(VisualEffectSubgraphBlock.Extension) - || filePath.EndsWith(VisualEffectSubgraphOperator.Extension); + return filePath.EndsWith(VisualEffectResource.Extension, StringComparison.InvariantCultureIgnoreCase) + || filePath.EndsWith(VisualEffectSubgraphBlock.Extension, StringComparison.InvariantCultureIgnoreCase) + || filePath.EndsWith(VisualEffectSubgraphOperator.Extension, StringComparison.InvariantCultureIgnoreCase); } static string[] OnWillSaveAssets(string[] paths) From 4d22c94b675567fd4fa27a19fb9a97e02f274e43 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 24 Jun 2021 14:57:00 +0200 Subject: [PATCH 04/38] *Update changelog.md --- com.unity.visualeffectgraph/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 732c57f8d9b..3e05aad0f5b 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix unexpected Spawn context execution ordering - Fix incorrect buffer type for strips - Enabled an optimization for motion vectors, storing projected positions for vertices instead of the transform matrix +- Move Sanitize from PreProcess to PostProcess to avoid loss of data due to model migration [Case 1344645](https://issuetracker.unity3d.com/product/unity/issues/guid/1344645/) ## [11.0.0] - 2020-10-21 ### Added From 99ab5fb3d52971eee3e745fe410dbcef7539032a Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 24 Jun 2021 16:39:27 +0200 Subject: [PATCH 05/38] *Fix HDRP warning Hoping it will prevent this issue : ``` Unhandled log message: '[Exception] UnityException: DestroyImmediate is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'HDWizard'. See "Script Serialization" page in the Unity Manual for further details.'. Use UnityEngine.TestTools.LogAssert.Expect ``` See https://yamato-artifactviewer.prd.cds.internal.unity3d.com/9f8a60fd-d1f9-48b5-9513-e4e535cf5d7c%2Flogs%2FTestProjects%2FVisualEffectGraph_HDRP%2Ftest-results/TestReportV1.html --- .../Assets/HDRP/HDRenderPipelineAsset.asset | 5 +- .../HDRenderPipelineGlobalSettings.asset | 8 ++- .../Assets/scene.unity.meta | 7 ++ .../ProjectSettings/ProjectSettings.asset | 72 +++++++++++++------ 4 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset index c7b393e7f9d..1e4eea866ea 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset @@ -44,7 +44,6 @@ MonoBehaviour: decalNormalBufferHP: 0 msaaSampleCount: 1 supportMotionVectors: 1 - supportRuntimeDebugDisplay: 1 supportRuntimeAOVAPI: 0 supportDitheringCrossFade: 1 supportTerrainHole: 0 @@ -131,6 +130,7 @@ MonoBehaviour: upsampleFilter: 1 forceResolution: 0 forcedPercentage: 100 + lowResTransparencyMinimumThreshold: 0 lowresTransparentSettings: enabled: 1 checkerboardDepthBuffer: 1 @@ -258,8 +258,9 @@ MonoBehaviour: m_ObsoleteDecalLayerName5: m_ObsoleteDecalLayerName6: m_ObsoleteDecalLayerName7: + m_ObsoleteSupportRuntimeDebugDisplay: 1 allowShaderVariantStripping: 1 - enableSRPBatcher: 0 + enableSRPBatcher: 1 availableMaterialQualityLevels: -1 m_DefaultMaterialQualityLevel: 4 diffusionProfileSettings: {fileID: 11400000, guid: cbe1ee9036c47b84ba1b8b3dbcde2aff, diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset index 0f6b7eae15d..8cd68cadbc5 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset @@ -88,6 +88,12 @@ MonoBehaviour: diffusionProfileSettingsList: - {fileID: 11400000, guid: cbe1ee9036c47b84ba1b8b3dbcde2aff, type: 2} - {fileID: 11400000, guid: 38c0905fbe269274782e939ce4393d85, type: 2} + rendererListCulling: 0 DLSSProjectId: 000000 useDLSSCustomProjectId: 0 - m_Version: 2 + supportProbeVolumes: 0 + supportRuntimeDebugDisplay: 1 + apvScenesBounds: + serializedBounds: [] + serializedHasVolumes: [] + m_Version: 3 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta b/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta new file mode 100644 index 00000000000..ccdec0aaa36 --- /dev/null +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fa21be0ed58d7694391e9bb9e5bc17cc +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset index 442593ce212..e224ed787f4 100644 --- a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 21 + serializedVersion: 23 productGUID: 213451596e328ea49a600474fe756f52 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -68,6 +68,12 @@ PlayerSettings: androidRenderOutsideSafeArea: 0 androidUseSwappy: 0 androidBlitType: 1 + androidResizableWindow: 0 + androidDefaultWindowWidth: 1920 + androidDefaultWindowHeight: 1080 + androidMinimumWindowWidth: 400 + androidMinimumWindowHeight: 300 + androidFullscreenMode: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -121,6 +127,7 @@ PlayerSettings: vulkanEnableSetSRGBWrite: 0 vulkanEnablePreTransform: 0 vulkanEnableLateAcquireNextImage: 0 + vulkanEnableCommandBufferRecycling: 1 m_SupportedAspectRatios: 4:3: 1 5:4: 1 @@ -155,9 +162,9 @@ PlayerSettings: Standalone: 0 iPhone: 0 tvOS: 0 - overrideDefaultApplicationIdentifier: 0 + overrideDefaultApplicationIdentifier: 1 AndroidBundleVersionCode: 1 - AndroidMinSdkVersion: 19 + AndroidMinSdkVersion: 22 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1 aotOptions: @@ -213,11 +220,13 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] + macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 metalAPIValidation: 1 iOSRenderExtraFrameOnPause: 1 + iosCopyPluginsCodeInsteadOfSymlink: 0 appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: @@ -227,6 +236,7 @@ PlayerSettings: iOSRequireARKit: 0 iOSAutomaticallyDetectAndAddCapabilities: 1 appleEnableProMotion: 0 + shaderPrecisionModel: 0 clonedFromGUID: 00000000000000000000000000000000 templatePackageId: templateDefaultScene: @@ -238,6 +248,7 @@ PlayerSettings: useCustomGradlePropertiesTemplate: 0 useCustomProguardFile: 0 AndroidTargetArchitectures: 5 + AndroidTargetDevices: 0 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} AndroidKeystoreName: '{inproject}: ' @@ -254,6 +265,7 @@ PlayerSettings: height: 180 banner: {fileID: 0} androidGamepadSupportLevel: 0 + chromeosInputEmulation: 1 AndroidMinifyWithR8: 0 AndroidMinifyRelease: 0 AndroidMinifyDebug: 0 @@ -307,6 +319,9 @@ PlayerSettings: - m_BuildTarget: WindowsStandaloneSupport m_APIs: 020000001500000012000000 m_Automatic: 0 + - m_BuildTarget: AndroidPlayer + m_APIs: 0b00000008000000 + m_Automatic: 0 m_BuildTargetVRSettings: [] openGLRequireES31: 0 openGLRequireES31AEP: 0 @@ -317,13 +332,20 @@ PlayerSettings: tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: - m_BuildTarget: Standalone - m_EncodingQuality: 1 + m_EncodingQuality: 2 - m_BuildTarget: XboxOne m_EncodingQuality: 1 - m_BuildTarget: PS4 m_EncodingQuality: 1 + - m_BuildTarget: Android + m_EncodingQuality: 2 + - m_BuildTarget: Lumin + m_EncodingQuality: 2 + - m_BuildTarget: Windows Store Apps + m_EncodingQuality: 2 m_BuildTargetGroupLightmapSettings: [] m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -333,6 +355,7 @@ PlayerSettings: cameraUsageDescription: locationUsageDescription: microphoneUsageDescription: + bluetoothUsageDescription: switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 @@ -341,6 +364,7 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchUseGOLDLinker: 0 + switchLTOSetting: 0 switchApplicationID: 0x0005000C10000001 switchNSODependencies: switchTitleNames_0: @@ -358,6 +382,7 @@ PlayerSettings: switchTitleNames_12: switchTitleNames_13: switchTitleNames_14: + switchTitleNames_15: switchPublisherNames_0: switchPublisherNames_1: switchPublisherNames_2: @@ -373,6 +398,7 @@ PlayerSettings: switchPublisherNames_12: switchPublisherNames_13: switchPublisherNames_14: + switchPublisherNames_15: switchIcons_0: {fileID: 0} switchIcons_1: {fileID: 0} switchIcons_2: {fileID: 0} @@ -388,6 +414,7 @@ PlayerSettings: switchIcons_12: {fileID: 0} switchIcons_13: {fileID: 0} switchIcons_14: {fileID: 0} + switchIcons_15: {fileID: 0} switchSmallIcons_0: {fileID: 0} switchSmallIcons_1: {fileID: 0} switchSmallIcons_2: {fileID: 0} @@ -403,6 +430,7 @@ PlayerSettings: switchSmallIcons_12: {fileID: 0} switchSmallIcons_13: {fileID: 0} switchSmallIcons_14: {fileID: 0} + switchSmallIcons_15: {fileID: 0} switchManualHTML: switchAccessibleURLs: switchLegalInformation: @@ -466,6 +494,8 @@ PlayerSettings: switchNetworkInterfaceManagerInitializeEnabled: 1 switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 + switchUseMicroSleepForYield: 1 + switchMicroSleepForYieldTime: 25 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -573,32 +603,32 @@ PlayerSettings: webGLThreadsSupport: 0 webGLDecompressionFallback: 0 scriptingDefineSymbols: - 1: UNITY_POST_PROCESSING_STACK_V2 - 4: UNITY_POST_PROCESSING_STACK_V2 - 7: UNITY_POST_PROCESSING_STACK_V2 - 13: UNITY_POST_PROCESSING_STACK_V2 - 14: UNITY_POST_PROCESSING_STACK_V2 - 18: UNITY_POST_PROCESSING_STACK_V2 - 19: UNITY_POST_PROCESSING_STACK_V2 - 21: UNITY_POST_PROCESSING_STACK_V2 - 23: UNITY_POST_PROCESSING_STACK_V2 - 25: UNITY_POST_PROCESSING_STACK_V2 - 26: UNITY_POST_PROCESSING_STACK_V2 - 27: UNITY_POST_PROCESSING_STACK_V2 - 28: UNITY_POST_PROCESSING_STACK_V2 + : UNITY_POST_PROCESSING_STACK_V2 + Android: UNITY_POST_PROCESSING_STACK_V2 + Lumin: UNITY_POST_PROCESSING_STACK_V2 + Nintendo Switch: UNITY_POST_PROCESSING_STACK_V2 + PS4: UNITY_POST_PROCESSING_STACK_V2 + Standalone: UNITY_POST_PROCESSING_STACK_V2 + WebGL: UNITY_POST_PROCESSING_STACK_V2 + Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2 + XboxOne: UNITY_POST_PROCESSING_STACK_V2 + iPhone: UNITY_POST_PROCESSING_STACK_V2 + tvOS: UNITY_POST_PROCESSING_STACK_V2 + additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: Standalone: 0 il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {} + suppressCommonWarnings: 1 allowUnsafeCode: 0 useDeterministicCompilation: 1 - useReferenceAssemblies: 1 enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 + assemblyVersionValidation: 1 gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: Standalone: 6 @@ -649,6 +679,7 @@ PlayerSettings: XboxOneCapability: [] XboxOneGameRating: {} XboxOneIsContentPackage: 0 + XboxOneEnhancedXboxCompatibilityMode: 0 XboxOneEnableGPUVariability: 0 XboxOneSockets: {} XboxOneSplashScreen: {fileID: 0} @@ -678,7 +709,8 @@ PlayerSettings: projectName: organizationId: cloudEnabled: 0 - enableNativePlatformBackendsForNewInputSystem: 0 - disableOldInputManagerSupport: 0 legacyClampBlendShapeWeights: 1 + playerDataPath: + forceSRGBBlit: 1 virtualTexturingSupportEnabled: 0 + uploadClearedTextureDataAfterCreationFromScript: 0 From d0d9438c57b0cac43d623aa4871ae6e6f8193c16 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Fri, 25 Jun 2021 08:41:14 +0200 Subject: [PATCH 06/38] Revert "*Fix HDRP warning" This reverts commit 99ab5fb3d52971eee3e745fe410dbcef7539032a. --- .../Assets/HDRP/HDRenderPipelineAsset.asset | 5 +- .../HDRenderPipelineGlobalSettings.asset | 8 +-- .../Assets/scene.unity.meta | 7 -- .../ProjectSettings/ProjectSettings.asset | 72 ++++++------------- 4 files changed, 23 insertions(+), 69 deletions(-) delete mode 100644 TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset index 1e4eea866ea..c7b393e7f9d 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset @@ -44,6 +44,7 @@ MonoBehaviour: decalNormalBufferHP: 0 msaaSampleCount: 1 supportMotionVectors: 1 + supportRuntimeDebugDisplay: 1 supportRuntimeAOVAPI: 0 supportDitheringCrossFade: 1 supportTerrainHole: 0 @@ -130,7 +131,6 @@ MonoBehaviour: upsampleFilter: 1 forceResolution: 0 forcedPercentage: 100 - lowResTransparencyMinimumThreshold: 0 lowresTransparentSettings: enabled: 1 checkerboardDepthBuffer: 1 @@ -258,9 +258,8 @@ MonoBehaviour: m_ObsoleteDecalLayerName5: m_ObsoleteDecalLayerName6: m_ObsoleteDecalLayerName7: - m_ObsoleteSupportRuntimeDebugDisplay: 1 allowShaderVariantStripping: 1 - enableSRPBatcher: 1 + enableSRPBatcher: 0 availableMaterialQualityLevels: -1 m_DefaultMaterialQualityLevel: 4 diffusionProfileSettings: {fileID: 11400000, guid: cbe1ee9036c47b84ba1b8b3dbcde2aff, diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset index 8cd68cadbc5..0f6b7eae15d 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset @@ -88,12 +88,6 @@ MonoBehaviour: diffusionProfileSettingsList: - {fileID: 11400000, guid: cbe1ee9036c47b84ba1b8b3dbcde2aff, type: 2} - {fileID: 11400000, guid: 38c0905fbe269274782e939ce4393d85, type: 2} - rendererListCulling: 0 DLSSProjectId: 000000 useDLSSCustomProjectId: 0 - supportProbeVolumes: 0 - supportRuntimeDebugDisplay: 1 - apvScenesBounds: - serializedBounds: [] - serializedHasVolumes: [] - m_Version: 3 + m_Version: 2 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta b/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta deleted file mode 100644 index ccdec0aaa36..00000000000 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/scene.unity.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: fa21be0ed58d7694391e9bb9e5bc17cc -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset index e224ed787f4..442593ce212 100644 --- a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 23 + serializedVersion: 21 productGUID: 213451596e328ea49a600474fe756f52 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -68,12 +68,6 @@ PlayerSettings: androidRenderOutsideSafeArea: 0 androidUseSwappy: 0 androidBlitType: 1 - androidResizableWindow: 0 - androidDefaultWindowWidth: 1920 - androidDefaultWindowHeight: 1080 - androidMinimumWindowWidth: 400 - androidMinimumWindowHeight: 300 - androidFullscreenMode: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -127,7 +121,6 @@ PlayerSettings: vulkanEnableSetSRGBWrite: 0 vulkanEnablePreTransform: 0 vulkanEnableLateAcquireNextImage: 0 - vulkanEnableCommandBufferRecycling: 1 m_SupportedAspectRatios: 4:3: 1 5:4: 1 @@ -162,9 +155,9 @@ PlayerSettings: Standalone: 0 iPhone: 0 tvOS: 0 - overrideDefaultApplicationIdentifier: 1 + overrideDefaultApplicationIdentifier: 0 AndroidBundleVersionCode: 1 - AndroidMinSdkVersion: 22 + AndroidMinSdkVersion: 19 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1 aotOptions: @@ -220,13 +213,11 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] - macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 metalAPIValidation: 1 iOSRenderExtraFrameOnPause: 1 - iosCopyPluginsCodeInsteadOfSymlink: 0 appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: @@ -236,7 +227,6 @@ PlayerSettings: iOSRequireARKit: 0 iOSAutomaticallyDetectAndAddCapabilities: 1 appleEnableProMotion: 0 - shaderPrecisionModel: 0 clonedFromGUID: 00000000000000000000000000000000 templatePackageId: templateDefaultScene: @@ -248,7 +238,6 @@ PlayerSettings: useCustomGradlePropertiesTemplate: 0 useCustomProguardFile: 0 AndroidTargetArchitectures: 5 - AndroidTargetDevices: 0 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} AndroidKeystoreName: '{inproject}: ' @@ -265,7 +254,6 @@ PlayerSettings: height: 180 banner: {fileID: 0} androidGamepadSupportLevel: 0 - chromeosInputEmulation: 1 AndroidMinifyWithR8: 0 AndroidMinifyRelease: 0 AndroidMinifyDebug: 0 @@ -319,9 +307,6 @@ PlayerSettings: - m_BuildTarget: WindowsStandaloneSupport m_APIs: 020000001500000012000000 m_Automatic: 0 - - m_BuildTarget: AndroidPlayer - m_APIs: 0b00000008000000 - m_Automatic: 0 m_BuildTargetVRSettings: [] openGLRequireES31: 0 openGLRequireES31AEP: 0 @@ -332,20 +317,13 @@ PlayerSettings: tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: - m_BuildTarget: Standalone - m_EncodingQuality: 2 + m_EncodingQuality: 1 - m_BuildTarget: XboxOne m_EncodingQuality: 1 - m_BuildTarget: PS4 m_EncodingQuality: 1 - - m_BuildTarget: Android - m_EncodingQuality: 2 - - m_BuildTarget: Lumin - m_EncodingQuality: 2 - - m_BuildTarget: Windows Store Apps - m_EncodingQuality: 2 m_BuildTargetGroupLightmapSettings: [] m_BuildTargetNormalMapEncoding: [] - m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -355,7 +333,6 @@ PlayerSettings: cameraUsageDescription: locationUsageDescription: microphoneUsageDescription: - bluetoothUsageDescription: switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 @@ -364,7 +341,6 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchUseGOLDLinker: 0 - switchLTOSetting: 0 switchApplicationID: 0x0005000C10000001 switchNSODependencies: switchTitleNames_0: @@ -382,7 +358,6 @@ PlayerSettings: switchTitleNames_12: switchTitleNames_13: switchTitleNames_14: - switchTitleNames_15: switchPublisherNames_0: switchPublisherNames_1: switchPublisherNames_2: @@ -398,7 +373,6 @@ PlayerSettings: switchPublisherNames_12: switchPublisherNames_13: switchPublisherNames_14: - switchPublisherNames_15: switchIcons_0: {fileID: 0} switchIcons_1: {fileID: 0} switchIcons_2: {fileID: 0} @@ -414,7 +388,6 @@ PlayerSettings: switchIcons_12: {fileID: 0} switchIcons_13: {fileID: 0} switchIcons_14: {fileID: 0} - switchIcons_15: {fileID: 0} switchSmallIcons_0: {fileID: 0} switchSmallIcons_1: {fileID: 0} switchSmallIcons_2: {fileID: 0} @@ -430,7 +403,6 @@ PlayerSettings: switchSmallIcons_12: {fileID: 0} switchSmallIcons_13: {fileID: 0} switchSmallIcons_14: {fileID: 0} - switchSmallIcons_15: {fileID: 0} switchManualHTML: switchAccessibleURLs: switchLegalInformation: @@ -494,8 +466,6 @@ PlayerSettings: switchNetworkInterfaceManagerInitializeEnabled: 1 switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 - switchUseMicroSleepForYield: 1 - switchMicroSleepForYieldTime: 25 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -603,32 +573,32 @@ PlayerSettings: webGLThreadsSupport: 0 webGLDecompressionFallback: 0 scriptingDefineSymbols: - : UNITY_POST_PROCESSING_STACK_V2 - Android: UNITY_POST_PROCESSING_STACK_V2 - Lumin: UNITY_POST_PROCESSING_STACK_V2 - Nintendo Switch: UNITY_POST_PROCESSING_STACK_V2 - PS4: UNITY_POST_PROCESSING_STACK_V2 - Standalone: UNITY_POST_PROCESSING_STACK_V2 - WebGL: UNITY_POST_PROCESSING_STACK_V2 - Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2 - XboxOne: UNITY_POST_PROCESSING_STACK_V2 - iPhone: UNITY_POST_PROCESSING_STACK_V2 - tvOS: UNITY_POST_PROCESSING_STACK_V2 - additionalCompilerArguments: {} + 1: UNITY_POST_PROCESSING_STACK_V2 + 4: UNITY_POST_PROCESSING_STACK_V2 + 7: UNITY_POST_PROCESSING_STACK_V2 + 13: UNITY_POST_PROCESSING_STACK_V2 + 14: UNITY_POST_PROCESSING_STACK_V2 + 18: UNITY_POST_PROCESSING_STACK_V2 + 19: UNITY_POST_PROCESSING_STACK_V2 + 21: UNITY_POST_PROCESSING_STACK_V2 + 23: UNITY_POST_PROCESSING_STACK_V2 + 25: UNITY_POST_PROCESSING_STACK_V2 + 26: UNITY_POST_PROCESSING_STACK_V2 + 27: UNITY_POST_PROCESSING_STACK_V2 + 28: UNITY_POST_PROCESSING_STACK_V2 platformArchitecture: {} scriptingBackend: Standalone: 0 il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {} - suppressCommonWarnings: 1 allowUnsafeCode: 0 useDeterministicCompilation: 1 + useReferenceAssemblies: 1 enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 - assemblyVersionValidation: 1 gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: Standalone: 6 @@ -679,7 +649,6 @@ PlayerSettings: XboxOneCapability: [] XboxOneGameRating: {} XboxOneIsContentPackage: 0 - XboxOneEnhancedXboxCompatibilityMode: 0 XboxOneEnableGPUVariability: 0 XboxOneSockets: {} XboxOneSplashScreen: {fileID: 0} @@ -709,8 +678,7 @@ PlayerSettings: projectName: organizationId: cloudEnabled: 0 + enableNativePlatformBackendsForNewInputSystem: 0 + disableOldInputManagerSupport: 0 legacyClampBlendShapeWeights: 1 - playerDataPath: - forceSRGBBlit: 1 virtualTexturingSupportEnabled: 0 - uploadClearedTextureDataAfterCreationFromScript: 0 From cbfa99c8b0fc2b5d2aafd7c891f149171930daa4 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Sun, 27 Jun 2021 17:51:48 +0200 Subject: [PATCH 07/38] More conservative way of workaround Preprocess issue Use a static cache of already santized object This solution remains a pretty dirty trick :-/ *Before* - Preprocess : Compile (possibly with side effect modifying the graph) - PostProcess : Sanitize, if there is a modification, it should relaunch the import & recompile *After* - Preprocess : Compile only if the sanitize has been done - PosProcess : Sanitize, if it's the first sanitize, relaunch the reimport Locally, it fixes unexpecting missing import of point cache asset (see 09_AttributeMaps). --- .../Editor/Models/VFXGraph.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index c951815607a..cb4d65fc5f1 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -21,6 +21,7 @@ namespace UnityEditor.VFX [InitializeOnLoad] class VFXGraphPreprocessor : AssetPostprocessor { + private static HashSet s_SanitizedGraph = new HashSet(); static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (var assetPath in importedAssets) @@ -36,6 +37,15 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse graph.SanitizeForImport(); else Debug.LogError("VisualEffectGraphResource without graph"); + + var path = AssetDatabase.GetAssetPath(resource); + var guid = AssetDatabase.AssetPathToGUID(path); + if (!s_SanitizedGraph.Contains(guid)) + { + s_SanitizedGraph.Add(guid); + //Relaunch previously skipped OnCompileResource + AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); + } } } } @@ -58,6 +68,11 @@ static void OnCompileResource(VisualEffectResource resource) { if (resource != null) { + var path = AssetDatabase.GetAssetPath(resource); + var guid = AssetDatabase.AssetPathToGUID(path); + if (!s_SanitizedGraph.Contains(guid)) + return; //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize + VFXGraph graph = resource.graph as VFXGraph; if (graph != null) resource.GetOrCreateGraph().CompileForImport(); From 508d713c785b8c737d0212e83cc1c7dbb9290615 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 30 Jun 2021 10:24:15 +0200 Subject: [PATCH 08/38] Remove DestroyImmediate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This instance singleton can be called from HDWizard constructor making this call illegal. See https://unity.slack.com/archives/GHD5LADU7/p1625040944440100?thread_ts=1624547150.387900&cid=GHD5LADU7 (cc @RSlysz) Testing yamato ⏳ --- .../Editor/RenderPipelineResources/HDProjectSettings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs index dad9beb69c3..840cd2a3974 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs @@ -122,7 +122,6 @@ static HDProjectSettings instance //(migration is done at loading time) if (!(s_Instance is HDProjectSettings inst) || inst.m_Version != MigrationDescription.LastVersion()) { - DestroyImmediate(s_Instance); s_Instance = null; } From 1fb08353108c9e0ca52c7a29e5deaec3233308f2 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 30 Jun 2021 15:07:04 +0200 Subject: [PATCH 09/38] Revert "Remove DestroyImmediate " This reverts commit 508d713c785b8c737d0212e83cc1c7dbb9290615. --- .../Editor/RenderPipelineResources/HDProjectSettings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs index 840cd2a3974..dad9beb69c3 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/HDProjectSettings.cs @@ -122,6 +122,7 @@ static HDProjectSettings instance //(migration is done at loading time) if (!(s_Instance is HDProjectSettings inst) || inst.m_Version != MigrationDescription.LastVersion()) { + DestroyImmediate(s_Instance); s_Instance = null; } From ff51dcf1ae1fef34b8daac4c581c18c543f17916 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 30 Jun 2021 15:24:19 +0200 Subject: [PATCH 10/38] Add HDRPUserSettings It prevents Wizard Popup to be shown while runnning editor test See : https://unity.slack.com/archives/GHD5LADU7/p1625056568458400?thread_ts=1624547150.387900&cid=GHD5LADU7 --- .../UserSettings/HDRPUserSettings.asset | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset diff --git a/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset b/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset new file mode 100644 index 00000000000..6c8bd1eaef9 --- /dev/null +++ b/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ef3b9f3ac26b8524bab7722d06b49724, type: 3} + m_Name: + m_EditorClassIdentifier: + m_WizardPopupAlreadyShownOnce: 1 + m_WizardActiveTab: 0 + m_WizardNeedRestartAfterChangingToDX12: 0 + m_WizardNeedToRunFixAllAgainAfterDomainReload: 0 From 6c5f90b431fd513162cfbe2d7e8b14189d6dec18 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 30 Jun 2021 15:47:50 +0200 Subject: [PATCH 11/38] Revert "Add HDRPUserSettings" This reverts commit ff51dcf1ae1fef34b8daac4c581c18c543f17916. --- .../UserSettings/HDRPUserSettings.asset | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset diff --git a/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset b/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset deleted file mode 100644 index 6c8bd1eaef9..00000000000 --- a/TestProjects/VisualEffectGraph_HDRP/UserSettings/HDRPUserSettings.asset +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &1 -MonoBehaviour: - m_ObjectHideFlags: 61 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ef3b9f3ac26b8524bab7722d06b49724, type: 3} - m_Name: - m_EditorClassIdentifier: - m_WizardPopupAlreadyShownOnce: 1 - m_WizardActiveTab: 0 - m_WizardNeedRestartAfterChangingToDX12: 0 - m_WizardNeedToRunFixAllAgainAfterDomainReload: 0 From a569cbed89709b33b373885a6cebe5318e51f7a6 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 30 Jun 2021 15:49:58 +0200 Subject: [PATCH 12/38] Force m_WizardPopupAtStart to false Prevent exception while launching test --- .../ProjectSettings/HDRPProjectSettings.asset | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/HDRPProjectSettings.asset b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/HDRPProjectSettings.asset index 4f0fe39477c..06c298f653d 100644 --- a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/HDRPProjectSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/HDRPProjectSettings.asset @@ -13,9 +13,16 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_ProjectSettingFolderPath: HDRPDefaultResources + m_WizardPopupAtStart: 0 m_LastMaterialVersion: 12 + m_HDShaderGraphLastSeenVersion: 0 + m_PluginMaterialVersions: + m_Keys: [] + m_Values: + m_PluginSubTargetVersions: + m_Keys: [] + m_Values: m_Version: 2 - m_ObsoleteWizardPopupAtStart: 0 m_ObsoleteWizardPopupAlreadyShownOnce: 0 m_ObsoleteWizardActiveTab: 0 m_ObsoleteWizardNeedRestartAfterChangingToDX12: 0 From ded88dc43000aa6f7e1686faa781c39108c2f766 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 1 Jul 2021 15:12:07 +0200 Subject: [PATCH 13/38] Improvement of this workaround after discussion with @julienf - Use m_GraphSanitized instead of an HashSet - ClearRuntimeData when not sanitized (prevent any unexpected call to OnSetupMaterial) --- .../Editor/Models/VFXGraph.cs | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index cb4d65fc5f1..0473af2b6d1 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -21,7 +21,6 @@ namespace UnityEditor.VFX [InitializeOnLoad] class VFXGraphPreprocessor : AssetPostprocessor { - private static HashSet s_SanitizedGraph = new HashSet(); static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (var assetPath in importedAssets) @@ -34,17 +33,18 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse return; VFXGraph graph = resource.graph as VFXGraph; if (graph != null) + { + bool wasGraphSanitized = graph.sanitized; graph.SanitizeForImport(); + if (!wasGraphSanitized && graph.sanitized) + { + //Relaunch previously skipped OnCompileResource + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + } + } else - Debug.LogError("VisualEffectGraphResource without graph"); - - var path = AssetDatabase.GetAssetPath(resource); - var guid = AssetDatabase.AssetPathToGUID(path); - if (!s_SanitizedGraph.Contains(guid)) { - s_SanitizedGraph.Add(guid); - //Relaunch previously skipped OnCompileResource - AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); + Debug.LogError("VisualEffectGraphResource without graph"); } } } @@ -68,14 +68,19 @@ static void OnCompileResource(VisualEffectResource resource) { if (resource != null) { - var path = AssetDatabase.GetAssetPath(resource); - var guid = AssetDatabase.AssetPathToGUID(path); - if (!s_SanitizedGraph.Contains(guid)) - return; //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize - VFXGraph graph = resource.graph as VFXGraph; if (graph != null) - resource.GetOrCreateGraph().CompileForImport(); + { + if (!graph.sanitized) + { + //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize + resource.ClearRuntimeData(); + } + else + { + resource.GetOrCreateGraph().CompileForImport(); + } + } else Debug.LogError("OnCompileResource error - VisualEffectResource without graph"); } @@ -102,6 +107,12 @@ static void OnSetupMaterial(VisualEffectResource resource, Material material, Un // return; //} + if (!resource.GetOrCreateGraph().sanitized) + { + Debug.LogError("OnSetupMaterial error - Graph hasn't been sanitized"); + return; + } + // Actual call if (model is IVFXSubRenderer) { @@ -965,6 +976,9 @@ private VFXGraphCompiledData compiledData return m_CompiledData; } } + + public bool sanitized { get { return m_GraphSanitized; } } + public int version { get { return m_GraphVersion; } } [SerializeField] From 9e94d07fa89a17f2510a48ab9042fc75a3624ab7 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Fri, 2 Jul 2021 13:51:47 +0200 Subject: [PATCH 14/38] Minor : Editor Test cleanup There was an unexpercted custom implementation of MakeTemporaryGraph Use common code : VFXTestCommon.MakeTemporaryGraph() --- .../AllTests/Editor/Tests/VFXDataTests.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXDataTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXDataTests.cs index ba7964f3d1a..f2d0ecd94e1 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXDataTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXDataTests.cs @@ -93,31 +93,16 @@ public void CheckDataType() Assert.IsInstanceOf(output.GetData()); } - string tempFilePath = "Assets/Temp_vfxTest_Ddata.vfx"; - - VFXGraph MakeTemporaryGraph() - { - if (System.IO.File.Exists(tempFilePath)) - { - AssetDatabase.DeleteAsset(tempFilePath); - } - var asset = VisualEffectAssetEditorUtility.CreateNewAsset(tempFilePath); - VisualEffectResource resource = asset.GetResource(); // force resource creation - VFXGraph graph = ScriptableObject.CreateInstance(); - graph.visualEffectResource = resource; - return graph; - } - [OneTimeTearDown] public void CleanUp() { - AssetDatabase.DeleteAsset(tempFilePath); + VFXTestCommon.DeleteAllTemporaryGraph(); } [Test] public void CheckName_Sharing_Between_Output_Event() { - var graph = MakeTemporaryGraph(); + var graph = VFXTestCommon.MakeTemporaryGraph(); var gameObj = new GameObject("CheckData_Sharing_Between_Output_Event"); var vfxComponent = gameObj.AddComponent(); From 8d4cdecd684c64cf5e9bbb85b9f111abc7a481b3 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Fri, 2 Jul 2021 14:52:55 +0200 Subject: [PATCH 15/38] Gather all ImportAsset after all Sanitize from the same batch Fix this issue : https://github.com/Unity-Technologies/Graphics/pull/4971#discussion_r662876822 See : See : https://unity.slack.com/archives/C47JPNNTZ/p1625218128286700?thread_ts=1623913383.239100&cid=C47JPNNTZ --- .../Editor/Models/VFXGraph.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 0473af2b6d1..6d3c7f98049 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -23,6 +23,8 @@ class VFXGraphPreprocessor : AssetPostprocessor { static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { + List assetToReimport = null; + foreach (var assetPath in importedAssets) { bool isVFX = VisualEffectAssetModicationProcessor.HasVFXExtension(assetPath); @@ -38,8 +40,9 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse graph.SanitizeForImport(); if (!wasGraphSanitized && graph.sanitized) { - //Relaunch previously skipped OnCompileResource - AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + if (assetToReimport == null) + assetToReimport = new List(); + assetToReimport.Add(assetPath); } } else @@ -48,6 +51,13 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse } } } + + //Relaunch previously skipped OnCompileResource + if (assetToReimport != null) + { + foreach (var assetPath in assetToReimport) + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + } } static string[] OnAddResourceDependencies(string assetPath) From f5a6be58f9efba2b28dfb6203d9e904fb847e262 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Wed, 7 Jul 2021 09:42:55 +0200 Subject: [PATCH 16/38] Minor changes : Change log & Safe execption handling - Use a more explanotory message for the changelog - Handle exception safely to avoid the import cancellation - Fix issue : https://github.com/Unity-Technologies/Graphics/pull/4971#discussion_r664008914 - Fix issue : https://github.com/Unity-Technologies/Graphics/pull/4971#discussion_r664008008 --- com.unity.visualeffectgraph/CHANGELOG.md | 2 +- .../Editor/Models/VFXGraph.cs | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 3e05aad0f5b..9d3d9133989 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -65,7 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix unexpected Spawn context execution ordering - Fix incorrect buffer type for strips - Enabled an optimization for motion vectors, storing projected positions for vertices instead of the transform matrix -- Move Sanitize from PreProcess to PostProcess to avoid loss of data due to model migration [Case 1344645](https://issuetracker.unity3d.com/product/unity/issues/guid/1344645/) +- Unexpected operator and block removal during migration [Case 1344645](https://issuetracker.unity3d.com/product/unity/issues/guid/1344645/) ## [11.0.0] - 2020-10-21 ### Added diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 6d3c7f98049..e13b8066753 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -37,17 +37,25 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse if (graph != null) { bool wasGraphSanitized = graph.sanitized; - graph.SanitizeForImport(); - if (!wasGraphSanitized && graph.sanitized) + + try + { + graph.SanitizeForImport(); + if (!wasGraphSanitized && graph.sanitized) + { + if (assetToReimport == null) + assetToReimport = new List(); + assetToReimport.Add(assetPath); + } + } + catch (Exception exception) { - if (assetToReimport == null) - assetToReimport = new List(); - assetToReimport.Add(assetPath); + Debug.LogErrorFormat("Exception during sanitization of {0} : {1}", assetPath, exception); } } else { - Debug.LogError("VisualEffectGraphResource without graph"); + Debug.LogErrorFormat("VisualEffectGraphResource without graph : {0}", assetPath); } } } @@ -56,7 +64,16 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse if (assetToReimport != null) { foreach (var assetPath in assetToReimport) - AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + { + try + { + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + } + catch (Exception exception) + { + Debug.LogErrorFormat("Exception during reimport of {0} : {1}", assetPath, exception); + } + } } } From 2d1fa12591914e49f29a528d33d52203ff526000 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Thu, 8 Jul 2021 17:38:01 +0200 Subject: [PATCH 17/38] Add regression test (which is expecting to crash on master) --- .../Editor/Tests/VFXControllerTests.cs | 67 ++++++++++++++++++- .../GraphView/Views/VFXConvertSubgraph.cs | 20 ++++-- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index fd71489bc7b..ba666f1027b 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -11,6 +11,7 @@ using System.IO; using UnityEditor.VFX.Block.Test; using UnityEngine.UIElements; +using UnityEngine.TestTools; namespace UnityEditor.VFX.Test { @@ -22,6 +23,7 @@ public class VFXControllersTests const string testAssetName = "Assets/TmpTests/VFXGraph1.vfx"; const string testSubgraphAssetName = "Assets/TmpTests/VFXGraphSub.vfx"; const string testSubgraphSubAssetName = "Assets/TmpTests/VFXGraphSub_Subgraph.vfx"; + const string testSubgraphSubOperatorAssetName = "Assets/TmpTests/VFXGraphSub_Subgraph.vfxoperator"; private int m_StartUndoGroupId; @@ -53,7 +55,9 @@ public void DestroyTestAsset() m_ViewController.useCount--; Undo.RevertAllDownToGroup(m_StartUndoGroupId); AssetDatabase.DeleteAsset(testAssetName); - AssetDatabase.DeleteAsset(testAssetName); + AssetDatabase.DeleteAsset(testSubgraphAssetName); + AssetDatabase.DeleteAsset(testSubgraphSubAssetName); + AssetDatabase.DeleteAsset(testSubgraphSubOperatorAssetName); } #pragma warning disable 0414 @@ -979,6 +983,67 @@ public void Subgraph_Event_Link_To_Spawn() window.graphView.controller = null; } + + + //Regression test for case 1345426 + [UnityTest] + public IEnumerator ToSubGraphOperator() + { + var window = VFXViewWindow.GetWindow(); + window.LoadAsset(AssetDatabase.LoadAssetAtPath(testAssetName), null); + + var graph = m_ViewController.graph; + var add_A = ScriptableObject.CreateInstance(); + graph.AddChild(add_A); + var add_B = ScriptableObject.CreateInstance(); + graph.AddChild(add_B); + Assert.IsTrue(add_A.outputSlots[0].Link(add_B.inputSlots[1])); + + //Simple compilable system + { + var spawnerContext = ScriptableObject.CreateInstance(); + + var spawnerInit = ScriptableObject.CreateInstance(); + var spawnerOutput = ScriptableObject.CreateInstance(); + + var blockAttributeDesc = VFXLibrary.GetBlocks().FirstOrDefault(o => o.modelType == typeof(Block.SetAttribute)); + var blockAttribute = blockAttributeDesc.CreateInstance(); + blockAttribute.SetSettingValue("attribute", "position"); + spawnerInit.AddChild(blockAttribute); + + graph.AddChild(spawnerContext); + graph.AddChild(spawnerInit); + graph.AddChild(spawnerOutput); + + spawnerInit.LinkFrom(spawnerContext); + spawnerOutput.LinkFrom(spawnerInit); + } + + var initialize = m_ViewController.graph.children.OfType().FirstOrDefault(); + Assert.IsNotNull(initialize); + Assert.IsTrue(initialize.children.Any()); + + var allSlot = initialize.children.SelectMany(o => o.inputSlots); + var firstVector3 = allSlot.FirstOrDefault(o => o.property.type == typeof(Position)); + Assert.IsNotNull(firstVector3); + Assert.IsTrue(add_B.outputSlots[0].Link(firstVector3[0][0])); + Assert.IsTrue(firstVector3.HasLink(true)); + m_ViewController.LightApplyChanges(); + + yield return null; + + var controller = window.graphView.Query().ToList().Where(t => t.controller.model is Operator.Add).Select(o => o.controller).Cast(); + Assert.AreEqual(2, controller.Count()); + VFXConvertSubgraph.ConvertToSubgraphOperator(window.graphView, controller, Rect.zero, testSubgraphSubOperatorAssetName); + + for (int i = 0; i < 32; ++i) + yield return null; + + //If we reach here without any error or crash, the bug has been fixed + + window.graphView.controller = null; + } + } } #endif diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs index 16f55b8c84a..3fe931369eb 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs @@ -19,10 +19,10 @@ public static void ConvertToSubgraphContext(VFXView sourceView, IEnumerable controllers, Rect rect) + public static void ConvertToSubgraphOperator(VFXView sourceView, IEnumerable controllers, Rect rect, string path = null) { var ctx = new Context(); - ctx.ConvertToSubgraphOperator(sourceView, controllers, rect); + ctx.ConvertToSubgraphOperator(sourceView, controllers, rect, path); } public static void ConvertToSubgraphBlock(VFXView sourceView, IEnumerable controllers, Rect rect) @@ -251,12 +251,22 @@ public void ConvertToSubgraphContext(VFXView sourceView, IEnumerable UninitSmart(); } - public void ConvertToSubgraphOperator(VFXView sourceView, IEnumerable controllers, Rect rect) + public void ConvertToSubgraphOperator(VFXView sourceView, IEnumerable controllers, Rect rect, string path) { this.m_Rect = rect; Init(sourceView, controllers); - if (!CreateUniqueSubgraph("SubgraphOperator", VisualEffectSubgraphOperator.Extension, VisualEffectAssetEditorUtility.CreateNew)) - return; + if (path == null) + { + if (!CreateUniqueSubgraph("SubgraphOperator", VisualEffectSubgraphOperator.Extension, VisualEffectAssetEditorUtility.CreateNew)) + return; + } + else + { + m_TargetSubgraph = VisualEffectAssetEditorUtility.CreateNew(path); + m_TargetController = VFXViewController.GetController(m_TargetSubgraph.GetResource()); + m_TargetController.useCount++; + m_TargetControllers = new List(); + } CopyPasteNodes(); m_SourceNode = ScriptableObject.CreateInstance(); PostSetupNode(); From 15059cf92403c67b408f9e40c95d3f7e4f425587 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Fri, 9 Jul 2021 11:03:01 +0200 Subject: [PATCH 18/38] Fix sanitize issue during the very first loading GetOrCreateGraph is also assigning the visualEffectResource to the current graph https://github.com/Unity-Technologies/Graphics/blob/d6a59150d20762251cc5fcb8515fee494a142ccc/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs#L231 It's needed to correctly update child dependencies This behavior is counterintuitive --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index e13b8066753..b04331c2821 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -33,7 +33,7 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); if (resource == null) return; - VFXGraph graph = resource.graph as VFXGraph; + VFXGraph graph = resource.GetOrCreateGraph(); //resource.graph should be already != null at this stage but GetOrCreateGraph is also assigning the visualEffectResource. It's required for UpdateSubAssets if (graph != null) { bool wasGraphSanitized = graph.sanitized; @@ -523,7 +523,7 @@ public void SanitizeGraph() m_GraphSanitized = true; m_GraphVersion = CurrentVersion; - UpdateSubAssets(); //Should not be necessary : force remove no more referenced object from asset + UpdateSubAssets(); //Force remove no more referenced object from the asset & *important* register as persistent new dependencies } private void SanitizeCameraBuffers(HashSet objs) From da1d40e3882b90d072dd0ffe25312817694b899e Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 13:11:19 +0200 Subject: [PATCH 19/38] *Revert this* : OnSRPChanged & PrepareSubgraphs are public --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index b04331c2821..a426323241e 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -354,7 +354,7 @@ public virtual void OnDisable() VFXLibrary.OnSRPChanged -= OnSRPChanged; } - private void OnSRPChanged() + public void OnSRPChanged() { m_GraphSanitized = false; m_ExpressionGraphDirty = true; @@ -868,7 +868,7 @@ void SubgraphDirty(VisualEffectObject subgraph) } } - private void PrepareSubgraphs() + public void PrepareSubgraphs() { Profiler.BeginSample("PrepareSubgraphs"); RecurseSubgraphRecreateCopy(children); From a105d0146efd5e447a54d671fcb5307bf931a993 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 13:15:50 +0200 Subject: [PATCH 20/38] Not a valid fix : prepare subgraphs just before reimport --- com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 67dd4546f5d..a40ffac8071 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -276,6 +276,8 @@ void Update() if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph) { VFXGraph.explicitCompile = true; + graph.PrepareSubgraphs(); //It only corrects one corner case : Subgraph has just been created in vfxgraph, resyncslot hasn't been done yet. + graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation); using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager)) { From 90ea42081fb8996b57c8ffb0c3db189526b06fcb Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 13:41:09 +0200 Subject: [PATCH 21/38] Rename ToSubGraphOperator to ConvertToSubGraphOperator --- .../Assets/AllTests/Editor/Tests/VFXControllerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index ba666f1027b..a4bc07d4437 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -987,7 +987,7 @@ public void Subgraph_Event_Link_To_Spawn() //Regression test for case 1345426 [UnityTest] - public IEnumerator ToSubGraphOperator() + public IEnumerator ConvertToSubGraphOperator() { var window = VFXViewWindow.GetWindow(); window.LoadAsset(AssetDatabase.LoadAssetAtPath(testAssetName), null); From ad447b18760a332e908d221a512c16890a622af0 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 16:36:37 +0200 Subject: [PATCH 22/38] Experiment : trying with a force double import --- .../Editor/GraphView/VFXViewWindow.cs | 3 +- .../Editor/Models/VFXGraph.cs | 52 ++++++++++++++++--- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index a40ffac8071..44bf865cbbd 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -276,8 +276,7 @@ void Update() if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph) { VFXGraph.explicitCompile = true; - graph.PrepareSubgraphs(); //It only corrects one corner case : Subgraph has just been created in vfxgraph, resyncslot hasn't been done yet. - + graph.PrepareSubgraphs(); //Be sure than the subgraph are in clean state (could have been just created here) graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation); using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager)) { diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index a426323241e..281f9a3108b 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -32,16 +32,18 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse { VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); if (resource == null) - return; + continue; VFXGraph graph = resource.GetOrCreateGraph(); //resource.graph should be already != null at this stage but GetOrCreateGraph is also assigning the visualEffectResource. It's required for UpdateSubAssets if (graph != null) { - bool wasGraphSanitized = graph.sanitized; + bool wasCompilable = graph.sanitized && graph.cleanDependencies; try { graph.SanitizeForImport(); - if (!wasGraphSanitized && graph.sanitized) + + bool isCompilable = graph.sanitized && graph.cleanDependencies; + if (!wasCompilable && isCompilable) { if (assetToReimport == null) assetToReimport = new List(); @@ -74,6 +76,25 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse Debug.LogErrorFormat("Exception during reimport of {0} : {1}", assetPath, exception); } } + + //This delay call is unexpected, we shouldn't have a deferred behavior from ImportAsset + //See case 1144276 + EditorApplication.delayCall += () => + { + //Once it's done, reset the clean dependency sate, the next import will require a new reimport + //in case of undetected modification from subgraph or shaderGraph + foreach (var assetPath in assetToReimport) + { + VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); + if (resource == null) + continue; + VFXGraph graph = resource.GetOrCreateGraph(); + if (graph != null) + { + graph.cleanDependencies = false; + } + } + }; } } @@ -96,9 +117,10 @@ static void OnCompileResource(VisualEffectResource resource) if (resource != null) { VFXGraph graph = resource.graph as VFXGraph; + if (graph != null) { - if (!graph.sanitized) + if (!graph.sanitized || !graph.cleanDependencies) { //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize resource.ClearRuntimeData(); @@ -912,8 +934,12 @@ public void SanitizeForImport() } } - foreach (var child in children) - child.CheckGraphBeforeImport(); + if (!cleanDependencies) + { + foreach (var child in children) + child.CheckGraphBeforeImport(); + cleanDependencies = true; + } SanitizeGraph(); } @@ -1004,6 +1030,18 @@ private VFXGraphCompiledData compiledData } } + public bool cleanDependencies + { + get + { + return m_CleanDependencies; + } + set + { + m_CleanDependencies = value; + } + } + public bool sanitized { get { return m_GraphSanitized; } } public int version { get { return m_GraphVersion; } } @@ -1017,6 +1055,8 @@ private VFXGraphCompiledData compiledData [NonSerialized] private bool m_GraphSanitized = false; [NonSerialized] + private bool m_CleanDependencies = false; + [NonSerialized] private bool m_ExpressionGraphDirty = true; [NonSerialized] private bool m_ExpressionValuesDirty = true; From bbcf70d1e472f91409463040f8b981b01abbc022 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:00:01 +0200 Subject: [PATCH 23/38] Test : Don't know what PrepareSubgraph does better --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 281f9a3108b..0df073deba5 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -938,6 +938,7 @@ public void SanitizeForImport() { foreach (var child in children) child.CheckGraphBeforeImport(); + PrepareSubgraphs(); /// ?? cleanDependencies = true; } From 2b8a9715ed5651e3e48fcc0cd6f19af2dbb47c59 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:10:01 +0200 Subject: [PATCH 24/38] Remove dirty PrepareSubgraphs in VFXViewWindow --- com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 44bf865cbbd..67dd4546f5d 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -276,7 +276,6 @@ void Update() if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph) { VFXGraph.explicitCompile = true; - graph.PrepareSubgraphs(); //Be sure than the subgraph are in clean state (could have been just created here) graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation); using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager)) { From 20270029fcbf2f0e8e63c2170812eca689ed241c Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:20:50 +0200 Subject: [PATCH 25/38] *Add comment about reason behind PrepareSubgraphs requirement --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 0df073deba5..5ee6ad0759f 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -936,9 +936,15 @@ public void SanitizeForImport() if (!cleanDependencies) { + //The CheckGraphBeforeImport of VFXSubgraphOperator isn't sufficient + //We could have cached incorrect m_SubChildren which aren't to be recomputed by CheckGraphBeforeImport + //Furthermore, CheckGraphBeforeImport is ignored when explicitCompile == true + //All in all, it shouldn't be needed here, it's a workaround. + PrepareSubgraphs(); + foreach (var child in children) child.CheckGraphBeforeImport(); - PrepareSubgraphs(); /// ?? + cleanDependencies = true; } From 0fb7316776875149b6df75908c2f5f02df194f4d Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:37:04 +0200 Subject: [PATCH 26/38] *Update changelog Even if it's a bit ambitious for now... --- com.unity.visualeffectgraph/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 7ff4e0aa0d7..056ac5110a3 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -71,6 +71,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - VFX Graph operators keep the same width when expanded or collpased so that the button does not change position - Fix Soft Particle depth computation when using an orthographic camera [Case 1309961](https://issuetracker.unity3d.com/product/unity/issues/guid/1309961) - Unexpected operator and block removal during migration [Case 1344645](https://issuetracker.unity3d.com/product/unity/issues/guid/1344645/) +- Random crash using subgraph [Case 1345426](https://issuetracker.unity3d.com/product/unity/issues/guid/1345426/) ## [11.0.0] - 2020-10-21 ### Added From 8e1c455f5939c40ef0177a23cb50dfac073947c8 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:44:11 +0200 Subject: [PATCH 27/38] Remove unexpected public/private --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 5ee6ad0759f..cb0418b3bd1 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -376,7 +376,7 @@ public virtual void OnDisable() VFXLibrary.OnSRPChanged -= OnSRPChanged; } - public void OnSRPChanged() + private void OnSRPChanged() { m_GraphSanitized = false; m_ExpressionGraphDirty = true; @@ -890,7 +890,7 @@ void SubgraphDirty(VisualEffectObject subgraph) } } - public void PrepareSubgraphs() + private void PrepareSubgraphs() { Profiler.BeginSample("PrepareSubgraphs"); RecurseSubgraphRecreateCopy(children); From 8c442a8cf3d006f8406e31e571075ac00d8f271c Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 17:52:23 +0200 Subject: [PATCH 28/38] *Minor* Replace `return` by `continue` I noticed this issue working on this PR : https://github.com/Unity-Technologies/Graphics/pull/5104 --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index b04331c2821..a4c751f654f 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -32,7 +32,7 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse { VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); if (resource == null) - return; + continue; VFXGraph graph = resource.GetOrCreateGraph(); //resource.graph should be already != null at this stage but GetOrCreateGraph is also assigning the visualEffectResource. It's required for UpdateSubAssets if (graph != null) { From e19d404ac26b9b02b5a00c6754a6672a2b08dbce Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 20:17:39 +0200 Subject: [PATCH 29/38] Extend test & Add some notes The missing TODOPAUL are revealed missing corner cases :loading: --- .../Editor/Tests/VFXControllerTests.cs | 116 +++++++++++++++++- .../Editor/GraphView/VFXViewWindow.cs | 1 + .../Editor/Models/VFXGraph.cs | 3 +- 3 files changed, 114 insertions(+), 6 deletions(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index a4bc07d4437..3a9630dd387 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -21,8 +21,11 @@ public class VFXControllersTests VFXViewController m_ViewController; const string testAssetName = "Assets/TmpTests/VFXGraph1.vfx"; + const string testSubgraphAssetName = "Assets/TmpTests/VFXGraphSub.vfx"; const string testSubgraphSubAssetName = "Assets/TmpTests/VFXGraphSub_Subgraph.vfx"; + + const string testAssetMainSubgraph = "Assets/TmpTests/VFXGraphSubGraph_Main.vfx"; const string testSubgraphSubOperatorAssetName = "Assets/TmpTests/VFXGraphSub_Subgraph.vfxoperator"; private int m_StartUndoGroupId; @@ -55,6 +58,7 @@ public void DestroyTestAsset() m_ViewController.useCount--; Undo.RevertAllDownToGroup(m_StartUndoGroupId); AssetDatabase.DeleteAsset(testAssetName); + AssetDatabase.DeleteAsset(testAssetMainSubgraph); AssetDatabase.DeleteAsset(testSubgraphAssetName); AssetDatabase.DeleteAsset(testSubgraphSubAssetName); AssetDatabase.DeleteAsset(testSubgraphSubOperatorAssetName); @@ -990,9 +994,14 @@ public void Subgraph_Event_Link_To_Spawn() public IEnumerator ConvertToSubGraphOperator() { var window = VFXViewWindow.GetWindow(); - window.LoadAsset(AssetDatabase.LoadAssetAtPath(testAssetName), null); - var graph = m_ViewController.graph; + VisualEffectAsset asset = VisualEffectAssetEditorUtility.CreateNewAsset(testAssetMainSubgraph); + VisualEffectResource resource = asset.GetResource(); + window.LoadAsset(AssetDatabase.LoadAssetAtPath(testAssetMainSubgraph), null); + + var viewController = VFXViewController.GetController(VisualEffectResource.GetResourceAtPath(testAssetMainSubgraph)); + + var graph = viewController.graph; var add_A = ScriptableObject.CreateInstance(); graph.AddChild(add_A); var add_B = ScriptableObject.CreateInstance(); @@ -1019,7 +1028,7 @@ public IEnumerator ConvertToSubGraphOperator() spawnerOutput.LinkFrom(spawnerInit); } - var initialize = m_ViewController.graph.children.OfType().FirstOrDefault(); + var initialize = viewController.graph.children.OfType().FirstOrDefault(); Assert.IsNotNull(initialize); Assert.IsTrue(initialize.children.Any()); @@ -1028,7 +1037,7 @@ public IEnumerator ConvertToSubGraphOperator() Assert.IsNotNull(firstVector3); Assert.IsTrue(add_B.outputSlots[0].Link(firstVector3[0][0])); Assert.IsTrue(firstVector3.HasLink(true)); - m_ViewController.LightApplyChanges(); + viewController.LightApplyChanges(); yield return null; @@ -1040,10 +1049,107 @@ public IEnumerator ConvertToSubGraphOperator() yield return null; //If we reach here without any error or crash, the bug has been fixed - window.graphView.controller = null; } + //Extension of previous test (related to 1345426) : create two outputs in subgraph (instead of one), revert and restore + [UnityTest] + public IEnumerator ConvertToSubGraphOperator_And_ModifySubgraph() + { + var previousTest = ConvertToSubGraphOperator(); + while (previousTest.MoveNext()) + yield return previousTest.Current; + + var resource = VisualEffectResource.GetResourceAtPath(testSubgraphSubOperatorAssetName); + resource.WriteAsset(); + + var oneOutputState = File.ReadAllText(testSubgraphSubOperatorAssetName); + Assert.IsFalse(string.IsNullOrEmpty(oneOutputState)); + + resource = VisualEffectResource.GetResourceAtPath(testSubgraphSubOperatorAssetName); + Assert.IsNotNull(resource); + var window = VFXViewWindow.GetWindow(); + window.LoadResource(resource, null); + + var viewController = window.graphView.controller; + var graph = viewController.graph; + Assert.IsNotNull(graph); + + var parameter = VFXLibrary.GetParameters().FirstOrDefault(o => o.model.type == typeof(Sphere)); + Assert.IsNotNull(parameter); + var newParam = viewController.AddVFXParameter(Vector2.zero, (VFXModelDescriptorParameters)parameter); + newParam.isOutput = true; + var otherParamName = "programatically_new_name_test"; + newParam.SetSettingValue("m_ExposedName", otherParamName); + viewController.ApplyChanges(); + + resource.WriteAsset(); + + yield return null; + window.Close(); + + var twoOutputState = File.ReadAllText(testSubgraphSubOperatorAssetName); + Assert.IsFalse(string.IsNullOrEmpty(twoOutputState)); + Assert.AreNotEqual(oneOutputState, twoOutputState); + Assert.IsTrue(twoOutputState.Contains(otherParamName)); + + window.graphView.controller = null; + for (int i = 0; i < 16; ++i) + yield return null; + + //Check the actual status, should have now two slots + { + AssetDatabase.ImportAsset(testAssetMainSubgraph); + var mainAsset = AssetDatabase.LoadAssetAtPath(testAssetMainSubgraph); + var mainGraph = mainAsset.GetOrCreateResource().GetOrCreateGraph(); + + var subGraph = mainGraph.children.OfType().FirstOrDefault(); + Assert.IsNotNull(subGraph); + Assert.AreEqual(2, subGraph.outputSlots.Count); + //Assert.IsFalse(subGraph.outputSlots.Any(o => o == null)); //TODOPAUL : There is still a problem here + } + yield return null; + + //Removing old slots, shouldn't get unexpected removed + { + File.WriteAllText(testSubgraphSubOperatorAssetName, oneOutputState); + AssetDatabase.Refresh(); + + AssetDatabase.ImportAsset(testAssetMainSubgraph); + var mainAsset = AssetDatabase.LoadAssetAtPath(testAssetMainSubgraph); + var mainGraph = mainAsset.GetOrCreateResource().GetOrCreateGraph(); + + var subGraph = mainGraph.children.OfType().FirstOrDefault(); + Assert.IsNotNull(subGraph); + Assert.AreEqual(1, subGraph.outputSlots.Count); + Assert.IsFalse(subGraph.outputSlots.Any(o => o == null)); + } + yield return null; + + //Here, restore to the previous state, if one outputSlot is null, then we did a resync slot during compilation + { + File.WriteAllText(testSubgraphSubOperatorAssetName, twoOutputState); + AssetDatabase.Refresh(); + + AssetDatabase.ImportAsset(testAssetMainSubgraph); + var mainAsset = AssetDatabase.LoadAssetAtPath(testAssetMainSubgraph); + var mainGraph = mainAsset.GetOrCreateResource().GetOrCreateGraph(); + + var subGraph = mainGraph.children.OfType().FirstOrDefault(); + Assert.IsNotNull(subGraph); + Assert.AreEqual(2, subGraph.outputSlots.Count); + Assert.IsFalse(subGraph.outputSlots.Any(o => o == null)); + } + yield return null; + + //Finally, open the source asset it will crash if the vfxasset is wrongly formed + resource = VisualEffectResource.GetResourceAtPath(testAssetMainSubgraph); + window = VFXViewWindow.GetWindow(); + window.LoadResource(resource, null); + + for (int i = 0; i < 16; ++i) + yield return null; + } } } #endif diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 67dd4546f5d..06762890bbd 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -276,6 +276,7 @@ void Update() if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph) { VFXGraph.explicitCompile = true; + graph.PrepareSubgraphs(); //Why is it still needed ? TODOPAUL graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation); using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager)) { diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index cb0418b3bd1..c35c779e0be 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -890,7 +890,8 @@ void SubgraphDirty(VisualEffectObject subgraph) } } - private void PrepareSubgraphs() + //TODOPAUL : Revert this public + public void PrepareSubgraphs() { Profiler.BeginSample("PrepareSubgraphs"); RecurseSubgraphRecreateCopy(children); From 9ffde33c0dec3856f3081ede24559a71f8779af8 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Mon, 12 Jul 2021 21:47:48 +0200 Subject: [PATCH 30/38] Remove ClearRuntimeData Temp, it seems wrong but it's only related to the delayCall which let the VFXAsset in dangling state --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index c35c779e0be..fa2037114cd 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -123,7 +123,11 @@ static void OnCompileResource(VisualEffectResource resource) if (!graph.sanitized || !graph.cleanDependencies) { //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize - resource.ClearRuntimeData(); + + //It could be more appropriate to ClearRuntimeData but with systematic double import + delayCall, + //the C++ behavior can be confused, removing an exposed property too early. + //Thus, for now, commenting : resource.ClearRuntimeData(); + //See EditorTest : CreateComponent_Modify_Asset_Keep_Override } else { From 6dc0d56d835753d547aa0ffb7a0c87a37a9f1eea Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 08:05:06 +0200 Subject: [PATCH 31/38] *Add note about reason of failure for playmodeXR --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index fa2037114cd..7fe1456eead 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -128,6 +128,7 @@ static void OnCompileResource(VisualEffectResource resource) //the C++ behavior can be confused, removing an exposed property too early. //Thus, for now, commenting : resource.ClearRuntimeData(); //See EditorTest : CreateComponent_Modify_Asset_Keep_Override + //... But it causes a failure with PlayModeXR : OnSetupMaterial is called } else { From d2eb21c7ae0a78f0545c3d851124b70b33153273 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 10:39:59 +0200 Subject: [PATCH 32/38] Simpler solution : Use backup system instead of reimporting twice --- .../Editor/GraphView/VFXViewWindow.cs | 1 - .../Editor/Models/VFXGraph.cs | 81 +++++-------------- 2 files changed, 21 insertions(+), 61 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 06762890bbd..67dd4546f5d 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -276,7 +276,6 @@ void Update() if (autoCompile && graph.IsExpressionGraphDirty() && !graph.GetResource().isSubgraph) { VFXGraph.explicitCompile = true; - graph.PrepareSubgraphs(); //Why is it still needed ? TODOPAUL graph.errorManager.ClearAllErrors(null, VFXErrorOrigin.Compilation); using (var reporter = new VFXCompileErrorReporter(controller.graph.errorManager)) { diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 7fe1456eead..75d4f657d3a 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -36,14 +36,13 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse VFXGraph graph = resource.GetOrCreateGraph(); //resource.graph should be already != null at this stage but GetOrCreateGraph is also assigning the visualEffectResource. It's required for UpdateSubAssets if (graph != null) { - bool wasCompilable = graph.sanitized && graph.cleanDependencies; + bool wasGraphSanitized = graph.sanitized; try { graph.SanitizeForImport(); - bool isCompilable = graph.sanitized && graph.cleanDependencies; - if (!wasCompilable && isCompilable) + if (!wasGraphSanitized && graph.sanitized) { if (assetToReimport == null) assetToReimport = new List(); @@ -76,25 +75,6 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse Debug.LogErrorFormat("Exception during reimport of {0} : {1}", assetPath, exception); } } - - //This delay call is unexpected, we shouldn't have a deferred behavior from ImportAsset - //See case 1144276 - EditorApplication.delayCall += () => - { - //Once it's done, reset the clean dependency sate, the next import will require a new reimport - //in case of undetected modification from subgraph or shaderGraph - foreach (var assetPath in assetToReimport) - { - VisualEffectResource resource = VisualEffectResource.GetResourceAtPath(assetPath); - if (resource == null) - continue; - VFXGraph graph = resource.GetOrCreateGraph(); - if (graph != null) - { - graph.cleanDependencies = false; - } - } - }; } } @@ -120,19 +100,26 @@ static void OnCompileResource(VisualEffectResource resource) if (graph != null) { - if (!graph.sanitized || !graph.cleanDependencies) + if (!graph.sanitized) { - //Early return, the reimport will be forced with the next OnPostprocessAllAssets after Sanitize - - //It could be more appropriate to ClearRuntimeData but with systematic double import + delayCall, - //the C++ behavior can be confused, removing an exposed property too early. - //Thus, for now, commenting : resource.ClearRuntimeData(); - //See EditorTest : CreateComponent_Modify_Asset_Keep_Override - //... But it causes a failure with PlayModeXR : OnSetupMaterial is called + resource.ClearRuntimeData(); } else { - resource.GetOrCreateGraph().CompileForImport(); + //Trying another approach, since the CompileForImport seems to modify the vfxGraph + //Restore the previous state after compilation ! + + graph = resource.GetOrCreateGraph(); + var dependencies = new HashSet(); + dependencies.Add(graph); + graph.CollectDependencies(dependencies); + var backup = VFXMemorySerializer.StoreObjectsToByteArray(dependencies.ToArray(), CompressionLevel.Fastest); + + graph.CompileForImport(); + + VFXMemorySerializer.ExtractObjects(backup, false); + //The backup is actually calling UnknownChange here + //You have to avoid because it will call ResyncSlot } } else @@ -895,8 +882,7 @@ void SubgraphDirty(VisualEffectObject subgraph) } } - //TODOPAUL : Revert this public - public void PrepareSubgraphs() + private void PrepareSubgraphs() { Profiler.BeginSample("PrepareSubgraphs"); RecurseSubgraphRecreateCopy(children); @@ -940,19 +926,8 @@ public void SanitizeForImport() } } - if (!cleanDependencies) - { - //The CheckGraphBeforeImport of VFXSubgraphOperator isn't sufficient - //We could have cached incorrect m_SubChildren which aren't to be recomputed by CheckGraphBeforeImport - //Furthermore, CheckGraphBeforeImport is ignored when explicitCompile == true - //All in all, it shouldn't be needed here, it's a workaround. - PrepareSubgraphs(); - - foreach (var child in children) - child.CheckGraphBeforeImport(); - - cleanDependencies = true; - } + foreach (var child in children) + child.CheckGraphBeforeImport(); SanitizeGraph(); } @@ -1043,18 +1018,6 @@ private VFXGraphCompiledData compiledData } } - public bool cleanDependencies - { - get - { - return m_CleanDependencies; - } - set - { - m_CleanDependencies = value; - } - } - public bool sanitized { get { return m_GraphSanitized; } } public int version { get { return m_GraphVersion; } } @@ -1068,8 +1031,6 @@ public bool cleanDependencies [NonSerialized] private bool m_GraphSanitized = false; [NonSerialized] - private bool m_CleanDependencies = false; - [NonSerialized] private bool m_ExpressionGraphDirty = true; [NonSerialized] private bool m_ExpressionValuesDirty = true; From da7d41e9db40b1d0dc80dc37c44947de2a6390f2 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 10:42:04 +0200 Subject: [PATCH 33/38] Restore test which wasn't working before --- .../Assets/AllTests/Editor/Tests/VFXControllerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index 3a9630dd387..41920f4385e 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -1106,7 +1106,7 @@ public IEnumerator ConvertToSubGraphOperator_And_ModifySubgraph() var subGraph = mainGraph.children.OfType().FirstOrDefault(); Assert.IsNotNull(subGraph); Assert.AreEqual(2, subGraph.outputSlots.Count); - //Assert.IsFalse(subGraph.outputSlots.Any(o => o == null)); //TODOPAUL : There is still a problem here + Assert.IsFalse(subGraph.outputSlots.Any(o => o == null)); } yield return null; From f47bbd7a4543085ed0ede30cebbc9d4d32ade286 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 10:53:44 +0200 Subject: [PATCH 34/38] Minor : update comment --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 75d4f657d3a..162e3d69298 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -97,7 +97,6 @@ static void OnCompileResource(VisualEffectResource resource) if (resource != null) { VFXGraph graph = resource.graph as VFXGraph; - if (graph != null) { if (!graph.sanitized) @@ -106,19 +105,19 @@ static void OnCompileResource(VisualEffectResource resource) } else { - //Trying another approach, since the CompileForImport seems to modify the vfxGraph - //Restore the previous state after compilation ! - + //Workaround, use backup system to prevent any modification of the graph during compilation + //The responsible of this unexpected change is PrepareSubgraphs => RecurseSubgraphRecreateCopy => ResyncSlots + //It will let the VFXGraph in a really bad state after compilation. graph = resource.GetOrCreateGraph(); var dependencies = new HashSet(); dependencies.Add(graph); graph.CollectDependencies(dependencies); - var backup = VFXMemorySerializer.StoreObjectsToByteArray(dependencies.ToArray(), CompressionLevel.Fastest); + var backup = VFXMemorySerializer.StoreObjectsToByteArray(dependencies.ToArray(), CompressionLevel.None); graph.CompileForImport(); VFXMemorySerializer.ExtractObjects(backup, false); - //The backup is actually calling UnknownChange here + //The backup during undo/redo is actually calling UnknownChange after ExtractObjects //You have to avoid because it will call ResyncSlot } } From dec84facb3553e7ef22f2b1dc48727e18f4211ad Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 11:38:39 +0200 Subject: [PATCH 35/38] *Fix bad conflict resolution --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index abb47d2d407..1bf1d8ca7e5 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -53,7 +53,6 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse Debug.LogErrorFormat("Exception during sanitization of {0} : {1}", assetPath, exception); } } - } else { Debug.LogErrorFormat("VisualEffectGraphResource without graph : {0}", assetPath); From 2421bc5742d9ac1744001298d8fef51b3d6bf5eb Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 14:16:43 +0200 Subject: [PATCH 36/38] Restored previously skipped PrepareSubgraphs It has side effect which are caught by any editor test --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 1bf1d8ca7e5..781fd7322cf 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -925,6 +925,10 @@ public void SanitizeForImport() } } + //This PrepareSubgraphs has been canceled from the compilation, + //but it's still needed to get update slot in VFXView. + //TODO : We shouldn't rely on compilation for the subgraph state. + PrepareSubgraphs(); foreach (var child in children) child.CheckGraphBeforeImport(); From 31f756c523573e274c00ee33bd6a441a99338428 Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 14:23:11 +0200 Subject: [PATCH 37/38] Revert "Restored previously skipped PrepareSubgraphs" This reverts commit 2421bc5742d9ac1744001298d8fef51b3d6bf5eb. --- com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 781fd7322cf..1bf1d8ca7e5 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -925,10 +925,6 @@ public void SanitizeForImport() } } - //This PrepareSubgraphs has been canceled from the compilation, - //but it's still needed to get update slot in VFXView. - //TODO : We shouldn't rely on compilation for the subgraph state. - PrepareSubgraphs(); foreach (var child in children) child.CheckGraphBeforeImport(); From 29c18b77881333543221da2921a85fb7f5cfb9cc Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 13 Jul 2021 14:54:32 +0200 Subject: [PATCH 38/38] Fix missing ResyncSlots on the very first creation of the subgraph And verify expected output slot in VFXControllerTest --- .../Assets/AllTests/Editor/Tests/VFXControllerTests.cs | 6 ++++++ .../Editor/GraphView/Views/VFXConvertSubgraph.cs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index 41920f4385e..42c3dc1f996 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -1048,6 +1048,12 @@ public IEnumerator ConvertToSubGraphOperator() for (int i = 0; i < 32; ++i) yield return null; + //Check the status of the newly integrated subgraph, expecting one output + var subgraph = viewController.graph.children.OfType().FirstOrDefault(); + Assert.IsNotNull(subgraph); + Assert.AreEqual(1, subgraph.outputSlots.Count); + Assert.IsFalse(subgraph.outputSlots.Any(s => s == null)); + //If we reach here without any error or crash, the bug has been fixed window.graphView.controller = null; } diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs index 3fe931369eb..79d5152b8fe 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXConvertSubgraph.cs @@ -274,6 +274,13 @@ public void ConvertToSubgraphOperator(VFXView sourceView, IEnumerable m_SourceBlockControllers;