Merge pull request #15161 from volzhs/tween-follow

Fix Tween follow not working
This commit is contained in:
Rémi Verschelde 2018-01-03 11:45:19 +01:00 committed by GitHub
commit b23f7bc923
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -561,57 +561,50 @@ void Tween::_tween_process(float p_delta) {
data.finish = true; data.finish = true;
} }
switch (data.type) { if (data.type == INTER_CALLBACK) {
case INTER_PROPERTY: if (data.finish) {
case INTER_METHOD: { if (data.call_deferred) {
Variant result = _run_equation(data);
emit_signal("tween_step", object, NodePath(Vector<StringName>(), data.key, false), data.elapsed, result);
_apply_tween_value(data, result);
if (data.finish)
_apply_tween_value(data, data.final_val);
} break;
case INTER_CALLBACK: switch (data.args) {
if (data.finish) { case 0:
if (data.call_deferred) { object->call_deferred(data.key[0]);
break;
switch (data.args) { case 1:
case 0: object->call_deferred(data.key[0], data.arg[0]);
object->call_deferred(data.key[0]); break;
break; case 2:
case 1: object->call_deferred(data.key[0], data.arg[0], data.arg[1]);
object->call_deferred(data.key[0], data.arg[0]); break;
break; case 3:
case 2: object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2]);
object->call_deferred(data.key[0], data.arg[0], data.arg[1]); break;
break; case 4:
case 3: object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2], data.arg[3]);
object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2]); break;
break; case 5:
case 4: object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2], data.arg[3], data.arg[4]);
object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2], data.arg[3]); break;
break;
case 5:
object->call_deferred(data.key[0], data.arg[0], data.arg[1], data.arg[2], data.arg[3], data.arg[4]);
break;
}
} else {
Variant::CallError error;
Variant *arg[5] = {
&data.arg[0],
&data.arg[1],
&data.arg[2],
&data.arg[3],
&data.arg[4],
};
object->call(data.key[0], (const Variant **)arg, data.args, error);
} }
} else {
Variant::CallError error;
Variant *arg[5] = {
&data.arg[0],
&data.arg[1],
&data.arg[2],
&data.arg[3],
&data.arg[4],
};
object->call(data.key[0], (const Variant **)arg, data.args, error);
} }
break; }
default: {} } else {
Variant result = _run_equation(data);
emit_signal("tween_step", object, NodePath(Vector<StringName>(), data.key, false), data.elapsed, result);
_apply_tween_value(data, result);
} }
if (data.finish) { if (data.finish) {
_apply_tween_value(data, data.final_val);
emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false)); emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false));
// not repeat mode, remove completed action // not repeat mode, remove completed action
if (!repeat) if (!repeat)