Skip to content

Commit ebb4e52

Browse files
iTris666julienf-unity
authored andcommitted
Override VFXPropertyAttribute equals to make it correct. (#73)
* Override VFXPropertyAttribute equals to make it correct. * Update CHANGELOG.md
1 parent 59c7a6f commit ebb4e52

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8585
- Subgraphs are not in hardcoded categories anymore : updated default subgraph templates + Samples to add meaningful categories.
8686
- Enum fields having headers show the header in the inspector as well.
8787
- Fix incorrect propagation on expression flags [Case 1246738](https://issuetracker.unity3d.com/product/unity/issues/guid/1246738/)
88+
- Fix multiple undos [Case 1262133](https://issuetracker.unity3d.com/product/unity/issues/guid/1262133/)
8889

8990
## [8.1.0] - 2020-04-21
9091

com.unity.visualeffectgraph/Editor/Types/VFXPropertyAttribute.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,30 @@ public static bool IsEqual(VFXPropertyAttribute[] one,VFXPropertyAttribute[] oth
7272
return true;
7373
}
7474

75+
76+
public override bool Equals(object obj)
77+
{
78+
if (!(obj is VFXPropertyAttribute other))
79+
return false;
80+
81+
return m_Type == other.m_Type && m_Min == other.m_Min && m_Max == other.m_Max && m_Tooltip == other.m_Tooltip && m_Regex == other.m_Regex && m_RegexMaxLength == other.m_RegexMaxLength;
82+
}
83+
84+
public override int GetHashCode()
85+
{
86+
int hashCode = (int)m_Type;
87+
88+
hashCode += 23 * m_Min.GetHashCode();
89+
hashCode += 23 * m_Max.GetHashCode();
90+
if(m_Tooltip != null)
91+
hashCode += 23 * m_Tooltip.GetHashCode();
92+
if (m_Regex != null)
93+
hashCode += 23 * m_Regex.GetHashCode();
94+
hashCode += 23 * m_RegexMaxLength;
95+
96+
return hashCode;
97+
}
98+
7599
public static VFXExpression ApplyToExpressionGraph(VFXPropertyAttribute[] attributes, VFXExpression exp)
76100
{
77101
if (attributes != null)

0 commit comments

Comments
 (0)