diff options
author | reduz <reduzio@gmail.com> | 2021-08-23 20:57:52 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-08-23 21:55:45 -0300 |
commit | 65ca132a80760be9f4c0fe1a175445e867bb7ac8 (patch) | |
tree | 1798a0e9c5da9047319ff3c73bf555a9e9f4f8d3 /core/variant | |
parent | aa3c3a9ebbc096bba9eda324b91acbb7f14a7b07 (diff) |
Expose RID creation utilities.
* Exposed as utility functions.
* Not very useful for script, but vital for creating servers using native extensions.
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/variant_utility.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 6c57d1de10..f5cb2d40d6 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -35,6 +35,8 @@ #include "core/object/ref_counted.h" #include "core/os/os.h" #include "core/templates/oa_hash_map.h" +#include "core/templates/rid.h" +#include "core/templates/rid_owner.h" #include "core/variant/binder_common.h" #include "core/variant/variant_parser.h" @@ -728,6 +730,13 @@ struct VariantUtilityFunctions { } return p_instance.get_validated_object() != nullptr; } + + static inline uint64_t rid_allocate_id() { + return RID_AllocBase::_gen_id(); + } + static inline RID rid_from_int64(uint64_t p_base) { + return RID::from_uint64(p_base); + } }; #ifdef DEBUG_METHODS_ENABLED @@ -1265,6 +1274,9 @@ void Variant::_register_variant_utility_functions() { FUNCBINDR(instance_from_id, sarray("instance_id"), Variant::UTILITY_FUNC_TYPE_GENERAL); FUNCBINDR(is_instance_id_valid, sarray("id"), Variant::UTILITY_FUNC_TYPE_GENERAL); FUNCBINDR(is_instance_valid, sarray("instance"), Variant::UTILITY_FUNC_TYPE_GENERAL); + + FUNCBINDR(rid_allocate_id, Vector<String>(), Variant::UTILITY_FUNC_TYPE_GENERAL); + FUNCBINDR(rid_from_int64, sarray("base"), Variant::UTILITY_FUNC_TYPE_GENERAL); } void Variant::_unregister_variant_utility_functions() { |