From 526bf3644c26cb031c36ab918b0d84134472ee82 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 14 Aug 2025 19:57:17 +0200 Subject: [PATCH] Fix deleting active envmap --- base/sources/ts/project.ts | 16 ++++++++++------ base/sources/ts/tab_textures.ts | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/base/sources/ts/project.ts b/base/sources/ts/project.ts index 01da8846..fb95ff78 100644 --- a/base/sources/ts/project.ts +++ b/base/sources/ts/project.ts @@ -310,6 +310,16 @@ function project_new(reset_layers: bool = true) { if (in_use) draw_begin(current); + project_set_default_envmap(); + + ///if is_paint + context_init_tool(); + ///end + + render_path_raytrace_ready = false; +} + +function project_set_default_envmap() { context_raw.saved_envmap = null; context_raw.envmap_loaded = false; scene_world._.envmap = context_raw.empty_envmap; @@ -319,12 +329,6 @@ function project_new(reset_layers: bool = true) { scene_world._.radiance_mipmaps = context_raw.default_radiance_mipmaps; scene_world._.irradiance = context_raw.default_irradiance; scene_world.strength = 4.0; - - ///if is_paint - context_init_tool(); - ///end - - render_path_raytrace_ready = false; } function project_import_material() { diff --git a/base/sources/ts/tab_textures.ts b/base/sources/ts/tab_textures.ts index 6c8af4ca..b7c05c2d 100644 --- a/base/sources/ts/tab_textures.ts +++ b/base/sources/ts/tab_textures.ts @@ -265,6 +265,10 @@ function tab_textures_delete_texture(asset: asset_t) { ui_toolbar_handle.redraws = 1; } + if (data_get_image(asset.file) == scene_world._.envmap) { + project_set_default_envmap(); + } + data_delete_image(asset.file); map_delete(project_asset_map, asset.id); array_splice(project_assets, i, 1);