From f3c3bac3d1e44b55d22d3545adc01dacbeed1572 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 1 Aug 2021 18:38:21 +0200 Subject: [PATCH] Changed the key's type from Variant to int, as it will work better. --- library/terraman_library.cpp | 24 ++++++++++++------------ library/terraman_library.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/library/terraman_library.cpp b/library/terraman_library.cpp index d9d319e..ef1dd00 100644 --- a/library/terraman_library.cpp +++ b/library/terraman_library.cpp @@ -75,11 +75,11 @@ Variant TerramanLibrary::_material_cached_get_key(Ref chunk) { return 0; } -Ref TerramanLibrary::material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::material_lod_cached_get(const int index, const int key) { return call("_material_lod_cached_get", index, key); } -Ref TerramanLibrary::_material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::_material_lod_cached_get(const int index, const int key) { ERR_FAIL_V_MSG(material_lod_get(index), "This TerramanLibrary doesn't support cached materials!"); } @@ -150,11 +150,11 @@ Variant TerramanLibrary::_liquid_material_cached_get_key(Ref chunk) return 0; } -Ref TerramanLibrary::liquid_material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::liquid_material_lod_cached_get(const int index, const int key) { return call("_liquid_material_lod_cached_get", index, key); } -Ref TerramanLibrary::_liquid_material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::_liquid_material_lod_cached_get(const int index, const int key) { ERR_FAIL_V_MSG(liquid_material_lod_get(index), "This TerramanLibrary doesn't support cached liquid materials!"); } @@ -225,11 +225,11 @@ Variant TerramanLibrary::_prop_material_cached_get_key(Ref chunk) { return 0; } -Ref TerramanLibrary::prop_material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::prop_material_lod_cached_get(const int index, const int key) { return call("_prop_material_lod_cached_get", index, key); } -Ref TerramanLibrary::_prop_material_lod_cached_get(const int index, const Variant &key) { +Ref TerramanLibrary::_prop_material_lod_cached_get(const int index, const int key) { ERR_FAIL_V_MSG(prop_material_lod_get(index), "This TerramanLibrary doesn't support cached prop materials!"); } @@ -347,8 +347,8 @@ void TerramanLibrary::_bind_methods() { BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::INT, "material_index"), PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); - BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::NIL, "ret"), "_material_cached_get_key")); - BIND_VMETHOD(MethodInfo("_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "key"))); + BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::INT, "ret"), "_material_cached_get_key")); + BIND_VMETHOD(MethodInfo("_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "key"))); ClassDB::bind_method(D_METHOD("material_get", "index"), &TerramanLibrary::material_get); ClassDB::bind_method(D_METHOD("material_lod_get", "index"), &TerramanLibrary::material_lod_get); @@ -368,8 +368,8 @@ void TerramanLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_set"), &TerramanLibrary::materials_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); - BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::NIL, "ret"), "_liquid_material_cached_get_key")); - BIND_VMETHOD(MethodInfo("_liquid_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "key"))); + BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::INT, "ret"), "_liquid_material_cached_get_key")); + BIND_VMETHOD(MethodInfo("_liquid_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "key"))); ClassDB::bind_method(D_METHOD("liquid_material_get", "index"), &TerramanLibrary::liquid_material_get); ClassDB::bind_method(D_METHOD("liquid_material_lod_get", "index"), &TerramanLibrary::liquid_material_lod_get); @@ -389,8 +389,8 @@ void TerramanLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("liquid_materials_set"), &TerramanLibrary::liquid_materials_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_materials", PROPERTY_HINT_NONE, "17/17:Material", PROPERTY_USAGE_DEFAULT, "Material"), "liquid_materials_set", "liquid_materials_get"); - BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::NIL, "ret"), "_prop_material_cached_get_key")); - BIND_VMETHOD(MethodInfo("_prop_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::NIL, "key"))); + BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::INT, "ret"), "_prop_material_cached_get_key")); + BIND_VMETHOD(MethodInfo("_prop_material_lod_cached_get", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "key"))); ClassDB::bind_method(D_METHOD("prop_material_get", "index"), &TerramanLibrary::prop_material_get); ClassDB::bind_method(D_METHOD("prop_material_lod_get", "index"), &TerramanLibrary::prop_material_lod_get); diff --git a/library/terraman_library.h b/library/terraman_library.h index 945a560..df9d9cc 100644 --- a/library/terraman_library.h +++ b/library/terraman_library.h @@ -73,8 +73,8 @@ public: Variant material_cached_get_key(const Ref &chunk); virtual Variant _material_cached_get_key(Ref chunk); - Ref material_lod_cached_get(const int index, const Variant &key); - virtual Ref _material_lod_cached_get(const int index, const Variant &key); + Ref material_lod_cached_get(const int index, const int key); + virtual Ref _material_lod_cached_get(const int index, const int key); void material_add(const Ref &value); void material_set(const int index, const Ref &value); @@ -90,8 +90,8 @@ public: Variant liquid_material_cached_get_key(const Ref &chunk); virtual Variant _liquid_material_cached_get_key(Ref chunk); - Ref liquid_material_lod_cached_get(const int index, const Variant &key); - virtual Ref _liquid_material_lod_cached_get(const int index, const Variant &key); + Ref liquid_material_lod_cached_get(const int index, const int key); + virtual Ref _liquid_material_lod_cached_get(const int index, const int key); void liquid_material_add(const Ref &value); void liquid_material_set(const int index, const Ref &value); @@ -107,8 +107,8 @@ public: Variant prop_material_cached_get_key(const Ref &chunk); virtual Variant _prop_material_cached_get_key(Ref chunk); - Ref prop_material_lod_cached_get(const int index, const Variant &key); - virtual Ref _prop_material_lod_cached_get(const int index, const Variant &key); + Ref prop_material_lod_cached_get(const int index, const int key); + virtual Ref _prop_material_lod_cached_get(const int index, const int key); void prop_material_add(const Ref &value); void prop_material_set(const int index, const Ref &value);