Skip to content

Commit

Permalink
8.x.x VFX staging (Unity-Technologies#6126)
Browse files Browse the repository at this point in the history
* Fix issues with CheckVFXManager (not all :()

* Fix for exception when clicking stop while no debugui curve is chosen.

* Fix vfxmanager not beeing called on first use of vfx.

* Fix Instability in spawn test (Unity-Technologies#237)

* It doesn't fix but help to receive an understandable error

* *Add comment

* *Disable sprite packer to speed up switch to playmode

* *Use EnterPlayMode instead of Update in editor when it's relevant

* *Update comment

* Remove workaround to retrieve gameobject, it was actually a closure issue.

* Fix case 1193602. handle correctly texture constant folding with multiple references

* Regression test for case 1216631 : Exact Fixed Time Step (Unity-Technologies#231)

* Add regression test for case 1216631

* Avoid corner case of 05. + 0.5 almost equals to 1 (Yamato could have one frame delay)

* Clean correctly scene after test

* Fix Create_Spawner_Check_Time_Mode_Update_Count

* Fix missing null check for pCache (Unity-Technologies#239)

* Inspector : Add message when asset is stored in bundle (Unity-Technologies#240)

* Add message for properties when asset is store in asset bundle.

* *Update changelog.md

* Mention Inspector only constraint in graphInBundle text

"Exposed properties are hidden in the Inspector when Visual Effect Assets are stored in Asset Bundles."

* Fix pCache file handling (Unity-Technologies#241)

* Fix case 1185677 : There was missing close of several stream leading to some locked file

* *Update changelog.md

* Fix age option filters out (Unity-Technologies#242)

* Fix AppendVector

* Fix various bugs with Position (Cone) block

* 6143028 - renamed soft particle fade distance, made attributes adding text (min… (Unity-Technologies#234)

* Fix for mainTexture input slot appearing during firt import in MeshOutputs.

* 310c43a - Fix for nesting of VFXSubgraphContexts (Unity-Technologies#236)

* cd2cd7e - fix for Convert inline to exposed property / Quick expose property does not set correct default value in parent

* Fix for compilation cycling when a dependent asset is not found.

* VFXUIDebug is no longet a VFXObject as it doesn't have to be.

* Change the way multiple reference to the same texture is handled

* Fix space issues with blocks and operators taking a camera as input

* Fix issue with multiple definition of texture

* Fix changelog

* Update VFX

Co-authored-by: Tristan Genevet <tristan@unity3d.com>
Co-authored-by: Paul Demeulenaere <pauld@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
  • Loading branch information
4 people committed Mar 9, 2020
1 parent ce59ed3 commit 992a63a
Show file tree
Hide file tree
Showing 52 changed files with 1,083 additions and 837 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using UnityEngine;
using UnityEngine.VFX;

namespace UnityEditor.VFX
{
class VFXCustomSpawnerUpdateCounterTest : VFXSpawnerCallbacks
{
public class InputProperties
{
}

public static uint s_UpdateCount = 0u;
public static float s_LastDeltaTime = 0.0f;
public override void OnPlay(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent)
{
}

public override void OnUpdate(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent)
{
if (state.deltaTime != 0.0f)
{
s_UpdateCount++;
s_LastDeltaTime = state.deltaTime;
}
}

public override void OnStop(VFXSpawnerState state, VFXExpressionValues vfxValues, VisualEffect vfxComponent)
{
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,29 @@ public void AppendOperator()
Assert.AreEqual(VFXValueType.Float4, append.outputSlots[0].GetExpression().valueType);
}

[Test]
public void AppendOperator_With_Direction()
{
var append = ScriptableObject.CreateInstance<Operator.AppendVector>();
append.SetOperandType(0, typeof(DirectionType));
append.SetOperandType(1, typeof(float));

append.inputSlots[0].value = new DirectionType() { direction = new Vector3(1.0f, 1.0f, 0) };
append.inputSlots[1].value = 3.0f;

var context = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation);
var outputValue = context.Compile(append.outputSlots[0].GetExpression());

var expressionValue = outputValue.Get<Vector4>();
//Direction expects a normalize
var expectedValue = new Vector4(1.0f/Mathf.Sqrt(2), 1.0f/Mathf.Sqrt(2), 0.0f, 3.0f);

Assert.AreEqual(expectedValue.x, expressionValue.x, 1e-5f);
Assert.AreEqual(expectedValue.y, expressionValue.y, 1e-5f);
Assert.AreEqual(expectedValue.z, expressionValue.z, 1e-5f);
Assert.AreEqual(expectedValue.w, expressionValue.w, 1e-5f);
}

[Test]
public void BranchOperator_With_Sphere()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,93 @@ public IEnumerator Create_Asset_And_Component_Spawner()
yield return new ExitPlayMode();
}

public struct VFXTimeModeTest
{
public override string ToString()
{
return name;
}

public string name { get; }
public uint vfxUpdateMode { get; }
public uint expectedUpdateCount { get; }
public float expectedDeltaTime { get; }

public VFXTimeModeTest(string name, uint vfxUpdateMode, uint expectedUpdateCount, float expectedDeltaTime)
{
this.name = name;
this.vfxUpdateMode = vfxUpdateMode;
this.expectedUpdateCount = expectedUpdateCount;
this.expectedDeltaTime = expectedDeltaTime;
}
}

const float s_Check_Time_Mode_SleepingTimeInSecond = 1.0f;
const float s_Check_Time_Mode_FixedDeltaTime = 0.1f;
const float s_Check_Time_Mode_MaxDeltaTime = 0.7f;

static VFXTimeModeTest[] s_CheckTimeMode = new[]
{
new VFXTimeModeTest("FixedDeltaTime", (uint)VFXUpdateMode.FixedDeltaTime, 1u, s_Check_Time_Mode_MaxDeltaTime),
new VFXTimeModeTest("ExactFixedDeltaTime", (uint)VFXUpdateMode.ExactFixedTimeStep, (uint)Mathf.Floor(s_Check_Time_Mode_MaxDeltaTime / s_Check_Time_Mode_FixedDeltaTime), s_Check_Time_Mode_FixedDeltaTime),
};

//Fix 1216631 : Check Exact time has actually an effect in low fps condition
[UnityTest]
public IEnumerator Create_Spawner_Check_Time_Mode_Update_Count([ValueSource("s_CheckTimeMode")] VFXTimeModeTest timeMode)
{
yield return new EnterPlayMode();

var spawnCountValue = 651.0f;
VisualEffect vfxComponent;
GameObject cameraObj, gameObj;
VFXGraph graph;
CreateAssetAndComponent(spawnCountValue, "OnPlay", out graph, out vfxComponent, out gameObj, out cameraObj);

var basicSpawner = graph.children.OfType<VFXBasicSpawner>().FirstOrDefault();
var blockCustomSpawner = ScriptableObject.CreateInstance<VFXSpawnerCustomWrapper>();
blockCustomSpawner.SetSettingValue("m_customType", new SerializableType(typeof(VFXCustomSpawnerUpdateCounterTest)));
basicSpawner.AddChild(blockCustomSpawner);

graph.GetResource().updateMode = (VFXUpdateMode)timeMode.vfxUpdateMode;
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graph));

var previousCaptureFrameRate = Time.captureFramerate;
var previousFixedTimeStep = UnityEngine.VFX.VFXManager.fixedTimeStep;
var previousMaxDeltaTime = UnityEngine.VFX.VFXManager.maxDeltaTime;

UnityEngine.VFX.VFXManager.fixedTimeStep = s_Check_Time_Mode_FixedDeltaTime;
UnityEngine.VFX.VFXManager.maxDeltaTime = s_Check_Time_Mode_MaxDeltaTime;

VFXCustomSpawnerUpdateCounterTest.s_UpdateCount = 0;
//Wait for the first warm up
int maxFrame = 128;
while (VFXCustomSpawnerUpdateCounterTest.s_UpdateCount == 0 && --maxFrame > 0)
{
yield return null;
}
Assert.AreNotEqual(0u, VFXCustomSpawnerUpdateCounterTest.s_UpdateCount);

vfxComponent.Reinit();
VFXCustomSpawnerUpdateCounterTest.s_UpdateCount = 0;
VFXCustomSpawnerUpdateCounterTest.s_LastDeltaTime = 0.0f;
Time.captureDeltaTime = s_Check_Time_Mode_SleepingTimeInSecond;

while (VFXCustomSpawnerUpdateCounterTest.s_UpdateCount == 0)
{
yield return null;
}
Assert.AreEqual(timeMode.expectedUpdateCount, VFXCustomSpawnerUpdateCounterTest.s_UpdateCount);
Assert.AreEqual(timeMode.expectedDeltaTime, VFXCustomSpawnerUpdateCounterTest.s_LastDeltaTime);


Time.captureFramerate = previousCaptureFrameRate;
UnityEngine.VFX.VFXManager.fixedTimeStep = previousFixedTimeStep;
UnityEngine.VFX.VFXManager.maxDeltaTime = previousMaxDeltaTime;

yield return new ExitPlayMode();
}

[Retry(3)]
[UnityTest]
public IEnumerator Create_Asset_And_Component_Spawner_Plugging_OnStop_Into_Start_Input_Flow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,10 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114583290908281188}
- {fileID: 114049330692400060}
- {fileID: 114692224659306562}
- {fileID: 8926484042661614626}
- {fileID: 114583290908281188}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114337012759867870}
Expand All @@ -920,7 +920,6 @@ MonoBehaviour:
castShadows: 1
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114369422258304014
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -2337,7 +2336,6 @@ MonoBehaviour:
castShadows: 1
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
primitiveType: 1
useGeometryShader: 0
--- !u!114 &114790879288114018
Expand Down Expand Up @@ -2477,6 +2475,7 @@ MonoBehaviour:
m_UISuperCollapsed: 0
m_UIInfos: {fileID: 114150288650739006}
m_ParameterInfo: []
m_ImportDependencies: []
m_GraphVersion: 4
m_saved: 1
m_SubgraphDependencies: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
primitiveType: 1
useGeometryShader: 0
--- !u!114 &114178076996238554
Expand Down Expand Up @@ -1211,6 +1210,7 @@ MonoBehaviour:
m_UISuperCollapsed: 0
m_UIInfos: {fileID: 114186473412445228}
m_ParameterInfo: []
m_ImportDependencies: []
m_GraphVersion: 4
m_saved: 1
m_SubgraphDependencies: []
Expand Down Expand Up @@ -3046,10 +3046,10 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114665685447460600}
- {fileID: 114069829755871234}
- {fileID: 114641720432344164}
- {fileID: 114898925103429786}
- {fileID: 114665685447460600}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114282520515415856}
Expand All @@ -3076,7 +3076,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114680178850013376
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,10 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114903038865561644}
- {fileID: 114742699564142396}
- {fileID: 114347075832499752}
- {fileID: 114776405816517722}
- {fileID: 114903038865561644}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114069458236294264}
Expand All @@ -938,7 +938,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114194721034308180
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -1512,7 +1511,7 @@ MonoBehaviour:
- {fileID: 114155846815806328}
m_Shader: {fileID: -6465566751694194690, guid: a1f88376c5c975644a8bea93ca9eecde,
type: 3}
shaderGUID: a1f88376c5c975644a8bea93ca9eecde
m_ShaderName:
--- !u!114 &114330014756498278
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -1813,7 +1812,7 @@ MonoBehaviour:
- {fileID: 114515421661568980}
m_Shader: {fileID: -6465566751694194690, guid: a1f88376c5c975644a8bea93ca9eecde,
type: 3}
shaderGUID: a1f88376c5c975644a8bea93ca9eecde
m_ShaderName:
--- !u!114 &114402011493172982
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -3606,9 +3605,9 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114794263605523346}
- {fileID: 114633346589423346}
- {fileID: 114217164729974510}
- {fileID: 114794263605523346}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114069458236294264}
Expand All @@ -3635,7 +3634,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114800354742086734
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -4033,9 +4031,9 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114591936974525876}
- {fileID: 114334200475736672}
- {fileID: 114515927899430142}
- {fileID: 114591936974525876}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114069458236294264}
Expand All @@ -4062,7 +4060,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114849367105866056
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -4236,9 +4233,9 @@ MonoBehaviour:
m_UICollapsed: 0
m_UISuperCollapsed: 0
m_InputSlots:
- {fileID: 114294992042851386}
- {fileID: 114099094156732596}
- {fileID: 114280783948514120}
- {fileID: 114294992042851386}
m_OutputSlots: []
m_Label:
m_Data: {fileID: 114069458236294264}
Expand All @@ -4265,7 +4262,6 @@ MonoBehaviour:
castShadows: 0
useExposureWeight: 0
shaderGraph: {fileID: 0}
shadergraphGUID:
--- !u!114 &114893539770069574
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -4526,7 +4522,7 @@ MonoBehaviour:
- {fileID: 114291945608062826}
m_Shader: {fileID: -6465566751694194690, guid: a1f88376c5c975644a8bea93ca9eecde,
type: 3}
shaderGUID: a1f88376c5c975644a8bea93ca9eecde
m_ShaderName:
--- !u!114 &114927614131177854
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -4917,6 +4913,7 @@ MonoBehaviour:
m_UISuperCollapsed: 0
m_UIInfos: {fileID: 114562678332364746}
m_ParameterInfo: []
m_ImportDependencies: []
m_GraphVersion: 4
m_saved: 1
m_SubgraphDependencies: []
Expand Down

0 comments on commit 992a63a

Please sign in to comment.