diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 12:53:28 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-10-07 11:32:33 +0300 |
commit | 0103af1ddda6a2aa31227965141dd7d3a513e081 (patch) | |
tree | b0965bb65919bc1495ee02204a91e5ed3a9b56a7 /editor/import | |
parent | 5b7f62af55b7f322192f95258d825b163cbf9dc1 (diff) |
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/audio_stream_import_settings.cpp | 14 | ||||
-rw-r--r-- | editor/import/dynamic_font_import_settings.cpp | 12 | ||||
-rw-r--r-- | editor/import/editor_import_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/import/resource_importer_layered_texture.cpp | 18 | ||||
-rw-r--r-- | editor/import/resource_importer_texture.cpp | 30 |
5 files changed, 39 insertions, 39 deletions
diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index e3da82a5cb..d94b517003 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -76,7 +76,7 @@ void AudioStreamImportSettings::_notification(int p_what) { void AudioStreamImportSettings::_draw_preview() { Rect2 rect = _preview->get_rect(); - Size2 size = rect.size; + Size2 rect_size = rect.size; Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream); float preview_offset = zoom_bar->get_value(); @@ -85,7 +85,7 @@ void AudioStreamImportSettings::_draw_preview() { Ref<Font> beat_font = get_theme_font(SNAME("main"), SNAME("EditorFonts")); int main_size = get_theme_font_size(SNAME("main_size"), SNAME("EditorFonts")); Vector<Vector2> lines; - lines.resize(size.width * 2); + lines.resize(rect_size.width * 2); Color color_active = get_theme_color(SNAME("contrast_color_2"), SNAME("Editor")); Color color_inactive = color_active; color_inactive.a *= 0.5; @@ -107,9 +107,9 @@ void AudioStreamImportSettings::_draw_preview() { } } - for (int i = 0; i < size.width; i++) { - float ofs = preview_offset + i * preview_len / size.width; - float ofs_n = preview_offset + (i + 1) * preview_len / size.width; + for (int i = 0; i < rect_size.width; i++) { + float ofs = preview_offset + i * preview_len / rect_size.width; + float ofs_n = preview_offset + (i + 1) * preview_len / rect_size.width; float max = preview->get_max(ofs, ofs_n) * 0.5 + 0.5; float min = preview->get_min(ofs, ofs_n) * 0.5 + 0.5; @@ -139,8 +139,8 @@ void AudioStreamImportSettings::_draw_preview() { int bar_beats = stream->get_bar_beats(); int last_text_end_x = 0; - for (int i = 0; i < size.width; i++) { - float ofs = preview_offset + i * preview_len / size.width; + for (int i = 0; i < rect_size.width; i++) { + float ofs = preview_offset + i * preview_len / rect_size.width; int beat = int(ofs / beat_size); if (beat != prev_beat) { String text = itos(beat); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 1e0f45419f..5585c8edd2 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -949,11 +949,11 @@ void DynamicFontImportSettings::_re_import() { void DynamicFontImportSettings::open_settings(const String &p_path) { // Load base font data. - Vector<uint8_t> data = FileAccess::get_file_as_array(p_path); + Vector<uint8_t> font_data = FileAccess::get_file_as_array(p_path); // Load font for preview. font_preview.instantiate(); - font_preview->set_data(data); + font_preview->set_data(font_data); String font_name = vformat("%s (%s)", font_preview->get_font_name(), font_preview->get_font_style_name()); String sample; @@ -976,7 +976,7 @@ void DynamicFontImportSettings::open_settings(const String &p_path) { // Load second copy of font with MSDF disabled for the glyph table and metadata extraction. font_main.instantiate(); - font_main->set_data(data); + font_main->set_data(font_data); font_main->set_multichannel_signed_distance_field(false); text_edit->add_theme_font_override("font", font_main); @@ -1036,7 +1036,7 @@ void DynamicFontImportSettings::open_settings(const String &p_path) { double embolden = preload_config.has("variation_embolden") ? preload_config["variation_embolden"].operator double() : 0; int face_index = preload_config.has("variation_face_index") ? preload_config["variation_face_index"].operator int() : 0; Transform2D transform = preload_config.has("variation_transform") ? preload_config["variation_transform"].operator Transform2D() : Transform2D(); - Vector2i size = preload_config.has("size") ? preload_config["size"].operator Vector2i() : Vector2i(16, 0); + Vector2i font_size = preload_config.has("size") ? preload_config["size"].operator Vector2i() : Vector2i(16, 0); String cfg_name = preload_config.has("name") ? preload_config["name"].operator String() : vformat("Configuration %d", i); TreeItem *vars_item = vars_list->create_item(vars_list_root); @@ -1061,8 +1061,8 @@ void DynamicFontImportSettings::open_settings(const String &p_path) { import_variation_data_custom->options = options_variations; vars_item->set_metadata(0, import_variation_data_custom); - import_variation_data_custom->set("size", size.x); - import_variation_data_custom->set("outline_size", size.y); + import_variation_data_custom->set("size", font_size.x); + import_variation_data_custom->set("outline_size", font_size.y); import_variation_data_custom->set("variation_opentype", variation); import_variation_data_custom->set("variation_embolden", embolden); import_variation_data_custom->set("variation_face_index", face_index); diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp index 5211f003c1..5d684fc5db 100644 --- a/editor/import/editor_import_plugin.cpp +++ b/editor/import/editor_import_plugin.cpp @@ -154,7 +154,7 @@ bool EditorImportPlugin::get_option_visibility(const String &p_path, const Strin d[E->key] = E->value; ++E; } - bool visible; + bool visible = false; if (GDVIRTUAL_CALL(_get_option_visibility, p_path, p_option, d, visible)) { return visible; } @@ -172,7 +172,7 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa ++E; } - int err; + int err = 0; if (GDVIRTUAL_CALL(_import, p_source_file, p_save_path, options, platform_variants, gen_files, err)) { Error ret_err = Error(err); diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index ed83535421..9dafa47c1c 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -396,12 +396,12 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const texture_import->used_channels = used_channels; _check_compress_ctex(p_source_file, texture_import); if (r_metadata) { - Dictionary metadata; - metadata["vram_texture"] = compress_mode == COMPRESS_VRAM_COMPRESSED; + Dictionary meta; + meta["vram_texture"] = compress_mode == COMPRESS_VRAM_COMPRESSED; if (formats_imported.size()) { - metadata["imported_formats"] = formats_imported; + meta["imported_formats"] = formats_imported; } - *r_metadata = metadata; + *r_metadata = meta; } return OK; @@ -432,20 +432,20 @@ String ResourceImporterLayeredTexture::get_import_settings_string() const { bool ResourceImporterLayeredTexture::are_import_settings_valid(const String &p_path) const { //will become invalid if formats are missing to import - Dictionary metadata = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path); + Dictionary meta = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path); - if (!metadata.has("vram_texture")) { + if (!meta.has("vram_texture")) { return false; } - bool vram = metadata["vram_texture"]; + bool vram = meta["vram_texture"]; if (!vram) { return true; //do not care about non vram } Vector<String> formats_imported; - if (metadata.has("imported_formats")) { - formats_imported = metadata["imported_formats"]; + if (meta.has("imported_formats")) { + formats_imported = meta["imported_formats"]; } int index = 0; diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c06756ff0b..73f1c0b39b 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -669,23 +669,23 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String } if (r_metadata) { - Dictionary metadata; - metadata["vram_texture"] = compress_mode == COMPRESS_VRAM_COMPRESSED; + Dictionary meta; + meta["vram_texture"] = compress_mode == COMPRESS_VRAM_COMPRESSED; if (formats_imported.size()) { - metadata["imported_formats"] = formats_imported; + meta["imported_formats"] = formats_imported; } if (editor_image.is_valid()) { - metadata["has_editor_variant"] = true; + meta["has_editor_variant"] = true; if (use_editor_scale) { - metadata["editor_scale"] = EDSCALE; + meta["editor_scale"] = EDSCALE; } if (convert_editor_colors) { - metadata["editor_dark_theme"] = EditorSettings::get_singleton()->is_dark_theme(); + meta["editor_dark_theme"] = EditorSettings::get_singleton()->is_dark_theme(); } } - *r_metadata = metadata; + *r_metadata = meta; } return OK; } @@ -715,29 +715,29 @@ String ResourceImporterTexture::get_import_settings_string() const { bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) const { //will become invalid if formats are missing to import - Dictionary metadata = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path); + Dictionary meta = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path); - if (metadata.has("has_editor_variant")) { - if (metadata.has("editor_scale") && (float)metadata["editor_scale"] != EDSCALE) { + if (meta.has("has_editor_variant")) { + if (meta.has("editor_scale") && (float)meta["editor_scale"] != EDSCALE) { return false; } - if (metadata.has("editor_dark_theme") && (bool)metadata["editor_dark_theme"] != EditorSettings::get_singleton()->is_dark_theme()) { + if (meta.has("editor_dark_theme") && (bool)meta["editor_dark_theme"] != EditorSettings::get_singleton()->is_dark_theme()) { return false; } } - if (!metadata.has("vram_texture")) { + if (!meta.has("vram_texture")) { return false; } - bool vram = metadata["vram_texture"]; + bool vram = meta["vram_texture"]; if (!vram) { return true; // Do not care about non-VRAM. } Vector<String> formats_imported; - if (metadata.has("imported_formats")) { - formats_imported = metadata["imported_formats"]; + if (meta.has("imported_formats")) { + formats_imported = meta["imported_formats"]; } int index = 0; |