Changed the key's type from Variant to int, as it will work better.

This commit is contained in:
Relintai 2021-08-01 18:38:21 +02:00
parent 40c0b2373e
commit f3c3bac3d1
2 changed files with 18 additions and 18 deletions

View File

@ -75,11 +75,11 @@ Variant TerramanLibrary::_material_cached_get_key(Ref<TerraChunk> chunk) {
return 0;
}
Ref<Material> TerramanLibrary::material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> TerramanLibrary::material_lod_cached_get(const int index, const int key) {
return call("_material_lod_cached_get", index, key);
}
Ref<Material> TerramanLibrary::_material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> 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<TerraChunk> chunk)
return 0;
}
Ref<Material> TerramanLibrary::liquid_material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> TerramanLibrary::liquid_material_lod_cached_get(const int index, const int key) {
return call("_liquid_material_lod_cached_get", index, key);
}
Ref<Material> TerramanLibrary::_liquid_material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> 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<TerraChunk> chunk) {
return 0;
}
Ref<Material> TerramanLibrary::prop_material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> TerramanLibrary::prop_material_lod_cached_get(const int index, const int key) {
return call("_prop_material_lod_cached_get", index, key);
}
Ref<Material> TerramanLibrary::_prop_material_lod_cached_get(const int index, const Variant &key) {
Ref<Material> 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);

View File

@ -73,8 +73,8 @@ public:
Variant material_cached_get_key(const Ref<TerraChunk> &chunk);
virtual Variant _material_cached_get_key(Ref<TerraChunk> chunk);
Ref<Material> material_lod_cached_get(const int index, const Variant &key);
virtual Ref<Material> _material_lod_cached_get(const int index, const Variant &key);
Ref<Material> material_lod_cached_get(const int index, const int key);
virtual Ref<Material> _material_lod_cached_get(const int index, const int key);
void material_add(const Ref<Material> &value);
void material_set(const int index, const Ref<Material> &value);
@ -90,8 +90,8 @@ public:
Variant liquid_material_cached_get_key(const Ref<TerraChunk> &chunk);
virtual Variant _liquid_material_cached_get_key(Ref<TerraChunk> chunk);
Ref<Material> liquid_material_lod_cached_get(const int index, const Variant &key);
virtual Ref<Material> _liquid_material_lod_cached_get(const int index, const Variant &key);
Ref<Material> liquid_material_lod_cached_get(const int index, const int key);
virtual Ref<Material> _liquid_material_lod_cached_get(const int index, const int key);
void liquid_material_add(const Ref<Material> &value);
void liquid_material_set(const int index, const Ref<Material> &value);
@ -107,8 +107,8 @@ public:
Variant prop_material_cached_get_key(const Ref<TerraChunk> &chunk);
virtual Variant _prop_material_cached_get_key(Ref<TerraChunk> chunk);
Ref<Material> prop_material_lod_cached_get(const int index, const Variant &key);
virtual Ref<Material> _prop_material_lod_cached_get(const int index, const Variant &key);
Ref<Material> prop_material_lod_cached_get(const int index, const int key);
virtual Ref<Material> _prop_material_lod_cached_get(const int index, const int key);
void prop_material_add(const Ref<Material> &value);
void prop_material_set(const int index, const Ref<Material> &value);