Merge pull request #15160 from volzhs/tween-follow-2.1

Fix Tween follow not working [2.1]
This commit is contained in:
Rémi Verschelde 2018-01-03 11:50:38 +01:00 committed by GitHub
commit 116b0e5328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 44 deletions

View File

@ -557,56 +557,50 @@ void Tween::_tween_process(float p_delta) {
data.finish = true;
}
switch (data.type) {
case INTER_PROPERTY:
case INTER_METHOD: {
Variant result = _run_equation(data);
emit_signal("tween_step", object, data.key, data.elapsed, result);
_apply_tween_value(data, result);
if (data.finish)
_apply_tween_value(data, data.final_val);
} break;
if (data.type == INTER_CALLBACK) {
if (data.finish) {
if (data.call_deferred) {
case INTER_CALLBACK:
if (data.finish) {
if (data.call_deferred) {
switch (data.args) {
case 0:
object->call_deferred(data.key);
break;
case 1:
object->call_deferred(data.key, data.arg[0]);
break;
case 2:
object->call_deferred(data.key, data.arg[0], data.arg[1]);
break;
case 3:
object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2]);
break;
case 4:
object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3]);
break;
case 5:
object->call_deferred(data.key, 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, (const Variant **)arg, data.args, error);
switch (data.args) {
case 0:
object->call_deferred(data.key);
break;
case 1:
object->call_deferred(data.key, data.arg[0]);
break;
case 2:
object->call_deferred(data.key, data.arg[0], data.arg[1]);
break;
case 3:
object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2]);
break;
case 4:
object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3]);
break;
case 5:
object->call_deferred(data.key, 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, (const Variant **)arg, data.args, error);
}
break;
}
} else {
Variant result = _run_equation(data);
emit_signal("tween_step", object, data.key, data.elapsed, result);
_apply_tween_value(data, result);
}
if (data.finish) {
_apply_tween_value(data, data.final_val);
emit_signal("tween_complete", object, data.key);
// not repeat mode, remove completed action
if (!repeat)