Skip to content

Commit 0a8c098

Browse files
committed
add operator alternative functions for ImperialDistance
1 parent e2a805a commit 0a8c098

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Packages/com.unity.formats.fbx/Editor/Scripts/CustomExtensions.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,43 @@ public override bool Equals(object obj) {
161161
return new ImperialDistance(a._inches + b._inches);
162162
}
163163

164+
public static ImperialDistance Add(ImperialDistance a, ImperialDistance b)
165+
{
166+
return a + b;
167+
}
168+
164169
public static ImperialDistance operator -(ImperialDistance a, ImperialDistance b) {
165170
if (a == null) throw new ArgumentNullException("a");
166171
if (b == null) throw new ArgumentNullException("b");
167172
return new ImperialDistance(a._inches - b._inches);
168173
}
169174

175+
public static ImperialDistance Subtract(ImperialDistance a, ImperialDistance b)
176+
{
177+
return a - b;
178+
}
179+
170180
public static ImperialDistance operator *(ImperialDistance a, ImperialDistance b) {
171181
if (a == null) throw new ArgumentNullException("a");
172182
if (b == null) throw new ArgumentNullException("b");
173183
return new ImperialDistance(a._inches * b._inches);
174184
}
175185

186+
public static ImperialDistance Multiply(ImperialDistance a, ImperialDistance b)
187+
{
188+
return a * b;
189+
}
190+
176191
public static ImperialDistance operator /(ImperialDistance a, ImperialDistance b) {
177192
if (a == null) throw new ArgumentNullException("a");
178193
if (b == null) throw new ArgumentNullException("b");
179194
return new ImperialDistance(a._inches / b._inches);
180195
}
196+
197+
public static ImperialDistance Divide(ImperialDistance a, ImperialDistance b)
198+
{
199+
return a / b;
200+
}
181201
}
182202

183203
//Extension methods must be defined in a static class
@@ -229,6 +249,11 @@ public static class AnimationCurveExtension
229249
// and specifies the type for which the method is defined.
230250
public static void Dump (this AnimationCurve animCurve, string message="", float[] keyTimesExpected = null, float[] keyValuesExpected = null)
231251
{
252+
if(animCurve == null)
253+
{
254+
throw new System.ArgumentNullException("animCurve");
255+
}
256+
232257
int idx = 0;
233258
foreach (var key in animCurve.keys) {
234259
if (keyTimesExpected != null && keyValuesExpected != null && keyTimesExpected.Length==keyValuesExpected.Length) {

0 commit comments

Comments
 (0)