summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_tree.cpp4
-rw-r--r--scene/animation/skeleton_ik.cpp13
-rw-r--r--scene/animation/skeleton_ik.h1
-rw-r--r--scene/animation/tween.cpp1
4 files changed, 17 insertions, 2 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 5f606ff4c5..5c284cb483 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -832,8 +832,8 @@ void AnimationNodeTransition::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "xfade_time", PROPERTY_HINT_RANGE, "0,120,0.01"), "set_cross_fade_time", "get_cross_fade_time");
for (int i = 0; i < MAX_INPUTS; i++) {
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name"), "set_input_caption", "get_input_caption", i);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance"), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_caption", "get_input_caption", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
}
}
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 518c243dd0..46028a9ce2 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -329,6 +329,17 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
}
}
+void FabrikInverseKinematic::reset(Task *p_task) {
+ ChainItem *ci(&p_task->chain.chain_root);
+ while (ci) {
+ p_task->skeleton->set_bone_global_pose_override(ci->bone, Transform(), 0);
+ if (!ci->children.empty())
+ ci = &ci->children.write[0];
+ else
+ ci = NULL;
+ }
+}
+
void SkeletonIK::_validate_property(PropertyInfo &property) const {
if (property.name == "root_bone" || property.name == "tip_bone") {
@@ -531,6 +542,8 @@ void SkeletonIK::start(bool p_one_time) {
void SkeletonIK::stop() {
set_process_internal(false);
+ if (task)
+ FabrikInverseKinematic::reset(task);
}
Transform SkeletonIK::_get_target_transform() {
diff --git a/scene/animation/skeleton_ik.h b/scene/animation/skeleton_ik.h
index 9ae010dc4e..8fc8a58b99 100644
--- a/scene/animation/skeleton_ik.h
+++ b/scene/animation/skeleton_ik.h
@@ -139,6 +139,7 @@ public:
static void set_goal(Task *p_task, const Transform &p_goal);
static void make_goal(Task *p_task, const Transform &p_inverse_transf, real_t blending_delta);
static void solve(Task *p_task, real_t blending_delta, bool override_tip_basis, bool p_use_magnet, const Vector3 &p_magnet_position);
+ static void reset(Task *p_task);
};
class SkeletonIK : public Node {
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 58212335c2..331a6c769c 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -827,6 +827,7 @@ bool Tween::start() {
// Are there any pending updates?
if (pending_update != 0) {
// Start the tweens after deferring
+ call_deferred("start");
return true;
}