Skip to content

Commit

Permalink
6.5.2-preview - 2019/03/11
Browse files Browse the repository at this point in the history
@2019.2
  • Loading branch information
ErikMoczi committed Mar 14, 2019
1 parent 9676abb commit 808ff00
Show file tree
Hide file tree
Showing 83 changed files with 827 additions and 1,342 deletions.
46 changes: 11 additions & 35 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,24 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [5.8.2-preview] - 2019-03-14
### Fixed
- Issue that remove the edge when dragging an edge from slot to the same slot.
- Exception when undoing an edge deletion on a dynamic operator.
- Exception regarding undo/redo when dragging a edge linked to a dynamic operator on another slot.
- Missing graph invalidation in VFXGraph.OnEnable, was causing trouble with value invalidation until next recompilation
## [6.5.2-preview] - 2019-03-11

## [5.8.1-preview] - 2019-03-13
## [6.5.1-preview] - 2019-03-08

## [5.8.0-preview] - 2019-03-13
### Added
- Addressing mode for Sequential blocks
- Invert transform available on GPU
- Add automatic depth buffer reference for main camera (for position and collision blocks)
- Total Time for PreWarm in Visual Effect Asset inspector
- Support for unlit output with LWRP
## [6.5.0-preview] - 2019-03-07

### Fixed
- Better Handling of Null or Missing Parameter Binders (Editor + Runtime)
- Undo Redo while changing space
- Type declaration was unmodifiable due to exception during space intialization
- Fix unexpected issue when plugging per particle data into hash of per component fixed random
- Missing asset reimport when exception has been thrown during graph compilation
- Fix exception when using a Oriented Box Volume node [Case 1110419](https://issuetracker.unity3d.com/issues/operator-indexoutofrangeexception-when-using-a-volume-oriented-box-node)
- Add missing blend value slot in Inherit Source Attribute blocks [Case 1120568](https://issuetracker.unity3d.com/issues/source-attribute-blend-source-attribute-blocks-are-not-useful-without-the-blend-value)
- Visual Effect Inspector Cosmetic Improvements
- Exception while removing a sub-slot of a dynamic operator
## [6.4.0-preview] - 2019-02-21

## [5.7.0-preview] - 2019-03-07
## [6.3.0-preview] - 2019-02-18

## [5.6.0-preview] - 2019-02-21
## [6.2.0-preview] - 2019-02-15

## [5.5.0-preview] - 2019-02-18
### Changed
- Code refactor: all macros with ARGS have been swapped with macros with PARAM. This is because the ARGS macros were incorrectly named
- Code refactor: all macros with ARGS have been swapped with macros with PARAM. This is because the ARGS macros were incorrectly named.

## [5.4.0-preview] - 2019-02-11
### Fixed
- Incorrect toggle rectangle in VisualEffect inspector
- Shader compilation with SimpleLit and debug display

## [5.3.1-preview] - 2019-01-28
## [6.1.0-preview] - 2019-02-13

## [5.3.0-preview] - 2019-01-28
## [6.0.0-preview] - 2019-02-23
### Added
- Add spawnTime & spawnCount operator
- Add seed slot to constant random mode of Attribute from curve and map
Expand All @@ -68,6 +42,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix fog on decals
- Saturate alpha component in outputs
- Fixed scaleY in ConnectTarget
- Incorrect toggle rectangle in VisualEffect inspector
- Shader compilation with SimpleLit and debug display

## [5.2.0-preview] - 2018-11-27
### Added
Expand Down
2 changes: 1 addition & 1 deletion package/Documentation~/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Make sure your project is already configured with HD Render Pipeline before proc
## Getting Started

To get started right away with Visual Effect Graph, you can visit [this page](Visual-Effect-Graph-Getting-Started) that sums up most of the features you need to know about.
To get started right away with Visual Effect Graph, you can visit [this page](Getting-Started) that sums up most of the features you need to know about.

## Documentation

Expand Down
16 changes: 8 additions & 8 deletions package/Editor/Compiler/VFXGraphCompiledData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,11 @@ public void Compile(VFXCompilationMode compilationMode, bool forceShaderValidati
}

Profiler.BeginSample("VFXEditor.CompileAsset");
float nbSteps = 12.0f;
string assetPath = AssetDatabase.GetAssetPath(visualEffectResource);
string progressBarTitle = "Compiling " + assetPath;
try
{
float nbSteps = 12.0f;
string assetPath = AssetDatabase.GetAssetPath(visualEffectResource);
string progressBarTitle = "Compiling " + assetPath;

EditorUtility.DisplayProgressBar(progressBarTitle, "Collecting dependencies", 0 / nbSteps);
var models = new HashSet<ScriptableObject>();
Expand Down Expand Up @@ -737,6 +737,11 @@ public void Compile(VFXCompilationMode compilationMode, bool forceShaderValidati
{
k_FnVFXResource_SetCompileInitialVariants(m_Graph.visualEffectResource, forceShaderValidation);
}

EditorUtility.DisplayProgressBar(progressBarTitle, "Importing VFX", 11 / nbSteps);
Profiler.BeginSample("VFXEditor.CompileAsset:ImportAsset");
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); //This should compile the shaders on the C++ size
Profiler.EndSample();
}
catch (Exception e)
{
Expand All @@ -751,11 +756,6 @@ public void Compile(VFXCompilationMode compilationMode, bool forceShaderValidati
}
finally
{
EditorUtility.DisplayProgressBar(progressBarTitle, "Importing VFX", 11 / nbSteps);
Profiler.BeginSample("VFXEditor.CompileAsset:ImportAsset");
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); //This should compile the shaders on the C++ size
Profiler.EndSample();

Profiler.EndSample();
EditorUtility.ClearProgressBar();
}
Expand Down
31 changes: 0 additions & 31 deletions package/Editor/Core/VFXLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ static class VFXLibrary
public static IEnumerable<VFXModelDescriptor<VFXOperator>> GetOperators() { LoadIfNeeded(); return VFXViewPreference.displayExperimentalOperator ? m_OperatorDescs : m_OperatorDescs.Where(o => !o.info.experimental); }
public static IEnumerable<VFXModelDescriptor<VFXSlot>> GetSlots() { LoadSlotsIfNeeded(); return m_SlotDescs.Values; }
public static IEnumerable<Type> GetSlotsType() { LoadSlotsIfNeeded(); return m_SlotDescs.Keys; }
public static bool IsSpaceableSlotType(Type type) { LoadSlotsIfNeeded(); return m_SlotSpaceable.Contains(type); }

public static IEnumerable<VFXModelDescriptorParameters> GetParameters() { LoadIfNeeded(); return m_ParametersDescs; }

public static VFXModelDescriptor<VFXSlot> GetSlot(System.Type type)
Expand Down Expand Up @@ -237,26 +235,6 @@ public static void Load()
}
}

private static bool IsSpaceable(Type type)
{
var spaceAttributeOnType = type.GetCustomAttributes(typeof(VFXSpaceAttribute), true).FirstOrDefault();
if (spaceAttributeOnType != null)
{
return true;
}

var fields = type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).ToArray();
foreach (var field in fields)
{
var spaceAttributeOnField = field.GetCustomAttributes(typeof(VFXSpaceAttribute), true).FirstOrDefault();
if (spaceAttributeOnField != null || IsSpaceable(field.FieldType))
{
return true;
}
}
return false;
}

private static void LoadSlotsIfNeeded()
{
if (m_SlotLoaded)
Expand All @@ -267,14 +245,6 @@ private static void LoadSlotsIfNeeded()
if (!m_SlotLoaded)
{
m_SlotDescs = LoadSlots();
m_SlotSpaceable = new HashSet<Type>();
foreach (var slotDescType in m_SlotDescs.Keys)
{
if (IsSpaceable(slotDescType))
{
m_SlotSpaceable.Add(slotDescType);
}
}
m_SlotLoaded = true;
}
}
Expand Down Expand Up @@ -391,7 +361,6 @@ public static IEnumerable<Type> FindConcreteSubclasses(Type objectType = null, T
private static volatile List<VFXModelDescriptor<VFXBlock>> m_BlockDescs;
private static volatile List<VFXModelDescriptorParameters> m_ParametersDescs;
private static volatile Dictionary<Type, VFXModelDescriptor<VFXSlot>> m_SlotDescs;
private static volatile HashSet<Type> m_SlotSpaceable;

private static Object m_Lock = new Object();
private static volatile bool m_Loaded = false;
Expand Down
15 changes: 0 additions & 15 deletions package/Editor/Expressions/VFXExpressionCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,4 @@ sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)
return VFXValue.Constant(CameraType.defaultValue.pixelDimensions);
}
}

class VFXExpressionGetBufferFromMainCamera : VFXExpression
{
public VFXExpressionGetBufferFromMainCamera(VFXCameraBufferTypes bufferType) : base(VFXExpression.Flags.InvalidOnGPU)
{
m_BufferType = bufferType;
}

public override VFXExpressionOperation operation { get { return VFXExpressionOperation.GetBufferFromMainCamera; }}
sealed protected override VFXExpression Evaluate(VFXExpression[] constParents) { return VFXValue.Constant<Texture2D>(null); }

protected override int[] additionnalOperands { get { return new int[] { (int)m_BufferType }; } }
private VFXCameraBufferTypes m_BufferType;
}

}
152 changes: 0 additions & 152 deletions package/Editor/Expressions/VFXExpressionMath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,98 +215,12 @@ protected override bool ProcessUnaryOperation(bool input)
}
}

class VFXExpressionSaturate : VFXExpressionUnaryFloatOperation
{
public VFXExpressionSaturate() : this(VFXValue<float>.Default) { }

public VFXExpressionSaturate(VFXExpression parent) : base(parent, VFXExpressionOperation.Saturate)
{
if (!IsFloatValueType(parent.valueType))
throw new InvalidOperationException("Unexpected VFXExpressionSaturate type with parent " + parent.valueType);
}

sealed protected override string GetUnaryOperationCode(string x)
{
return string.Format("saturate({0})", x);
}

sealed protected override float ProcessUnaryOperation(float input)
{
return Mathf.Clamp01(input);
}
}

class VFXExpressionCeil : VFXExpressionUnaryFloatOperation
{
public VFXExpressionCeil() : this(VFXValue<float>.Default) { }

public VFXExpressionCeil(VFXExpression parent) : base(parent, VFXExpressionOperation.Ceil)
{
if (!IsFloatValueType(parent.valueType))
throw new InvalidOperationException("Unexpected VFXExpressionCeil type with parent " + parent.valueType);
}

sealed protected override string GetUnaryOperationCode(string x)
{
return string.Format("ceil({0})", x);
}

sealed protected override float ProcessUnaryOperation(float input)
{
return Mathf.Ceil(input);
}
}

class VFXExpressionRound : VFXExpressionUnaryFloatOperation
{
public VFXExpressionRound() : this(VFXValue<float>.Default) { }

public VFXExpressionRound(VFXExpression parent) : base(parent, VFXExpressionOperation.Round)
{
if (!IsFloatValueType(parent.valueType))
throw new InvalidOperationException("Unexpected VFXExpressionRound type with parent " + parent.valueType);
}

sealed protected override string GetUnaryOperationCode(string x)
{
return string.Format("round({0})", x);
}

sealed protected override float ProcessUnaryOperation(float input)
{
return Mathf.Round(input);
}
}

class VFXExpressionFrac : VFXExpressionUnaryFloatOperation
{
public VFXExpressionFrac() : this(VFXValue<float>.Default) { }

public VFXExpressionFrac(VFXExpression parent) : base(parent, VFXExpressionOperation.Frac)
{
if (!IsFloatValueType(parent.valueType))
throw new InvalidOperationException("Unexpected VFXExpressionFrac type with parent " + parent.valueType);
}

sealed protected override string GetUnaryOperationCode(string x)
{
return string.Format("frac({0})", x);
}

sealed protected override float ProcessUnaryOperation(float input)
{
return Mathf.Repeat(input, 1.0f);
}
}

class VFXExpressionFloor : VFXExpressionUnaryFloatOperation
{
public VFXExpressionFloor() : this(VFXValue<float>.Default) {}

public VFXExpressionFloor(VFXExpression parent) : base(parent, VFXExpressionOperation.Floor)
{
if (!IsFloatValueType(parent.valueType))
throw new InvalidOperationException("Unexpected VFXExpressionFloor type with parent " + parent.valueType);
}

sealed protected override string GetUnaryOperationCode(string x)
Expand Down Expand Up @@ -554,16 +468,6 @@ sealed protected override string GetBinaryOperationCode(string left, string righ
return string.Format("{0} < {1} ? {0} : {1}", left, right);
return string.Format("min({0}, {1})", left, right);
}

protected override VFXExpression Reduce(VFXExpression[] reducedParents)
{
VFXExpression inputSaturateExpression = null;
if (VFXExpressionMax.CanBeReducedToSaturate(this, reducedParents, out inputSaturateExpression))
{
return new VFXExpressionSaturate(inputSaturateExpression);
}
return base.Reduce(reducedParents);
}
}

class VFXExpressionMax : VFXExpressionBinaryNumericOperation
Expand Down Expand Up @@ -602,62 +506,6 @@ protected override string GetBinaryOperationCode(string left, string right, VFXV
return string.Format("{0} > {1} ? {0} : {1}", left, right);
return string.Format("max({0}, {1})", left, right);
}

static public bool CanBeReducedToSaturate(VFXExpression current, VFXExpression[] reducedParents, out VFXExpression inputValueRef)
{
inputValueRef = null;
var valueType = current.valueType;
if (reducedParents.Length != 2 || !VFXExpression.IsFloatValueType(valueType))
return false;

var one = VFXOperatorUtility.OneExpression[valueType];
var zero = VFXOperatorUtility.ZeroExpression[valueType];

Type searchInnerFunctionType = null;
VFXExpression searchInnerValueFirstLevel = null;
VFXExpression searchInnerValueSecondLevel = null;

if (current is VFXExpressionMax)
{
searchInnerFunctionType = typeof(VFXExpressionMin);
searchInnerValueFirstLevel = zero;
searchInnerValueSecondLevel = one;
}
else if (current is VFXExpressionMin)
{
searchInnerFunctionType = typeof(VFXExpressionMax);
searchInnerValueFirstLevel = one;
searchInnerValueSecondLevel = zero;
}
else
{
return false;
}

var minReferenceExpected = reducedParents.FirstOrDefault(o => o.GetType() == searchInnerFunctionType);
var firstValueExpected = reducedParents.FirstOrDefault(o => o == searchInnerValueFirstLevel);
if (minReferenceExpected != null && firstValueExpected != null)
{
var indexOf = Array.IndexOf(minReferenceExpected.parents, searchInnerValueSecondLevel);
if (indexOf != -1)
{
var otherIndexOf = (indexOf + 1) % 2;
inputValueRef = minReferenceExpected.parents[otherIndexOf];
return true;
}
}
return false;
}

protected override VFXExpression Reduce(VFXExpression[] reducedParents)
{
VFXExpression inputSaturateExpression = null;
if (CanBeReducedToSaturate(this, reducedParents, out inputSaturateExpression))
{
return new VFXExpressionSaturate(inputSaturateExpression);
}
return base.Reduce(reducedParents);
}
}

class VFXExpressionPow : VFXExpressionBinaryFloatOperation
Expand Down
11 changes: 9 additions & 2 deletions package/Editor/Expressions/VFXExpressionRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public override IEnumerable<VFXAttributeInfo> GetNeededAttributes()
class VFXExpressionFixedRandom : VFXExpression
{
public VFXExpressionFixedRandom() : this(VFXValue<uint>.Default) {}
public VFXExpressionFixedRandom(VFXExpression hash) : base(VFXExpression.Flags.None, hash) {}
public VFXExpressionFixedRandom(VFXExpression hash, bool perElement = false) : base(perElement ? VFXExpression.Flags.PerElement : VFXExpression.Flags.None, hash)
{}

public override VFXExpressionOperation operation { get { return VFXExpressionOperation.GenerateFixedRandom; }}

Expand All @@ -62,7 +63,13 @@ sealed protected override VFXExpression Evaluate(VFXExpression[] constParents)

public override string GetCodeString(string[] parents)
{
return string.Format("FixedRand({0})", parents[0]);
return string.Format("FixedRand(particleId ^ {0})", parents[0]);
}

public override IEnumerable<VFXAttributeInfo> GetNeededAttributes()
{
if (Is(Flags.PerElement))
yield return new VFXAttributeInfo(VFXAttribute.ParticleId, VFXAttributeMode.Read);
}
}
#pragma warning restore 0659
Expand Down
Loading

0 comments on commit 808ff00

Please sign in to comment.