Skip to content

Commit

Permalink
Allow texture based object be used in
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmdx committed Nov 10, 2024
1 parent e65a237 commit 8002d68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion drivers/gles3/storage/material_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2427,8 +2427,11 @@ void MaterialStorage::material_set_param(RID p_material, const StringName &p_par

if (p_value.get_type() == Variant::NIL) {
material->params.erase(p_param);
} else if (p_value.get_type() == Variant::OBJECT) {
Ref<::Texture> tex = p_value; // Use the global namespace to avoid conflict with GLES3::Texture
ERR_FAIL_COND_MSG(tex.is_null(), "Invalid object, only texture based objects are allowed.");
material->params[p_param] = p_value;
} else {
ERR_FAIL_COND(p_value.get_type() == Variant::OBJECT); //object not allowed
material->params[p_param] = p_value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "scene/resources/texture.h"
#include "servers/rendering/storage/variant_converters.h"
#include "texture_storage.h"

Expand Down Expand Up @@ -2226,8 +2227,11 @@ void MaterialStorage::material_set_param(RID p_material, const StringName &p_par

if (p_value.get_type() == Variant::NIL) {
material->params.erase(p_param);
} else if (p_value.get_type() == Variant::OBJECT) {
Ref<Texture> tex = p_value;
ERR_FAIL_COND_MSG(tex.is_null(), "Invalid object, only texture based objects are allowed.");
material->params[p_param] = p_value;
} else {
ERR_FAIL_COND(p_value.get_type() == Variant::OBJECT); //object not allowed
material->params[p_param] = p_value;
}

Expand Down

0 comments on commit 8002d68

Please sign in to comment.