diff options
Diffstat (limited to 'editor')
32 files changed, 176 insertions, 95 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 3f773c646a..0a60aabd2d 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -856,7 +856,6 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { HBoxContainer *audioprev_hbc = memnew(HBoxContainer); audioprev_hbc->set_v_size_flags(SIZE_EXPAND_FILL); audioprev_hbc->set_h_size_flags(SIZE_EXPAND_FILL); - audioprev_hbc->set_mouse_filter(MOUSE_FILTER_PASS); audio_value_preview_box->add_child(audioprev_hbc); audio_value_preview_label = memnew(Label); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index d66b386f93..3d8ea0b040 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -748,7 +748,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & config.instance(); Error err = config->load(path + ".import"); if (err != OK) { - ERR_PRINTS("Could not parse: '" + path + "', not exported."); + ERR_PRINT("Could not parse: '" + path + "', not exported."); continue; } diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index a4a7a0cd45..559a0ef0ea 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -192,14 +192,14 @@ Error EditorFeatureProfile::load_from_file(const String &p_path) { Variant v; err = JSON::parse(text, v, err_str, err_line); if (err != OK) { - ERR_PRINTS("Error parsing '" + p_path + "' on line " + itos(err_line) + ": " + err_str); + ERR_PRINT("Error parsing '" + p_path + "' on line " + itos(err_line) + ": " + err_str); return ERR_PARSE_ERROR; } Dictionary json = v; if (!json.has("type") || String(json["type"]) != "feature_profile") { - ERR_PRINTS("Error parsing '" + p_path + "', it's not a feature profile."); + ERR_PRINT("Error parsing '" + p_path + "', it's not a feature profile."); return ERR_PARSE_ERROR; } @@ -298,7 +298,7 @@ void EditorFeatureProfileManager::_notification(int p_what) { current.instance(); Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile")); if (err != OK) { - ERR_PRINTS("Error loading default feature profile: " + current_profile); + ERR_PRINT("Error loading default feature profile: " + current_profile); current_profile = String(); current.unref(); } diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 5abb3c4ec2..04fe6e5ce6 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -387,7 +387,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo if (err == ERR_FILE_EOF) { break; } else if (err != OK) { - ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'."); + ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'."); memdelete(f); return false; //parse error, try reimport manually (Avoid reimport loop on broken file) } @@ -435,7 +435,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo if (err == ERR_FILE_EOF) { break; } else if (err != OK) { - ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import.md5:" + itos(lines) + "' error '" + error_text + "'."); + ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import.md5:" + itos(lines) + "' error '" + error_text + "'."); memdelete(md5s); return false; // parse error } @@ -734,7 +734,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess da->change_dir(".."); } } else { - ERR_PRINTS("Cannot go into subdir '" + E->get() + "'."); + ERR_PRINT("Cannot go into subdir '" + E->get() + "'."); } p_progress.update(idx, total); @@ -1114,7 +1114,7 @@ void EditorFileSystem::_notification(int p_what) { Thread::wait_to_finish(thread); memdelete(thread); thread = NULL; - WARN_PRINTS("Scan thread aborted..."); + WARN_PRINT("Scan thread aborted..."); set_process(false); } @@ -1780,7 +1780,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) { Error err = importer->import(p_file, base_path, params, &import_variants, &gen_files, &metadata); if (err != OK) { - ERR_PRINTS("Error importing '" + p_file + "'."); + ERR_PRINT("Error importing '" + p_file + "'."); } //as import is complete, save the .import file diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 700d9b692b..80981e8fa1 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -307,7 +307,7 @@ bool EditorHelpSearch::Runner::_slice() { case PHASE_MAX: return true; default: - WARN_PRINTS("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search."); + WARN_PRINT("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search."); return true; }; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dd15910d09..7d0601e8db 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2732,7 +2732,7 @@ void EditorNode::_tool_menu_option(int p_idx) { handler->call(callback, (const Variant **)&ud, 1, ce); if (ce.error != Variant::CallError::CALL_OK) { String err = Variant::get_call_error_text(handler, callback, (const Variant **)&ud, 1, ce); - ERR_PRINTS("Error calling function from tool menu: " + err); + ERR_PRINT("Error calling function from tool menu: " + err); } } // else it's a submenu so don't do anything. } break; @@ -3042,7 +3042,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, } ps->set("editor_plugins/enabled", enabled_plugins); ps->save(); - WARN_PRINTS("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins."); + WARN_PRINT("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins."); return; } Error err = cf->load(addon_path); @@ -3988,7 +3988,7 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) { warning->set_title(p_title); warning->popup_centered_minsize(); } else { - WARN_PRINTS(p_title + " " + p_text); + WARN_PRINT(p_title + " " + p_text); } } diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index b81a996956..16decf5c04 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -96,28 +96,28 @@ void EditorPluginSettings::update_plugins() { Error err2 = cf->load(path); if (err2 != OK) { - WARN_PRINTS("Can't load plugin config: " + path); + WARN_PRINT("Can't load plugin config: " + path); } else { bool key_missing = false; if (!cf->has_section_key("plugin", "name")) { - WARN_PRINTS("Plugin config misses \"plugin/name\" key: " + path); + WARN_PRINT("Plugin config misses \"plugin/name\" key: " + path); key_missing = true; } if (!cf->has_section_key("plugin", "author")) { - WARN_PRINTS("Plugin config misses \"plugin/author\" key: " + path); + WARN_PRINT("Plugin config misses \"plugin/author\" key: " + path); key_missing = true; } if (!cf->has_section_key("plugin", "version")) { - WARN_PRINTS("Plugin config misses \"plugin/version\" key: " + path); + WARN_PRINT("Plugin config misses \"plugin/version\" key: " + path); key_missing = true; } if (!cf->has_section_key("plugin", "description")) { - WARN_PRINTS("Plugin config misses \"plugin/description\" key: " + path); + WARN_PRINT("Plugin config misses \"plugin/description\" key: " + path); key_missing = true; } if (!cf->has_section_key("plugin", "script")) { - WARN_PRINTS("Plugin config misses \"plugin/script\" key: " + path); + WARN_PRINT("Plugin config misses \"plugin/script\" key: " + path); key_missing = true; } diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 3fdeaff19d..e5a9c4d699 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -165,12 +165,10 @@ void EditorProfiler::_item_edited() { void EditorProfiler::_update_plot() { - int w = graph->get_size().width; - int h = graph->get_size().height; - + const int w = graph->get_size().width; + const int h = graph->get_size().height; bool reset_texture = false; - - int desired_len = w * h * 4; + const int desired_len = w * h * 4; if (graph_image.size() != desired_len) { reset_texture = true; @@ -178,18 +176,19 @@ void EditorProfiler::_update_plot() { } PoolVector<uint8_t>::Write wr = graph_image.write(); + const Color background_color = get_color("dark_color_2", "Editor"); - //clear + // Clear the previous frame and set the background color. for (int i = 0; i < desired_len; i += 4) { - wr[i + 0] = 0; - wr[i + 1] = 0; - wr[i + 2] = 0; + wr[i + 0] = Math::fast_ftoi(background_color.r * 255); + wr[i + 1] = Math::fast_ftoi(background_color.g * 255); + wr[i + 2] = Math::fast_ftoi(background_color.b * 255); wr[i + 3] = 255; } //find highest value - bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME; + const bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME; float highest = 0; for (int i = 0; i < frame_metrics.size(); i++) { @@ -321,21 +320,23 @@ void EditorProfiler::_update_plot() { for (int j = 0; j < h * 4; j += 4) { - int a = column[j + 3]; + const int a = column[j + 3]; if (a > 0) { column[j + 0] /= a; column[j + 1] /= a; column[j + 2] /= a; } - uint8_t r = uint8_t(column[j + 0]); - uint8_t g = uint8_t(column[j + 1]); - uint8_t b = uint8_t(column[j + 2]); + const uint8_t red = uint8_t(column[j + 0]); + const uint8_t green = uint8_t(column[j + 1]); + const uint8_t blue = uint8_t(column[j + 2]); + const bool is_filled = red >= 1 || green >= 1 || blue >= 1; + const int widx = ((j >> 2) * w + i) * 4; - int widx = ((j >> 2) * w + i) * 4; - wr[widx + 0] = r; - wr[widx + 1] = g; - wr[widx + 2] = b; + // If the pixel isn't filled by any profiler line, apply the background color instead. + wr[widx + 0] = is_filled ? red : Math::fast_ftoi(background_color.r * 255); + wr[widx + 1] = is_filled ? green : Math::fast_ftoi(background_color.g * 255); + wr[widx + 2] = is_filled ? blue : Math::fast_ftoi(background_color.b * 255); wr[widx + 3] = 255; } } diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index f63d4884e2..1f2a02c9a0 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -297,7 +297,7 @@ void EditorResourcePreview::_thread() { if (!f) { // Not returning as this would leave the thread hanging and would require // some proper cleanup/disabling of resource preview generation. - ERR_PRINTS("Cannot create file '" + file + "'. Check user write permissions."); + ERR_PRINT("Cannot create file '" + file + "'. Check user write permissions."); } else { f->store_line(itos(thumbnail_size)); f->store_line(itos(has_small_texture)); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 92e3f61ca5..715ce6bea7 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -148,7 +148,7 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const { const VariantContainer *v = props.getptr(p_name); if (!v) { - WARN_PRINTS("EditorSettings::_get - Property not found: " + String(p_name)); + WARN_PRINT("EditorSettings::_get - Property not found: " + String(p_name)); return false; } r_ret = v->variant; @@ -794,13 +794,13 @@ void EditorSettings::create() { self_contained = true; Error err = extra_config->load(exe_path + "/._sc_"); if (err != OK) { - ERR_PRINTS("Can't load config from path '" + exe_path + "/._sc_'."); + ERR_PRINT("Can't load config from path '" + exe_path + "/._sc_'."); } } else if (d->file_exists(exe_path + "/_sc_")) { self_contained = true; Error err = extra_config->load(exe_path + "/_sc_"); if (err != OK) { - ERR_PRINTS("Can't load config from path '" + exe_path + "/_sc_'."); + ERR_PRINT("Can't load config from path '" + exe_path + "/_sc_'."); } } memdelete(d); @@ -1056,7 +1056,7 @@ void EditorSettings::save() { Error err = ResourceSaver::save(singleton->config_file_path, singleton); if (err != OK) { - ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path); + ERR_PRINT("Error saving editor settings to " + singleton->config_file_path); } else { print_verbose("EditorSettings: Save OK!"); } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 8037045e77..28bc20a957 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -35,7 +35,11 @@ #include "editor_icons.gen.h" #include "editor_scale.h" #include "editor_settings.h" + +#include "modules/modules_enabled.gen.h" +#ifdef MODULE_SVG_ENABLED #include "modules/svg/image_loader_svg.h" +#endif static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) { Ref<StyleBoxTexture> style(memnew(StyleBoxTexture)); @@ -109,7 +113,7 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) { -#ifdef SVG_ENABLED +#ifdef MODULE_SVG_ENABLED // The default icon theme is designed to be used for a dark theme. // This dictionary stores color codes to convert to other colors // for better readability on a light theme. diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp index 0562c3ba43..c420cf44e7 100644 --- a/editor/editor_vcs_interface.cpp +++ b/editor/editor_vcs_interface.cpp @@ -63,7 +63,7 @@ void EditorVCSInterface::_bind_methods() { bool EditorVCSInterface::_initialize(String p_project_root_path) { - WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.") + WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed."); return true; } diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index cb636f8cdc..7ed6688154 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -638,7 +638,7 @@ Error ExportTemplateManager::install_android_template() { FileAccess::set_unix_permissions(to_write, (info.external_fa >> 16) & 0x01FF); #endif } else { - ERR_PRINTS("Can't uncompress file: " + to_write); + ERR_PRINT("Can't uncompress file: " + to_write); } } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 62effb406d..5041441ac3 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1413,17 +1413,13 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw if (!can_move) { // Ask to do something. overwrite_dialog->popup_centered_minsize(); - overwrite_dialog->grab_focus(); return; } } // Check groups. for (int i = 0; i < to_move.size(); i++) { - - print_line("is group: " + to_move[i].path + ": " + itos(EditorFileSystem::get_singleton()->is_group_file(to_move[i].path))); if (to_move[i].is_file && EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)) { - print_line("move to: " + p_to_path.plus_file(to_move[i].path.get_file())); EditorFileSystem::get_singleton()->move_group_file(to_move[i].path, p_to_path.plus_file(to_move[i].path.get_file())); } } @@ -1442,7 +1438,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw if (is_moved) { int current_tab = editor->get_current_tab(); - _save_scenes_after_move(file_renames); //save scenes before updating + _save_scenes_after_move(file_renames); // Save scenes before updating. _update_dependencies_after_move(file_renames); _update_resource_paths_after_move(file_renames); _update_project_settings_after_move(file_renames); @@ -1948,7 +1944,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return false; // Attempting to move a folder into itself will fail later, - // rather than bring up a message don't try to do it in the first place + // rather than bring up a message don't try to do it in the first place. to_dir = to_dir.ends_with("/") ? to_dir : (to_dir + "/"); Vector<String> fnames = drag_data["files"]; for (int i = 0; i < fnames.size(); ++i) { @@ -2050,11 +2046,15 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, Vector<String> fnames = drag_data["files"]; to_move.clear(); for (int i = 0; i < fnames.size(); i++) { - to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/"))); + if (fnames[i].get_base_dir() != to_dir) { + to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/"))); + } + } + if (!to_move.empty()) { + _move_operation_confirm(to_dir); } - _move_operation_confirm(to_dir); } else if (favorite) { - // Add the files from favorites + // Add the files from favorites. Vector<String> fnames = drag_data["files"]; Vector<String> favorites = EditorSettings::get_singleton()->get_favorites(); for (int i = 0; i < fnames.size(); i++) { @@ -2103,6 +2103,10 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori // We drop on a folder. target = fpath; return; + } else { + // We drop on the folder that the target file is in. + target = fpath.get_base_dir(); + return; } } else { if (ti->get_parent() != tree->get_root()->get_children()) { diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index b3f97714ae..e2d8dc8962 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -892,7 +892,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me material = material_cache[target]; } else if (p.material != "") { - WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + p.material); + WARN_PRINT("Collada: Unreferenced material in geometry instance: " + p.material); } } @@ -1210,7 +1210,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres mesh_cache[meshid] = mesh; } else { - WARN_PRINTS("Collada: Will not import geometry: " + meshid); + WARN_PRINT("Collada: Will not import geometry: " + meshid); } } @@ -1237,7 +1237,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres mi->set_surface_material(i, material); } else if (matname != "") { - WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + matname); + WARN_PRINT("Collada: Unreferenced material in geometry instance: " + matname); } } } @@ -1408,7 +1408,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im node = node_name_map[at.target]; } else { - WARN_PRINTS("Collada: Couldn't find node: " + at.target); + WARN_PRINT("Collada: Couldn't find node: " + at.target); continue; } } else { @@ -1588,7 +1588,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } if (xform_idx == -1) { - WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param + "."); + WARN_PRINT("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param + "."); continue; } @@ -1666,7 +1666,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Collada::Node *cn = collada.state.scene_map[E->key()]; if (cn->ignore_anim) { - WARN_PRINTS("Collada: Ignoring animation on node: " + path); + WARN_PRINT("Collada: Ignoring animation on node: " + path); continue; } @@ -1735,7 +1735,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones //matrix WARN_PRINT("Collada: Value keys for matrices not supported."); } else { - WARN_PRINTS("Collada: Unexpected amount of value keys: " + itos(data.size())); + WARN_PRINT("Collada: Unexpected amount of value keys: " + itos(data.size())); } animation->track_insert_key(track, time, value); diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 2f9135c52c..d4664e1bb9 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "editor_scene_importer_gltf.h" + #include "core/crypto/crypto_core.h" #include "core/io/json.h" #include "core/math/disjoint_set.h" @@ -233,7 +234,7 @@ Error EditorSceneImporterGLTF::_parse_scenes(GLTFState &state) { if (state.json.has("scene")) { loaded_scene = state.json["scene"]; } else { - WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.") + WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene."); } if (scenes.size()) { @@ -2438,7 +2439,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { track->weight_tracks.write[k] = cf; } } else { - WARN_PRINTS("Invalid path '" + path + "'."); + WARN_PRINT("Invalid path '" + path + "'."); } } diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index b1ed59a2db..bdd6a197f8 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -63,7 +63,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati material_map[current_name] = current; } else if (l.begins_with("Ka ")) { //uv - WARN_PRINTS("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR"); + WARN_PRINT("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR"); } else if (l.begins_with("Kd ")) { //normal @@ -119,7 +119,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati } else if (l.begins_with("map_Ka ")) { //uv - WARN_PRINTS("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR"); + WARN_PRINT("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR"); } else if (l.begins_with("map_Kd ")) { //normal diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 07b87633a9..1506ba319c 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -35,9 +35,13 @@ #include "editor/editor_plugin.h" #include "editor/editor_scale.h" #include "editor/project_settings_editor.h" -#include "modules/gdscript/gdscript.h" #include "scene/gui/grid_container.h" +#include "modules/modules_enabled.gen.h" +#ifdef MODULE_GDSCRIPT_ENABLED +#include "modules/gdscript/gdscript.h" +#endif + void PluginConfigDialog::_clear_fields() { name_edit->set_text(""); subfolder_edit->set_text(""); @@ -75,6 +79,9 @@ void PluginConfigDialog::_on_confirmed() { // TODO Use script templates. Right now, this code won't add the 'tool' annotation to other languages. // TODO Better support script languages with named classes (has_named_classes). + // FIXME: It's hacky to have hardcoded access to the GDScript module here. + // The editor code should not have to know what languages are enabled. +#ifdef MODULE_GDSCRIPT_ENABLED if (lang_name == GDScriptLanguage::get_singleton()->get_name()) { // Hard-coded GDScript template to keep usability until we use script templates. Ref<Script> gdscript = memnew(GDScript); @@ -95,12 +102,15 @@ void PluginConfigDialog::_on_confirmed() { ResourceSaver::save(script_path, gdscript); script = gdscript; } else { +#endif String script_path = path.plus_file(script_edit->get_text()); String class_name = script_path.get_file().get_basename(); script = ScriptServer::get_language(lang_idx)->get_template(class_name, "EditorPlugin"); script->set_path(script_path); ResourceSaver::save(script_path, script); +#ifdef MODULE_GDSCRIPT_ENABLED } +#endif emit_signal("plugin_ready", script.operator->(), active_edit->is_pressed() ? subfolder_edit->get_text() : ""); } else { @@ -229,9 +239,11 @@ PluginConfigDialog::PluginConfigDialog() { for (int i = 0; i < ScriptServer::get_language_count(); i++) { ScriptLanguage *lang = ScriptServer::get_language(i); script_option_edit->add_item(lang->get_name()); +#ifdef MODULE_GDSCRIPT_ENABLED if (lang == GDScriptLanguage::get_singleton()) { default_lang = i; } +#endif } script_option_edit->select(default_lang); grid->add_child(script_option_edit); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 4f73a5eaea..2428bf82d4 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -139,8 +139,6 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { set_custom_minimum_size(Size2(250, 100) * EDSCALE); set_h_size_flags(SIZE_EXPAND_FILL); - - set_mouse_filter(MOUSE_FILTER_PASS); } ////////////////////////////////////////////////////////////////////////////// @@ -812,7 +810,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons _image_update(p_code == HTTPClient::RESPONSE_NOT_MODIFIED, true, p_data, p_queue_id); } else { - WARN_PRINTS("Error getting image file from URL: " + image_queue[p_queue_id].image_url); + WARN_PRINT("Error getting image file from URL: " + image_queue[p_queue_id].image_url); Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("FileBrokenBigThumb", "EditorIcons")); @@ -1455,7 +1453,6 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_scroll->add_child(library_vb_border); library_vb_border->add_style_override("panel", border2); library_vb_border->set_h_size_flags(SIZE_EXPAND_FILL); - library_vb_border->set_mouse_filter(MOUSE_FILTER_PASS); library_vb = memnew(VBoxContainer); library_vb->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 1d8f3a2bbd..a0e5b1c6ea 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4967,6 +4967,7 @@ void CanvasItemEditor::_focus_selection(int p_op) { zoom = scale_x < scale_y ? scale_x : scale_y; zoom *= 0.90; viewport->update(); + _update_zoom_label(); call_deferred("_popup_callback", VIEW_CENTER_TO_SELECTION); } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f13abd47a9..1da47196f8 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3209,7 +3209,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list = memnew(ItemList); scripts_vbox->add_child(script_list); - script_list->set_custom_minimum_size(Size2(150, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing + script_list->set_custom_minimum_size(Size2(150, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(140); _sort_list_on_update = true; @@ -3254,14 +3254,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { overview_vbox->add_child(members_overview); members_overview->set_allow_reselect(true); - members_overview->set_custom_minimum_size(Size2(0, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing + members_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing members_overview->set_v_size_flags(SIZE_EXPAND_FILL); members_overview->set_allow_rmb_select(true); help_overview = memnew(ItemList); overview_vbox->add_child(help_overview); help_overview->set_allow_reselect(true); - help_overview->set_custom_minimum_size(Size2(0, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing + help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing help_overview->set_v_size_flags(SIZE_EXPAND_FILL); tab_container = memnew(TabContainer); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index c24a666c55..a19f0b4975 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -369,6 +369,7 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type")); shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); + shader_editor->get_text_edit()->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces")); shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers")); shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); @@ -381,6 +382,9 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed")); shader_editor->get_text_edit()->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/navigation/show_minimap")); shader_editor->get_text_edit()->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width") * EDSCALE); + shader_editor->get_text_edit()->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guideline")); + shader_editor->get_text_edit()->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_column")); + shader_editor->get_text_edit()->set_breakpoint_gutter_enabled(false); } void ShaderEditor::_bind_methods() { diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index 8b5fe7d2c5..9101c64eab 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -103,8 +103,10 @@ void SkeletonEditor::create_physical_skeleton() { PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) { - real_t half_height(skeleton->get_bone_rest(bone_child_id).origin.length() * 0.5); - real_t radius(half_height * 0.2); + const Transform child_rest = skeleton->get_bone_rest(bone_child_id); + + const real_t half_height(child_rest.origin.length() * 0.5); + const real_t radius(half_height * 0.2); CapsuleShape *bone_shape_capsule = memnew(CapsuleShape); bone_shape_capsule->set_height((half_height - radius) * 2); @@ -114,7 +116,8 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i bone_shape->set_shape(bone_shape_capsule); Transform body_transform; - body_transform.origin = Vector3(0, 0, -half_height); + body_transform.set_look_at(Vector3(0, 0, 0), child_rest.origin, Vector3(0, 1, 0)); + body_transform.origin = body_transform.basis.xform(Vector3(0, 0, -half_height)); Transform joint_transform; joint_transform.origin = Vector3(0, 0, half_height); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 507ea0b83d..94aef60f1f 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -546,6 +546,17 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { edit_draw->update(); } } + + Ref<InputEventMagnifyGesture> magnify_gesture = p_input; + if (magnify_gesture.is_valid()) { + _zoom_on_position(draw_zoom * magnify_gesture->get_factor(), magnify_gesture->get_position()); + } + + Ref<InputEventPanGesture> pan_gesture = p_input; + if (pan_gesture.is_valid()) { + hscroll->set_value(hscroll->get_value() + hscroll->get_page() * pan_gesture->get_delta().x / 8); + vscroll->set_value(vscroll->get_value() + vscroll->get_page() * pan_gesture->get_delta().y / 8); + } } void TextureRegionEditor::_scroll_changed(float) { diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index c53fc7e6c5..3622ca8d61 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -203,7 +203,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() { } } else { - WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu.") + WARN_PRINT("No VCS addon is initialized. Select a Version Control Addon from Project menu."); } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index e334d4b093..fb095692bc 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -556,6 +556,7 @@ void VisualShaderEditor::_update_graph() { } Ref<VisualShaderNodeUniform> uniform = vsnode; + Ref<VisualShaderNodeScalarUniform> scalar_uniform = vsnode; if (uniform.is_valid()) { graph->add_child(node); _update_created_node(node); @@ -570,7 +571,9 @@ void VisualShaderEditor::_update_graph() { //shortcut VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0); node->set_slot(0, false, VisualShaderNode::PORT_TYPE_SCALAR, Color(), true, port_right, type_color[port_right]); - continue; + if (!scalar_uniform.is_valid()) { + continue; + } } port_offset++; } @@ -582,11 +585,16 @@ void VisualShaderEditor::_update_graph() { } } - if (custom_editor && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) { + if (custom_editor && !scalar_uniform.is_valid() && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) { //will be embedded in first port } else if (custom_editor) { + port_offset++; node->add_child(custom_editor); + if (scalar_uniform.is_valid()) { + custom_editor->call_deferred("_show_prop_names", true); + continue; + } custom_editor = NULL; } @@ -2972,6 +2980,13 @@ public: bool updating; Ref<VisualShaderNode> node; Vector<EditorProperty *> properties; + Vector<Label *> prop_names; + + void _show_prop_names(bool p_show) { + for (int i = 0; i < prop_names.size(); i++) { + prop_names[i]->set_visible(p_show); + } + } void setup(Ref<Resource> p_parent_resource, Vector<EditorProperty *> p_properties, const Vector<StringName> &p_names, Ref<VisualShaderNode> p_node) { parent_resource = p_parent_resource; @@ -2981,7 +2996,20 @@ public: for (int i = 0; i < p_properties.size(); i++) { - add_child(p_properties[i]); + HBoxContainer *hbox = memnew(HBoxContainer); + hbox->set_h_size_flags(SIZE_EXPAND_FILL); + add_child(hbox); + + Label *prop_name = memnew(Label); + String prop_name_str = p_names[i]; + prop_name_str = prop_name_str.capitalize() + ":"; + prop_name->set_text(prop_name_str); + prop_name->set_visible(false); + hbox->add_child(prop_name); + prop_names.push_back(prop_name); + + p_properties[i]->set_h_size_flags(SIZE_EXPAND_FILL); + hbox->add_child(p_properties[i]); bool res_prop = Object::cast_to<EditorPropertyResource>(p_properties[i]); if (res_prop) { @@ -3003,6 +3031,7 @@ public: ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request); ClassDB::bind_method("_resource_selected", &VisualShaderNodePluginDefaultEditor::_resource_selected); ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector); + ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names); } }; diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 8245264e0d..3c8fef6233 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -974,7 +974,7 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) { error_dialog->set_text(vformat(TTR("Failed to export the project for platform '%s'.\nThis might be due to a configuration issue in the export preset or your export settings."), platform->get_name())); } - ERR_PRINTS(vformat("Failed to export the project for platform '%s'.", platform->get_name())); + ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name())); error_dialog->show(); error_dialog->popup_centered_minsize(Size2(300, 80)); } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 30e31cb530..ee434aaac2 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -163,7 +163,7 @@ private: } if (valid_path == "") { - set_message(TTR("The path does not exist."), MESSAGE_ERROR); + set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR); memdelete(d); get_ok()->set_disabled(true); return ""; @@ -177,7 +177,7 @@ private: } if (valid_install_path == "") { - set_message(TTR("The path does not exist."), MESSAGE_ERROR, INSTALL_PATH); + set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH); memdelete(d); get_ok()->set_disabled(true); return ""; @@ -195,7 +195,7 @@ private: unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io); if (!pkg) { - set_message(TTR("Error opening package file, not in ZIP format."), MESSAGE_ERROR); + set_message(TTR("Error opening package file (it's not in ZIP format)."), MESSAGE_ERROR); memdelete(d); get_ok()->set_disabled(true); unzClose(pkg); @@ -216,7 +216,7 @@ private: } if (ret == UNZ_END_OF_LIST_OF_FILE) { - set_message(TTR("Invalid '.zip' project file, does not contain a 'project.godot' file."), MESSAGE_ERROR); + set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR); memdelete(d); get_ok()->set_disabled(true); unzClose(pkg); @@ -230,7 +230,11 @@ private: bool is_empty = true; String n = d->get_next(); while (n != String()) { - if (n != "." && n != "..") { + if (!n.begins_with(".")) { + // Allow `.`, `..` (reserved current/parent folder names) + // and hidden files/folders to be present. + // For instance, this lets users initialize a Git repository + // and still be able to create a project in the directory afterwards. is_empty = false; break; } @@ -247,7 +251,7 @@ private: } } else { - set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR); + set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR); memdelete(d); install_path_container->hide(); get_ok()->set_disabled(true); @@ -256,7 +260,7 @@ private: } else if (valid_path.ends_with("zip")) { - set_message(TTR("Directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH); + set_message(TTR("This directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH); memdelete(d); get_ok()->set_disabled(true); return ""; @@ -269,7 +273,11 @@ private: bool is_empty = true; String n = d->get_next(); while (n != String()) { - if (n != "." && n != "..") { // i don't know if this is enough to guarantee an empty dir + if (!n.begins_with(".")) { + // Allow `.`, `..` (reserved current/parent folder names) + // and hidden files/folders to be present. + // For instance, this lets users initialize a Git repository + // and still be able to create a project in the directory afterwards. is_empty = false; break; } @@ -332,7 +340,7 @@ private: install_path_container->show(); get_ok()->set_disabled(false); } else { - set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR); + set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR); get_ok()->set_disabled(true); return; } @@ -1316,6 +1324,7 @@ void ProjectList::create_project_item_control(int p_index) { // The project icon may not be loaded by the time the control is displayed, // so use a loading placeholder. tf->set_texture(get_icon("ProjectIconLoading", "EditorIcons")); + tf->set_v_size_flags(SIZE_SHRINK_CENTER); if (item.missing) { tf->set_modulate(Color(1, 1, 1, 0.5)); } diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 7586f6eac1..317be309a3 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -612,7 +612,7 @@ void RenameDialog::rename() { const String &new_name = to_rename[i].second; if (!n) { - ERR_PRINTS("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames()); + ERR_PRINT("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames()); continue; } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index dca6087f8b..7410a998ad 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -981,7 +981,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!new_node) { new_node = memnew(Node); - ERR_PRINTS("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead."); + ERR_PRINT("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead."); } } else { switch (p_tool) { diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index a982724d4c..c4627e6627 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -84,7 +84,9 @@ void ScriptCreateDialog::_path_hbox_sorted() { int filename_start_pos = initial_bp.find_last("/") + 1; int filename_end_pos = initial_bp.length(); - file_path->select(filename_start_pos, filename_end_pos); + if (!is_built_in) { + file_path->select(filename_start_pos, filename_end_pos); + } // First set cursor to the end of line to scroll LineEdit view // to the right and then set the actual cursor position. @@ -575,6 +577,10 @@ void ScriptCreateDialog::_browse_class_in_tree() { void ScriptCreateDialog::_path_changed(const String &p_path) { + if (is_built_in) { + return; + } + is_path_valid = false; is_new_script_created = true; diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index ab4501bb8a..34547717fd 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -338,7 +338,7 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) { FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err); if (err != OK) { - ERR_PRINTS("Failed to open " + p_file); + ERR_PRINT("Failed to open " + p_file); return; } Vector<String> line; |