diff --git a/scene/resources/compressed_texture.cpp b/scene/resources/compressed_texture.cpp index 588a2b967b1..6664dc1e2f2 100644 --- a/scene/resources/compressed_texture.cpp +++ b/scene/resources/compressed_texture.cpp @@ -155,6 +155,8 @@ Error CompressedTexture2D::load(const String &p_path) { path_to_file = p_path; format = image->get_format(); + RS::get_singleton()->texture_set_path(texture, get_path()); + if (get_path().is_empty()) { //temporarily set path if no path set for resource, helps find errors RenderingServer::get_singleton()->texture_set_path(texture, p_path); diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp index 3d294ca8cb1..d6695477742 100644 --- a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp @@ -242,6 +242,12 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) { if (light->type != RS::LIGHT_DIRECTIONAL) { if (light->projector.is_valid()) { +#ifdef TOOLS_ENABLED + TextureStorage::Texture *tex = TextureStorage::get_singleton()->get_texture(p_texture); + if (tex->detect_3d_callback) { + tex->detect_3d_callback(tex->detect_3d_callback_ud); + } +#endif texture_storage->texture_add_to_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI); } light->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_LIGHT_SOFT_SHADOW_AND_PROJECTOR); diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index 6e5e8f63e0e..211d88e6bb0 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -2458,6 +2458,27 @@ void TextureStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID decal->textures[p_type] = p_texture; if (decal->textures[p_type].is_valid()) { +#ifdef TOOLS_ENABLED + Texture *tex = get_texture(p_texture); + if (tex->detect_3d_callback) { + tex->detect_3d_callback(tex->detect_3d_callback_ud); + } + if (tex->detect_normal_callback && p_type == RS::DecalTexture::DECAL_TEXTURE_NORMAL) { + tex->detect_normal_callback(tex->detect_normal_callback_ud); + } + + Texture *normal_tex = nullptr; + if (decal->textures[RS::DecalTexture::DECAL_TEXTURE_NORMAL].is_valid()) { + normal_tex = get_texture(decal->textures[RS::DecalTexture::DECAL_TEXTURE_NORMAL]); + } + Texture *orm_tex = nullptr; + if (decal->textures[RS::DecalTexture::DECAL_TEXTURE_ORM].is_valid()) { + orm_tex = get_texture(decal->textures[RS::DecalTexture::DECAL_TEXTURE_ORM]); + } + if (orm_tex && orm_tex->detect_roughness_callback && normal_tex && !normal_tex->path.is_empty()) { + orm_tex->detect_roughness_callback(orm_tex->detect_roughness_callback_ud, normal_tex->path, RS::TEXTURE_DETECT_ROUGHNESS_G); + } +#endif texture_add_to_decal_atlas(decal->textures[p_type]); }