Make parameters of relative node optional.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
using Cryville.Common;
|
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -133,6 +132,7 @@ namespace Cryville.Crtr {
|
|||||||
new MotionNode() {
|
new MotionNode() {
|
||||||
Id = 0,
|
Id = 0,
|
||||||
Time = new Vec1(0),
|
Time = new Vec1(0),
|
||||||
|
Transition = TransitionType.Ease,
|
||||||
Rate = new Vec1(1),
|
Rate = new Vec1(1),
|
||||||
Value = init
|
Value = init
|
||||||
}
|
}
|
||||||
@@ -181,6 +181,7 @@ namespace Cryville.Crtr {
|
|||||||
cnode = new MotionNode {
|
cnode = new MotionNode {
|
||||||
Id = node.Id,
|
Id = node.Id,
|
||||||
Time = new Vec1(0),
|
Time = new Vec1(0),
|
||||||
|
Transition = TransitionType.Ease,
|
||||||
Rate = new Vec1(1),
|
Rate = new Vec1(1),
|
||||||
Value = (Vector)Activator.CreateInstance(node.Value.GetType())
|
Value = (Vector)Activator.CreateInstance(node.Value.GetType())
|
||||||
};
|
};
|
||||||
@@ -190,7 +191,7 @@ namespace Cryville.Crtr {
|
|||||||
RelativeNodes.RemoveAt(i);
|
RelativeNodes.RemoveAt(i);
|
||||||
}
|
}
|
||||||
if (node.Time != null) cnode.Time = node.Time;
|
if (node.Time != null) cnode.Time = node.Time;
|
||||||
if (node.Transition.HasValue) cnode.Transition = node.Transition.Value;
|
if (node.Transition != null) cnode.Transition = node.Transition;
|
||||||
if (node.Rate != null) cnode.Rate = node.Rate;
|
if (node.Rate != null) cnode.Rate = node.Rate;
|
||||||
if (node.Value != null) cnode.Value.ReplaceFrom(node.Value);
|
if (node.Value != null) cnode.Value.ReplaceFrom(node.Value);
|
||||||
|
|
||||||
@@ -274,18 +275,19 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public void LerpWith(MotionNode start, float lerpedTime, ref MotionNode result) {
|
public void LerpWith(MotionNode start, float lerpedTime, ref MotionNode result) {
|
||||||
result.Id = Id;
|
result.Id = Id;
|
||||||
if (Time == null) result.Time = null;
|
if (Time == null) result.Time = start.Time;
|
||||||
else {
|
else {
|
||||||
var t = (Vector)result.Time;
|
var t = (Vector)result.Time;
|
||||||
Time.LerpWith(start.Time, lerpedTime, ref t);
|
Time.LerpWith(start.Time, lerpedTime, ref t);
|
||||||
}
|
}
|
||||||
result.Transition = Transition;
|
if (Transition == null) result.Transition = start.Transition;
|
||||||
if (Rate == null) result.Rate = null;
|
else result.Transition = Transition;
|
||||||
|
if (Rate == null) result.Rate = start.Rate;
|
||||||
else {
|
else {
|
||||||
var t = (Vector)result.Rate;
|
var t = (Vector)result.Rate;
|
||||||
Rate.LerpWith(start.Rate, lerpedTime, ref t);
|
Rate.LerpWith(start.Rate, lerpedTime, ref t);
|
||||||
}
|
}
|
||||||
if (Value == null) result.Value = null;
|
if (Value == null) result.Value = start.Value;
|
||||||
else Value.LerpWith(start.Value, lerpedTime, ref result.Value);
|
else Value.LerpWith(start.Value, lerpedTime, ref result.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user