diff --git a/hide/view/animgraph/BlendSpace2DEditor.hx b/hide/view/animgraph/BlendSpace2DEditor.hx index 4aec02a2..b3924222 100644 --- a/hide/view/animgraph/BlendSpace2DEditor.hx +++ b/hide/view/animgraph/BlendSpace2DEditor.hx @@ -403,6 +403,9 @@ class BlendSpace2DEditor extends hide.view.FileView { } } } + + updatePreviewAxis(); + animPreview.resetSmoothedValues(); } } diff --git a/hrt/animgraph/AnimGraphInstance.hx b/hrt/animgraph/AnimGraphInstance.hx index 79621393..11df671b 100644 --- a/hrt/animgraph/AnimGraphInstance.hx +++ b/hrt/animgraph/AnimGraphInstance.hx @@ -80,6 +80,17 @@ class AnimGraphInstance extends h3d.anim.Animation { } } + /** + Force nodes in the graph that smooth their input over time to match the + current value of their parameters + **/ + public function resetSmoothedValues() { + tickRec(rootNode, 0.0); + map(rootNode, (node) -> { + node.resetSmoothedValues(); + }); + } + override function clone(?target: h3d.anim.Animation) : h3d.anim.Animation { #if editor if (editorSkipClone) { diff --git a/hrt/animgraph/Node.hx b/hrt/animgraph/Node.hx index 77b50e91..5068f71f 100644 --- a/hrt/animgraph/Node.hx +++ b/hrt/animgraph/Node.hx @@ -48,6 +48,14 @@ implements hide.view.GraphInterface.IGraphNode } + /** + Called on the node when AnimGraphInstance.resetSmoothedValues is called + Should reset all the smoothed parameters to their input value OR default values + **/ + public function resetSmoothedValues() : Void { + + } + // Serialization api diff --git a/hrt/animgraph/nodes/BlendSpace2D.hx b/hrt/animgraph/nodes/BlendSpace2D.hx index e75a1702..8a5661fa 100644 --- a/hrt/animgraph/nodes/BlendSpace2D.hx +++ b/hrt/animgraph/nodes/BlendSpace2D.hx @@ -78,6 +78,13 @@ class BlendSpace2D extends AnimNode { return {x: eydt * (j0 + j1 * dt) + c, v: eydt *(v - j1*half_damping*dt)}; } + override function resetSmoothedValues() { + realX = bsX; + realY = bsY; + vX = 0.0; + vY = 0.0; + } + override function getBones(ctx: hrt.animgraph.nodes.AnimNode.GetBoneContext):Map { var boneMap : Map = [];