Skip to content

Commit 0336f4c

Browse files
authored
Merge pull request #122 from jss2a98aj/cherry-pick-4.4-import
[4.4 backport] Assorted import optimizations
2 parents 5906fc4 + 779804a commit 0336f4c

28 files changed

+1616
-74
lines changed

core/io/image.cpp

+155-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "image.h"
3232

33+
#include "core/config/project_settings.h"
3334
#include "core/error/error_list.h"
3435
#include "core/error/error_macros.h"
3536
#include "core/io/image_loader.h"
@@ -501,6 +502,38 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p
501502
}
502503
}
503504

505+
template <typename T, uint32_t read_channels, uint32_t write_channels, T def_zero, T def_one>
506+
static void _convert_fast(int p_width, int p_height, const T *p_src, T *p_dst) {
507+
uint32_t dst_count = 0;
508+
uint32_t src_count = 0;
509+
510+
const int resolution = p_width * p_height;
511+
512+
for (int i = 0; i < resolution; i++) {
513+
memcpy(p_dst + dst_count, p_src + src_count, MIN(read_channels, write_channels) * sizeof(T));
514+
515+
if constexpr (write_channels > read_channels) {
516+
const T def_value[4] = { def_zero, def_zero, def_zero, def_one };
517+
memcpy(p_dst + dst_count + read_channels, &def_value[read_channels], (write_channels - read_channels) * sizeof(T));
518+
}
519+
520+
dst_count += write_channels;
521+
src_count += read_channels;
522+
}
523+
}
524+
525+
static bool _are_formats_compatible(Image::Format p_format0, Image::Format p_format1) {
526+
if (p_format0 <= Image::FORMAT_RGBA8 && p_format1 <= Image::FORMAT_RGBA8) {
527+
return true;
528+
} else if (p_format0 <= Image::FORMAT_RGBAH && p_format0 >= Image::FORMAT_RH && p_format1 <= Image::FORMAT_RGBAH && p_format1 >= Image::FORMAT_RH) {
529+
return true;
530+
} else if (p_format0 <= Image::FORMAT_RGBAF && p_format0 >= Image::FORMAT_RF && p_format1 <= Image::FORMAT_RGBAF && p_format1 >= Image::FORMAT_RF) {
531+
return true;
532+
}
533+
534+
return false;
535+
}
536+
504537
void Image::convert(Format p_new_format) {
505538
ERR_FAIL_INDEX_MSG(p_new_format, FORMAT_MAX, "The Image format specified (" + itos(p_new_format) + ") is out of range. See Image's Format enum.");
506539
if (data.size() == 0) {
@@ -517,7 +550,7 @@ void Image::convert(Format p_new_format) {
517550
if (Image::is_format_compressed(format) || Image::is_format_compressed(p_new_format)) {
518551
ERR_FAIL_MSG("Cannot convert to <-> from compressed formats. Use compress() and decompress() instead.");
519552

520-
} else if (format > FORMAT_RGBA8 || p_new_format > FORMAT_RGBA8) {
553+
} else if (!_are_formats_compatible(format, p_new_format)) {
521554
//use put/set pixel which is slower but works with non byte formats
522555
Image new_img(width, height, mipmaps, p_new_format);
523556

@@ -648,6 +681,78 @@ void Image::convert(Format p_new_format) {
648681
case FORMAT_RGBA8 | (FORMAT_RGB8 << 8):
649682
_convert<3, true, 3, false, false, false>(mip_width, mip_height, rptr, wptr);
650683
break;
684+
case FORMAT_RH | (FORMAT_RGH << 8):
685+
_convert_fast<uint16_t, 1, 2, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
686+
break;
687+
case FORMAT_RH | (FORMAT_RGBH << 8):
688+
_convert_fast<uint16_t, 1, 3, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
689+
break;
690+
case FORMAT_RH | (FORMAT_RGBAH << 8):
691+
_convert_fast<uint16_t, 1, 4, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
692+
break;
693+
case FORMAT_RGH | (FORMAT_RH << 8):
694+
_convert_fast<uint16_t, 2, 1, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
695+
break;
696+
case FORMAT_RGH | (FORMAT_RGBH << 8):
697+
_convert_fast<uint16_t, 2, 3, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
698+
break;
699+
case FORMAT_RGH | (FORMAT_RGBAH << 8):
700+
_convert_fast<uint16_t, 2, 4, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
701+
break;
702+
case FORMAT_RGBH | (FORMAT_RH << 8):
703+
_convert_fast<uint16_t, 3, 1, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
704+
break;
705+
case FORMAT_RGBH | (FORMAT_RGH << 8):
706+
_convert_fast<uint16_t, 3, 2, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
707+
break;
708+
case FORMAT_RGBH | (FORMAT_RGBAH << 8):
709+
_convert_fast<uint16_t, 3, 4, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
710+
break;
711+
case FORMAT_RGBAH | (FORMAT_RH << 8):
712+
_convert_fast<uint16_t, 4, 1, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
713+
break;
714+
case FORMAT_RGBAH | (FORMAT_RGH << 8):
715+
_convert_fast<uint16_t, 4, 2, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
716+
break;
717+
case FORMAT_RGBAH | (FORMAT_RGBH << 8):
718+
_convert_fast<uint16_t, 4, 3, 0x0000, 0x3C00>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
719+
break;
720+
case FORMAT_RF | (FORMAT_RGF << 8):
721+
_convert_fast<uint32_t, 1, 2, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
722+
break;
723+
case FORMAT_RF | (FORMAT_RGBF << 8):
724+
_convert_fast<uint32_t, 1, 3, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
725+
break;
726+
case FORMAT_RF | (FORMAT_RGBAF << 8):
727+
_convert_fast<uint32_t, 1, 4, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
728+
break;
729+
case FORMAT_RGF | (FORMAT_RF << 8):
730+
_convert_fast<uint32_t, 2, 1, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
731+
break;
732+
case FORMAT_RGF | (FORMAT_RGBF << 8):
733+
_convert_fast<uint32_t, 2, 3, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
734+
break;
735+
case FORMAT_RGF | (FORMAT_RGBAF << 8):
736+
_convert_fast<uint32_t, 2, 4, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
737+
break;
738+
case FORMAT_RGBF | (FORMAT_RF << 8):
739+
_convert_fast<uint32_t, 3, 1, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
740+
break;
741+
case FORMAT_RGBF | (FORMAT_RGF << 8):
742+
_convert_fast<uint32_t, 3, 2, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
743+
break;
744+
case FORMAT_RGBF | (FORMAT_RGBAF << 8):
745+
_convert_fast<uint32_t, 3, 4, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
746+
break;
747+
case FORMAT_RGBAF | (FORMAT_RF << 8):
748+
_convert_fast<uint32_t, 4, 1, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
749+
break;
750+
case FORMAT_RGBAF | (FORMAT_RGF << 8):
751+
_convert_fast<uint32_t, 4, 2, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
752+
break;
753+
case FORMAT_RGBAF | (FORMAT_RGBF << 8):
754+
_convert_fast<uint32_t, 4, 3, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
755+
break;
651756
}
652757
}
653758

@@ -2630,6 +2735,27 @@ Error Image::compress(CompressMode p_mode, CompressSource p_source, ASTCFormat p
26302735
Error Image::compress_from_channels(CompressMode p_mode, UsedChannels p_channels, ASTCFormat p_astc_format) {
26312736
ERR_FAIL_COND_V(data.is_empty(), ERR_INVALID_DATA);
26322737

2738+
// RenderingDevice only.
2739+
if (GLOBAL_GET("rendering/textures/vram_compression/compress_with_gpu")) {
2740+
switch (p_mode) {
2741+
case COMPRESS_BPTC: {
2742+
// BC7 is unsupported currently.
2743+
if ((format >= FORMAT_RF && format <= FORMAT_RGBE9995) && _image_compress_bptc_rd_func) {
2744+
Error result = _image_compress_bptc_rd_func(this, p_channels);
2745+
2746+
// If the image was compressed successfully, we return here. If not, we fall back to the default compression scheme.
2747+
if (result == OK) {
2748+
return OK;
2749+
}
2750+
}
2751+
2752+
} break;
2753+
2754+
default: {
2755+
}
2756+
}
2757+
}
2758+
26332759
switch (p_mode) {
26342760
case COMPRESS_S3TC: {
26352761
ERR_FAIL_NULL_V(_image_compress_bc_func, ERR_UNAVAILABLE);
@@ -3011,6 +3137,7 @@ void (*Image::_image_compress_bptc_func)(Image *, Image::UsedChannels) = nullptr
30113137
void (*Image::_image_compress_etc1_func)(Image *) = nullptr;
30123138
void (*Image::_image_compress_etc2_func)(Image *, Image::UsedChannels) = nullptr;
30133139
void (*Image::_image_compress_astc_func)(Image *, Image::ASTCFormat) = nullptr;
3140+
Error (*Image::_image_compress_bptc_rd_func)(Image *, Image::UsedChannels) = nullptr;
30143141
void (*Image::_image_decompress_bc)(Image *) = nullptr;
30153142
void (*Image::_image_decompress_bptc)(Image *) = nullptr;
30163143
void (*Image::_image_decompress_etc1)(Image *) = nullptr;
@@ -3696,6 +3823,33 @@ void Image::bump_map_to_normal_map(float bump_scale) {
36963823
data = result_image;
36973824
}
36983825

3826+
bool Image::detect_signed(bool p_include_mips) const {
3827+
ERR_FAIL_COND_V(is_compressed(), false);
3828+
3829+
if (format >= Image::FORMAT_RH && format <= Image::FORMAT_RGBAH) {
3830+
const uint16_t *img_data = reinterpret_cast<const uint16_t *>(data.ptr());
3831+
const uint64_t img_size = p_include_mips ? (data.size() / 2) : (width * height * get_format_pixel_size(format) / 2);
3832+
3833+
for (uint64_t i = 0; i < img_size; i++) {
3834+
if ((img_data[i] & 0x8000) != 0 && (img_data[i] & 0x7fff) != 0) {
3835+
return true;
3836+
}
3837+
}
3838+
3839+
} else if (format >= Image::FORMAT_RF && format <= Image::FORMAT_RGBAF) {
3840+
const uint32_t *img_data = reinterpret_cast<const uint32_t *>(data.ptr());
3841+
const uint64_t img_size = p_include_mips ? (data.size() / 4) : (width * height * get_format_pixel_size(format) / 4);
3842+
3843+
for (uint64_t i = 0; i < img_size; i++) {
3844+
if ((img_data[i] & 0x80000000) != 0 && (img_data[i] & 0x7fffffff) != 0) {
3845+
return true;
3846+
}
3847+
}
3848+
}
3849+
3850+
return false;
3851+
}
3852+
36993853
void Image::srgb_to_linear() {
37003854
if (data.size() == 0) {
37013855
return;

core/io/image.h

+4
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ class Image : public Resource {
159159
static void (*_image_compress_etc2_func)(Image *, UsedChannels p_channels);
160160
static void (*_image_compress_astc_func)(Image *, ASTCFormat p_format);
161161

162+
static Error (*_image_compress_bptc_rd_func)(Image *, UsedChannels p_channels);
163+
162164
static void (*_image_decompress_bc)(Image *);
163165
static void (*_image_decompress_bptc)(Image *);
164166
static void (*_image_decompress_etc1)(Image *);
@@ -388,6 +390,8 @@ class Image : public Resource {
388390
Ref<Image> get_image_from_mipmap(int p_mipmap) const;
389391
void bump_map_to_normal_map(float bump_scale = 1.0);
390392

393+
bool detect_signed(bool p_include_mips = true) const;
394+
391395
void blit_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const Point2i &p_dest);
392396
void blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2i &p_src_rect, const Point2i &p_dest);
393397
void blend_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const Point2i &p_dest);

core/math/color.h

+40-27
Original file line numberDiff line numberDiff line change
@@ -129,33 +129,46 @@ struct [[nodiscard]] Color {
129129
}
130130

131131
_FORCE_INLINE_ uint32_t to_rgbe9995() const {
132-
const float pow2to9 = 512.0f;
133-
const float B = 15.0f;
134-
const float N = 9.0f;
135-
136-
float sharedexp = 65408.000f; // Result of: ((pow2to9 - 1.0f) / pow2to9) * powf(2.0f, 31.0f - 15.0f)
137-
138-
float cRed = MAX(0.0f, MIN(sharedexp, r));
139-
float cGreen = MAX(0.0f, MIN(sharedexp, g));
140-
float cBlue = MAX(0.0f, MIN(sharedexp, b));
141-
142-
float cMax = MAX(cRed, MAX(cGreen, cBlue));
143-
144-
float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / (real_t)Math_LN2)) + 1.0f + B;
145-
146-
float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f);
147-
148-
float exps = expp + 1.0f;
149-
150-
if (0.0f <= sMax && sMax < pow2to9) {
151-
exps = expp;
152-
}
153-
154-
float sRed = Math::floor((cRed / pow(2.0f, exps - B - N)) + 0.5f);
155-
float sGreen = Math::floor((cGreen / pow(2.0f, exps - B - N)) + 0.5f);
156-
float sBlue = Math::floor((cBlue / pow(2.0f, exps - B - N)) + 0.5f);
157-
158-
return (uint32_t(Math::fast_ftoi(sRed)) & 0x1FF) | ((uint32_t(Math::fast_ftoi(sGreen)) & 0x1FF) << 9) | ((uint32_t(Math::fast_ftoi(sBlue)) & 0x1FF) << 18) | ((uint32_t(Math::fast_ftoi(exps)) & 0x1F) << 27);
132+
// https://github.com/microsoft/DirectX-Graphics-Samples/blob/v10.0.19041.0/MiniEngine/Core/Color.cpp
133+
static const float kMaxVal = float(0x1FF << 7);
134+
static const float kMinVal = float(1.f / (1 << 16));
135+
136+
// Clamp RGB to [0, 1.FF*2^16]
137+
const float _r = CLAMP(r, 0.0f, kMaxVal);
138+
const float _g = CLAMP(g, 0.0f, kMaxVal);
139+
const float _b = CLAMP(b, 0.0f, kMaxVal);
140+
141+
// Compute the maximum channel, no less than 1.0*2^-15
142+
const float MaxChannel = MAX(MAX(_r, _g), MAX(_b, kMinVal));
143+
144+
// Take the exponent of the maximum channel (rounding up the 9th bit) and
145+
// add 15 to it. When added to the channels, it causes the implicit '1.0'
146+
// bit and the first 8 mantissa bits to be shifted down to the low 9 bits
147+
// of the mantissa, rounding the truncated bits.
148+
union {
149+
float f;
150+
int32_t i;
151+
} R, G, B, E;
152+
153+
E.f = MaxChannel;
154+
E.i += 0x07804000; // Add 15 to the exponent and 0x4000 to the mantissa
155+
E.i &= 0x7F800000; // Zero the mantissa
156+
157+
// This shifts the 9-bit values we need into the lowest bits, rounding as
158+
// needed. Note that if the channel has a smaller exponent than the max
159+
// channel, it will shift even more. This is intentional.
160+
R.f = _r + E.f;
161+
G.f = _g + E.f;
162+
B.f = _b + E.f;
163+
164+
// Convert the Bias to the correct exponent in the upper 5 bits.
165+
E.i <<= 4;
166+
E.i += 0x10000000;
167+
168+
// Combine the fields. RGB floats have unwanted data in the upper 9
169+
// bits. Only red needs to mask them off because green and blue shift
170+
// it out to the left.
171+
return E.i | (B.i << 18) | (G.i << 9) | (R.i & 511);
159172
}
160173

161174
_FORCE_INLINE_ Color blend(const Color &p_over) const {

doc/classes/ProjectSettings.xml

+5
Original file line numberDiff line numberDiff line change
@@ -2882,6 +2882,11 @@
28822882
<member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false">
28832883
If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP.
28842884
</member>
2885+
<member name="rendering/textures/vram_compression/compress_with_gpu" type="bool" setter="" getter="" default="true">
2886+
If [code]true[/code], the texture importer will utilize the GPU for compressing textures, which makes large textures import significantly faster.
2887+
[b]Note:[/b] This setting requires either Vulkan or D3D12 available as a rendering backend.
2888+
[b]Note:[/b] Currently this only affects BC6H compression, which is used on Desktop and Console for HDR images.
2889+
</member>
28852890
<member name="rendering/textures/vram_compression/import_etc2_astc" type="bool" setter="" getter="" default="false">
28862891
If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm for lower quality textures and normal maps and Adaptable Scalable Texture Compression algorithm for high quality textures (in 4×4 block size).
28872892
[b]Note:[/b] This setting is an override. The texture importer will always import the format the host platform needs, even if this is set to [code]false[/code].

doc/classes/ResourceImporterOBJ.xml

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
<member name="offset_mesh" type="Vector3" setter="" getter="" default="Vector3(0, 0, 0)">
2222
Offsets the mesh's data by the specified value. This can be used to work around misaligned meshes without having to modify the source file.
2323
</member>
24-
<member name="optimize_mesh" type="bool" setter="" getter="" default="true">
25-
Unused parameter. This currently has no effect.
26-
</member>
2724
<member name="scale_mesh" type="Vector3" setter="" getter="" default="Vector3(1, 1, 1)">
2825
Scales the mesh's data by the specified value. This can be used to work around misscaled meshes without having to modify the source file.
2926
</member>

editor/editor_file_system.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -2277,10 +2277,18 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
22772277
if (!is_scanning()) {
22782278
_process_update_pending();
22792279
}
2280-
call_deferred(SNAME("emit_signal"), "filesystem_changed"); // Update later
2280+
if (!filesystem_changed_queued) {
2281+
filesystem_changed_queued = true;
2282+
callable_mp(this, &EditorFileSystem::_notify_filesystem_changed).call_deferred();
2283+
}
22812284
}
22822285
}
22832286

2287+
void EditorFileSystem::_notify_filesystem_changed() {
2288+
emit_signal("filesystem_changed");
2289+
filesystem_changed_queued = false;
2290+
}
2291+
22842292
HashSet<String> EditorFileSystem::get_valid_extensions() const {
22852293
return valid_extensions;
22862294
}

editor/editor_file_system.h

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class EditorFileSystem : public Node {
180180
EditorFileSystemDirectory *new_filesystem = nullptr;
181181
ScannedDirectory *first_scan_root_dir = nullptr;
182182

183+
bool filesystem_changed_queued = false;
183184
bool scanning = false;
184185
bool importing = false;
185186
bool first_scan = true;
@@ -189,6 +190,7 @@ class EditorFileSystem : public Node {
189190
bool revalidate_import_files = false;
190191
int nb_files_total = 0;
191192

193+
void _notify_filesystem_changed();
192194
void _scan_filesystem();
193195
void _first_scan_filesystem();
194196
void _first_scan_process_scripts(const ScannedDirectory *p_scan_dir, HashSet<String> &p_existing_class_names);

editor/import/3d/resource_importer_obj.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static Error _parse_material_library(const String &p_path, HashMap<String, Ref<S
202202
return OK;
203203
}
204204

205-
static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes, bool p_single_mesh, bool p_generate_tangents, bool p_optimize, Vector3 p_scale_mesh, Vector3 p_offset_mesh, bool p_disable_compression, List<String> *r_missing_deps) {
205+
static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes, bool p_single_mesh, bool p_generate_tangents, Vector3 p_scale_mesh, Vector3 p_offset_mesh, bool p_disable_compression, List<String> *r_missing_deps) {
206206
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
207207
ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, vformat("Couldn't open OBJ file '%s', it may not exist or not be readable.", p_path));
208208

@@ -512,7 +512,7 @@ static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes,
512512
Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, const HashMap<StringName, Variant> &p_options, List<String> *r_missing_deps, Error *r_err) {
513513
List<Ref<ImporterMesh>> meshes;
514514

515-
Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, false, Vector3(1, 1, 1), Vector3(0, 0, 0), p_flags & IMPORT_FORCE_DISABLE_MESH_COMPRESSION, r_missing_deps);
515+
Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, Vector3(1, 1, 1), Vector3(0, 0, 0), p_flags & IMPORT_FORCE_DISABLE_MESH_COMPRESSION, r_missing_deps);
516516

517517
if (err != OK) {
518518
if (r_err) {
@@ -583,7 +583,6 @@ void ResourceImporterOBJ::get_import_options(const String &p_path, List<ImportOp
583583
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true));
584584
r_options->push_back(ImportOption(PropertyInfo(Variant::VECTOR3, "scale_mesh"), Vector3(1, 1, 1)));
585585
r_options->push_back(ImportOption(PropertyInfo(Variant::VECTOR3, "offset_mesh"), Vector3(0, 0, 0)));
586-
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "optimize_mesh"), true));
587586
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "force_disable_mesh_compression"), false));
588587
}
589588

@@ -594,7 +593,7 @@ bool ResourceImporterOBJ::get_option_visibility(const String &p_path, const Stri
594593
Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
595594
List<Ref<ImporterMesh>> meshes;
596595

597-
Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["optimize_mesh"], p_options["scale_mesh"], p_options["offset_mesh"], p_options["force_disable_mesh_compression"], nullptr);
596+
Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["scale_mesh"], p_options["offset_mesh"], p_options["force_disable_mesh_compression"], nullptr);
598597

599598
ERR_FAIL_COND_V(err != OK, err);
600599
ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG);

0 commit comments

Comments
 (0)