diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_asset_installer.cpp | 8 | ||||
-rw-r--r-- | editor/editor_audio_buses.cpp | 2 | ||||
-rw-r--r-- | editor/editor_export.cpp | 10 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 19 | ||||
-rw-r--r-- | editor/plugins/cpu_particles_2d_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 33 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 4 |
10 files changed, 60 insertions, 39 deletions
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index ea76aad168..86611bd20a 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -195,7 +195,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { String res_path = "res://" + path; if (FileAccess::exists(res_path)) { ti->set_custom_color(0, get_color("error_color", "Editor")); - ti->set_tooltip(0, res_path + " (Already Exists)"); + ti->set_tooltip(0, vformat(TTR("%s (Already Exists)"), res_path)); ti->set_checked(0, false); } else { ti->set_tooltip(0, res_path); @@ -288,11 +288,11 @@ void EditorAssetInstaller::ok_pressed() { unzClose(pkg); if (failed_files.size()) { - String msg = "The following files failed extraction from package:\n\n"; + String msg = TTR("The following files failed extraction from package:") + "\n\n"; for (int i = 0; i < failed_files.size(); i++) { if (i > 15) { - msg += "\nAnd " + itos(failed_files.size() - i) + " more files."; + msg += "\n" + vformat(TTR("And %s more files."), itos(failed_files.size() - i)); break; } msg += failed_files[i]; @@ -317,7 +317,7 @@ EditorAssetInstaller::EditorAssetInstaller() { add_child(vb); tree = memnew(Tree); - vb->add_margin_child("Package Contents:", tree, true); + vb->add_margin_child(TTR("Package Contents:"), tree, true); tree->connect("item_edited", this, "_item_edited"); error = memnew(AcceptDialog); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 07b4a1ea31..365238222f 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1290,7 +1290,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { Error err = ResourceSaver::save(p_string, AudioServer::get_singleton()->generate_bus_layout()); if (err != OK) { - EditorNode::get_singleton()->show_warning("Error saving file: " + p_string); + EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_string)); return; } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 72530e23b9..264206472b 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -32,6 +32,7 @@ #include "core/crypto/crypto_core.h" #include "core/io/config_file.h" +#include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" @@ -970,11 +971,12 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c int64_t pck_start_pos = f->get_position(); - f->store_32(0x43504447); //GDPC - f->store_32(1); //pack version + f->store_32(PACK_HEADER_MAGIC); + f->store_32(PACK_FORMAT_VERSION); f->store_32(VERSION_MAJOR); f->store_32(VERSION_MINOR); - f->store_32(0); //hmph + f->store_32(VERSION_PATCH); + for (int i = 0; i < 16; i++) { //reserved f->store_32(0); @@ -1049,7 +1051,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c int64_t pck_size = f->get_position() - pck_start_pos; f->store_64(pck_size); - f->store_32(0x43504447); //GDPC + f->store_32(PACK_HEADER_MAGIC); if (r_embedded_size) { *r_embedded_size = f->get_position() - embed_pos; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 4949d1a4e5..f5128103f3 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1479,9 +1479,16 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (d.has("alphaMode")) { const String &am = d["alphaMode"]; - if (am != "OPAQUE") { + if (am == "BLEND") { material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS); + } else if (am == "MASK") { + material->set_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR, true); + if (d.has("alphaCutoff")) { + material->set_alpha_scissor_threshold(d["alphaCutoff"]); + } else { + material->set_alpha_scissor_threshold(0.5f); + } } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 71afddba11..2b0c582b49 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4216,11 +4216,13 @@ void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) { void CanvasItemEditor::_update_zoom_label() { String zoom_text; + // The zoom level displayed is relative to the editor scale + // (like in most image editors). if (zoom >= 10) { - // Don't show a decimal when the zoom level is higher than 1000 % - zoom_text = rtos(Math::round(zoom * 100)) + " %"; + // Don't show a decimal when the zoom level is higher than 1000 %. + zoom_text = rtos(Math::round((zoom / EDSCALE) * 100)) + " %"; } else { - zoom_text = rtos(Math::stepify(zoom * 100, 0.1)) + " %"; + zoom_text = rtos(Math::stepify((zoom / EDSCALE) * 100, 0.1)) + " %"; } zoom_reset->set_text(zoom_text); @@ -4231,7 +4233,7 @@ void CanvasItemEditor::_button_zoom_minus() { } void CanvasItemEditor::_button_zoom_reset() { - _zoom_on_position(1.0, viewport_scrollable->get_size() / 2.0); + _zoom_on_position(1.0 * EDSCALE, viewport_scrollable->get_size() / 2.0); } void CanvasItemEditor::_button_zoom_plus() { @@ -4993,7 +4995,8 @@ void CanvasItemEditor::_bind_methods() { Dictionary CanvasItemEditor::get_state() const { Dictionary state; - state["zoom"] = zoom; + // Take the editor scale into account. + state["zoom"] = zoom / EDSCALE; state["ofs"] = view_offset; state["grid_offset"] = grid_offset; state["grid_step"] = grid_step; @@ -5030,7 +5033,9 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { bool update_scrollbars = false; Dictionary state = p_state; if (state.has("zoom")) { - zoom = p_state["zoom"]; + // Compensate the editor scale, so that the editor scale can be changed + // and the zoom level will still be the same (relative to the editor scale). + zoom = float(p_state["zoom"]) * EDSCALE; _update_zoom_label(); } @@ -5246,7 +5251,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { show_rulers = true; show_guides = true; show_edit_locks = true; - zoom = 1; + zoom = 1.0 / EDSCALE; view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH); previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen grid_offset = Point2(); diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 33ae9363dc..655048c271 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -296,9 +296,9 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { emission_mask->add_child(emvb); emission_mask_mode = memnew(OptionButton); emvb->add_margin_child(TTR("Emission Mask"), emission_mask_mode); - emission_mask_mode->add_item("Solid Pixels", EMISSION_MODE_SOLID); - emission_mask_mode->add_item("Border Pixels", EMISSION_MODE_BORDER); - emission_mask_mode->add_item("Directed Border Pixels", EMISSION_MODE_BORDER_DIRECTED); + emission_mask_mode->add_item(TTR("Solid Pixels"), EMISSION_MODE_SOLID); + emission_mask_mode->add_item(TTR("Border Pixels"), EMISSION_MODE_BORDER); + emission_mask_mode->add_item(TTR("Directed Border Pixels"), EMISSION_MODE_BORDER_DIRECTED); emission_colors = memnew(CheckBox); emission_colors->set_text(TTR("Capture from Pixel")); emvb->add_margin_child(TTR("Emission Colors"), emission_colors); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 441739de5f..b036368bc8 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -424,9 +424,9 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { emission_mask->add_child(emvb); emission_mask_mode = memnew(OptionButton); emvb->add_margin_child(TTR("Emission Mask"), emission_mask_mode); - emission_mask_mode->add_item("Solid Pixels", EMISSION_MODE_SOLID); - emission_mask_mode->add_item("Border Pixels", EMISSION_MODE_BORDER); - emission_mask_mode->add_item("Directed Border Pixels", EMISSION_MODE_BORDER_DIRECTED); + emission_mask_mode->add_item(TTR("Solid Pixels"), EMISSION_MODE_SOLID); + emission_mask_mode->add_item(TTR("Border Pixels"), EMISSION_MODE_BORDER); + emission_mask_mode->add_item(TTR("Directed Border Pixels"), EMISSION_MODE_BORDER_DIRECTED); emission_colors = memnew(CheckBox); emission_colors->set_text(TTR("Capture from Pixel")); emvb->add_margin_child(TTR("Emission Colors"), emission_colors); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 26f2968369..294bedd598 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -136,13 +136,19 @@ void TextureRegionEditor::_region_draw() { Ref<Texture> select_handle = get_icon("EditorHandle", "EditorIcons"); - Rect2 scroll_rect; + Rect2 scroll_rect(Point2(), base_tex->get_size()); - Vector2 endpoints[4] = { - mtx.basis_xform(rect.position), - mtx.basis_xform(rect.position + Vector2(rect.size.x, 0)), - mtx.basis_xform(rect.position + rect.size), - mtx.basis_xform(rect.position + Vector2(0, rect.size.y)) + const Vector2 raw_endpoints[4] = { + rect.position, + rect.position + Vector2(rect.size.x, 0), + rect.position + rect.size, + rect.position + Vector2(0, rect.size.y) + }; + const Vector2 endpoints[4] = { + mtx.basis_xform(raw_endpoints[0]), + mtx.basis_xform(raw_endpoints[1]), + mtx.basis_xform(raw_endpoints[2]), + mtx.basis_xform(raw_endpoints[3]) }; Color color = get_color("mono_color", "Editor"); for (int i = 0; i < 4; i++) { @@ -164,31 +170,32 @@ void TextureRegionEditor::_region_draw() { if (snap_mode != SNAP_AUTOSLICE) edit_draw->draw_texture(select_handle, (endpoints[i] + ofs - (select_handle->get_size() / 2)).floor() - draw_ofs * draw_zoom); - scroll_rect.expand_to(endpoints[i]); + scroll_rect.expand_to(raw_endpoints[i]); } - scroll_rect.position -= edit_draw->get_size(); - scroll_rect.size += edit_draw->get_size() * 2.0; + const Size2 scroll_margin = edit_draw->get_size() / draw_zoom; + scroll_rect.position -= scroll_margin; + scroll_rect.size += scroll_margin * 2; updating_scroll = true; hscroll->set_min(scroll_rect.position.x); hscroll->set_max(scroll_rect.position.x + scroll_rect.size.x); - if (ABS(scroll_rect.position.x - (scroll_rect.position.x + scroll_rect.size.x)) <= edit_draw->get_size().x) { + if (ABS(scroll_rect.position.x - (scroll_rect.position.x + scroll_rect.size.x)) <= scroll_margin.x) { hscroll->hide(); } else { hscroll->show(); - hscroll->set_page(edit_draw->get_size().x); + hscroll->set_page(scroll_margin.x); hscroll->set_value(draw_ofs.x); } vscroll->set_min(scroll_rect.position.y); vscroll->set_max(scroll_rect.position.y + scroll_rect.size.y); - if (ABS(scroll_rect.position.y - (scroll_rect.position.y + scroll_rect.size.y)) <= edit_draw->get_size().y) { + if (ABS(scroll_rect.position.y - (scroll_rect.position.y + scroll_rect.size.y)) <= scroll_margin.y) { vscroll->hide(); draw_ofs.y = scroll_rect.position.y; } else { vscroll->show(); - vscroll->set_page(edit_draw->get_size().y); + vscroll->set_page(scroll_margin.y); vscroll->set_value(draw_ofs.y); } updating_scroll = false; diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 4c36e15eb4..e1f9ed497c 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -46,7 +46,7 @@ void ScriptCreateDialog::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_ENTER_TREE: { for (int i = 0; i < ScriptServer::get_language_count(); i++) { - String lang = ScriptServer::get_language(i)->get_name(); + String lang = ScriptServer::get_language(i)->get_type(); Ref<Texture> lang_icon = get_icon(lang, "EditorIcons"); if (lang_icon.is_valid()) { language_menu->set_item_icon(i, lang_icon); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 3ea5272ebf..89713c2579 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -736,11 +736,11 @@ void EditorSpatialGizmo::set_plugin(EditorSpatialGizmoPlugin *p_plugin) { void EditorSpatialGizmo::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_lines", "lines", "material", "billboard"), &EditorSpatialGizmo::add_lines, DEFVAL(false), DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("add_lines", "lines", "material", "billboard", "modulate"), &EditorSpatialGizmo::add_lines, DEFVAL(false), DEFVAL(Color(1, 1, 1))); ClassDB::bind_method(D_METHOD("add_mesh", "mesh", "billboard", "skeleton", "material"), &EditorSpatialGizmo::add_mesh, DEFVAL(false), DEFVAL(Ref<SkinReference>()), DEFVAL(Variant())); ClassDB::bind_method(D_METHOD("add_collision_segments", "segments"), &EditorSpatialGizmo::add_collision_segments); ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles"), &EditorSpatialGizmo::add_collision_triangles); - ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1), DEFVAL(Color(1, 1, 1))); + ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale", "modulate"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1), DEFVAL(Color(1, 1, 1))); ClassDB::bind_method(D_METHOD("add_handles", "handles", "material", "billboard", "secondary"), &EditorSpatialGizmo::add_handles, DEFVAL(false), DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_spatial_node", "node"), &EditorSpatialGizmo::_set_spatial_node); ClassDB::bind_method(D_METHOD("get_spatial_node"), &EditorSpatialGizmo::get_spatial_node); |