From 084b21c4a8b7a70bcd4682140c958a77a59c8514 Mon Sep 17 00:00:00 2001 From: BimDav <67792882+BimDav@users.noreply.github.com> Date: Tue, 2 Nov 2021 11:10:18 +0100 Subject: [PATCH] expose Variant operator= to GDNative --- modules/gdnative/gdnative/variant.cpp | 6 ++++++ modules/gdnative/gdnative_api.json | 8 ++++++++ modules/gdnative/include/gdnative/variant.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 8026bf90008..b4d4730cb86 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -62,6 +62,12 @@ godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) { return (godot_variant_type)self->get_type(); } +void GDAPI godot_variant_operator_assign(godot_variant *r_dest, const godot_variant *p_v) { + Variant *dest = (Variant *)r_dest; + Variant *v = (Variant *)p_v; + *dest = *v; +} + void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) { Variant *dest = (Variant *)p_dest; Variant *src = (Variant *)p_src; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 3a56a25e9f7..4b88259e772 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -4393,6 +4393,14 @@ ["const godot_variant *", "p_v"] ] }, + { + "name": "godot_variant_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_variant *", "r_dest"], + ["const godot_variant *", "p_v"] + ] + }, { "name": "godot_variant_new_copy", "return_type": "void", diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index c20b71a8d8d..377ed6045b3 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -170,6 +170,8 @@ extern "C" { godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v); +void GDAPI godot_variant_operator_assign(godot_variant *r_dest, const godot_variant *p_v); + void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src); void GDAPI godot_variant_new_nil(godot_variant *r_dest);