diff options
author | reduz <reduzio@gmail.com> | 2020-11-09 00:19:09 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2020-11-09 08:54:43 -0300 |
commit | 221a2a17422dfbb7e0be5ca42fe56b91adb656e3 (patch) | |
tree | 8b07402f807804ee8944b047a4ffe683c6027b12 /core/math | |
parent | 593e35346ab182c36068c3dcfc741eeb7311a19e (diff) |
Refactored variant constructor logic
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/expression.cpp | 4 | ||||
-rw-r--r-- | core/math/transform_2d.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 426586fc9c..48ad73bd32 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -564,7 +564,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant return; } else { - *r_return = Variant::construct(Variant::Type(type), p_inputs, 1, r_error); + Variant::construct(Variant::Type(type), *r_return, p_inputs, 1, r_error); } } break; case TYPE_OF: { @@ -2021,7 +2021,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: } Callable::CallError ce; - r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce); + Variant::construct(constructor->data_type, r_ret, (const Variant **)argp.ptr(), argp.size(), ce); if (ce.error != Callable::CallError::CALL_OK) { r_error_str = vformat(RTR("Invalid arguments to construct '%s'"), Variant::get_type_name(constructor->data_type)); diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index 46e97abaa7..342623939e 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -128,6 +128,12 @@ struct Transform2D { elements[2][1] = oy; } + Transform2D(const Vector2 &p_x, const Vector2 &p_y, const Vector2 &p_origin) { + elements[0] = p_x; + elements[1] = p_y; + elements[2] = p_origin; + } + Transform2D(real_t p_rot, const Vector2 &p_pos); Transform2D() { elements[0][0] = 1.0; |