Merge pull request #79981 from RandomShaper/fix_res_imp_life_2

Fix life cycle of ResourceImporterTexture better
This commit is contained in:
Aaron Franke 2023-07-29 10:56:28 -05:00 committed by GitHub
commit 75f9c97dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -790,12 +790,16 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co
ResourceImporterTexture *ResourceImporterTexture::singleton = nullptr;
ResourceImporterTexture::ResourceImporterTexture() {
singleton = this;
if (!singleton) {
singleton = this;
}
CompressedTexture2D::request_3d_callback = _texture_reimport_3d;
CompressedTexture2D::request_roughness_callback = _texture_reimport_roughness;
CompressedTexture2D::request_normal_callback = _texture_reimport_normal;
}
ResourceImporterTexture::~ResourceImporterTexture() {
singleton = nullptr;
if (singleton == this) {
singleton = nullptr;
}
}