diff options
Diffstat (limited to 'editor')
140 files changed, 3058 insertions, 2025 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index c0d5716c4e..d195561a85 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -63,7 +63,7 @@ static const char *_joy_axis_descriptions[JOY_AXIS_MAX * 2] = { String InputEventConfigurationDialog::get_event_text(const Ref<InputEvent> &p_event) { ERR_FAIL_COND_V_MSG(p_event.is_null(), String(), "Provided event is not a valid instance of InputEvent"); - // Joypad motion events will display slighlty differently than what the event->as_text() provides. See #43660. + // Joypad motion events will display slightly differently than what the event->as_text() provides. See #43660. Ref<InputEventJoypadMotion> jpmotion = p_event; if (jpmotion.is_valid()) { String desc = TTR("Unknown Joypad Axis"); @@ -97,11 +97,11 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event) { if (mod.is_valid()) { show_mods = true; - mod_checkboxes[MOD_ALT]->set_pressed(mod->get_alt()); - mod_checkboxes[MOD_SHIFT]->set_pressed(mod->get_shift()); - mod_checkboxes[MOD_COMMAND]->set_pressed(mod->get_command()); - mod_checkboxes[MOD_CONTROL]->set_pressed(mod->get_control()); - mod_checkboxes[MOD_META]->set_pressed(mod->get_metakey()); + mod_checkboxes[MOD_ALT]->set_pressed(mod->is_alt_pressed()); + mod_checkboxes[MOD_SHIFT]->set_pressed(mod->is_shift_pressed()); + mod_checkboxes[MOD_COMMAND]->set_pressed(mod->is_command_pressed()); + mod_checkboxes[MOD_CTRL]->set_pressed(mod->is_ctrl_pressed()); + mod_checkboxes[MOD_META]->set_pressed(mod->is_meta_pressed()); store_command_checkbox->set_pressed(mod->is_storing_command()); } @@ -122,9 +122,9 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event) { // Update selected item in input list for keys, joybuttons and joyaxis only (since the mouse cannot be "listened" for). if (k.is_valid() || joyb.is_valid() || joym.is_valid()) { - TreeItem *category = input_list_tree->get_root()->get_children(); + TreeItem *category = input_list_tree->get_root()->get_first_child(); while (category) { - TreeItem *input_item = category->get_children(); + TreeItem *input_item = category->get_first_child(); // has_type this should be always true, unless the tree structure has been misconfigured. bool has_type = input_item->get_parent()->has_meta("__type"); @@ -384,15 +384,15 @@ void InputEventConfigurationDialog::_mod_toggled(bool p_checked, int p_index) { } if (p_index == 0) { - ie->set_alt(p_checked); + ie->set_alt_pressed(p_checked); } else if (p_index == 1) { - ie->set_shift(p_checked); + ie->set_shift_pressed(p_checked); } else if (p_index == 2) { - ie->set_command(p_checked); + ie->set_command_pressed(p_checked); } else if (p_index == 3) { - ie->set_control(p_checked); + ie->set_ctrl_pressed(p_checked); } else if (p_index == 4) { - ie->set_metakey(p_checked); + ie->set_meta_pressed(p_checked); } _set_event(ie); @@ -413,7 +413,7 @@ void InputEventConfigurationDialog::_store_command_toggled(bool p_checked) { mod_checkboxes[MOD_COMMAND]->show(); mod_checkboxes[MOD_COMMAND]->set_text("Meta (Command)"); #else - mod_checkboxes[MOD_CONTROL]->hide(); + mod_checkboxes[MOD_CTRL]->hide(); mod_checkboxes[MOD_COMMAND]->show(); mod_checkboxes[MOD_COMMAND]->set_text("Control (Command)"); @@ -421,7 +421,7 @@ void InputEventConfigurationDialog::_store_command_toggled(bool p_checked) { } else { // If not, hide Command, show Control and Meta. mod_checkboxes[MOD_COMMAND]->hide(); - mod_checkboxes[MOD_CONTROL]->show(); + mod_checkboxes[MOD_CTRL]->show(); mod_checkboxes[MOD_META]->show(); } } @@ -469,11 +469,11 @@ void InputEventConfigurationDialog::_input_list_item_selected() { } // Maintain modifier state from checkboxes - k->set_alt(mod_checkboxes[MOD_ALT]->is_pressed()); - k->set_shift(mod_checkboxes[MOD_SHIFT]->is_pressed()); - k->set_command(mod_checkboxes[MOD_COMMAND]->is_pressed()); - k->set_control(mod_checkboxes[MOD_CONTROL]->is_pressed()); - k->set_metakey(mod_checkboxes[MOD_META]->is_pressed()); + k->set_alt_pressed(mod_checkboxes[MOD_ALT]->is_pressed()); + k->set_shift_pressed(mod_checkboxes[MOD_SHIFT]->is_pressed()); + k->set_command_pressed(mod_checkboxes[MOD_COMMAND]->is_pressed()); + k->set_ctrl_pressed(mod_checkboxes[MOD_CTRL]->is_pressed()); + k->set_meta_pressed(mod_checkboxes[MOD_META]->is_pressed()); k->set_store_command(store_command_checkbox->is_pressed()); _set_event(k); @@ -484,11 +484,11 @@ void InputEventConfigurationDialog::_input_list_item_selected() { mb.instance(); mb->set_button_index(idx); // Maintain modifier state from checkboxes - mb->set_alt(mod_checkboxes[MOD_ALT]->is_pressed()); - mb->set_shift(mod_checkboxes[MOD_SHIFT]->is_pressed()); - mb->set_command(mod_checkboxes[MOD_COMMAND]->is_pressed()); - mb->set_control(mod_checkboxes[MOD_CONTROL]->is_pressed()); - mb->set_metakey(mod_checkboxes[MOD_META]->is_pressed()); + mb->set_alt_pressed(mod_checkboxes[MOD_ALT]->is_pressed()); + mb->set_shift_pressed(mod_checkboxes[MOD_SHIFT]->is_pressed()); + mb->set_command_pressed(mod_checkboxes[MOD_COMMAND]->is_pressed()); + mb->set_ctrl_pressed(mod_checkboxes[MOD_CTRL]->is_pressed()); + mb->set_meta_pressed(mod_checkboxes[MOD_META]->is_pressed()); mb->set_store_command(store_command_checkbox->is_pressed()); _set_event(mb); @@ -731,7 +731,7 @@ void ActionMapEditor::_add_action_pressed() { void ActionMapEditor::_add_action(const String &p_name) { if (p_name == "" || !_is_action_name_valid(p_name)) { - show_message(TTR("Invalid action name. it cannot be.is_empty()() nor contain '/', ':', '=', '\\' or '\"'")); + show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'")); return; } @@ -756,7 +756,7 @@ void ActionMapEditor::_action_edited() { if (new_name == "" || !_is_action_name_valid(new_name)) { ti->set_text(0, old_name); - show_message(TTR("Invalid action name. it cannot be.is_empty()() nor contain '/', ':', '=', '\\' or '\"'")); + show_message(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'")); return; } diff --git a/editor/action_map_editor.h b/editor/action_map_editor.h index fb097ddfdd..aff3e6e957 100644 --- a/editor/action_map_editor.h +++ b/editor/action_map_editor.h @@ -78,11 +78,11 @@ private: MOD_ALT, MOD_SHIFT, MOD_COMMAND, - MOD_CONTROL, + MOD_CTRL, MOD_META, MOD_MAX }; - String mods[MOD_MAX] = { "Alt", "Shift", "Command", "Control", "Meta" }; + String mods[MOD_MAX] = { "Alt", "Shift", "Command", "Ctrl", "Metakey" }; CheckBox *mod_checkboxes[MOD_MAX]; CheckBox *store_command_checkbox; diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 67b52bf0ca..63ffab6727 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -619,7 +619,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { float v_zoom_orig = v_zoom; - if (mb->get_command()) { + if (mb->is_command_pressed()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); } else { if (v_zoom < 100000) { @@ -632,7 +632,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { float v_zoom_orig = v_zoom; - if (mb->get_command()) { + if (mb->is_command_pressed()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); } else { if (v_zoom > 0.000001) { @@ -691,9 +691,9 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { //first check point //command makes it ignore the main point, so control point editors can be force-edited //path 2D editing in the 3D and 2D editors works the same way - if (!mb->get_command()) { + if (!mb->is_command_pressed()) { if (edit_points[i].point_rect.has_point(mb->get_position())) { - if (mb->get_shift()) { + if (mb->is_shift_pressed()) { //add to selection if (selection.has(i)) { selection.erase(i); @@ -743,7 +743,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { } //insert new point - if (mb->get_command() && mb->get_position().x >= timeline->get_name_limit() && mb->get_position().x < get_size().width - timeline->get_buttons_width()) { + if (mb->is_command_pressed() && mb->get_position().x >= timeline->get_name_limit() && mb->get_position().x < get_size().width - timeline->get_buttons_width()) { Array new_point; new_point.resize(5); @@ -961,7 +961,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (box_selecting_attempt && mm.is_valid()) { if (!box_selecting) { box_selecting = true; - box_selecting_add = mm->get_shift(); + box_selecting_add = mm->is_shift_pressed(); } box_selection_to = mm->get_position(); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 89f77f3c77..9d5811dcbd 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -2662,7 +2662,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { } if (key_idx != -1) { - if (mb->get_command() || mb->get_shift()) { + if (mb->is_command_pressed() || mb->is_shift_pressed()) { if (editor->is_key_selected(track, key_idx)) { emit_signal("deselect_key", key_idx); } else { @@ -4028,7 +4028,7 @@ bool AnimationTrackEditor::is_selection_active() const { } bool AnimationTrackEditor::is_snap_enabled() const { - return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); + return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(KEY_CTRL); } void AnimationTrackEditor::_update_tracks() { @@ -4959,12 +4959,12 @@ void AnimationTrackEditor::_box_selection_draw() { void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { + if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); scroll->accept_event(); } - if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { + if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); scroll->accept_event(); } @@ -4980,7 +4980,7 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) { for (int i = 0; i < track_edits.size(); i++) { Rect2 local_rect = box_select_rect; local_rect.position -= track_edits[i]->get_global_position(); - track_edits[i]->append_to_selection(local_rect, mb->get_command()); + track_edits[i]->append_to_selection(local_rect, mb->is_command_pressed()); } if (_get_track_selected() == -1 && track_edits.size() > 0) { //minimal hack to make shortcuts work @@ -5010,7 +5010,7 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) { } if (!box_selection->is_visible_in_tree()) { - if (!mm->get_command() && !mm->get_shift()) { + if (!mm->is_command_pressed() && !mm->is_shift_pressed()) { _clear_selection(); } box_selection->show(); @@ -5216,7 +5216,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { track_clipboard.clear(); TreeItem *root = track_copy_select->get_root(); if (root) { - TreeItem *it = root->get_children(); + TreeItem *it = root->get_first_child(); while (it) { Dictionary md = it->get_metadata(0); int idx = md["track_idx"]; @@ -5602,7 +5602,7 @@ void AnimationTrackEditor::_show_imported_anim_warning() { } void AnimationTrackEditor::_select_all_tracks_for_copy() { - TreeItem *track = track_copy_select->get_root()->get_children(); + TreeItem *track = track_copy_select->get_root()->get_first_child(); if (!track) { return; } @@ -5616,7 +5616,7 @@ void AnimationTrackEditor::_select_all_tracks_for_copy() { track = track->get_next(); } - track = track_copy_select->get_root()->get_children(); + track = track_copy_select->get_root()->get_first_child(); while (track) { track->set_checked(0, !all_selected); track = track->get_next(); @@ -5681,7 +5681,7 @@ void AnimationTrackEditor::_pick_track_select_recursive(TreeItem *p_item, const p_select_candidates.push_back(node); } - TreeItem *c = p_item->get_children(); + TreeItem *c = p_item->get_first_child(); while (c) { _pick_track_select_recursive(c, p_filter, p_select_candidates); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index ae79299331..54c1e89d1e 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -1091,7 +1091,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) { if (len_resizing && mm.is_valid()) { len_resizing_rel += mm->get_relative().x; - len_resizing_start = mm->get_shift(); + len_resizing_start = mm->is_shift_pressed(); update(); accept_event(); return; @@ -1100,7 +1100,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) { len_resizing = true; - len_resizing_start = mb->get_shift(); + len_resizing_start = mb->is_shift_pressed(); len_resizing_from_px = mb->get_position().x; len_resizing_rel = 0; update(); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 1c62c3d3e1..12e78c3120 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -726,7 +726,7 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_command()) { + if (mb->is_pressed() && mb->is_command_pressed()) { if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) { _zoom_in(); } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) { @@ -1012,7 +1012,7 @@ void CodeTextEditor::convert_indent_to_spaces() { if (cursor_line == i && cursor_column > j) { cursor_column += indent_size - 1; } - line = line.left(j) + indent + line.right(j + 1); + line = line.left(j) + indent + line.substr(j + 1); } j++; } @@ -1056,7 +1056,7 @@ void CodeTextEditor::convert_indent_to_tabs() { if (cursor_line == i && cursor_column > j) { cursor_column -= indent_size; } - line = line.left(j - indent_size) + "\t" + line.right(j + 1); + line = line.left(j - indent_size) + "\t" + line.substr(j + 1); j = 0; space_count = -1; } @@ -1114,7 +1114,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) { new_line = text_editor->get_line(i).left(begin_col) + new_line; } if (i == end) { - new_line = new_line + text_editor->get_line(i).right(end_col); + new_line = new_line + text_editor->get_line(i).substr(end_col); } text_editor->set_line(i, new_line); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 0c1fb6fe4d..511c2a48cc 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -655,7 +655,7 @@ void ConnectionsDock::_disconnect_all() { return; } - TreeItem *child = item->get_children(); + TreeItem *child = item->get_first_child(); String signalName = item->get_metadata(0).operator Dictionary()["name"]; undo_redo->create_action(vformat(TTR("Disconnect all from signal: '%s'"), signalName)); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 1d95161e6c..7493cc2a8d 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -220,7 +220,7 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) { file->store_csv_line(headers); if (vmem_tree->get_root()) { - TreeItem *ti = vmem_tree->get_root()->get_children(); + TreeItem *ti = vmem_tree->get_root()->get_first_child(); while (ti) { Vector<String> values; values.resize(vmem_tree->get_columns()); @@ -1319,7 +1319,7 @@ bool ScriptEditorDebugger::is_skip_breakpoints() { void ScriptEditorDebugger::_error_activated() { TreeItem *selected = error_tree->get_selected(); - TreeItem *ci = selected->get_children(); + TreeItem *ci = selected->get_first_child(); if (ci) { selected->set_collapsed(!selected->is_collapsed()); } @@ -1341,7 +1341,7 @@ void ScriptEditorDebugger::_expand_errors_list() { return; } - TreeItem *item = root->get_children(); + TreeItem *item = root->get_first_child(); while (item) { item->set_collapsed(false); item = item->get_next(); @@ -1354,7 +1354,7 @@ void ScriptEditorDebugger::_collapse_errors_list() { return; } - TreeItem *item = root->get_children(); + TreeItem *item = root->get_first_child(); while (item) { item->set_collapsed(true); item = item->get_next(); @@ -1403,7 +1403,7 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { int rpad_len = text.length(); text = type + text + ti->get_text(1) + "\n"; - TreeItem *ci = ti->get_children(); + TreeItem *ci = ti->get_first_child(); while (ci) { text += " " + ci->get_text(0).rpad(rpad_len) + ci->get_text(1) + "\n"; ci = ci->get_next(); @@ -1419,7 +1419,7 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { } // We only need the first child here (C++ source stack trace). - TreeItem *ci = ti->get_children(); + TreeItem *ci = ti->get_first_child(); // Parse back the `file:line @ method()` string. const Vector<String> file_line_number = ci->get_text(1).split("@")[0].strip_edges().split(":"); ERR_FAIL_COND_MSG(file_line_number.size() < 2, "Incorrect C++ source stack trace file:line format (please report)."); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 57d44ca56c..c085205f63 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -725,8 +725,8 @@ void OrphanResourcesDialog::_find_to_delete(TreeItem *p_item, List<String> &path paths.push_back(p_item->get_metadata(0)); } - if (p_item->get_children()) { - _find_to_delete(p_item->get_children(), paths); + if (p_item->get_first_child()) { + _find_to_delete(p_item->get_first_child(), paths); } p_item = p_item->get_next(); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 2d29076476..9dcd550f5c 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -45,8 +45,8 @@ void EditorAssetInstaller::_update_subitems(TreeItem *p_item, bool p_check, bool p_item->set_checked(0, false); } - if (p_item->get_children()) { - _update_subitems(p_item->get_children(), p_check); + if (p_item->get_first_child()) { + _update_subitems(p_item->get_first_child(), p_check); } if (!p_first && p_item->get_next()) { @@ -60,7 +60,7 @@ void EditorAssetInstaller::_uncheck_parent(TreeItem *p_item) { } bool any_checked = false; - TreeItem *item = p_item->get_children(); + TreeItem *item = p_item->get_first_child(); while (item) { if (item->is_checked(0)) { any_checked = true; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index e7934bed0a..466ca70130 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -312,7 +312,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) { const float p_db = this->_normalized_volume_to_scaled_db(p_normalized); - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { // Snap the value when holding Ctrl for easier editing. // To do so, it needs to be converted back to normalized volume (as the slider uses that unit). slider->set_value(_scaled_db_to_normalized_volume(Math::round(p_db))); @@ -372,7 +372,7 @@ float EditorAudioBus::_scaled_db_to_normalized_volume(float db) { void EditorAudioBus::_show_value(float slider_value) { float db; - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { // Display the correct (snapped) value when holding Ctrl db = Math::round(_normalized_volume_to_scaled_db(slider_value)); } else { diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 86c5c87a68..ff0daa86ff 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -53,7 +53,7 @@ def make_fonts_header(target, source, env): g.write("#ifndef _EDITOR_FONTS_H\n") g.write("#define _EDITOR_FONTS_H\n") - # saving uncompressed, since freetype will reference from memory pointer + # Saving uncompressed, since FreeType will reference from memory pointer. for i in range(len(source)): with open(source[i], "rb") as f: buf = f.read() diff --git a/editor/editor_data.h b/editor/editor_data.h index 2ece94d6a3..df6ba9d0c9 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -167,7 +167,7 @@ public: EditorPlugin *get_editor_plugin(int p_idx); UndoRedo &get_undo_redo(); - void add_undo_redo_inspector_hook_callback(Callable p_callable); // Callbacks shoud have 4 args: (Object* undo_redo, Object *modified_object, String property, Varian new_value) + void add_undo_redo_inspector_hook_callback(Callable p_callable); // Callbacks should have 4 args: (Object* undo_redo, Object *modified_object, String property, Variant new_value) void remove_undo_redo_inspector_hook_callback(Callable p_callable); const Vector<Callable> get_undo_redo_inspector_hook_callback(); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index a368a9618e..b3755bef80 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1222,12 +1222,12 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c } for (int i = 0; i < pd.file_ofs.size(); i++) { - int string_len = pd.file_ofs[i].path_utf8.length(); - int pad = _get_pad(4, string_len); + uint32_t string_len = pd.file_ofs[i].path_utf8.length(); + uint32_t pad = _get_pad(4, string_len); fhead->store_32(string_len + pad); fhead->store_buffer((const uint8_t *)pd.file_ofs[i].path_utf8.get_data(), string_len); - for (int j = 0; j < pad; j++) { + for (uint32_t j = 0; j < pad; j++) { fhead->store_8(0); } @@ -1269,8 +1269,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c uint8_t buf[bufsize]; while (true) { - int got = ftmp->get_buffer(buf, bufsize); - if (got <= 0) { + uint64_t got = ftmp->get_buffer(buf, bufsize); + if (got == 0) { break; } f->store_buffer(buf, got); @@ -1280,13 +1280,13 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c if (p_embed) { // Ensure embedded data ends at a 64-bit multiple - int64_t embed_end = f->get_position() - embed_pos + 12; - int pad = embed_end % 8; - for (int i = 0; i < pad; i++) { + uint64_t embed_end = f->get_position() - embed_pos + 12; + uint64_t pad = embed_end % 8; + for (uint64_t i = 0; i < pad; i++) { f->store_8(0); } - int64_t pck_size = f->get_position() - pck_start_pos; + uint64_t pck_size = f->get_position() - pck_start_pos; f->store_64(pck_size); f->store_32(PACK_HEADER_MAGIC); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 495bdd42f7..69663b9ed9 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -506,7 +506,7 @@ bool EditorFileSystem::_update_scan_actions() { case ItemAction::ACTION_DIR_ADD: { int idx = 0; for (int i = 0; i < ia.dir->subdirs.size(); i++) { - if (ia.new_dir->name < ia.dir->subdirs[i]->name) { + if (ia.new_dir->name.naturalnocasecmp_to(ia.dir->subdirs[i]->name) < 0) { break; } idx++; @@ -528,7 +528,7 @@ bool EditorFileSystem::_update_scan_actions() { case ItemAction::ACTION_FILE_ADD: { int idx = 0; for (int i = 0; i < ia.dir->files.size(); i++) { - if (ia.new_file->file < ia.dir->files[i]->file) { + if (ia.new_file->file.naturalnocasecmp_to(ia.dir->files[i]->file) < 0) { break; } idx++; @@ -713,7 +713,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess int idx2 = 0; for (int i = 0; i < p_dir->subdirs.size(); i++) { - if (efd->name < p_dir->subdirs[i]->name) { + if (efd->name.naturalnocasecmp_to(p_dir->subdirs[i]->name) < 0) { break; } idx2++; @@ -1245,7 +1245,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector int idx2 = 0; for (int j = 0; j < fs->get_subdir_count(); j++) { - if (efsd->name < fs->get_subdir(j)->get_name()) { + if (efsd->name.naturalnocasecmp_to(fs->get_subdir(j)->get_name()) < 0) { break; } idx2++; @@ -1481,7 +1481,7 @@ void EditorFileSystem::update_file(const String &p_file) { String file_name = p_file.get_file(); for (int i = 0; i < fs->files.size(); i++) { - if (file_name < fs->files[i]->file) { + if (p_file.naturalnocasecmp_to(fs->files[i]->file) < 0) { break; } idx++; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 6039f64b7c..3f94f43710 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -475,7 +475,7 @@ void EditorHelp::_update_doc() { String linktxt = (cd.tutorials[i].title.is_empty()) ? link : DTR(cd.tutorials[i].title); const int seppos = linktxt.find("//"); if (seppos != -1) { - linktxt = link.right(seppos + 2); + linktxt = link.substr(seppos + 2); } class_desc->push_color(symbol_color); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 23226ffa9b..b93ffa9321 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -334,7 +334,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { for (int i = 0; i < class_doc.methods.size(); i++) { String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); if (method_name.find(term) > -1 || - (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.begins_with(".") && method_name.begins_with(term.substr(1))) || (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 5bb3c8b4d0..29cc4c3c46 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1809,12 +1809,12 @@ void EditorInspector::update_tree() { basename = group + "/" + basename; } - String name = (basename.find("/") != -1) ? basename.right(basename.rfind("/") + 1) : basename; + String name = (basename.find("/") != -1) ? basename.substr(basename.rfind("/") + 1) : basename; if (capitalize_paths) { int dot = name.find("."); if (dot != -1) { - String ov = name.right(dot); + String ov = name.substr(dot); name = name.substr(0, dot); name = name.capitalize(); name += ov; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 7c485d53c5..469fb41406 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -376,7 +376,7 @@ EditorLog::EditorLog() { collapse_button = memnew(Button); collapse_button->set_flat(true); collapse_button->set_focus_mode(FOCUS_NONE); - collapse_button->set_tooltip(TTR("Collapse duplicate messages into one log entry. Shows number of occurences.")); + collapse_button->set_tooltip(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); collapse_button->set_toggle_mode(true); collapse_button->set_pressed(false); collapse_button->connect("toggled", callable_mp(this, &EditorLog::_set_collapse)); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 61b17a7247..72963012d6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -82,6 +82,7 @@ #include "editor/editor_log.h" #include "editor/editor_plugin.h" #include "editor/editor_properties.h" +#include "editor/editor_resource_picker.h" #include "editor/editor_resource_preview.h" #include "editor/editor_run_native.h" #include "editor/editor_run_script.h" @@ -3093,10 +3094,11 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_chan if (p_config_changed) { p_editor->disable_plugin(); } - singleton->editor_plugins_over->get_plugins_list().erase(p_editor); + singleton->editor_plugins_over->remove_plugin(p_editor); + singleton->editor_plugins_force_over->remove_plugin(p_editor); + singleton->editor_plugins_force_input_forwarding->remove_plugin(p_editor); singleton->remove_child(p_editor); singleton->editor_data.remove_editor_plugin(p_editor); - singleton->get_editor_plugins_force_input_forwarding()->remove_plugin(p_editor); } void EditorNode::_update_addon_config() { @@ -3165,7 +3167,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, // Errors in the script cause the base_type to be an empty string. if (String(script->get_instance_base_type()) == "") { - show_warning(vformat(TTR("Unable to load addon script from path: '%s'. This might be due to a code error in that script. \nDisabling the addon at '%s' to prevent further errors."), script_path, p_addon)); + show_warning(vformat(TTR("Unable to load addon script from path: '%s'. This might be due to a code error in that script.\nDisabling the addon at '%s' to prevent further errors."), script_path, p_addon)); _remove_plugin_from_enabled(p_addon); return; } @@ -3757,6 +3759,8 @@ void EditorNode::register_editor_types() { ClassDB::register_class<ScriptCreateDialog>(); ClassDB::register_class<EditorFeatureProfile>(); ClassDB::register_class<EditorSpinSlider>(); + ClassDB::register_class<EditorResourcePicker>(); + ClassDB::register_class<EditorScriptPicker>(); ClassDB::register_class<EditorSceneImporterMesh>(); ClassDB::register_class<EditorSceneImporterMeshNode3D>(); @@ -5288,7 +5292,7 @@ void EditorNode::_file_access_close_error_notify(const String &p_str) { void EditorNode::reload_scene(const String &p_path) { /* - * No longer necesary since scenes now reset and reload their internal resource if needed. + * No longer necessary since scenes now reset and reload their internal resource if needed. //first of all, reload internal textures, materials, meshes, etc. as they might have changed on disk List<Ref<Resource>> cached; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index ee55ec4c0b..7beff4147d 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2384,426 +2384,64 @@ EditorPropertyRID::EditorPropertyRID() { ////////////// RESOURCE ////////////////////// -void EditorPropertyResource::_file_selected(const String &p_path) { - RES res = ResourceLoader::load(p_path); - - ERR_FAIL_COND_MSG(res.is_null(), "Cannot load resource from path '" + p_path + "'."); - - List<PropertyInfo> prop_list; - get_edited_object()->get_property_list(&prop_list); - String property_types; - - for (List<PropertyInfo>::Element *E = prop_list.front(); E; E = E->next()) { - if (E->get().name == get_edited_property() && (E->get().hint & PROPERTY_HINT_RESOURCE_TYPE)) { - property_types = E->get().hint_string; - } - } - if (!property_types.is_empty()) { - bool any_type_matches = false; - const Vector<String> split_property_types = property_types.split(","); - for (int i = 0; i < split_property_types.size(); ++i) { - if (res->is_class(split_property_types[i])) { - any_type_matches = true; - break; - } - } - - if (!any_type_matches) { - EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match any type expected for this property (%s)."), res->get_class(), property_types)); - } +void EditorPropertyResource::_resource_selected(const RES &p_resource) { + if (use_sub_inspector) { + bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property()); + get_edited_object()->editor_set_section_unfold(get_edited_property(), unfold); + update_property(); + } else { + emit_signal("resource_selected", get_edited_property(), p_resource); } - - emit_changed(get_edited_property(), res); - update_property(); } -void EditorPropertyResource::_menu_option(int p_which) { - //scene_tree->popup_scenetree_dialog(); - switch (p_which) { - case OBJ_MENU_LOAD: { - if (!file) { - file = memnew(EditorFileDialog); - file->connect("file_selected", callable_mp(this, &EditorPropertyResource::_file_selected)); - add_child(file); - } - file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); - String type = base_type; - - List<String> extensions; - for (int i = 0; i < type.get_slice_count(","); i++) { - ResourceLoader::get_recognized_extensions_for_type(type.get_slice(",", i), &extensions); - } - - Set<String> valid_extensions; - for (List<String>::Element *E = extensions.front(); E; E = E->next()) { - valid_extensions.insert(E->get()); - } - - file->clear_filters(); - for (Set<String>::Element *E = valid_extensions.front(); E; E = E->next()) { - file->add_filter("*." + E->get() + " ; " + E->get().to_upper()); - } - - file->popup_file_dialog(); - } break; - - case OBJ_MENU_EDIT: { - RES res = get_edited_object()->get(get_edited_property()); +void EditorPropertyResource::_resource_changed(const RES &p_resource) { + // Make visual script the correct type. + Ref<Script> s = p_resource; + if (get_edited_object() && s.is_valid()) { + s->call("set_instance_base_type", get_edited_object()->get_class()); + } - if (!res.is_null()) { - emit_signal("resource_selected", get_edited_property(), res); - } - } break; - case OBJ_MENU_CLEAR: { + // Prevent the creation of invalid ViewportTextures when possible. + Ref<ViewportTexture> vpt = p_resource; + if (vpt.is_valid()) { + Resource *r = Object::cast_to<Resource>(get_edited_object()); + if (r && r->get_path().is_resource_file()) { + EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture on resources saved as a file.\nResource needs to belong to a scene.")); emit_changed(get_edited_property(), RES()); update_property(); - - } break; - - case OBJ_MENU_MAKE_UNIQUE: { - RES res_orig = get_edited_object()->get(get_edited_property()); - if (res_orig.is_null()) { - return; - } - - List<PropertyInfo> property_list; - res_orig->get_property_list(&property_list); - List<Pair<String, Variant>> propvalues; - - for (List<PropertyInfo>::Element *E = property_list.front(); E; E = E->next()) { - Pair<String, Variant> p; - PropertyInfo &pi = E->get(); - if (pi.usage & PROPERTY_USAGE_STORAGE) { - p.first = pi.name; - p.second = res_orig->get(pi.name); - } - - propvalues.push_back(p); - } - - String orig_type = res_orig->get_class(); - - Object *inst = ClassDB::instance(orig_type); - - Ref<Resource> res = Ref<Resource>(Object::cast_to<Resource>(inst)); - - ERR_FAIL_COND(res.is_null()); - - for (List<Pair<String, Variant>>::Element *E = propvalues.front(); E; E = E->next()) { - Pair<String, Variant> &p = E->get(); - res->set(p.first, p.second); - } - - emit_changed(get_edited_property(), res); - update_property(); - - } break; - - case OBJ_MENU_SAVE: { - RES res = get_edited_object()->get(get_edited_property()); - if (res.is_null()) { - return; - } - EditorNode::get_singleton()->save_resource(res); - } break; - - case OBJ_MENU_COPY: { - RES res = get_edited_object()->get(get_edited_property()); - - EditorSettings::get_singleton()->set_resource_clipboard(res); - - } break; - case OBJ_MENU_PASTE: { - RES res = EditorSettings::get_singleton()->get_resource_clipboard(); - emit_changed(get_edited_property(), res); - update_property(); - - } break; - case OBJ_MENU_NEW_SCRIPT: { - if (Object::cast_to<Node>(get_edited_object())) { - EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(Object::cast_to<Node>(get_edited_object()), false); - } - - } break; - case OBJ_MENU_EXTEND_SCRIPT: { - if (Object::cast_to<Node>(get_edited_object())) { - EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(Object::cast_to<Node>(get_edited_object()), true); - } - - } break; - case OBJ_MENU_SHOW_IN_FILE_SYSTEM: { - RES res = get_edited_object()->get(get_edited_property()); - - FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); - file_system_dock->navigate_to_path(res->get_path()); - // Ensure that the FileSystem dock is visible. - TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_index()); - } break; - default: { - RES res = get_edited_object()->get(get_edited_property()); - - if (p_which >= CONVERT_BASE_ID) { - int to_type = p_which - CONVERT_BASE_ID; - - Vector<Ref<EditorResourceConversionPlugin>> conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(res); - - ERR_FAIL_INDEX(to_type, conversions.size()); - - Ref<Resource> new_res = conversions[to_type]->convert(res); - - emit_changed(get_edited_property(), new_res); - update_property(); - break; - } - ERR_FAIL_COND(inheritors_array.is_empty()); - - String intype = inheritors_array[p_which - TYPE_BASE_ID]; - - if (intype == "ViewportTexture") { - Resource *r = Object::cast_to<Resource>(get_edited_object()); - if (r && r->get_path().is_resource_file()) { - EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture on resources saved as a file.\nResource needs to belong to a scene.")); - return; - } - - if (r && !r->is_local_to_scene()) { - EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture on this resource because it's not set as local to scene.\nPlease switch on the 'local to scene' property on it (and all resources containing it up to a node).")); - return; - } - - if (!scene_tree) { - scene_tree = memnew(SceneTreeDialog); - Vector<StringName> valid_types; - valid_types.push_back("Viewport"); - scene_tree->get_scene_tree()->set_valid_types(valid_types); - scene_tree->get_scene_tree()->set_show_enabled_subscene(true); - add_child(scene_tree); - scene_tree->connect("selected", callable_mp(this, &EditorPropertyResource::_viewport_selected)); - scene_tree->set_title(TTR("Pick a Viewport")); - } - scene_tree->popup_scenetree_dialog(); - - return; - } - - Variant obj; - - if (ScriptServer::is_global_class(intype)) { - obj = ClassDB::instance(ScriptServer::get_global_class_native_base(intype)); - if (obj) { - Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype)); - if (script.is_valid()) { - ((Object *)obj)->set_script(script); - } - } - } else { - obj = ClassDB::instance(intype); - } - - if (!obj) { - obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource"); - } - - Resource *resp = Object::cast_to<Resource>(obj); - ERR_BREAK(!resp); - if (get_edited_object() && base_type != String() && base_type == "Script") { - //make visual script the right type - resp->call("set_instance_base_type", get_edited_object()->get_class()); - } - - res = RES(resp); - emit_changed(get_edited_property(), res); - update_property(); - - } break; - } -} - -void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj) { - RES p = get_edited_object()->get(get_edited_property()); - if (p.is_valid() && p->get_instance_id() == p_obj) { - String type = p->get_class_name(); - - if (ClassDB::is_parent_class(type, "Script")) { - assign->set_text(p->get_path().get_file()); return; } - if (p_preview.is_valid()) { - preview->set_offset(SIDE_LEFT, assign->get_icon()->get_width() + assign->get_theme_stylebox("normal")->get_default_margin(SIDE_LEFT) + get_theme_constant("hseparation", "Button")); - if (type == "GradientTexture") { - preview->set_stretch_mode(TextureRect::STRETCH_SCALE); - assign->set_custom_minimum_size(Size2(1, 1)); - } else { - preview->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); - thumbnail_size *= EDSCALE; - assign->set_custom_minimum_size(Size2(1, thumbnail_size)); - } - preview->set_texture(p_preview); - assign->set_text(""); - } - } -} - -void EditorPropertyResource::_update_menu_items() { - //////////////////// UPDATE MENU ////////////////////////// - RES res = get_edited_object()->get(get_edited_property()); - - menu->clear(); - - if (get_edited_property() == "script" && base_type == "Script" && Object::cast_to<Node>(get_edited_object())) { - menu->add_icon_item(get_theme_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); - menu->add_icon_item(get_theme_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); - menu->add_separator(); - } else if (base_type != "") { - int idx = 0; - - Vector<EditorData::CustomType> custom_resources; - - if (EditorNode::get_editor_data().get_custom_types().has("Resource")) { - custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"]; - } - - for (int i = 0; i < base_type.get_slice_count(","); i++) { - String base = base_type.get_slice(",", i); - - Set<String> valid_inheritors; - valid_inheritors.insert(base); - List<StringName> inheritors; - ClassDB::get_inheriters_from_class(base.strip_edges(), &inheritors); - - for (int j = 0; j < custom_resources.size(); j++) { - inheritors.push_back(custom_resources[j].name); - } - - List<StringName>::Element *E = inheritors.front(); - while (E) { - valid_inheritors.insert(E->get()); - E = E->next(); - } - - List<StringName> global_classes; - ScriptServer::get_global_class_list(&global_classes); - E = global_classes.front(); - while (E) { - if (EditorNode::get_editor_data().script_class_is_parent(E->get(), base_type)) { - valid_inheritors.insert(E->get()); - } - E = E->next(); - } - - for (Set<String>::Element *F = valid_inheritors.front(); F; F = F->next()) { - const String &t = F->get(); - - bool is_custom_resource = false; - Ref<Texture2D> icon; - if (!custom_resources.is_empty()) { - for (int j = 0; j < custom_resources.size(); j++) { - if (custom_resources[j].name == t) { - is_custom_resource = true; - if (custom_resources[j].icon.is_valid()) { - icon = custom_resources[j].icon; - } - break; - } - } - } - - if (!is_custom_resource && !(ScriptServer::is_global_class(t) || ClassDB::can_instance(t))) { - continue; - } - - inheritors_array.push_back(t); - - if (!icon.is_valid()) { - icon = get_theme_icon(has_theme_icon(t, "EditorIcons") ? t : "Object", "EditorIcons"); - } - - int id = TYPE_BASE_ID + idx; - menu->add_icon_item(icon, vformat(TTR("New %s"), t), id); - - idx++; - } - } - - if (menu->get_item_count()) { - menu->add_separator(); - } - } - - menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD); - - if (!res.is_null()) { - menu->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT); - menu->add_icon_item(get_theme_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR); - menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE); - menu->add_icon_item(get_theme_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE); - RES r = res; - if (r.is_valid() && r->get_path().is_resource_file()) { - menu->add_separator(); - menu->add_item(TTR("Show in FileSystem"), OBJ_MENU_SHOW_IN_FILE_SYSTEM); - } - } - - RES cb = EditorSettings::get_singleton()->get_resource_clipboard(); - bool paste_valid = false; - if (cb.is_valid()) { - if (base_type == "") { - paste_valid = true; - } else { - for (int i = 0; i < base_type.get_slice_count(","); i++) { - if (ClassDB::is_parent_class(cb->get_class(), base_type.get_slice(",", i))) { - paste_valid = true; - break; - } - } + if (r && !r->is_local_to_scene()) { + EditorNode::get_singleton()->show_warning(TTR("Can't create a ViewportTexture on this resource because it's not set as local to scene.\nPlease switch on the 'local to scene' property on it (and all resources containing it up to a node).")); + emit_changed(get_edited_property(), RES()); + update_property(); + return; } } - if (!res.is_null() || paste_valid) { - menu->add_separator(); + emit_changed(get_edited_property(), p_resource); + update_property(); - if (!res.is_null()) { - menu->add_item(TTR("Copy"), OBJ_MENU_COPY); - } + // Automatically suggest setting up the path for a ViewportTexture. + if (vpt.is_valid() && vpt->get_viewport_path_in_scene().is_empty()) { + if (!scene_tree) { + scene_tree = memnew(SceneTreeDialog); + scene_tree->set_title(TTR("Pick a Viewport")); - if (paste_valid) { - menu->add_item(TTR("Paste"), OBJ_MENU_PASTE); - } - } + Vector<StringName> valid_types; + valid_types.push_back("Viewport"); + scene_tree->get_scene_tree()->set_valid_types(valid_types); + scene_tree->get_scene_tree()->set_show_enabled_subscene(true); - if (!res.is_null()) { - Vector<Ref<EditorResourceConversionPlugin>> conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(res); - if (conversions.size()) { - menu->add_separator(); + add_child(scene_tree); + scene_tree->connect("selected", callable_mp(this, &EditorPropertyResource::_viewport_selected)); } - for (int i = 0; i < conversions.size(); i++) { - String what = conversions[i]->converts_to(); - Ref<Texture2D> icon; - if (has_theme_icon(what, "EditorIcons")) { - icon = get_theme_icon(what, "EditorIcons"); - } else { - icon = get_theme_icon(what, "Resource"); - } - menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); - } + scene_tree->popup_scenetree_dialog(); } } -void EditorPropertyResource::_update_menu() { - _update_menu_items(); - - Rect2 gt = edit->get_screen_rect(); - menu->set_as_minsize(); - int ms = menu->get_contents_minimum_size().width; - Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0); - menu->set_position(popup_pos); - menu->popup(); -} - void EditorPropertyResource::_sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool) { emit_signal("property_keyed_with_value", String(get_edited_property()) + ":" + p_property, p_value, false); } @@ -2816,24 +2454,11 @@ void EditorPropertyResource::_sub_inspector_object_id_selected(int p_id) { emit_signal("object_id_selected", get_edited_property(), p_id); } -void EditorPropertyResource::_button_input(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> mb = p_event; - if (mb.is_valid()) { - if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { - _update_menu_items(); - Vector2 pos = get_screen_position() + mb->get_position(); - //pos = assign->get_global_transform().xform(pos); - menu->set_as_minsize(); - menu->set_position(pos); - menu->popup(); - } - } -} - void EditorPropertyResource::_open_editor_pressed() { RES res = get_edited_object()->get(get_edited_property()); if (res.is_valid()) { - EditorNode::get_singleton()->call_deferred("edit_item_resource", res); //may clear the editor so do it deferred + // May clear the editor so do it deferred. + EditorNode::get_singleton()->call_deferred("edit_item_resource", res); } } @@ -2843,28 +2468,28 @@ void EditorPropertyResource::_fold_other_editors(Object *p_self) { } RES res = get_edited_object()->get(get_edited_property()); - if (!res.is_valid()) { return; } + bool use_editor = false; for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) { EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i); if (ep->handles(res.ptr())) { use_editor = true; + break; } } - if (!use_editor) { return; } - bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property()); opened_editor = false; + bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property()); if (unfolded) { - //refold - assign->set_pressed(false); + // Refold. + resource_picker->set_toggle_pressed(false); get_edited_object()->editor_set_section_unfold(get_edited_property(), false); update_property(); } @@ -2876,6 +2501,7 @@ void EditorPropertyResource::_update_property_bg() { } updating_theme = true; + if (sub_inspector != nullptr) { int count_subinspectors = 0; Node *n = get_parent(); @@ -2905,12 +2531,60 @@ void EditorPropertyResource::_update_property_bg() { updating_theme = false; update(); } + +void EditorPropertyResource::_viewport_selected(const NodePath &p_path) { + Node *to_node = get_node(p_path); + if (!Object::cast_to<Viewport>(to_node)) { + EditorNode::get_singleton()->show_warning(TTR("Selected node is not a Viewport!")); + return; + } + + Ref<ViewportTexture> vt; + vt.instance(); + vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node)); + vt->setup_local_to_scene(); + + emit_changed(get_edited_property(), vt); + update_property(); +} + +void EditorPropertyResource::setup(Object *p_object, const String &p_path, const String &p_base_type) { + if (resource_picker) { + resource_picker->disconnect("resource_selected", callable_mp(this, &EditorPropertyResource::_resource_selected)); + resource_picker->disconnect("resource_changed", callable_mp(this, &EditorPropertyResource::_resource_changed)); + memdelete(resource_picker); + } + + if (p_path == "script" && p_base_type == "Script" && Object::cast_to<Node>(p_object)) { + EditorScriptPicker *script_picker = memnew(EditorScriptPicker); + script_picker->set_script_owner(Object::cast_to<Node>(p_object)); + resource_picker = script_picker; + } else { + resource_picker = memnew(EditorResourcePicker); + } + + resource_picker->set_base_type(p_base_type); + resource_picker->set_editable(true); + resource_picker->set_h_size_flags(SIZE_EXPAND_FILL); + add_child(resource_picker); + + resource_picker->connect("resource_selected", callable_mp(this, &EditorPropertyResource::_resource_selected)); + resource_picker->connect("resource_changed", callable_mp(this, &EditorPropertyResource::_resource_changed)); + + for (int i = 0; i < resource_picker->get_child_count(); i++) { + Button *b = Object::cast_to<Button>(resource_picker->get_child(i)); + if (b) { + add_focusable(b); + } + } +} + void EditorPropertyResource::update_property() { RES res = get_edited_object()->get(get_edited_property()); if (use_sub_inspector) { - if (res.is_valid() != assign->is_toggle_mode()) { - assign->set_toggle_mode(res.is_valid()); + if (res.is_valid() != resource_picker->is_toggle_mode()) { + resource_picker->set_toggle_mode(res.is_valid()); } if (res.is_valid() && get_edited_object()->editor_is_section_unfolded(get_edited_property())) { @@ -2935,7 +2609,7 @@ void EditorPropertyResource::update_property() { set_bottom_editor(sub_inspector_vbox); sub_inspector_vbox->add_child(sub_inspector); - assign->set_pressed(true); + resource_picker->set_toggle_pressed(true); bool use_editor = false; for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) { @@ -2946,7 +2620,7 @@ void EditorPropertyResource::update_property() { } if (use_editor) { - //open editor directly and hide other open of these + // Open editor directly and hide other such editors which are currently open. _open_editor_pressed(); if (is_inside_tree()) { get_tree()->call_deferred("call_group", "_editor_resource_properties", "_fold_other_editors", this); @@ -2967,102 +2641,18 @@ void EditorPropertyResource::update_property() { memdelete(sub_inspector_vbox); sub_inspector = nullptr; sub_inspector_vbox = nullptr; + if (opened_editor) { EditorNode::get_singleton()->hide_top_editors(); opened_editor = false; } + _update_property_bg(); } } } - preview->set_texture(Ref<Texture2D>()); - if (res == RES()) { - assign->set_icon(Ref<Texture2D>()); - assign->set_text(TTR("[empty]")); - assign->set_custom_minimum_size(Size2(1, 1)); - } else { - assign->set_icon(EditorNode::get_singleton()->get_object_icon(res.operator->(), "Object")); - - if (res->get_name() != String()) { - assign->set_text(res->get_name()); - } else if (res->get_path().is_resource_file()) { - assign->set_text(res->get_path().get_file()); - assign->set_tooltip(res->get_path()); - } else { - assign->set_text(res->get_class()); - } - - if (res->get_path().is_resource_file()) { - assign->set_tooltip(res->get_path()); - } - - //preview will override the above, so called at the end - EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview", res->get_instance_id()); - } -} - -void EditorPropertyResource::_resource_selected() { - RES res = get_edited_object()->get(get_edited_property()); - - if (res.is_null()) { - edit->set_pressed(true); - _update_menu(); - return; - } - - if (use_sub_inspector) { - bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property()); - get_edited_object()->editor_set_section_unfold(get_edited_property(), unfold); - update_property(); - } else { - emit_signal("resource_selected", get_edited_property(), res); - } -} - -void EditorPropertyResource::setup(const String &p_base_type) { - base_type = p_base_type; -} - -void EditorPropertyResource::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - if (updating_theme) { - return; - } - Ref<Texture2D> t = get_theme_icon("select_arrow", "Tree"); - edit->set_icon(t); - _update_property_bg(); - } - - if (p_what == NOTIFICATION_DRAG_BEGIN) { - if (_is_drop_valid(get_viewport()->gui_get_drag_data())) { - dropping = true; - assign->update(); - } - } - - if (p_what == NOTIFICATION_DRAG_END) { - if (dropping) { - dropping = false; - assign->update(); - } - } -} - -void EditorPropertyResource::_viewport_selected(const NodePath &p_path) { - Node *to_node = get_node(p_path); - if (!Object::cast_to<Viewport>(to_node)) { - EditorNode::get_singleton()->show_warning(TTR("Selected node is not a Viewport!")); - return; - } - - Ref<ViewportTexture> vt; - vt.instance(); - vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node)); - vt->setup_local_to_scene(); - - emit_changed(get_edited_property(), vt); - update_property(); + resource_picker->set_edited_resource(res); } void EditorPropertyResource::collapse_all_folding() { @@ -3077,204 +2667,29 @@ void EditorPropertyResource::expand_all_folding() { } } -void EditorPropertyResource::_button_draw() { - if (dropping) { - Color color = get_theme_color("accent_color", "Editor"); - assign->draw_rect(Rect2(Point2(), assign->get_size()), color, false); - } -} - -Variant EditorPropertyResource::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - RES res = get_edited_object()->get(get_edited_property()); - if (res.is_valid()) { - return EditorNode::get_singleton()->drag_resource(res, p_from); - } - - return Variant(); -} - -bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const { - Vector<String> allowed_types = base_type.split(","); - int size = allowed_types.size(); - for (int i = 0; i < size; i++) { - String at = allowed_types[i].strip_edges(); - if (at == "StandardMaterial3D") { - allowed_types.append("Texture2D"); - } else if (at == "ShaderMaterial") { - allowed_types.append("Shader"); - } else if (at == "Font") { - allowed_types.append("FontData"); - } - } - - Dictionary drag_data = p_drag_data; - - Ref<Resource> res; - if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { - ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); - res = se->get_edited_resource(); - } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { - res = drag_data["resource"]; - } - - if (res.is_valid()) { - for (int i = 0; i < allowed_types.size(); i++) { - String at = allowed_types[i].strip_edges(); - if (ClassDB::is_parent_class(res->get_class(), at)) { - return true; - } - } - } - - if (drag_data.has("type") && String(drag_data["type"]) == "files") { - Vector<String> files = drag_data["files"]; - - if (files.size() == 1) { - String file = files[0]; - String ftype = EditorFileSystem::get_singleton()->get_file_type(file); - - if (ftype != "") { - for (int i = 0; i < allowed_types.size(); i++) { - String at = allowed_types[i].strip_edges(); - if (ClassDB::is_parent_class(ftype, at)) { - return true; - } - } - } - } - } - - return false; -} - -bool EditorPropertyResource::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { - return _is_drop_valid(p_data); +void EditorPropertyResource::set_use_sub_inspector(bool p_enable) { + use_sub_inspector = p_enable; } -void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { - ERR_FAIL_COND(!_is_drop_valid(p_data)); - - Dictionary drag_data = p_data; - - Ref<Resource> res; - if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { - ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); - res = se->get_edited_resource(); - } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { - res = drag_data["resource"]; - } - - if (!res.is_valid() && drag_data.has("type") && String(drag_data["type"]) == "files") { - Vector<String> files = drag_data["files"]; - - if (files.size() == 1) { - String file = files[0]; - res = ResourceLoader::load(file); - } - } - - if (res.is_valid()) { - bool need_convert = true; - - Vector<String> allowed_types = base_type.split(","); - for (int i = 0; i < allowed_types.size(); i++) { - String at = allowed_types[i].strip_edges(); - if (ClassDB::is_parent_class(res->get_class(), at)) { - need_convert = false; - break; - } - } - - if (need_convert) { - for (int i = 0; i < allowed_types.size(); i++) { - String at = allowed_types[i].strip_edges(); - if (at == "StandardMaterial3D" && ClassDB::is_parent_class(res->get_class(), "Texture2D")) { - Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D); - mat->set_texture(StandardMaterial3D::TextureParam::TEXTURE_ALBEDO, res); - res = mat; - break; - } - - if (at == "ShaderMaterial" && ClassDB::is_parent_class(res->get_class(), "Shader")) { - Ref<ShaderMaterial> mat = memnew(ShaderMaterial); - mat->set_shader(res); - res = mat; - break; - } - - if (at == "Font" && ClassDB::is_parent_class(res->get_class(), "FontData")) { - Ref<Font> font = memnew(Font); - font->add_data(res); - res = font; - break; - } +void EditorPropertyResource::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + if (!updating_theme) { + _update_property_bg(); } - } - - emit_changed(get_edited_property(), res); - update_property(); - return; + } break; } } -void EditorPropertyResource::set_use_sub_inspector(bool p_enable) { - use_sub_inspector = p_enable; -} - void EditorPropertyResource::_bind_methods() { - ClassDB::bind_method(D_METHOD("_resource_preview"), &EditorPropertyResource::_resource_preview); - ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &EditorPropertyResource::get_drag_data_fw); - ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &EditorPropertyResource::can_drop_data_fw); - ClassDB::bind_method(D_METHOD("drop_data_fw"), &EditorPropertyResource::drop_data_fw); ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed); ClassDB::bind_method(D_METHOD("_fold_other_editors"), &EditorPropertyResource::_fold_other_editors); } EditorPropertyResource::EditorPropertyResource() { - opened_editor = false; - sub_inspector = nullptr; - sub_inspector_vbox = nullptr; use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector")); - HBoxContainer *hbc = memnew(HBoxContainer); - add_child(hbc); - assign = memnew(Button); - assign->set_flat(true); - assign->set_h_size_flags(SIZE_EXPAND_FILL); - assign->set_clip_text(true); - assign->connect("pressed", callable_mp(this, &EditorPropertyResource::_resource_selected)); - assign->set_drag_forwarding(this); - assign->connect("draw", callable_mp(this, &EditorPropertyResource::_button_draw)); - hbc->add_child(assign); - add_focusable(assign); - - preview = memnew(TextureRect); - preview->set_expand(true); - preview->set_anchors_and_offsets_preset(PRESET_WIDE); - preview->set_offset(SIDE_TOP, 1); - preview->set_offset(SIDE_BOTTOM, -1); - preview->set_offset(SIDE_RIGHT, -1); - // This is required to draw the focus outline in front of the preview, rather than behind. - preview->set_draw_behind_parent(true); - assign->add_child(preview); - assign->connect("gui_input", callable_mp(this, &EditorPropertyResource::_button_input)); - - menu = memnew(PopupMenu); - add_child(menu); - edit = memnew(Button); - edit->set_flat(true); - edit->set_toggle_mode(true); - menu->connect("id_pressed", callable_mp(this, &EditorPropertyResource::_menu_option)); - menu->connect("popup_hide", callable_mp((BaseButton *)edit, &BaseButton::set_pressed), varray(false)); - edit->connect("pressed", callable_mp(this, &EditorPropertyResource::_update_menu)); - hbc->add_child(edit); - edit->connect("gui_input", callable_mp(this, &EditorPropertyResource::_button_input)); - add_focusable(edit); - - file = nullptr; - scene_tree = nullptr; - dropping = false; - add_to_group("_editor_resource_properties"); } @@ -3751,7 +3166,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ } break; case Variant::OBJECT: { EditorPropertyResource *editor = memnew(EditorPropertyResource); - editor->setup(p_hint == PROPERTY_HINT_RESOURCE_TYPE ? p_hint_text : "Resource"); + editor->setup(p_object, p_path, p_hint == PROPERTY_HINT_RESOURCE_TYPE ? p_hint_text : "Resource"); if (p_hint == PROPERTY_HINT_RESOURCE_TYPE) { String open_in_new = EDITOR_GET("interface/inspector/resources_to_open_in_new_inspector"); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 07a1e72319..07f496f54d 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -33,6 +33,7 @@ #include "editor/create_dialog.h" #include "editor/editor_inspector.h" +#include "editor/editor_resource_picker.h" #include "editor/editor_spin_slider.h" #include "editor/property_selector.h" #include "editor/scene_tree_editor.h" @@ -599,64 +600,26 @@ public: class EditorPropertyResource : public EditorProperty { GDCLASS(EditorPropertyResource, EditorProperty); - enum MenuOption { - OBJ_MENU_LOAD = 0, - OBJ_MENU_EDIT = 1, - OBJ_MENU_CLEAR = 2, - OBJ_MENU_MAKE_UNIQUE = 3, - OBJ_MENU_SAVE = 4, - OBJ_MENU_COPY = 5, - OBJ_MENU_PASTE = 6, - OBJ_MENU_NEW_SCRIPT = 7, - OBJ_MENU_EXTEND_SCRIPT = 8, - OBJ_MENU_SHOW_IN_FILE_SYSTEM = 9, - TYPE_BASE_ID = 100, - CONVERT_BASE_ID = 1000 + EditorResourcePicker *resource_picker = nullptr; + SceneTreeDialog *scene_tree = nullptr; - }; - - Button *assign; - TextureRect *preview; - Button *edit; - PopupMenu *menu; - EditorFileDialog *file; - Vector<String> inheritors_array; - EditorInspector *sub_inspector; - VBoxContainer *sub_inspector_vbox; - - bool use_sub_inspector; - bool dropping; - String base_type; + bool use_sub_inspector = false; + EditorInspector *sub_inspector = nullptr; + VBoxContainer *sub_inspector_vbox = nullptr; + bool updating_theme = false; + bool opened_editor = false; - SceneTreeDialog *scene_tree; + void _resource_selected(const RES &p_resource); + void _resource_changed(const RES &p_resource); - void _file_selected(const String &p_path); - void _menu_option(int p_which); - void _resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj); - void _resource_selected(); void _viewport_selected(const NodePath &p_path); - void _update_menu_items(); - - void _update_menu(); - void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool); void _sub_inspector_resource_selected(const RES &p_resource, const String &p_property); void _sub_inspector_object_id_selected(int p_id); - void _button_draw(); - Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); - bool _is_drop_valid(const Dictionary &p_drag_data) const; - bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; - void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - - void _button_input(const Ref<InputEvent> &p_event); void _open_editor_pressed(); void _fold_other_editors(Object *p_self); - - bool opened_editor; - - bool updating_theme = false; void _update_property_bg(); protected: @@ -665,7 +628,7 @@ protected: public: virtual void update_property() override; - void setup(const String &p_base_type); + void setup(Object *p_object, const String &p_path, const String &p_base_type); void collapse_all_folding() override; void expand_all_folding() override; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index fb2980c948..3bc29856f1 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -902,7 +902,7 @@ void EditorPropertyDictionary::update_property() { } else { EditorPropertyResource *editor = memnew(EditorPropertyResource); - editor->setup("Resource"); + editor->setup(object.ptr(), prop_name, "Resource"); prop = editor; } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp new file mode 100644 index 0000000000..086afde07c --- /dev/null +++ b/editor/editor_resource_picker.cpp @@ -0,0 +1,862 @@ +/*************************************************************************/ +/* editor_resource_picker.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "editor_resource_picker.h" + +#include "editor/editor_resource_preview.h" +#include "editor_node.h" +#include "editor_scale.h" +#include "editor_settings.h" +#include "filesystem_dock.h" + +void EditorResourcePicker::_update_resource() { + preview_rect->set_texture(Ref<Texture2D>()); + assign_button->set_custom_minimum_size(Size2(1, 1)); + + if (edited_resource == RES()) { + assign_button->set_icon(Ref<Texture2D>()); + assign_button->set_text(TTR("[empty]")); + } else { + assign_button->set_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->(), "Object")); + + if (edited_resource->get_name() != String()) { + assign_button->set_text(edited_resource->get_name()); + } else if (edited_resource->get_path().is_resource_file()) { + assign_button->set_text(edited_resource->get_path().get_file()); + assign_button->set_tooltip(edited_resource->get_path()); + } else { + assign_button->set_text(edited_resource->get_class()); + } + + if (edited_resource->get_path().is_resource_file()) { + assign_button->set_tooltip(edited_resource->get_path()); + } + + // Preview will override the above, so called at the end. + EditorResourcePreview::get_singleton()->queue_edited_resource_preview(edited_resource, this, "_update_resource_preview", edited_resource->get_instance_id()); + } +} + +void EditorResourcePicker::_update_resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj) { + if (!edited_resource.is_valid() || edited_resource->get_instance_id() != p_obj) { + return; + } + + String type = edited_resource->get_class_name(); + if (ClassDB::is_parent_class(type, "Script")) { + assign_button->set_text(edited_resource->get_path().get_file()); + return; + } + + if (p_preview.is_valid()) { + preview_rect->set_offset(SIDE_LEFT, assign_button->get_icon()->get_width() + assign_button->get_theme_stylebox("normal")->get_default_margin(SIDE_LEFT) + get_theme_constant("hseparation", "Button")); + + if (type == "GradientTexture") { + preview_rect->set_stretch_mode(TextureRect::STRETCH_SCALE); + assign_button->set_custom_minimum_size(Size2(1, 1)); + } else { + preview_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + thumbnail_size *= EDSCALE; + assign_button->set_custom_minimum_size(Size2(1, thumbnail_size)); + } + + preview_rect->set_texture(p_preview); + assign_button->set_text(""); + } +} + +void EditorResourcePicker::_resource_selected() { + if (edited_resource.is_null()) { + edit_button->set_pressed(true); + _update_menu(); + return; + } + + emit_signal("resource_selected", edited_resource); +} + +void EditorResourcePicker::_file_selected(const String &p_path) { + RES loaded_resource = ResourceLoader::load(p_path); + ERR_FAIL_COND_MSG(loaded_resource.is_null(), "Cannot load resource from path '" + p_path + "'."); + + if (base_type != "") { + bool any_type_matches = false; + + for (int i = 0; i < base_type.get_slice_count(","); i++) { + String base = base_type.get_slice(",", i); + if (loaded_resource->is_class(base)) { + any_type_matches = true; + break; + } + } + + if (!any_type_matches) { + EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match any type expected for this property (%s)."), loaded_resource->get_class(), base_type)); + return; + } + } + + edited_resource = loaded_resource; + emit_signal("resource_changed", edited_resource); + _update_resource(); +} + +void EditorResourcePicker::_update_menu() { + _update_menu_items(); + + Rect2 gt = edit_button->get_screen_rect(); + edit_menu->set_as_minsize(); + int ms = edit_menu->get_contents_minimum_size().width; + Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0); + edit_menu->set_position(popup_pos); + edit_menu->popup(); +} + +void EditorResourcePicker::_update_menu_items() { + edit_menu->clear(); + + // Add options for creating specific subtypes of the base resource type. + set_create_options(edit_menu); + + // Add an option to load a resource from a file. + edit_menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD); + + // Add options for changing existing value of the resource. + if (edited_resource.is_valid()) { + edit_menu->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT); + edit_menu->add_icon_item(get_theme_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR); + edit_menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE); + edit_menu->add_icon_item(get_theme_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE); + + if (edited_resource->get_path().is_resource_file()) { + edit_menu->add_separator(); + edit_menu->add_item(TTR("Show in FileSystem"), OBJ_MENU_SHOW_IN_FILE_SYSTEM); + } + } + + // Add options to copy/paste resource. + RES cb = EditorSettings::get_singleton()->get_resource_clipboard(); + bool paste_valid = false; + if (cb.is_valid()) { + if (base_type == "") { + paste_valid = true; + } else { + for (int i = 0; i < base_type.get_slice_count(","); i++) { + if (ClassDB::is_parent_class(cb->get_class(), base_type.get_slice(",", i))) { + paste_valid = true; + break; + } + } + } + } + + if (edited_resource.is_valid() || paste_valid) { + edit_menu->add_separator(); + + if (edited_resource.is_valid()) { + edit_menu->add_item(TTR("Copy"), OBJ_MENU_COPY); + } + + if (paste_valid) { + edit_menu->add_item(TTR("Paste"), OBJ_MENU_PASTE); + } + } + + // Add options to convert existing resource to another type of resource. + if (edited_resource.is_valid()) { + Vector<Ref<EditorResourceConversionPlugin>> conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(edited_resource); + if (conversions.size()) { + edit_menu->add_separator(); + } + for (int i = 0; i < conversions.size(); i++) { + String what = conversions[i]->converts_to(); + Ref<Texture2D> icon; + if (has_theme_icon(what, "EditorIcons")) { + icon = get_theme_icon(what, "EditorIcons"); + } else { + icon = get_theme_icon(what, "Resource"); + } + + edit_menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); + } + } +} + +void EditorResourcePicker::_edit_menu_cbk(int p_which) { + switch (p_which) { + case OBJ_MENU_LOAD: { + List<String> extensions; + for (int i = 0; i < base_type.get_slice_count(","); i++) { + String base = base_type.get_slice(",", i); + ResourceLoader::get_recognized_extensions_for_type(base, &extensions); + } + + Set<String> valid_extensions; + for (List<String>::Element *E = extensions.front(); E; E = E->next()) { + valid_extensions.insert(E->get()); + } + + file_dialog->clear_filters(); + for (Set<String>::Element *E = valid_extensions.front(); E; E = E->next()) { + file_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper()); + } + + file_dialog->popup_file_dialog(); + } break; + + case OBJ_MENU_EDIT: { + if (edited_resource.is_valid()) { + emit_signal("resource_selected", edited_resource); + } + } break; + + case OBJ_MENU_CLEAR: { + edited_resource = RES(); + emit_signal("resource_changed", edited_resource); + _update_resource(); + } break; + + case OBJ_MENU_MAKE_UNIQUE: { + if (edited_resource.is_null()) { + return; + } + + List<PropertyInfo> property_list; + edited_resource->get_property_list(&property_list); + List<Pair<String, Variant>> propvalues; + for (List<PropertyInfo>::Element *E = property_list.front(); E; E = E->next()) { + Pair<String, Variant> p; + PropertyInfo &pi = E->get(); + if (pi.usage & PROPERTY_USAGE_STORAGE) { + p.first = pi.name; + p.second = edited_resource->get(pi.name); + } + + propvalues.push_back(p); + } + + String orig_type = edited_resource->get_class(); + Object *inst = ClassDB::instance(orig_type); + Ref<Resource> unique_resource = Ref<Resource>(Object::cast_to<Resource>(inst)); + ERR_FAIL_COND(unique_resource.is_null()); + + for (List<Pair<String, Variant>>::Element *E = propvalues.front(); E; E = E->next()) { + Pair<String, Variant> &p = E->get(); + unique_resource->set(p.first, p.second); + } + + edited_resource = unique_resource; + emit_signal("resource_changed", edited_resource); + _update_resource(); + } break; + + case OBJ_MENU_SAVE: { + if (edited_resource.is_null()) { + return; + } + EditorNode::get_singleton()->save_resource(edited_resource); + } break; + + case OBJ_MENU_COPY: { + EditorSettings::get_singleton()->set_resource_clipboard(edited_resource); + } break; + + case OBJ_MENU_PASTE: { + edited_resource = EditorSettings::get_singleton()->get_resource_clipboard(); + emit_signal("resource_changed", edited_resource); + _update_resource(); + } break; + + case OBJ_MENU_SHOW_IN_FILE_SYSTEM: { + FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); + file_system_dock->navigate_to_path(edited_resource->get_path()); + + // Ensure that the FileSystem dock is visible. + TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); + tab_container->set_current_tab(file_system_dock->get_index()); + } break; + + default: { + // Allow subclasses to handle their own options first, only then fallback on the default branch logic. + if (handle_menu_selected(p_which)) { + break; + } + + if (p_which >= CONVERT_BASE_ID) { + int to_type = p_which - CONVERT_BASE_ID; + Vector<Ref<EditorResourceConversionPlugin>> conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(edited_resource); + ERR_FAIL_INDEX(to_type, conversions.size()); + + edited_resource = conversions[to_type]->convert(edited_resource); + emit_signal("resource_changed", edited_resource); + _update_resource(); + break; + } + + ERR_FAIL_COND(inheritors_array.is_empty()); + + String intype = inheritors_array[p_which - TYPE_BASE_ID]; + Variant obj; + + if (ScriptServer::is_global_class(intype)) { + obj = ClassDB::instance(ScriptServer::get_global_class_native_base(intype)); + if (obj) { + Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype)); + if (script.is_valid()) { + ((Object *)obj)->set_script(script); + } + } + } else { + obj = ClassDB::instance(intype); + } + + if (!obj) { + obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource"); + } + + Resource *resp = Object::cast_to<Resource>(obj); + ERR_BREAK(!resp); + + edited_resource = RES(resp); + emit_signal("resource_changed", edited_resource); + _update_resource(); + } break; + } +} + +void EditorResourcePicker::set_create_options(Object *p_menu_node) { + // If a subclass implements this method, use it to replace all create items. + if (get_script_instance() && get_script_instance()->has_method("set_create_options")) { + get_script_instance()->call("set_create_options", p_menu_node); + return; + } + + // By default provide generic "New ..." options. + if (base_type != "") { + int idx = 0; + + Set<String> allowed_types; + _get_allowed_types(false, &allowed_types); + + Vector<EditorData::CustomType> custom_resources; + if (EditorNode::get_editor_data().get_custom_types().has("Resource")) { + custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"]; + } + + for (Set<String>::Element *E = allowed_types.front(); E; E = E->next()) { + const String &t = E->get(); + + bool is_custom_resource = false; + Ref<Texture2D> icon; + if (!custom_resources.is_empty()) { + for (int j = 0; j < custom_resources.size(); j++) { + if (custom_resources[j].name == t) { + is_custom_resource = true; + if (custom_resources[j].icon.is_valid()) { + icon = custom_resources[j].icon; + } + break; + } + } + } + + if (!is_custom_resource && !(ScriptServer::is_global_class(t) || ClassDB::can_instance(t))) { + continue; + } + + inheritors_array.push_back(t); + + if (!icon.is_valid()) { + icon = get_theme_icon(has_theme_icon(t, "EditorIcons") ? t : "Object", "EditorIcons"); + } + + int id = TYPE_BASE_ID + idx; + edit_menu->add_icon_item(icon, vformat(TTR("New %s"), t), id); + + idx++; + } + + if (edit_menu->get_item_count()) { + edit_menu->add_separator(); + } + } +} + +bool EditorResourcePicker::handle_menu_selected(int p_which) { + if (get_script_instance() && get_script_instance()->has_method("handle_menu_selected")) { + return get_script_instance()->call("handle_menu_selected", p_which); + } + + return false; +} + +void EditorResourcePicker::_button_draw() { + if (dropping) { + Color color = get_theme_color("accent_color", "Editor"); + assign_button->draw_rect(Rect2(Point2(), assign_button->get_size()), color, false); + } +} + +void EditorResourcePicker::_button_input(const Ref<InputEvent> &p_event) { + if (!editable) { + return; + } + + Ref<InputEventMouseButton> mb = p_event; + + if (mb.is_valid()) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { + _update_menu_items(); + + Vector2 pos = get_screen_position() + mb->get_position(); + edit_menu->set_as_minsize(); + edit_menu->set_position(pos); + edit_menu->popup(); + } + } +} + +void EditorResourcePicker::_get_allowed_types(bool p_with_convert, Set<String> *p_vector) const { + Vector<String> allowed_types = base_type.split(","); + int size = allowed_types.size(); + + List<StringName> global_classes; + ScriptServer::get_global_class_list(&global_classes); + + for (int i = 0; i < size; i++) { + String base = allowed_types[i].strip_edges(); + p_vector->insert(base); + + List<StringName> inheriters; + + ClassDB::get_inheriters_from_class(base, &inheriters); + for (List<StringName>::Element *E = inheriters.front(); E; E = E->next()) { + p_vector->insert(E->get()); + } + + for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) { + if (EditorNode::get_editor_data().script_class_is_parent(E->get(), base)) { + p_vector->insert(E->get()); + } + } + + if (p_with_convert) { + if (base == "StandardMaterial3D") { + p_vector->insert("Texture2D"); + } else if (base == "ShaderMaterial") { + p_vector->insert("Shader"); + } else if (base == "Font") { + p_vector->insert("FontData"); + } + } + } + + if (EditorNode::get_editor_data().get_custom_types().has("Resource")) { + Vector<EditorData::CustomType> custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"]; + + for (int i = 0; i < custom_resources.size(); i++) { + p_vector->insert(custom_resources[i].name); + } + } +} + +bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { + if (base_type.is_empty()) { + return true; + } + + Dictionary drag_data = p_drag_data; + + Ref<Resource> res; + if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { + ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); + res = se->get_edited_resource(); + } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { + res = drag_data["resource"]; + } + + Set<String> allowed_types; + _get_allowed_types(true, &allowed_types); + + if (res.is_valid() && _is_type_valid(res->get_class(), allowed_types)) { + return true; + } + + if (res.is_valid() && res->get_script()) { + StringName custom_class = EditorNode::get_singleton()->get_object_custom_type_name(res->get_script()); + if (_is_type_valid(custom_class, allowed_types)) { + return true; + } + } + + if (drag_data.has("type") && String(drag_data["type"]) == "files") { + Vector<String> files = drag_data["files"]; + + if (files.size() == 1) { + String file = files[0]; + + String file_type = EditorFileSystem::get_singleton()->get_file_type(file); + if (file_type != "" && _is_type_valid(file_type, allowed_types)) { + return true; + } + } + } + + return false; +} + +bool EditorResourcePicker::_is_type_valid(const String p_type_name, Set<String> p_allowed_types) const { + for (Set<String>::Element *E = p_allowed_types.front(); E; E = E->next()) { + String at = E->get().strip_edges(); + if (p_type_name == at || ClassDB::is_parent_class(p_type_name, at) || EditorNode::get_editor_data().script_class_is_parent(p_type_name, at)) { + return true; + } + } + + return false; +} + +Variant EditorResourcePicker::get_drag_data_fw(const Point2 &p_point, Control *p_from) { + if (edited_resource.is_valid()) { + return EditorNode::get_singleton()->drag_resource(edited_resource, p_from); + } + + return Variant(); +} + +bool EditorResourcePicker::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { + return editable && _is_drop_valid(p_data); +} + +void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { + ERR_FAIL_COND(!_is_drop_valid(p_data)); + + Dictionary drag_data = p_data; + + Ref<Resource> dropped_resource; + if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { + ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); + dropped_resource = se->get_edited_resource(); + } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { + dropped_resource = drag_data["resource"]; + } + + if (!dropped_resource.is_valid() && drag_data.has("type") && String(drag_data["type"]) == "files") { + Vector<String> files = drag_data["files"]; + + if (files.size() == 1) { + String file = files[0]; + dropped_resource = ResourceLoader::load(file); + } + } + + if (dropped_resource.is_valid()) { + Set<String> allowed_types; + _get_allowed_types(false, &allowed_types); + + // If the accepted dropped resource is from the extended list, it requires conversion. + if (!_is_type_valid(dropped_resource->get_class(), allowed_types)) { + for (Set<String>::Element *E = allowed_types.front(); E; E = E->next()) { + String at = E->get().strip_edges(); + + if (at == "StandardMaterial3D" && ClassDB::is_parent_class(dropped_resource->get_class(), "Texture2D")) { + Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D); + mat->set_texture(StandardMaterial3D::TextureParam::TEXTURE_ALBEDO, dropped_resource); + dropped_resource = mat; + break; + } + + if (at == "ShaderMaterial" && ClassDB::is_parent_class(dropped_resource->get_class(), "Shader")) { + Ref<ShaderMaterial> mat = memnew(ShaderMaterial); + mat->set_shader(dropped_resource); + dropped_resource = mat; + break; + } + + if (at == "Font" && ClassDB::is_parent_class(dropped_resource->get_class(), "FontData")) { + Ref<Font> font = memnew(Font); + font->add_data(dropped_resource); + dropped_resource = font; + break; + } + } + } + + edited_resource = dropped_resource; + emit_signal("resource_changed", edited_resource); + _update_resource(); + } +} + +void EditorResourcePicker::_bind_methods() { + ClassDB::bind_method(D_METHOD("_update_resource_preview"), &EditorResourcePicker::_update_resource_preview); + ClassDB::bind_method(D_METHOD("get_drag_data_fw", "position", "from"), &EditorResourcePicker::get_drag_data_fw); + ClassDB::bind_method(D_METHOD("can_drop_data_fw", "position", "data", "from"), &EditorResourcePicker::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("drop_data_fw", "position", "data", "from"), &EditorResourcePicker::drop_data_fw); + + ClassDB::bind_method(D_METHOD("set_base_type", "base_type"), &EditorResourcePicker::set_base_type); + ClassDB::bind_method(D_METHOD("get_base_type"), &EditorResourcePicker::get_base_type); + ClassDB::bind_method(D_METHOD("get_allowed_types"), &EditorResourcePicker::get_allowed_types); + ClassDB::bind_method(D_METHOD("set_edited_resource", "resource"), &EditorResourcePicker::set_edited_resource); + ClassDB::bind_method(D_METHOD("get_edited_resource"), &EditorResourcePicker::get_edited_resource); + ClassDB::bind_method(D_METHOD("set_toggle_mode", "enable"), &EditorResourcePicker::set_toggle_mode); + ClassDB::bind_method(D_METHOD("is_toggle_mode"), &EditorResourcePicker::is_toggle_mode); + ClassDB::bind_method(D_METHOD("set_toggle_pressed", "pressed"), &EditorResourcePicker::set_toggle_pressed); + ClassDB::bind_method(D_METHOD("set_editable", "enable"), &EditorResourcePicker::set_editable); + ClassDB::bind_method(D_METHOD("is_editable"), &EditorResourcePicker::is_editable); + + ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_create_options", PropertyInfo(Variant::OBJECT, "menu_node"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("handle_menu_selected", PropertyInfo(Variant::INT, "id"))); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type"), "set_base_type", "get_base_type"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource", 0), "set_edited_resource", "get_edited_resource"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode"); + + ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); + ADD_SIGNAL(MethodInfo("resource_changed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); +} + +void EditorResourcePicker::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + _update_resource(); + [[fallthrough]]; + } + case NOTIFICATION_THEME_CHANGED: { + edit_button->set_icon(get_theme_icon("select_arrow", "Tree")); + } break; + + case NOTIFICATION_DRAW: { + draw_style_box(get_theme_stylebox("bg", "Tree"), Rect2(Point2(), get_size())); + } break; + + case NOTIFICATION_DRAG_BEGIN: { + if (editable && _is_drop_valid(get_viewport()->gui_get_drag_data())) { + dropping = true; + assign_button->update(); + } + } break; + + case NOTIFICATION_DRAG_END: { + if (dropping) { + dropping = false; + assign_button->update(); + } + } break; + } +} + +void EditorResourcePicker::set_base_type(const String &p_base_type) { + base_type = p_base_type; + + // There is a possibility that the new base type is conflicting with the existing value. + // Keep the value, but warn the user that there is a potential mistake. + if (!base_type.is_empty() && edited_resource.is_valid()) { + Set<String> allowed_types; + _get_allowed_types(true, &allowed_types); + + StringName custom_class; + bool is_custom = false; + if (edited_resource->get_script()) { + custom_class = EditorNode::get_singleton()->get_object_custom_type_name(edited_resource->get_script()); + is_custom = _is_type_valid(custom_class, allowed_types); + } + + if (!is_custom && !_is_type_valid(edited_resource->get_class(), allowed_types)) { + String class_str = (custom_class == StringName() ? edited_resource->get_class() : vformat("%s (%s)", custom_class, edited_resource->get_class())); + WARN_PRINT(vformat("Value mismatch between the new base type of this EditorResourcePicker, '%s', and the type of the value it already has, '%s'.", base_type, class_str)); + } + } +} + +String EditorResourcePicker::get_base_type() const { + return base_type; +} + +Vector<String> EditorResourcePicker::get_allowed_types() const { + Set<String> allowed_types; + _get_allowed_types(false, &allowed_types); + + Vector<String> types; + types.resize(allowed_types.size()); + + int i = 0; + String *w = types.ptrw(); + for (Set<String>::Element *E = allowed_types.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + + return types; +} + +void EditorResourcePicker::set_edited_resource(RES p_resource) { + if (!p_resource.is_valid()) { + edited_resource = RES(); + _update_resource(); + return; + } + + if (!base_type.is_empty()) { + Set<String> allowed_types; + _get_allowed_types(true, &allowed_types); + + StringName custom_class; + bool is_custom = false; + if (p_resource->get_script()) { + custom_class = EditorNode::get_singleton()->get_object_custom_type_name(p_resource->get_script()); + is_custom = _is_type_valid(custom_class, allowed_types); + } + + if (!is_custom && !_is_type_valid(p_resource->get_class(), allowed_types)) { + String class_str = (custom_class == StringName() ? p_resource->get_class() : vformat("%s (%s)", custom_class, p_resource->get_class())); + ERR_FAIL_MSG(vformat("Failed to set a resource of the type '%s' because this EditorResourcePicker only accepts '%s' and its derivatives.", class_str, base_type)); + } + } + + edited_resource = p_resource; + _update_resource(); +} + +RES EditorResourcePicker::get_edited_resource() { + return edited_resource; +} + +void EditorResourcePicker::set_toggle_mode(bool p_enable) { + assign_button->set_toggle_mode(p_enable); +} + +bool EditorResourcePicker::is_toggle_mode() const { + return assign_button->is_toggle_mode(); +} + +void EditorResourcePicker::set_toggle_pressed(bool p_pressed) { + if (!is_toggle_mode()) { + return; + } + + assign_button->set_pressed(p_pressed); +} + +void EditorResourcePicker::set_editable(bool p_editable) { + editable = p_editable; + assign_button->set_disabled(!editable); + edit_button->set_visible(editable); +} + +bool EditorResourcePicker::is_editable() const { + return editable; +} + +EditorResourcePicker::EditorResourcePicker() { + assign_button = memnew(Button); + assign_button->set_flat(true); + assign_button->set_h_size_flags(SIZE_EXPAND_FILL); + assign_button->set_clip_text(true); + assign_button->connect("pressed", callable_mp(this, &EditorResourcePicker::_resource_selected)); + assign_button->set_drag_forwarding(this); + assign_button->connect("draw", callable_mp(this, &EditorResourcePicker::_button_draw)); + add_child(assign_button); + + preview_rect = memnew(TextureRect); + preview_rect->set_expand(true); + preview_rect->set_anchors_and_offsets_preset(PRESET_WIDE); + preview_rect->set_offset(SIDE_TOP, 1); + preview_rect->set_offset(SIDE_BOTTOM, -1); + preview_rect->set_offset(SIDE_RIGHT, -1); + assign_button->add_child(preview_rect); + assign_button->connect("gui_input", callable_mp(this, &EditorResourcePicker::_button_input)); + + edit_menu = memnew(PopupMenu); + add_child(edit_menu); + edit_button = memnew(Button); + edit_button->set_flat(true); + edit_button->set_toggle_mode(true); + edit_menu->connect("id_pressed", callable_mp(this, &EditorResourcePicker::_edit_menu_cbk)); + edit_menu->connect("popup_hide", callable_mp((BaseButton *)edit_button, &BaseButton::set_pressed), varray(false)); + edit_button->connect("pressed", callable_mp(this, &EditorResourcePicker::_update_menu)); + add_child(edit_button); + edit_button->connect("gui_input", callable_mp(this, &EditorResourcePicker::_button_input)); + + file_dialog = memnew(EditorFileDialog); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); + add_child(file_dialog); + file_dialog->connect("file_selected", callable_mp(this, &EditorResourcePicker::_file_selected)); +} + +void EditorScriptPicker::set_create_options(Object *p_menu_node) { + PopupMenu *menu_node = Object::cast_to<PopupMenu>(p_menu_node); + if (!menu_node) { + return; + } + + menu_node->add_icon_item(get_theme_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); + menu_node->add_icon_item(get_theme_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); + menu_node->add_separator(); +} + +bool EditorScriptPicker::handle_menu_selected(int p_which) { + switch (p_which) { + case OBJ_MENU_NEW_SCRIPT: { + if (script_owner) { + EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(script_owner, false); + } + return true; + } + + case OBJ_MENU_EXTEND_SCRIPT: { + if (script_owner) { + EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(script_owner, true); + } + return true; + } + } + + return false; +} + +void EditorScriptPicker::set_script_owner(Node *p_owner) { + script_owner = p_owner; +} + +Node *EditorScriptPicker::get_script_owner() const { + return script_owner; +} + +void EditorScriptPicker::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_script_owner", "owner_node"), &EditorScriptPicker::set_script_owner); + ClassDB::bind_method(D_METHOD("get_script_owner"), &EditorScriptPicker::get_script_owner); + + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "script_owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_script_owner", "get_script_owner"); +} + +EditorScriptPicker::EditorScriptPicker() { +} diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h new file mode 100644 index 0000000000..20fafe1780 --- /dev/null +++ b/editor/editor_resource_picker.h @@ -0,0 +1,141 @@ +/*************************************************************************/ +/* editor_resource_picker.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef EDITOR_RESOURCE_PICKER_H +#define EDITOR_RESOURCE_PICKER_H + +#include "editor_file_dialog.h" +#include "scene/gui/box_container.h" +#include "scene/gui/button.h" +#include "scene/gui/popup_menu.h" +#include "scene/gui/texture_rect.h" + +class EditorResourcePicker : public HBoxContainer { + GDCLASS(EditorResourcePicker, HBoxContainer); + + String base_type; + RES edited_resource; + + bool editable = true; + bool dropping = false; + + Vector<String> inheritors_array; + + Button *assign_button; + TextureRect *preview_rect; + Button *edit_button; + EditorFileDialog *file_dialog; + + enum MenuOption { + OBJ_MENU_LOAD, + OBJ_MENU_EDIT, + OBJ_MENU_CLEAR, + OBJ_MENU_MAKE_UNIQUE, + OBJ_MENU_SAVE, + OBJ_MENU_COPY, + OBJ_MENU_PASTE, + OBJ_MENU_SHOW_IN_FILE_SYSTEM, + + TYPE_BASE_ID = 100, + CONVERT_BASE_ID = 1000, + }; + + PopupMenu *edit_menu; + + void _update_resource(); + void _update_resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj); + + void _resource_selected(); + void _file_selected(const String &p_path); + + void _update_menu(); + void _update_menu_items(); + void _edit_menu_cbk(int p_which); + + void _button_draw(); + void _button_input(const Ref<InputEvent> &p_event); + + void _get_allowed_types(bool p_with_convert, Set<String> *p_vector) const; + bool _is_drop_valid(const Dictionary &p_drag_data) const; + bool _is_type_valid(const String p_type_name, Set<String> p_allowed_types) const; + + Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); + bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; + void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); + +protected: + static void _bind_methods(); + void _notification(int p_what); + +public: + void set_base_type(const String &p_base_type); + String get_base_type() const; + Vector<String> get_allowed_types() const; + + void set_edited_resource(RES p_resource); + RES get_edited_resource(); + + void set_toggle_mode(bool p_enable); + bool is_toggle_mode() const; + void set_toggle_pressed(bool p_pressed); + + void set_editable(bool p_editable); + bool is_editable() const; + + virtual void set_create_options(Object *p_menu_node); + virtual bool handle_menu_selected(int p_which); + + EditorResourcePicker(); +}; + +class EditorScriptPicker : public EditorResourcePicker { + GDCLASS(EditorScriptPicker, EditorResourcePicker); + + enum ExtraMenuOption { + OBJ_MENU_NEW_SCRIPT = 10, + OBJ_MENU_EXTEND_SCRIPT = 11 + }; + + Node *script_owner = nullptr; + +protected: + static void _bind_methods(); + +public: + virtual void set_create_options(Object *p_menu_node) override; + virtual bool handle_menu_selected(int p_which) override; + + void set_script_owner(Node *p_owner); + Node *get_script_owner() const; + + EditorScriptPicker(); +}; + +#endif // EDITOR_RESOURCE_PICKER_H diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index f81c87be9e..7532f1c796 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -135,7 +135,7 @@ void SectionedInspector::_section_selected() { } selected_category = sections->get_selected()->get_metadata(0); - filter->set_section(selected_category, sections->get_selected()->get_children() == nullptr); + filter->set_section(selected_category, sections->get_selected()->get_first_child() == nullptr); inspector->set_property_prefix(selected_category + "/"); } @@ -187,8 +187,8 @@ void SectionedInspector::edit(Object *p_object) { TreeItem *first_item = sections->get_root(); if (first_item) { - while (first_item->get_children()) { - first_item = first_item->get_children(); + while (first_item->get_first_child()) { + first_item = first_item->get_first_child(); } first_item->select(0); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index aba14df812..0868c31c45 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1656,10 +1656,10 @@ Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p ie->set_unicode(p_keycode & KEY_CODE_MASK); ie->set_keycode(p_keycode & KEY_CODE_MASK); - ie->set_shift(bool(p_keycode & KEY_MASK_SHIFT)); - ie->set_alt(bool(p_keycode & KEY_MASK_ALT)); - ie->set_control(bool(p_keycode & KEY_MASK_CTRL)); - ie->set_metakey(bool(p_keycode & KEY_MASK_META)); + ie->set_shift_pressed(bool(p_keycode & KEY_MASK_SHIFT)); + ie->set_alt_pressed(bool(p_keycode & KEY_MASK_ALT)); + ie->set_ctrl_pressed(bool(p_keycode & KEY_MASK_CTRL)); + ie->set_meta_pressed(bool(p_keycode & KEY_MASK_META)); } if (!EditorSettings::get_singleton()) { diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index dba53a9708..942a2d35ab 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -96,7 +96,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { if (mm.is_valid()) { if (grabbing_spinner_attempt) { double diff_x = mm->get_relative().x; - if (mm->get_shift() && grabbing_spinner) { + if (mm->is_shift_pressed() && grabbing_spinner) { diff_x *= 0.1; } grabbing_spinner_dist_cache += diff_x; @@ -115,7 +115,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { pre_grab_value = get_max(); } - if (mm->get_control()) { + if (mm->is_ctrl_pressed()) { // If control was just pressed, don't make the value do a huge jump in magnitude. if (grabbing_spinner_dist_cache != 0) { pre_grab_value += grabbing_spinner_dist_cache * get_step(); diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index d80003a12a..b04e518b0b 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -230,8 +230,7 @@ void EditorFileServer::_subthread_start(void *s) { cd->files[id]->seek(offset); Vector<uint8_t> buf; buf.resize(blocklen); - int read = cd->files[id]->get_buffer(buf.ptrw(), blocklen); - ERR_CONTINUE(read < 0); + uint32_t read = cd->files[id]->get_buffer(buf.ptrw(), blocklen); print_verbose("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen)); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 7ecfc5d520..a21a33a44a 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -180,12 +180,12 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() { Vector<String> uncollapsed_paths; TreeItem *root = tree->get_root(); if (root) { - TreeItem *favorites_item = root->get_children(); + TreeItem *favorites_item = root->get_first_child(); if (!favorites_item->is_collapsed()) { uncollapsed_paths.push_back(favorites_item->get_metadata(0)); } - TreeItem *resTree = root->get_children()->get_next(); + TreeItem *resTree = root->get_first_child()->get_next(); if (resTree) { Vector<TreeItem *> needs_check; needs_check.push_back(resTree); @@ -193,7 +193,7 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() { while (needs_check.size()) { if (!needs_check[0]->is_collapsed()) { uncollapsed_paths.push_back(needs_check[0]->get_metadata(0)); - TreeItem *child = needs_check[0]->get_children(); + TreeItem *child = needs_check[0]->get_first_child(); while (child) { needs_check.push_back(child); child = child->get_next(); @@ -464,7 +464,7 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s return; } - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); if (selected->get_parent() == favorites_item && !String(selected->get_metadata(0)).ends_with("/")) { // Go to the favorites if we click in the favorites and the path has changed. path = "Favorites"; @@ -860,7 +860,6 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { file_list.push_back(fi); } } - file_list.sort(); } // Sort the file list if needed. @@ -1644,7 +1643,7 @@ Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) { // Build a list of selected items with the active one at the first position. Vector<String> selected_strings; - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *active_selected = tree->get_selected(); if (active_selected && active_selected != favorites_item) { selected_strings.push_back(active_selected->get_metadata(0)); @@ -1700,7 +1699,7 @@ void FileSystemDock::_tree_rmb_option(int p_option) { while (needs_check.size()) { needs_check[0]->set_collapsed(is_collapsed); - TreeItem *child = needs_check[0]->get_children(); + TreeItem *child = needs_check[0]->get_first_child(); while (child) { needs_check.push_back(child); child = child->get_next(); @@ -2062,13 +2061,13 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) // Check if the first selected is in favorite. TreeItem *selected = tree->get_next_selected(tree->get_root()); while (selected) { - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); if (selected == favorites_item) { // The "Favorites" item is not draggable. return Variant(); } - bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_children() == selected->get_parent(); + bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_first_child() == selected->get_parent(); all_favorites &= is_favorite; all_not_favorites &= !is_favorite; selected = tree->get_next_selected(selected); @@ -2114,7 +2113,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da } int drop_section = tree->get_drop_section_at_position(p_point); - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *resources_item = favorites_item->get_next(); @@ -2190,7 +2189,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, int drop_position; Vector<String> files = drag_data["files"]; - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *resources_item = favorites_item->get_next(); if (ti == favorites_item) { @@ -2264,7 +2263,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, } } if (!to_move.is_empty()) { - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { for (int i = 0; i < to_move.size(); i++) { String new_path; String new_path_base; @@ -2328,10 +2327,10 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori int section = tree->get_drop_section_at_position(p_point); if (ti) { // Check the favorites first. - if (ti == tree->get_root()->get_children() && section >= 0) { + if (ti == tree->get_root()->get_first_child() && section >= 0) { target_favorites = true; return; - } else if (ti->get_parent() == tree->get_root()->get_children()) { + } else if (ti->get_parent() == tree->get_root()->get_first_child()) { target_favorites = true; return; } else { @@ -2347,7 +2346,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori return; } } else { - if (ti->get_parent() != tree->get_root()->get_children()) { + if (ti->get_parent() != tree->get_root()->get_first_child()) { // Not in the favorite section. if (fpath != "res://") { // We drop between two files @@ -2735,12 +2734,12 @@ MenuButton *FileSystemDock::_create_file_menu_button() { PopupMenu *p = button->get_popup(); p->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_sort_popup)); - p->add_radio_check_item("Sort by Name (Ascending)", FILE_SORT_NAME); - p->add_radio_check_item("Sort by Name (Descending)", FILE_SORT_NAME_REVERSE); - p->add_radio_check_item("Sort by Type (Ascending)", FILE_SORT_TYPE); - p->add_radio_check_item("Sort by Type (Descending)", FILE_SORT_TYPE_REVERSE); - p->add_radio_check_item("Sort by Last Modified", FILE_SORT_MODIFIED_TIME); - p->add_radio_check_item("Sort by First Modified", FILE_SORT_MODIFIED_TIME_REVERSE); + p->add_radio_check_item(TTR("Sort by Name (Ascending)"), FILE_SORT_NAME); + p->add_radio_check_item(TTR("Sort by Name (Descending)"), FILE_SORT_NAME_REVERSE); + p->add_radio_check_item(TTR("Sort by Type (Ascending)"), FILE_SORT_TYPE); + p->add_radio_check_item(TTR("Sort by Type (Descending)"), FILE_SORT_TYPE_REVERSE); + p->add_radio_check_item(TTR("Sort by Last Modified"), FILE_SORT_MODIFIED_TIME); + p->add_radio_check_item(TTR("Sort by First Modified"), FILE_SORT_MODIFIED_TIME_REVERSE); p->set_item_checked(file_sort, true); return button; } diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index baaa5d21bf..d9b956ed08 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -530,7 +530,7 @@ void FindInFilesDialog::_on_replace_text_entered(String text) { void FindInFilesDialog::_on_folder_selected(String path) { int i = path.find("://"); if (i != -1) { - path = path.right(i + 3); + path = path.substr(i + 3); } _folder_line_edit->set_text(path); } @@ -840,7 +840,7 @@ void FindInFilesPanel::_on_replace_all_clicked() { String fpath = file_item->get_metadata(0); Vector<Result> locations; - for (TreeItem *item = file_item->get_children(); item; item = item->get_next()) { + for (TreeItem *item = file_item->get_first_child(); item; item = item->get_next()) { if (!item->is_checked(0)) { continue; } @@ -934,7 +934,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result> continue; } - line = line.left(repl_begin) + new_text + line.right(repl_end); + line = line.left(repl_begin) + new_text + line.substr(repl_end); // keep an offset in case there are successive replaces in the same line offset += new_text.length() - (repl_end - repl_begin); } diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index f2a110ca03..d8e5a05c5d 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -52,7 +52,7 @@ void GroupDialog::_group_selected() { selected_group = groups->get_selected()->get_text(0); _load_nodes(scene_tree->get_edited_scene_root()); - group_empty->set_visible(!remove_node_root->get_children()); + group_empty->set_visible(!remove_node_root->get_first_child()); } void GroupDialog::_load_nodes(Node *p_current) { @@ -217,7 +217,7 @@ void GroupDialog::_group_renamed() { } const String name = renamed_group->get_text(0).strip_edges(); - for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) { + for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) { if (E != renamed_group && E->get_text(0) == name) { renamed_group->set_text(0, selected_group); error->set_text(TTR("Group name already exists.")); @@ -274,7 +274,7 @@ void GroupDialog::_rename_group_item(const String &p_old_name, const String &p_n selected_group = p_new_name; - for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) { + for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) { if (E->get_text(0) == p_old_name) { E->set_text(0, p_new_name); return; @@ -351,7 +351,7 @@ void GroupDialog::_delete_group_item(const String &p_name) { selected_group = ""; } - for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) { + for (TreeItem *E = groups_root->get_first_child(); E; E = E->get_next()) { if (E->get_text(0) == p_name) { groups_root->remove_child(E); return; diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp index 26c6a8462b..fa6ce5fc89 100644 --- a/editor/import/resource_importer_image.cpp +++ b/editor/import/resource_importer_image.cpp @@ -75,7 +75,7 @@ Error ResourceImporterImage::import(const String &p_source_file, const String &p ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file from path '" + p_source_file + "'."); - size_t len = f->get_len(); + uint64_t len = f->get_len(); Vector<uint8_t> data; data.resize(len); diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 48340ac242..488c124c28 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -339,7 +339,7 @@ void SceneImportSettings::_update_scene() { material_tree->clear(); mesh_tree->clear(); - //hiden roots + //hidden roots material_tree->create_item(); mesh_tree->create_item(); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 80d0a7db60..e6f7ec1fbf 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -266,7 +266,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) { if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { - if (mb->get_control() || mb->get_shift() || mb->get_alt()) { + if (mb->is_ctrl_pressed() || mb->is_shift_pressed() || mb->is_alt_pressed()) { return false; } @@ -399,7 +399,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint))); //Move the point in a single axis. Should only work when editing a polygon and while holding shift. - if (mode == MODE_EDIT && mm->get_shift()) { + if (mode == MODE_EDIT && mm->is_shift_pressed()) { Vector2 old_point = pre_move_edit.get(selected_point.vertex); if (ABS(cpoint.x - old_point.x) > ABS(cpoint.y - old_point.y)) { cpoint.y = old_point.y; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 612a8f30a4..e459d2f756 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1222,10 +1222,10 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { ERR_FAIL_COND(p_ev.is_null()); Ref<InputEventKey> k = p_ev; - if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) { + if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->is_alt_pressed() && !k->is_ctrl_pressed() && !k->is_meta_pressed()) { switch (k->get_keycode()) { case KEY_A: { - if (!k->get_shift()) { + if (!k->is_shift_pressed()) { _play_bw_from_pressed(); } else { _play_bw_pressed(); @@ -1237,7 +1237,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { accept_event(); } break; case KEY_D: { - if (!k->get_shift()) { + if (!k->is_shift_pressed()) { _play_from_pressed(); } else { _play_pressed(); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index a9709bbb16..c915276d3a 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -124,7 +124,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv } // select node or push a field inside - if (mb.is_valid() && !mb->get_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { + if (mb.is_valid() && !mb->is_shift_pressed() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { selected_transition_from = StringName(); selected_transition_to = StringName(); selected_node = StringName(); @@ -237,7 +237,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv } //connect nodes - if (mb.is_valid() && ((tool_select->is_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { + if (mb.is_valid() && ((tool_select->is_pressed() && mb->is_shift_pressed()) || tool_connect->is_pressed()) && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) { for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected connecting = true; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 91022ccb2c..21bff41498 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -332,7 +332,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; - bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CTRL); // Smart snap using the canvas position Vector2 output = p_target; @@ -460,7 +460,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig } float CanvasItemEditor::snap_angle(float p_target, float p_start) const { - if (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) { + if (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CTRL)) && snap_rotation_step != 0) { if (snap_relative) { return Math::snapped(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset + (p_start - (int)(p_start / snap_rotation_step) * snap_rotation_step); } else { @@ -481,11 +481,11 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { } if (k.is_valid()) { - if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) { + if (k->get_keycode() == KEY_CTRL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) { viewport->update(); } - if (k->is_pressed() && !k->get_control() && !k->is_echo()) { + if (k->is_pressed() && !k->is_ctrl_pressed() && !k->is_echo()) { if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) { // Multiply the grid size grid_step_multiplier = MIN(grid_step_multiplier + 1, 12); @@ -1269,12 +1269,12 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bool p_already_accepted) { Ref<InputEventMouseButton> b = p_event; if (b.is_valid() && !p_already_accepted) { - const bool pan_on_scroll = bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan")) && !b->get_control(); + const bool pan_on_scroll = bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan")) && !b->is_ctrl_pressed(); if (pan_on_scroll) { // Perform horizontal scrolling first so we can check for Shift being held. if (b->is_pressed() && - (b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP))) { + (b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->is_shift_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP))) { // Pan left view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); update_viewport(); @@ -1282,7 +1282,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo } if (b->is_pressed() && - (b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN))) { + (b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->is_shift_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN))) { // Pan right view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); update_viewport(); @@ -1389,7 +1389,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo Ref<InputEventPanGesture> pan_gesture = p_event; if (pan_gesture.is_valid() && !p_already_accepted) { // If control key pressed, then zoom instead of pan - if (pan_gesture->get_control()) { + if (pan_gesture->is_ctrl_pressed()) { const float factor = pan_gesture->get_delta().y; zoom_widget->set_zoom_by_increments(1); @@ -1574,7 +1574,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) { // Start rotation if (drag_type == DRAG_NONE) { if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { - if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { + if ((b->is_command_pressed() && !b->is_alt_pressed() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { List<CanvasItem *> selection = _get_edited_canvas_items(); // Remove not movable nodes @@ -1740,7 +1740,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) { Vector2 new_anchor = xform.xform(snap_point(previous_anchor + (drag_to - drag_from), SNAP_GRID | SNAP_OTHER_NODES, SNAP_NODE_PARENT | SNAP_NODE_SIDES | SNAP_NODE_CENTER, control)); new_anchor = _position_to_anchor(control, new_anchor).snapped(Vector2(0.001, 0.001)); - bool use_single_axis = m->get_shift(); + bool use_single_axis = m->is_shift_pressed(); Vector2 drag_vector = xform.xform(drag_to) - xform.xform(drag_from); bool use_y = Math::abs(drag_vector.y) > Math::abs(drag_vector.x); @@ -1888,8 +1888,8 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) { //Reset state canvas_item->_edit_set_state(se->undo_state); - bool uniform = m->get_shift(); - bool symmetric = m->get_alt(); + bool uniform = m->is_shift_pressed(); + bool symmetric = m->is_alt_pressed(); Rect2 local_rect = canvas_item->_edit_get_rect(); float aspect = local_rect.get_size().y / local_rect.get_size().x; @@ -2028,7 +2028,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) { // Drag resize handles if (drag_type == DRAG_NONE) { - if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && ((b->is_alt_pressed() && b->is_ctrl_pressed()) || tool == TOOL_SCALE)) { List<CanvasItem *> selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; @@ -2074,8 +2074,8 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) { Transform2D unscaled_transform = (transform * parent_xform * canvas_item->_edit_get_transform()).orthonormalized(); Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform; - bool uniform = m->get_shift(); - bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool uniform = m->is_shift_pressed(); + bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL); Point2 drag_from_local = simple_xform.xform(drag_from); Point2 drag_to_local = simple_xform.xform(drag_to); @@ -2167,7 +2167,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { if (drag_type == DRAG_NONE) { //Start moving the nodes if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) { - if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) { + if ((b->is_alt_pressed() && !b->is_ctrl_pressed()) || tool == TOOL_MOVE) { List<CanvasItem *> selection = _get_edited_canvas_items(); drag_selection.clear(); @@ -2235,7 +2235,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { new_pos.x = previous_pos.x; } - bool single_axis = m->get_shift(); + bool single_axis = m->is_shift_pressed(); if (single_axis) { if (ABS(new_pos.x - previous_pos.x) > ABS(new_pos.y - previous_pos.y)) { new_pos.y = previous_pos.y; @@ -2244,7 +2244,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { } } - bool force_no_IK = m->get_alt(); + bool force_no_IK = m->is_alt_pressed(); int index = 0; for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get(); @@ -2335,8 +2335,8 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { _restore_canvas_item_state(drag_selection, true); - bool move_local_base = k->get_alt(); - bool move_local_base_rotated = k->get_control() || k->get_metakey(); + bool move_local_base = k->is_alt_pressed(); + bool move_local_base_rotated = k->is_ctrl_pressed() || k->is_meta_pressed(); Vector2 dir; if (k->get_keycode() == KEY_UP) { @@ -2348,12 +2348,12 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { } else if (k->get_keycode() == KEY_RIGHT) { dir += Vector2(1, 0); } - if (k->get_shift()) { + if (k->is_shift_pressed()) { dir *= grid_step * Math::pow(2.0, grid_step_multiplier); } drag_to += dir; - if (k->get_shift()) { + if (k->is_shift_pressed()) { drag_to = drag_to.snapped(grid_step * Math::pow(2.0, grid_step_multiplier)); } @@ -2442,18 +2442,18 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { if (drag_type == DRAG_NONE) { if (b.is_valid() && - ((b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) || + ((b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_alt_pressed() && tool == TOOL_SELECT) || (b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_LIST_SELECT))) { // Popup the selection menu list Point2 click = transform.affine_inverse().xform(b->get_position()); - _get_canvas_items_at_pos(click, selection_results, b->get_alt() && tool != TOOL_LIST_SELECT); + _get_canvas_items_at_pos(click, selection_results, b->is_alt_pressed() && tool != TOOL_LIST_SELECT); if (selection_results.size() == 1) { CanvasItem *item = selection_results[0].item; selection_results.clear(); - _select_click_on_item(item, click, b->get_shift()); + _select_click_on_item(item, click, b->is_shift_pressed()); return true; } else if (!selection_results.is_empty()) { @@ -2497,14 +2497,14 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { selection_menu->set_item_tooltip(i, String(item->get_name()) + "\nType: " + item->get_class() + "\nPath: " + node_path); } - selection_menu_additive_selection = b->get_shift(); + selection_menu_additive_selection = b->is_shift_pressed(); selection_menu->set_position(get_screen_transform().xform(b->get_position())); selection_menu->popup(); return true; } } - if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_control()) { + if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_ctrl_pressed()) { add_node_menu->set_position(get_global_transform().xform(get_local_mouse_position())); add_node_menu->set_size(Vector2(1, 1)); add_node_menu->popup(); @@ -2540,7 +2540,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { if (!canvas_item) { // Start a box selection - if (!b->get_shift()) { + if (!b->is_shift_pressed()) { // Clear the selection if not additive editor_selection->clear(); viewport->update(); @@ -2552,7 +2552,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { box_selecting_to = drag_from; return true; } else { - bool still_selected = _select_click_on_item(canvas_item, click, b->get_shift()); + bool still_selected = _select_click_on_item(canvas_item, click, b->is_shift_pressed()); // Start dragging if (still_selected) { // Drag the node(s) if requested @@ -3574,7 +3574,7 @@ void CanvasItemEditor::_draw_selection() { } // Draw the move handles - bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL); bool is_alt = Input::get_singleton()->is_key_pressed(KEY_ALT); if (tool == TOOL_MOVE && show_transformation_gizmos) { if (_is_node_movable(canvas_item)) { diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp index b50a497ccf..252e5c68a0 100644 --- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp @@ -175,7 +175,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con case MODE_EDIT: { if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { - if (mb->get_control()) { + if (mb->is_ctrl_pressed()) { if (poly.size() < 3) { undo_redo->create_action(TTR("Edit Poly")); undo_redo->add_undo_method(node, "set_polygon", poly); @@ -317,7 +317,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con Vector2 cpoint(spoint.x, spoint.y); - if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CTRL)) { snap_ignore = false; } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index db999f50ab..7a38fd2bd5 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -168,8 +168,8 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) { // Snap to "round" coordinates when holding Ctrl. // Be more precise when holding Shift as well. float snap_threshold; - if (mm.get_control()) { - snap_threshold = mm.get_shift() ? 0.025 : 0.1; + if (mm.is_ctrl_pressed()) { + snap_threshold = mm.is_shift_pressed() ? 0.025 : 0.1; } else { snap_threshold = 0.0; } diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 81f1852fba..ba39ce3aed 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -85,10 +85,10 @@ void ViewportRotationControl::_notification(int p_what) { axis_menu_options.clear(); axis_menu_options.push_back(Node3DEditorViewport::VIEW_RIGHT); axis_menu_options.push_back(Node3DEditorViewport::VIEW_TOP); - axis_menu_options.push_back(Node3DEditorViewport::VIEW_FRONT); + axis_menu_options.push_back(Node3DEditorViewport::VIEW_REAR); axis_menu_options.push_back(Node3DEditorViewport::VIEW_LEFT); axis_menu_options.push_back(Node3DEditorViewport::VIEW_BOTTOM); - axis_menu_options.push_back(Node3DEditorViewport::VIEW_REAR); + axis_menu_options.push_back(Node3DEditorViewport::VIEW_FRONT); axis_colors.clear(); axis_colors.push_back(get_theme_color("axis_x_color", "Editor")); @@ -309,7 +309,7 @@ void Node3DEditorViewport::_update_camera(float p_interp_delta) { bool manipulated = Input::get_singleton()->get_mouse_button_mask() & (2 | 4); manipulated |= Input::get_singleton()->is_key_pressed(KEY_SHIFT); manipulated |= Input::get_singleton()->is_key_pressed(KEY_ALT); - manipulated |= Input::get_singleton()->is_key_pressed(KEY_CONTROL); + manipulated |= Input::get_singleton()->is_key_pressed(KEY_CTRL); float orbit_inertia = MAX(0.00001, manipulated ? manip_orbit_inertia : free_orbit_inertia); float translation_inertia = MAX(0.0001, manipulated ? manip_translation_inertia : free_translation_inertia); @@ -794,22 +794,22 @@ static int _get_key_modifier_setting(const String &p_property) { case 3: return KEY_META; case 4: - return KEY_CONTROL; + return KEY_CTRL; } return 0; } static int _get_key_modifier(Ref<InputEventWithModifiers> e) { - if (e->get_shift()) { + if (e->is_shift_pressed()) { return KEY_SHIFT; } - if (e->get_alt()) { + if (e->is_alt_pressed()) { return KEY_ALT; } - if (e->get_control()) { - return KEY_CONTROL; + if (e->is_ctrl_pressed()) { + return KEY_CTRL; } - if (e->get_metakey()) { + if (e->is_meta_pressed()) { return KEY_META; } return 0; @@ -1024,7 +1024,7 @@ bool Node3DEditorViewport ::_is_node_locked(const Node *p_node) { } void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) { - _find_items_at_pos(b->get_position(), clicked_includes_current, selection_results, b->get_shift()); + _find_items_at_pos(b->get_position(), clicked_includes_current, selection_results, b->is_shift_pressed()); Node *scene = editor->get_edited_scene(); @@ -1037,7 +1037,7 @@ void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) { } } - clicked_wants_append = b->get_shift(); + clicked_wants_append = b->is_shift_pressed(); if (selection_results.size() == 1) { clicked = selection_results[0].item->get_instance_id(); @@ -1149,7 +1149,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } if (_edit.mode == TRANSFORM_NONE && b->is_pressed()) { - if (b->get_alt()) { + if (b->is_alt_pressed()) { if (nav_scheme == NAVIGATION_MAYA) { break; } @@ -1234,7 +1234,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { case MOUSE_BUTTON_LEFT: { if (b->is_pressed()) { NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); - if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) { + if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->is_alt_pressed()) { break; } @@ -1262,7 +1262,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { int handle = -1; Vector3 point; Vector3 normal; - bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, b->get_shift()); + bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, b->is_shift_pressed()); if (inters && handle != -1) { _edit.gizmo = seg; _edit.gizmo_handle = handle; @@ -1279,7 +1279,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { clicked = ObjectID(); clicked_includes_current = false; - if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->get_command()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) { + if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->is_command_pressed()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) { /* HANDLE ROTATION */ if (get_selected_count() == 0) { break; //bye @@ -1314,11 +1314,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { int gizmo_handle = -1; - clicked = _select_ray(b->get_position(), b->get_shift(), clicked_includes_current, &gizmo_handle, b->get_shift()); + clicked = _select_ray(b->get_position(), b->is_shift_pressed(), clicked_includes_current, &gizmo_handle, b->is_shift_pressed()); //clicking is always deferred to either move or release - clicked_wants_append = b->get_shift(); + clicked_wants_append = b->is_shift_pressed(); if (clicked.is_null()) { if (!clicked_wants_append) { @@ -1441,13 +1441,13 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { set_message(n + ": " + String(v)); } else if (m->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { - if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) { + if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) { nav_mode = NAVIGATION_ORBIT; - } else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) { + } else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed() && m->is_shift_pressed()) { nav_mode = NAVIGATION_PAN; - } else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_control()) { + } else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed() && m->is_ctrl_pressed()) { nav_mode = NAVIGATION_ZOOM; - } else if (nav_scheme == NAVIGATION_MODO && m->get_alt()) { + } else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed()) { nav_mode = NAVIGATION_ORBIT; } else { if (clicked.is_valid()) { @@ -1831,7 +1831,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } } } else if ((m->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) || freelook_active) { - if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) { + if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) { nav_mode = NAVIGATION_ZOOM; } else if (freelook_active) { nav_mode = NAVIGATION_LOOK; @@ -1924,7 +1924,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } } else if (nav_scheme == NAVIGATION_MAYA) { - if (pan_gesture->get_alt()) { + if (pan_gesture->is_alt_pressed()) { nav_mode = NAVIGATION_PAN; } } @@ -2053,7 +2053,7 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const real_t pan_speed = 1 / 150.0; int pan_speed_modifier = 10; - if (nav_scheme == NAVIGATION_MAYA && p_event->get_shift()) { + if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { pan_speed *= pan_speed_modifier; } @@ -2078,7 +2078,7 @@ void Node3DEditorViewport::_nav_zoom(Ref<InputEventWithModifiers> p_event, const real_t zoom_speed = 1 / 80.0; int zoom_speed_modifier = 10; - if (nav_scheme == NAVIGATION_MAYA && p_event->get_shift()) { + if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) { zoom_speed *= zoom_speed_modifier; } @@ -6204,7 +6204,7 @@ void Node3DEditor::_unhandled_key_input(Ref<InputEvent> p_event) { return; } - snap_key_enabled = Input::get_singleton()->is_key_pressed(KEY_CONTROL); + snap_key_enabled = Input::get_singleton()->is_key_pressed(KEY_CTRL); } void Node3DEditor::_sun_environ_settings_pressed() { diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 84b4516452..208abeb87f 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -89,7 +89,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { // Check for point movement start (for point + in/out controls). if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { - if (mode == MODE_EDIT && !mb->get_shift() && dist_to_p < grab_threshold) { + if (mode == MODE_EDIT && !mb->is_shift_pressed() && dist_to_p < grab_threshold) { // Points can only be moved in edit mode. action = ACTION_MOVING_POINT; @@ -149,7 +149,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } // Check for point creation. - if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && ((mb->is_command_pressed() && mode == MODE_EDIT) || mode == MODE_CREATE)) { Ref<Curve2D> curve = node->get_curve(); undo_redo->create_action(TTR("Add Point to Curve")); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 47bd1114d2..8c73294723 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -316,7 +316,7 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref set_handle_clicked(false); } - if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { + if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->is_ctrl_pressed()))) { //click into curve, break it down Vector<Vector3> v3a = c->tessellate(); int idx = 0; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 470d897dcc..6d82685c05 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -613,11 +613,11 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } if (uv_move_current == UV_MODE_EDIT_POINT) { - if (mb->get_shift() && mb->get_command()) { + if (mb->is_shift_pressed() && mb->is_command_pressed()) { uv_move_current = UV_MODE_SCALE; - } else if (mb->get_shift()) { + } else if (mb->is_shift_pressed()) { uv_move_current = UV_MODE_MOVE; - } else if (mb->get_command()) { + } else if (mb->is_command_pressed()) { uv_move_current = UV_MODE_ROTATE; } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 8c4c5a3461..1147267ce0 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -218,6 +218,8 @@ Ref<EditorSyntaxHighlighter> EditorPlainTextSyntaxHighlighter::_create() const { /*** SCRIPT EDITOR ****/ void ScriptEditorBase::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_base_editor"), &ScriptEditorBase::get_base_editor); + ADD_SIGNAL(MethodInfo("name_changed")); ADD_SIGNAL(MethodInfo("edited_script_changed")); ADD_SIGNAL(MethodInfo("request_help", PropertyInfo(Variant::STRING, "topic"))); @@ -337,13 +339,13 @@ void ScriptEditorQuickOpen::_update_search() { if ((search_box->get_text() == "" || file.findn(search_box->get_text()) != -1)) { TreeItem *ti = search_options->create_item(root); ti->set_text(0, file); - if (root->get_children() == ti) { + if (root->get_first_child() == ti) { ti->select(0); } } } - get_ok_button()->set_disabled(root->get_children() == nullptr); + get_ok_button()->set_disabled(root->get_first_child() == nullptr); } void ScriptEditorQuickOpen::_confirmed() { @@ -1501,6 +1503,9 @@ void ScriptEditor::_notification(int p_what) { filename->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("normal", "LineEdit")); recent_scripts->set_as_minsize(); + + _update_script_colors(); + _update_script_names(); } break; case NOTIFICATION_READY: { @@ -1675,7 +1680,7 @@ struct _ScriptEditorItemData { if (sort_key == id.sort_key) { return index < id.index; } else { - return sort_key < id.sort_key; + return sort_key.naturalnocasecmp_to(id.sort_key) < 0; } } else { return category < id.category; @@ -2279,8 +2284,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra void ScriptEditor::save_current_script() { ScriptEditorBase *current = _get_current_editor(); - - if (_test_script_times_on_disk()) { + if (!current || _test_script_times_on_disk()) { return; } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 570ebfba4e..9ae63b7c4f 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -163,6 +163,8 @@ public: virtual Control *get_edit_menu() = 0; virtual void clear_edit_menu() = 0; + virtual Control *get_base_editor() const = 0; + virtual void validate() = 0; ScriptEditorBase() {} diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index edf540bf48..25755cc6cc 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1402,6 +1402,10 @@ void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) void ScriptTextEditor::set_debugger_active(bool p_active) { } +Control *ScriptTextEditor::get_base_editor() const { + return code_editor->get_text_editor(); +} + Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { return Variant(); } diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 17abfcf4cc..f79abc60ab 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -233,6 +233,8 @@ public: virtual void clear_edit_menu() override; static void register_editor(); + virtual Control *get_base_editor() const override; + virtual void validate() override; ScriptTextEditor(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index bd6dac7490..551d1c027a 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -115,7 +115,7 @@ void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) { int idx = h * y + x; - if (mb->get_shift() && last_frame_selected >= 0) { + if (mb->is_shift_pressed() && last_frame_selected >= 0) { //select multiple int from = idx; int to = last_frame_selected; @@ -124,7 +124,7 @@ void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) { } for (int i = from; i <= to; i++) { - if (mb->get_control()) { + if (mb->is_ctrl_pressed()) { frames_selected.erase(i); } else { frames_selected.insert(i); @@ -150,11 +150,11 @@ void SpriteFramesEditor::_sheet_scroll_input(const Ref<InputEvent> &p_event) { // Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer // to allow performing this action anywhere, even if the cursor isn't // hovering the texture in the workspace. - if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) { _sheet_zoom_in(); // Don't scroll up after zooming in. accept_event(); - } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) { _sheet_zoom_out(); // Don't scroll down after zooming out. accept_event(); @@ -513,7 +513,7 @@ void SpriteFramesEditor::_animation_select() { if (frames->has_animation(edited_anim)) { double value = anim_speed->get_line_edit()->get_text().to_float(); - if (!Math::is_equal_approx(value, frames->get_animation_speed(edited_anim))) { + if (!Math::is_equal_approx(value, (double)frames->get_animation_speed(edited_anim))) { _animation_fps_changed(value); } } @@ -694,11 +694,11 @@ void SpriteFramesEditor::_tree_input(const Ref<InputEvent> &p_event) { const Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { - if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) { _zoom_in(); // Don't scroll up after zooming in. accept_event(); - } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + } else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) { _zoom_out(); // Don't scroll down after zooming out. accept_event(); @@ -954,7 +954,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da if (String(d["type"]) == "files") { Vector<String> files = d["files"]; - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { _prepare_sprite_sheet(files[0]); } else { _file_load_request(files, at_pos); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 2b8bfe067d..e6fb2710ae 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -171,6 +171,10 @@ void TextEditor::add_callback(const String &p_function, PackedStringArray p_args void TextEditor::set_debugger_active(bool p_active) { } +Control *TextEditor::get_base_editor() const { + return code_editor->get_text_editor(); +} + Array TextEditor::get_breakpoints() { return Array(); } diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index c066d51b18..abb75cc9d8 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -142,6 +142,8 @@ public: virtual void validate() override; + virtual Control *get_base_editor() const override; + static void register_editor(); TextEditor(); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 7b927ad98b..62ecdb8c32 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -331,7 +331,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) { if (E->get().has_point(point)) { rect = E->get(); - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL) && !(Input::get_singleton()->is_key_pressed(KEY_SHIFT | KEY_ALT))) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !(Input::get_singleton()->is_key_pressed(KEY_SHIFT | KEY_ALT))) { Rect2 r; if (node_sprite) { r = node_sprite->get_region_rect(); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 0f7468bead..f1c73f99dc 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -321,7 +321,7 @@ void ThemeItemImportTree::_toggle_type_items(bool p_collapse) { return; } - TreeItem *type_node = root->get_children(); + TreeItem *type_node = root->get_first_child(); while (type_node) { type_node->set_collapsed(p_collapse); type_node = type_node->get_next(); @@ -491,7 +491,7 @@ void ThemeItemImportTree::_tree_item_edited() { } void ThemeItemImportTree::_select_all_subitems(TreeItem *p_root_item, bool p_select_with_data) { - TreeItem *child_item = p_root_item->get_children(); + TreeItem *child_item = p_root_item->get_first_child(); while (child_item) { child_item->set_checked(IMPORT_ITEM, true); if (p_select_with_data) { @@ -505,7 +505,7 @@ void ThemeItemImportTree::_select_all_subitems(TreeItem *p_root_item, bool p_sel } void ThemeItemImportTree::_deselect_all_subitems(TreeItem *p_root_item, bool p_deselect_completely) { - TreeItem *child_item = p_root_item->get_children(); + TreeItem *child_item = p_root_item->get_first_child(); while (child_item) { child_item->set_checked(IMPORT_ITEM_DATA, false); if (p_deselect_completely) { @@ -527,7 +527,7 @@ void ThemeItemImportTree::_update_parent_items(TreeItem *p_root_item) { bool any_checked = false; bool any_checked_with_data = false; - TreeItem *child_item = parent_item->get_children(); + TreeItem *child_item = parent_item->get_first_child(); while (child_item) { if (child_item->is_checked(IMPORT_ITEM)) { any_checked = true; diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 4f7eabac24..6e82951d3d 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -41,7 +41,7 @@ #include "editor/editor_scale.h" void TileAtlasView::_gui_input(const Ref<InputEvent> &p_event) { - bool ctrl = Input::get_singleton()->is_key_pressed(KEY_CONTROL); + bool ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL); Ref<InputEventMouseButton> b = p_event; if (b.is_valid()) { @@ -195,9 +195,9 @@ void TileAtlasView::_base_tiles_root_control_gui_input(const Ref<InputEvent> &p_ if (mm.is_valid()) { Transform2D xform = base_tiles_drawing_root->get_transform().affine_inverse(); Vector2i coords = get_atlas_tile_coords_at_pos(xform.xform(mm->get_position())); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { coords = tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { base_tiles_root_control->set_tooltip(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: 0"), source_id, coords)); } } @@ -215,7 +215,7 @@ void TileAtlasView::_draw_base_tiles() { for (int x = 0; x < grid_size.x; x++) { for (int y = 0; y < grid_size.y; y++) { Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = Rect2i(texture_region_size * coords + margins, texture_region_size); base_tiles_draw->draw_texture_rect_region(texture, rect, rect); } @@ -229,17 +229,23 @@ void TileAtlasView::_draw_base_tiles() { rect.set_end(Vector2i(texture->get_size().x, margins.y)); base_tiles_draw->draw_texture_rect_region(texture, rect, rect); // Bottom - rect.position = Vector2i(0, margins.y + (grid_size.y * texture_region_size.y)); - rect.set_end(texture->get_size()); - base_tiles_draw->draw_texture_rect_region(texture, rect, rect); + int bottom_border = margins.y + (grid_size.y * texture_region_size.y); + if (bottom_border < texture->get_size().y) { + rect.position = Vector2i(0, bottom_border); + rect.set_end(texture->get_size()); + base_tiles_draw->draw_texture_rect_region(texture, rect, rect); + } // Left rect.position = Vector2i(0, margins.y); rect.set_end(Vector2i(margins.x, margins.y + (grid_size.y * texture_region_size.y))); base_tiles_draw->draw_texture_rect_region(texture, rect, rect); // Right. - rect.position = Vector2i(margins.x + (grid_size.x * texture_region_size.x), margins.y); - rect.set_end(Vector2i(texture->get_size().x, margins.y + (grid_size.y * texture_region_size.y))); - base_tiles_draw->draw_texture_rect_region(texture, rect, rect); + int right_border = margins.x + (grid_size.x * texture_region_size.x); + if (right_border < texture->get_size().x) { + rect.position = Vector2i(right_border, margins.y); + rect.set_end(Vector2i(texture->get_size().x, margins.y + (grid_size.y * texture_region_size.y))); + base_tiles_draw->draw_texture_rect_region(texture, rect, rect); + } // Draw actual tiles, using their properties (modulation, etc...) for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) { @@ -249,7 +255,7 @@ void TileAtlasView::_draw_base_tiles() { Vector2i offset_pos = (margins + (atlas_coords * texture_region_size) + tile_set_atlas_source->get_tile_texture_region(atlas_coords).size / 2 + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, 0)); // Draw the tile. - TileSetAtlasPluginRendering::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0); + TileSetPluginAtlasRendering::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0); } } } @@ -268,7 +274,7 @@ void TileAtlasView::_draw_base_tiles_texture_grid() { for (int y = 0; y < grid_size.y; y++) { Vector2i origin = margins + (Vector2i(x, y) * (texture_region_size + separation)); Vector2i base_tile_coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y)); - if (base_tile_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (base_tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { if (base_tile_coords == Vector2i(x, y)) { // Draw existing tile. Vector2i size_in_atlas = tile_set_atlas_source->get_tile_size_in_atlas(base_tile_coords); @@ -299,7 +305,7 @@ void TileAtlasView::_draw_base_tiles_dark() { Vector2i origin = margins + (Vector2i(x, y) * (texture_region_size + separation)); Vector2i base_tile_coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y)); - if (base_tile_coords == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (base_tile_coords == TileSetSource::INVALID_ATLAS_COORDS) { // Draw the grid. base_tiles_dark->draw_rect(Rect2i(origin, texture_region_size), Color(0.0, 0.0, 0.0, 0.5), true); } @@ -331,7 +337,7 @@ void TileAtlasView::_alternative_tiles_root_control_gui_input(const Ref<InputEve Vector3i coords3 = get_alternative_tile_at_pos(xform.xform(mm->get_position())); Vector2i coords = Vector2i(coords3.x, coords3.y); int alternative_id = coords3.z; - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && alternative_id != TileSetAtlasSource::INVALID_TILE_ALTERNATIVE) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && alternative_id != TileSetSource::INVALID_TILE_ALTERNATIVE) { alternative_tiles_root_control->set_tooltip(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: %d"), source_id, coords, alternative_id)); } } @@ -364,7 +370,7 @@ void TileAtlasView::_draw_alternatives() { } // Draw the tile. - TileSetAtlasPluginRendering::draw_tile(alternatives_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, alternative_id); + TileSetPluginAtlasRendering::draw_tile(alternatives_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, alternative_id); // Increment the x position. current_pos.x += transposed ? texture_region.size.y : texture_region.size.x; @@ -464,7 +470,7 @@ Vector2i TileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos) const return ret; } - return TileSetAtlasSource::INVALID_ATLAS_COORDS; + return TileSetSource::INVALID_ATLAS_COORDS; } void TileAtlasView::_update_alternative_tiles_rect_cache() { @@ -506,7 +512,7 @@ Vector3i TileAtlasView::get_alternative_tile_at_pos(const Vector2 p_pos) const { } } - return Vector3i(TileSetAtlasSource::INVALID_ATLAS_COORDS.x, TileSetAtlasSource::INVALID_ATLAS_COORDS.y, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + return Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); } Rect2i TileAtlasView::get_alternative_tile_rect(const Vector2i p_coords, int p_alternative_tile) { diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 0b674bec39..d2665a3a2b 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -166,7 +166,7 @@ void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform Vector<String> components = String(p_property).split("/", true); if (components[0] == "terrain_mode" || components[0] == "terrain" || components[0] == "terrains_peering_bit") { - TileSetAtlasPluginTerrain::draw_terrains(p_canvas_item, p_transform, p_tile_set, tile_data); + TileSetPluginAtlasTerrain::draw_terrains(p_canvas_item, p_transform, p_tile_set, tile_data); } } diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 5937472e2b..80ba396936 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -32,6 +32,7 @@ #include "tiles_editor_plugin.h" +#include "editor/editor_resource_preview.h" #include "editor/editor_scale.h" #include "editor/plugins/canvas_item_editor_plugin.h" @@ -55,7 +56,7 @@ void TileMapEditorTilesPlugin::_notification(int p_what) { picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons")); erase_button->set_icon(get_theme_icon("Eraser", "EditorIcons")); - missing_texture_texture = get_theme_icon("TileSet", "EditorIcons"); + missing_atlas_texture_icon = get_theme_icon("TileSet", "EditorIcons"); break; case NOTIFICATION_VISIBILITY_CHANGED: _stop_dragging(); @@ -64,9 +65,8 @@ void TileMapEditorTilesPlugin::_notification(int p_what) { void TileMapEditorTilesPlugin::tile_set_changed() { _update_fix_selected_and_hovered(); - _update_bottom_panel(); _update_tile_set_sources_list(); - _update_atlas_view(); + _update_bottom_panel(); } void TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled(bool p_pressed) { @@ -146,19 +146,38 @@ void TileMapEditorTilesPlugin::_update_tile_set_sources_list() { for (int i = 0; i < tile_set->get_source_count(); i++) { int source_id = tile_set->get_source_id(i); - // TODO: handle with virtual functions TileSetSource *source = *tile_set->get_source(source_id); + + Ref<Texture2D> texture; + String item_text; + + // Atlas source. TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source); if (atlas_source) { - Ref<Texture2D> texture = atlas_source->get_texture(); + texture = atlas_source->get_texture(); if (texture.is_valid()) { - sources_list->add_item(vformat("%s - (id:%d)", texture->get_path().get_file(), source_id), texture); + item_text = vformat("%s (id:%d)", texture->get_path().get_file(), source_id); } else { - sources_list->add_item(vformat("No Texture Atlas Source - (id:%d)", source_id), missing_texture_texture); + item_text = vformat("No Texture Atlas Source (id:%d)", source_id); } - } else { - sources_list->add_item(vformat("Unknown Type Source - (id:%d)", source_id), missing_texture_texture); } + + // Scene collection source. + TileSetScenesCollectionSource *scene_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source); + if (scene_collection_source) { + texture = get_theme_icon("PackedScene", "EditorIcons"); + item_text = vformat(TTR("Scene Collection Source (id:%d)"), source_id); + } + + // Use default if not valid. + if (item_text.is_empty()) { + item_text = vformat(TTR("Unknown Type Source (id:%d)"), source_id); + } + if (!texture.is_valid()) { + texture = missing_atlas_texture_icon; + } + + sources_list->add_item(item_text, texture); sources_list->set_item_metadata(i, source_id); } @@ -176,7 +195,7 @@ void TileMapEditorTilesPlugin::_update_tile_set_sources_list() { TilesEditor::get_singleton()->set_atlas_sources_lists_current(sources_list->get_current()); } -void TileMapEditorTilesPlugin::_update_atlas_view() { +void TileMapEditorTilesPlugin::_update_bottom_panel() { // Update the atlas display. TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); if (!tile_map) { @@ -185,39 +204,161 @@ void TileMapEditorTilesPlugin::_update_atlas_view() { Ref<TileSet> tile_set = tile_map->get_tileset(); if (!tile_set.is_valid()) { - tile_atlas_view->hide(); return; } int source_index = sources_list->get_current(); if (source_index >= 0 && source_index < sources_list->get_item_count()) { + atlas_sources_split_container->show(); + missing_source_label->hide(); + int source_id = sources_list->get_item_metadata(source_index); TileSetSource *source = *tile_set->get_source(source_id); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source); + TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source); + if (atlas_source) { - tile_atlas_view->set_atlas_source(*tile_map->get_tileset(), atlas_source, source_id); tile_atlas_view->show(); + scene_tiles_list->hide(); + invalid_source_label->hide(); + _update_atlas_view(); + } else if (scenes_collection_source) { + tile_atlas_view->hide(); + scene_tiles_list->show(); + invalid_source_label->hide(); + _update_scenes_collection_view(); + } else { + tile_atlas_view->hide(); + scene_tiles_list->hide(); + invalid_source_label->show(); } } else { + atlas_sources_split_container->hide(); + missing_source_label->show(); + tile_atlas_view->hide(); + scene_tiles_list->hide(); + invalid_source_label->hide(); } +} - // Synchronize atlas view. - TilesEditor::get_singleton()->synchronize_atlas_view(tile_atlas_view); +void TileMapEditorTilesPlugin::_update_atlas_view() { + TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); + if (!tile_map) { + return; + } + Ref<TileSet> tile_set = tile_map->get_tileset(); + if (!tile_set.is_valid()) { + return; + } + + int source_id = sources_list->get_item_metadata(sources_list->get_current()); + TileSetSource *source = *tile_set->get_source(source_id); + TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source); + ERR_FAIL_COND(!atlas_source); + + tile_atlas_view->set_atlas_source(*tile_map->get_tileset(), atlas_source, source_id); + TilesEditor::get_singleton()->synchronize_atlas_view(tile_atlas_view); tile_atlas_control->update(); } -void TileMapEditorTilesPlugin::_update_bottom_panel() { +void TileMapEditorTilesPlugin::_update_scenes_collection_view() { TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); if (!tile_map) { return; } + Ref<TileSet> tile_set = tile_map->get_tileset(); + if (!tile_set.is_valid()) { + return; + } + + int source_id = sources_list->get_item_metadata(sources_list->get_current()); + TileSetSource *source = *tile_set->get_source(source_id); + TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source); + ERR_FAIL_COND(!scenes_collection_source); + + // Clear the list. + scene_tiles_list->clear(); + + // Rebuild the list. + for (int i = 0; i < scenes_collection_source->get_scene_tiles_count(); i++) { + int scene_id = scenes_collection_source->get_scene_tile_id(i); + + Ref<PackedScene> scene = scenes_collection_source->get_scene_tile_scene(scene_id); + + int item_index = 0; + if (scene.is_valid()) { + item_index = scene_tiles_list->add_item(vformat("%s (path:%s id:%d)", scene->get_path().get_file().get_basename(), scene->get_path(), scene_id)); + Variant udata = i; + EditorResourcePreview::get_singleton()->queue_edited_resource_preview(scene, this, "_scene_thumbnail_done", udata); + } else { + item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), get_theme_icon("PackedScene", "EditorIcons")); + } + scene_tiles_list->set_item_metadata(item_index, scene_id); - // Update the tabs. - missing_source_label->set_visible(tile_set.is_valid() && tile_set->get_source_count() == 0); - atlas_sources_split_container->set_visible(tile_set.is_valid() && tile_set->get_source_count() > 0); + // Check if in selection. + if (tile_set_selection.has(TileMapCell(source_id, Vector2i(), scene_id))) { + scene_tiles_list->select(item_index, false); + } + } + + // Icon size update. + int int_size = int(EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size")) * EDSCALE; + scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); +} + +void TileMapEditorTilesPlugin::_scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud) { + int index = p_ud; + + if (index >= 0 && index < scene_tiles_list->get_item_count()) { + scene_tiles_list->set_item_icon(index, p_preview); + } +} + +void TileMapEditorTilesPlugin::_scenes_list_multi_selected(int p_index, bool p_selected) { + TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); + if (!tile_map) { + return; + } + + Ref<TileSet> tile_set = tile_map->get_tileset(); + if (!tile_set.is_valid()) { + return; + } + + // Add or remove the Tile form the selection. + int scene_id = scene_tiles_list->get_item_metadata(p_index); + int source_id = sources_list->get_item_metadata(sources_list->get_current()); + TileSetSource *source = *tile_set->get_source(source_id); + TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source); + ERR_FAIL_COND(!scenes_collection_source); + + TileMapCell selected = TileMapCell(source_id, Vector2i(), scene_id); + + // Clear the selection if shift is not pressed. + if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { + tile_set_selection.clear(); + } + + if (p_selected) { + tile_set_selection.insert(selected); + } else { + if (tile_set_selection.has(selected)) { + tile_set_selection.erase(selected); + } + } + + _update_selection_pattern_from_tileset_selection(); +} + +void TileMapEditorTilesPlugin::_scenes_list_nothing_selected() { + scene_tiles_list->deselect_all(); + tile_set_selection.clear(); + tile_map_selection.clear(); + selection_pattern->clear(); + _update_selection_pattern_from_tileset_selection(); } bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) { @@ -257,7 +398,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p if (!tile_map_selection.is_empty()) { undo_redo->create_action(TTR("Delete tiles")); for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { - undo_redo->add_do_method(tile_map, "set_cell", E->get(), -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + undo_redo->add_do_method(tile_map, "set_cell", E->get(), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); undo_redo->add_undo_method(tile_map, "set_cell", E->get(), tile_map->get_cell_source_id(E->get()), tile_map->get_cell_atlas_coords(E->get()), tile_map->get_cell_alternative_tile(E->get())); } undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection()); @@ -288,7 +429,7 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p if (!tile_map_selection.is_empty()) { undo_redo->create_action(TTR("Delete tiles")); for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { - undo_redo->add_do_method(tile_map, "set_cell", E->get(), -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + undo_redo->add_do_method(tile_map, "set_cell", E->get(), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); undo_redo->add_undo_method(tile_map, "set_cell", E->get(), tile_map->get_cell_source_id(E->get()), tile_map->get_cell_atlas_coords(E->get()), tile_map->get_cell_alternative_tile(E->get())); } undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection()); @@ -357,14 +498,14 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p // Pressed if (tool_buttons_group->get_pressed_button() == select_tool_button) { drag_start_mouse_pos = mpos; - if (tile_map_selection.has(tile_map->world_to_map(drag_start_mouse_pos)) && !mb->get_shift()) { + if (tile_map_selection.has(tile_map->world_to_map(drag_start_mouse_pos)) && !mb->is_shift_pressed()) { // Move the selection drag_type = DRAG_TYPE_MOVE; drag_modified.clear(); for (Set<Vector2i>::Element *E = tile_map_selection.front(); E; E = E->next()) { Vector2i coords = E->get(); drag_modified.insert(coords, TileMapCell(tile_map->get_cell_source_id(coords), tile_map->get_cell_atlas_coords(coords), tile_map->get_cell_alternative_tile(coords))); - tile_map->set_cell(coords, -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + tile_map->set_cell(coords, -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); } } else { // Select tiles @@ -460,14 +601,14 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over // Draw the selection. if (is_visible_in_tree() && tool_buttons_group->get_pressed_button() == select_tool_button) { // In select mode, we only draw the current selection if we are modifying it (pressing control or shift). - if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(KEY_CONTROL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { + if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { // Do nothing } else { tile_map->draw_cells_outline(p_overlay, tile_map_selection, Color(0.0, 0.0, 1.0), xform); } } - // handle the preview of the tiles to be placed. + // Handle the preview of the tiles to be placed. if (is_visible_in_tree() && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered. Map<Vector2i, TileMapCell> preview; Rect2i drawn_grid_rect; @@ -583,11 +724,10 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over // Draw the preview. for (Map<Vector2i, TileMapCell>::Element *E = preview.front(); E; E = E->next()) { + Vector2i size = tile_set->get_tile_size(); + Vector2 position = tile_map->map_to_world(E->key()) - size / 2; + Rect2 cell_region = xform.xform(Rect2(position, size)); if (!erase_button->is_pressed() && random_tile_checkbox->is_pressed()) { - Vector2i size = tile_set->get_tile_size(); - Vector2 position = tile_map->map_to_world(E->key()) - size / 2; - Rect2 cell_region = xform.xform(Rect2(position, size)); - tile_set->draw_tile_shape(p_overlay, cell_region, Color(1.0, 1.0, 1.0, 0.5), true); } else { if (tile_set->has_source(E->get().source_id)) { @@ -629,12 +769,10 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over // Draw the tile. p_overlay->draw_texture_rect_region(atlas_source->get_texture(), dest_rect, source_rect, modulate * Color(1.0, 1.0, 1.0, 0.5), transpose, tile_set->is_uv_clipping()); + } else { + tile_set->draw_tile_shape(p_overlay, cell_region, Color(1.0, 1.0, 1.0, 0.5), true); } } else { - Vector2i size = tile_set->get_tile_size(); - Vector2 position = tile_map->map_to_world(E->key()) - size / 2; - Rect2 cell_region = xform.xform(Rect2(position, size)); - tile_set->draw_tile_shape(p_overlay, cell_region, Color(0.0, 0.0, 0.0, 0.5), true); } } @@ -669,7 +807,9 @@ TileMapCell TileMapEditorTilesPlugin::_pick_random_tile(const TileMapPattern *p_ TileSetSource *source = *tile_set->get_source(source_id); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source); if (atlas_source) { - sum += Object::cast_to<TileData>(atlas_source->get_tile_data(atlas_coords, alternative_tile))->get_probability(); + TileData *tile_data = Object::cast_to<TileData>(atlas_source->get_tile_data(atlas_coords, alternative_tile)); + ERR_FAIL_COND_V(!tile_data, TileMapCell()); + sum += tile_data->get_probability(); } else { sum += 1.0; } @@ -698,7 +838,7 @@ TileMapCell TileMapEditorTilesPlugin::_pick_random_tile(const TileMapPattern *p_ return TileMapCell(); } -Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2i p_to_mouse_pos) { +Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos) { TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); if (!tile_map) { return Map<Vector2i, TileMapCell>(); @@ -711,7 +851,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_ // Get or create the pattern. TileMapPattern erase_pattern; - erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); TileMapPattern *pattern = erase_button->is_pressed() ? &erase_pattern : selection_pattern; Map<Vector2i, TileMapCell> output; @@ -763,7 +903,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start // Get or create the pattern. TileMapPattern erase_pattern; - erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); TileMapPattern *pattern = erase_button->is_pressed() ? &erase_pattern : selection_pattern; // Compute the offset to align things to the bottom or right. @@ -814,7 +954,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i // Get or create the pattern. TileMapPattern erase_pattern; - erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + erase_pattern.set_cell(Vector2i(0, 0), -1, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); TileMapPattern *pattern = erase_button->is_pressed() ? &erase_pattern : selection_pattern; Map<Vector2i, TileMapCell> output; @@ -930,14 +1070,14 @@ void TileMapEditorTilesPlugin::_stop_dragging() { undo_redo->create_action(TTR("Change selection")); undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection()); - if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT) && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT) && !Input::get_singleton()->is_key_pressed(KEY_CTRL)) { tile_map_selection.clear(); } Rect2i rect = Rect2i(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos) - tile_map->world_to_map(drag_start_mouse_pos)).abs(); for (int x = rect.position.x; x <= rect.get_end().x; x++) { for (int y = rect.position.y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { if (tile_map_selection.has(coords)) { tile_map_selection.erase(coords); } @@ -1090,8 +1230,8 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id)); if (!tile_map) { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; tile_set_selection.clear(); tile_map_selection.clear(); selection_pattern->clear(); @@ -1101,8 +1241,8 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { Ref<TileSet> tile_set = tile_map->get_tileset(); if (!tile_set.is_valid()) { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; tile_set_selection.clear(); tile_map_selection.clear(); selection_pattern->clear(); @@ -1112,8 +1252,8 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { int source_index = sources_list->get_current(); if (source_index < 0 || source_index >= sources_list->get_item_count()) { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; tile_set_selection.clear(); tile_map_selection.clear(); selection_pattern->clear(); @@ -1128,8 +1268,8 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { !tile_set->get_source(hovered_tile.source_id)->has_tile(hovered_tile.get_atlas_coords()) || !tile_set->get_source(hovered_tile.source_id)->has_alternative_tile(hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile)) { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; } // Selection if needed. @@ -1187,6 +1327,7 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_selection( per_source[E->get().source_id].push_back(&(E->get())); } + int vertical_offset = 0; for (Map<int, List<const TileMapCell *>>::Element *E_source = per_source.front(); E_source; E_source = E_source->next()) { // Per source. List<const TileMapCell *> unorganized; @@ -1199,24 +1340,21 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_selection( // Organize using coordinates. for (List<const TileMapCell *>::Element *E_cell = E_source->get().front(); E_cell; E_cell = E_cell->next()) { const TileMapCell *current = E_cell->get(); - if (organized_pattern.has(current->get_atlas_coords())) { - if (current->alternative_tile < organized_pattern[current->get_atlas_coords()]->alternative_tile) { - unorganized.push_back(organized_pattern[current->get_atlas_coords()]); - organized_pattern[current->get_atlas_coords()] = current; - } else { - unorganized.push_back(current); - } - } else { + if (current->alternative_tile == 0) { organized_pattern[current->get_atlas_coords()] = current; + } else { + unorganized.push_back(current); } } // Compute the encompassing rect for the organized pattern. Map<Vector2i, const TileMapCell *>::Element *E_cell = organized_pattern.front(); - encompassing_rect_coords = Rect2i(E_cell->key(), Vector2i(1, 1)); - for (; E_cell; E_cell = E_cell->next()) { - encompassing_rect_coords.expand_to(E_cell->key() + Vector2i(1, 1)); - encompassing_rect_coords.expand_to(E_cell->key()); + if (E_cell) { + encompassing_rect_coords = Rect2i(E_cell->key(), Vector2i(1, 1)); + for (; E_cell; E_cell = E_cell->next()) { + encompassing_rect_coords.expand_to(E_cell->key() + Vector2i(1, 1)); + encompassing_rect_coords.expand_to(E_cell->key()); + } } } else { // Add everything unorganized. @@ -1227,12 +1365,15 @@ void TileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_selection( // Now add everything to the output pattern. for (Map<Vector2i, const TileMapCell *>::Element *E_cell = organized_pattern.front(); E_cell; E_cell = E_cell->next()) { - selection_pattern->set_cell(E_cell->key() - encompassing_rect_coords.position, E_cell->get()->source_id, E_cell->get()->get_atlas_coords(), E_cell->get()->alternative_tile); + selection_pattern->set_cell(E_cell->key() - encompassing_rect_coords.position + Vector2i(0, vertical_offset), E_cell->get()->source_id, E_cell->get()->get_atlas_coords(), E_cell->get()->alternative_tile); } Vector2i organized_size = selection_pattern->get_size(); + int unorganized_index = 0; for (List<const TileMapCell *>::Element *E_cell = unorganized.front(); E_cell; E_cell = E_cell->next()) { - selection_pattern->set_cell(Vector2(organized_size.x, 0), E_cell->get()->source_id, E_cell->get()->get_atlas_coords(), E_cell->get()->alternative_tile); + selection_pattern->set_cell(Vector2(organized_size.x + unorganized_index, vertical_offset), E_cell->get()->source_id, E_cell->get()->get_atlas_coords(), E_cell->get()->alternative_tile); + unorganized_index++; } + vertical_offset += MAX(organized_size.y, 1); } CanvasItemEditor::get_singleton()->update_viewport(); } @@ -1246,7 +1387,7 @@ void TileMapEditorTilesPlugin::_update_tileset_selection_from_selection_pattern( tile_set_selection.insert(TileMapCell(selection_pattern->get_cell_source_id(coords), selection_pattern->get_cell_atlas_coords(coords), selection_pattern->get_cell_alternative_tile(coords))); } } - _update_atlas_view(); + _update_bottom_panel(); } void TileMapEditorTilesPlugin::_tile_atlas_control_draw() { @@ -1283,7 +1424,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() { } // Draw the hovered tile. - if (hovered_tile.get_atlas_coords() != TileSetAtlasSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile == 0 && !tile_set_dragging_selection) { + if (hovered_tile.get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile == 0 && !tile_set_dragging_selection) { tile_atlas_control->draw_rect(atlas->get_tile_texture_region(hovered_tile.get_atlas_coords()), Color(1.0, 1.0, 1.0), false); } @@ -1299,7 +1440,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() { for (int x = region.position.x; x < region.get_end().x; x++) { for (int y = region.position.y; y < region.get_end().y; y++) { Vector2i tile = atlas->get_tile_at_coords(Vector2i(x, y)); - if (tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile != TileSetSource::INVALID_ATLAS_COORDS) { to_draw.insert(tile); } } @@ -1313,8 +1454,8 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_draw() { void TileMapEditorTilesPlugin::_tile_atlas_control_mouse_exited() { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; tile_set_dragging_selection = false; tile_atlas_control->update(); } @@ -1347,12 +1488,12 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_gui_input(const Ref<InputEven // Update the hovered tile hovered_tile.source_id = source_id; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position()); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { coords = atlas->get_tile_at_coords(coords); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { hovered_tile.set_atlas_coords(coords); hovered_tile.alternative_tile = 0; } @@ -1369,12 +1510,12 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_gui_input(const Ref<InputEven if (mb->is_pressed()) { // Pressed tile_set_dragging_selection = true; tile_set_drag_start_mouse_pos = tile_atlas_control->get_local_mouse_position(); - if (!mb->get_shift()) { + if (!mb->is_shift_pressed()) { tile_set_selection.clear(); } - if (hovered_tile.get_atlas_coords() != TileSetAtlasSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile == 0) { - if (mb->get_shift() && tile_set_selection.has(TileMapCell(source_id, hovered_tile.get_atlas_coords(), 0))) { + if (hovered_tile.get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile == 0) { + if (mb->is_shift_pressed() && tile_set_selection.has(TileMapCell(source_id, hovered_tile.get_atlas_coords(), 0))) { tile_set_selection.erase(TileMapCell(source_id, hovered_tile.get_atlas_coords(), 0)); } else { tile_set_selection.insert(TileMapCell(source_id, hovered_tile.get_atlas_coords(), 0)); @@ -1383,24 +1524,24 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_gui_input(const Ref<InputEven _update_selection_pattern_from_tileset_selection(); } else { // Released if (tile_set_dragging_selection) { - if (!mb->get_shift()) { + if (!mb->is_shift_pressed()) { tile_set_selection.clear(); } // Compute the covered area. Vector2i start_tile = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_set_drag_start_mouse_pos); Vector2i end_tile = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position()); - if (start_tile != TileSetAtlasSource::INVALID_ATLAS_COORDS && end_tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (start_tile != TileSetSource::INVALID_ATLAS_COORDS && end_tile != TileSetSource::INVALID_ATLAS_COORDS) { Rect2i region = Rect2i(start_tile, end_tile - start_tile).abs(); region.size += Vector2i(1, 1); // To update the selection, we copy the selected/not selected status of the tiles we drag from. Vector2i start_coords = atlas->get_tile_at_coords(start_tile); - if (mb->get_shift() && start_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && !tile_set_selection.has(TileMapCell(source_id, start_coords, 0))) { + if (mb->is_shift_pressed() && start_coords != TileSetSource::INVALID_ATLAS_COORDS && !tile_set_selection.has(TileMapCell(source_id, start_coords, 0))) { // Remove from the selection. for (int x = region.position.x; x < region.get_end().x; x++) { for (int y = region.position.y; y < region.get_end().y; y++) { Vector2i tile_coords = atlas->get_tile_at_coords(Vector2i(x, y)); - if (tile_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && tile_set_selection.has(TileMapCell(source_id, tile_coords, 0))) { + if (tile_coords != TileSetSource::INVALID_ATLAS_COORDS && tile_set_selection.has(TileMapCell(source_id, tile_coords, 0))) { tile_set_selection.erase(TileMapCell(source_id, tile_coords, 0)); } } @@ -1410,7 +1551,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_gui_input(const Ref<InputEven for (int x = region.position.x; x < region.get_end().x; x++) { for (int y = region.position.y; y < region.get_end().y; y++) { Vector2i tile_coords = atlas->get_tile_at_coords(Vector2i(x, y)); - if (tile_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { tile_set_selection.insert(TileMapCell(source_id, tile_coords, 0)); } } @@ -1453,7 +1594,7 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_draw() { // Draw the selection. for (Set<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) { - if (E->get().source_id == source_id && E->get().get_atlas_coords() != TileSetAtlasSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) { + if (E->get().source_id == source_id && E->get().get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) { Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().get_atlas_coords(), E->get().alternative_tile); if (rect != Rect2i()) { alternative_tiles_control->draw_rect(rect, Color(0.2, 0.2, 1.0), false); @@ -1462,7 +1603,7 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_draw() { } // Draw hovered tile. - if (hovered_tile.get_atlas_coords() != TileSetAtlasSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile > 0) { + if (hovered_tile.get_atlas_coords() != TileSetSource::INVALID_ATLAS_COORDS && hovered_tile.alternative_tile > 0) { Rect2i rect = tile_atlas_view->get_alternative_tile_rect(hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile); if (rect != Rect2i()) { alternative_tiles_control->draw_rect(rect, Color(1.0, 1.0, 1.0), false); @@ -1472,8 +1613,8 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_draw() { void TileMapEditorTilesPlugin::_tile_alternatives_control_mouse_exited() { hovered_tile.source_id = -1; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; tile_set_dragging_selection = false; alternative_tiles_control->update(); } @@ -1506,12 +1647,12 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_gui_input(const Ref<In // Update the hovered tile hovered_tile.source_id = source_id; - hovered_tile.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - hovered_tile.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + hovered_tile.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + hovered_tile.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; Vector3i alternative_coords = tile_atlas_view->get_alternative_tile_at_pos(alternative_tiles_control->get_local_mouse_position()); Vector2i coords = Vector2i(alternative_coords.x, alternative_coords.y); int alternative = alternative_coords.z; - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && alternative != TileSetAtlasSource::INVALID_TILE_ALTERNATIVE) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && alternative != TileSetSource::INVALID_TILE_ALTERNATIVE) { hovered_tile.set_atlas_coords(coords); hovered_tile.alternative_tile = alternative; } @@ -1526,12 +1667,12 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_gui_input(const Ref<In if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { // Pressed // Left click pressed. - if (!mb->get_shift()) { + if (!mb->is_shift_pressed()) { tile_set_selection.clear(); } - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && alternative != TileSetAtlasSource::INVALID_TILE_ALTERNATIVE) { - if (mb->get_shift() && tile_set_selection.has(TileMapCell(source_id, hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile))) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && alternative != TileSetAtlasSource::INVALID_TILE_ALTERNATIVE) { + if (mb->is_shift_pressed() && tile_set_selection.has(TileMapCell(source_id, hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile))) { tile_set_selection.erase(TileMapCell(source_id, hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile)); } else { tile_set_selection.insert(TileMapCell(source_id, hovered_tile.get_atlas_coords(), hovered_tile.alternative_tile)); @@ -1565,13 +1706,14 @@ TypedArray<Vector2i> TileMapEditorTilesPlugin::_get_tile_map_selection() const { void TileMapEditorTilesPlugin::edit(ObjectID p_tile_map_id) { tile_map_id = p_tile_map_id; - // Clean the selection. + // Clear the selection. tile_set_selection.clear(); tile_map_selection.clear(); selection_pattern->clear(); } void TileMapEditorTilesPlugin::_bind_methods() { + ClassDB::bind_method(D_METHOD("_scene_thumbnail_done"), &TileMapEditorTilesPlugin::_scene_thumbnail_done); ClassDB::bind_method(D_METHOD("_set_tile_map_selection", "selection"), &TileMapEditorTilesPlugin::_set_tile_map_selection); ClassDB::bind_method(D_METHOD("_get_tile_map_selection"), &TileMapEditorTilesPlugin::_get_tile_map_selection); } @@ -1718,20 +1860,20 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { sources_list->set_h_size_flags(SIZE_EXPAND_FILL); sources_list->set_stretch_ratio(0.25); sources_list->set_custom_minimum_size(Size2i(70, 0) * EDSCALE); + sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); sources_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_fix_selected_and_hovered).unbind(1)); - sources_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_atlas_view).unbind(1)); + sources_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_bottom_panel).unbind(1)); sources_list->connect("item_selected", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_atlas_sources_lists_current)); sources_list->connect("visibility_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::synchronize_atlas_sources_list), varray(sources_list)); - //sources_list->set_drag_forwarding(this); atlas_sources_split_container->add_child(sources_list); + // Tile atlas source. tile_atlas_view = memnew(TileAtlasView); tile_atlas_view->set_h_size_flags(SIZE_EXPAND_FILL); tile_atlas_view->set_v_size_flags(SIZE_EXPAND_FILL); tile_atlas_view->set_texture_grid_visible(false); tile_atlas_view->set_tile_shape_grid_visible(false); tile_atlas_view->connect("transform_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_atlas_view_transform)); - //tile_atlas_view->connect("visibility_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::synchronize_atlas_view), varray(tile_atlas_view)); atlas_sources_split_container->add_child(tile_atlas_view); tile_atlas_control = memnew(Control); @@ -1746,6 +1888,27 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { alternative_tiles_control->connect("gui_input", callable_mp(this, &TileMapEditorTilesPlugin::_tile_alternatives_control_gui_input)); tile_atlas_view->add_control_over_alternative_tiles(alternative_tiles_control); + // Scenes collection source. + scene_tiles_list = memnew(ItemList); + scene_tiles_list->set_h_size_flags(SIZE_EXPAND_FILL); + scene_tiles_list->set_v_size_flags(SIZE_EXPAND_FILL); + scene_tiles_list->set_drag_forwarding(this); + scene_tiles_list->set_select_mode(ItemList::SELECT_MULTI); + scene_tiles_list->connect("multi_selected", callable_mp(this, &TileMapEditorTilesPlugin::_scenes_list_multi_selected)); + scene_tiles_list->connect("nothing_selected", callable_mp(this, &TileMapEditorTilesPlugin::_scenes_list_nothing_selected)); + scene_tiles_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + atlas_sources_split_container->add_child(scene_tiles_list); + + // Invalid source label. + invalid_source_label = memnew(Label); + invalid_source_label->set_text(TTR("Invalid source selected.")); + invalid_source_label->set_h_size_flags(SIZE_EXPAND_FILL); + invalid_source_label->set_v_size_flags(SIZE_EXPAND_FILL); + invalid_source_label->set_align(Label::ALIGN_CENTER); + invalid_source_label->set_valign(Label::VALIGN_CENTER); + invalid_source_label->hide(); + atlas_sources_split_container->add_child(invalid_source_label); + _update_bottom_panel(); } @@ -2147,7 +2310,7 @@ Set<TileMapEditorTerrainsPlugin::Constraint> TileMapEditorTerrainsPlugin::_get_c Map<int, int> terrain_count; - // Count the number of occurences per terrain. + // Count the number of occurrences per terrain. Map<Vector2i, TileSet::CellNeighbor> overlapping_terrain_bits = c.get_overlapping_coords_and_peering_bits(); for (Map<Vector2i, TileSet::CellNeighbor>::Element *E_overlapping = overlapping_terrain_bits.front(); E_overlapping; E_overlapping = E_overlapping->next()) { if (!p_to_replace.has(E_overlapping->key())) { @@ -2165,7 +2328,7 @@ Set<TileMapEditorTerrainsPlugin::Constraint> TileMapEditorTerrainsPlugin::_get_c } } - // Get the terrain with the max number of occurences. + // Get the terrain with the max number of occurrences. int max = 0; int max_terrain = -1; for (Map<int, int>::Element *E_terrain_count = terrain_count.front(); E_terrain_count; E_terrain_count = E_terrain_count->next()) { @@ -2231,7 +2394,7 @@ Map<Vector2i, TileMapEditorTerrainsPlugin::TerrainsTilePattern> TileMapEditorTer per_cell_acceptable_tiles[E->get()] = _get_valid_terrains_tile_patterns_for_constraints(p_terrain_set, E->get(), constraints); } - // Ouput map. + // Output map. Map<Vector2i, TerrainsTilePattern> output; // Add all positions to a set. @@ -2450,7 +2613,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTerrainsPlugin::_draw_terrains(const Map output[E->key()] = _get_random_tile_from_pattern(p_terrain_set, E->get()); } - // Override the WFC results to make sure at least the painted tiles are acutally painted. + // Override the WFC results to make sure at least the painted tiles are actually painted. for (Map<Vector2i, TerrainsTilePattern>::Element *E_to_paint = p_to_paint.front(); E_to_paint; E_to_paint = E_to_paint->next()) { output[E_to_paint->key()] = _get_random_tile_from_pattern(p_terrain_set, E_to_paint->get()); } @@ -2587,7 +2750,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent> } if (need_tree_item_switch) { - for (tree_item = terrains_tree->get_root()->get_children(); tree_item; tree_item = tree_item->get_next_visible()) { + for (tree_item = terrains_tree->get_root()->get_first_child(); tree_item; tree_item = tree_item->get_next_visible()) { Dictionary metadata_dict = tree_item->get_metadata(0); if (metadata_dict.has("terrain_set") && metadata_dict.has("terrain_id")) { int terrain_set = metadata_dict["terrain_set"]; @@ -2771,8 +2934,8 @@ void TileMapEditorTerrainsPlugin::_update_terrains_cache() { TileMapCell empty_cell; empty_cell.source_id = -1; - empty_cell.set_atlas_coords(TileSetAtlasSource::INVALID_ATLAS_COORDS); - empty_cell.alternative_tile = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + empty_cell.set_atlas_coords(TileSetSource::INVALID_ATLAS_COORDS); + empty_cell.alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE; per_terrain_terrains_tile_patterns_tiles[i][empty_pattern].insert(empty_cell); } } diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h index f780686b82..a1fb9af3ef 100644 --- a/editor/plugins/tiles/tile_map_editor.h +++ b/editor/plugins/tiles/tile_map_editor.h @@ -58,7 +58,7 @@ private: ObjectID tile_map_id; virtual void edit(ObjectID p_tile_map_id) override; - // Toolbar. + ///// Toolbar ///// HBoxContainer *toolbar; Ref<ButtonGroup> tool_buttons_group; @@ -84,7 +84,7 @@ private: void _update_toolbar(); - // Tilemap editing. + ///// Tilemap editing. ///// bool has_mouse = false; void _mouse_exited_viewport(); @@ -105,12 +105,12 @@ private: Map<Vector2i, TileMapCell> drag_modified; TileMapCell _pick_random_tile(const TileMapPattern *p_pattern); - Map<Vector2i, TileMapCell> _draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2i p_to_mouse_pos); - Map<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_mouse_pos, Vector2i p_end_mouse_pos); + Map<Vector2i, TileMapCell> _draw_line(Vector2 p_start_drag_mouse_pos, Vector2 p_from_mouse_pos, Vector2 p_to_mouse_pos); + Map<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell); Map<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous); void _stop_dragging(); - // Selection system. + ///// Selection system. ///// Set<Vector2i> tile_map_selection; TileMapPattern *tile_map_clipboard = memnew(TileMapPattern); TileMapPattern *selection_pattern = memnew(TileMapPattern); @@ -124,22 +124,24 @@ private: void _update_tileset_selection_from_selection_pattern(); void _update_fix_selected_and_hovered(); - // Bottom panel. - bool tile_set_dragging_selection = false; - Vector2i tile_set_drag_start_mouse_pos; - + ///// Bottom panel. ////. Label *missing_source_label; - HSplitContainer *atlas_sources_split_container; + Label *invalid_source_label; ItemList *sources_list; - TileAtlasView *tile_atlas_view; - Ref<Texture2D> missing_texture_texture; + + Ref<Texture2D> missing_atlas_texture_icon; void _update_tile_set_sources_list(); - void _update_atlas_view(); void _update_bottom_panel(); + // Atlas sources. TileMapCell hovered_tile; + TileAtlasView *tile_atlas_view; + HSplitContainer *atlas_sources_split_container; + + bool tile_set_dragging_selection = false; + Vector2i tile_set_drag_start_mouse_pos; Control *tile_atlas_control; void _tile_atlas_control_mouse_exited(); @@ -151,6 +153,16 @@ private: void _tile_alternatives_control_mouse_exited(); void _tile_alternatives_control_gui_input(const Ref<InputEvent> &p_event); + void _update_atlas_view(); + + // Scenes collection sources. + ItemList *scene_tiles_list; + + void _update_scenes_collection_view(); + void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud); + void _scenes_list_multi_selected(int p_index, bool p_selected); + void _scenes_list_nothing_selected(); + // Update callback virtual void tile_set_changed() override; diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 69abbb29f1..b6e1a318cb 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -53,10 +53,10 @@ void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::set_id(int p_id) { if (source_id == p_id) { return; } - ERR_FAIL_COND_MSG(tile_set->has_source(p_id), vformat("Cannot change TileSet atlas source ID. Another atlas source exists with id %d.", p_id)); + ERR_FAIL_COND_MSG(tile_set->has_source(p_id), vformat("Cannot change TileSet Atlas Source ID. Another source exists with id %d.", p_id)); int previous_source = source_id; - source_id = p_id; // source_id must be updated before, because it's used by the atlas source list update. + source_id = p_id; // source_id must be updated before, because it's used by the source list update. tile_set->set_source_id(previous_source, p_id); emit_signal("changed", "id"); } @@ -126,7 +126,7 @@ void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::edit(Ref<TileSet> } // -- Proxy object used by the tile inspector -- -bool TileSetAtlasSourceEditor::TileProxyObject::_set(const StringName &p_name, const Variant &p_value) { +bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_name, const Variant &p_value) { if (!tile_set_atlas_source) { return false; } @@ -152,9 +152,9 @@ bool TileSetAtlasSourceEditor::TileProxyObject::_set(const StringName &p_name, c return true; } else if (alternative == 0 && p_name == "size_in_atlas") { Vector2i as_vector2i = Vector2i(p_value); - ERR_FAIL_COND_V(!tile_set_atlas_source->can_move_tile_in_atlas(coords, TileSetAtlasSource::INVALID_ATLAS_COORDS, as_vector2i), false); + ERR_FAIL_COND_V(!tile_set_atlas_source->can_move_tile_in_atlas(coords, TileSetSource::INVALID_ATLAS_COORDS, as_vector2i), false); - tile_set_atlas_source->move_tile_in_atlas(coords, TileSetAtlasSource::INVALID_ATLAS_COORDS, as_vector2i); + tile_set_atlas_source->move_tile_in_atlas(coords, TileSetSource::INVALID_ATLAS_COORDS, as_vector2i); emit_signal("changed", "size_in_atlas"); return true; } else if (alternative > 0 && p_name == "alternative_id") { @@ -197,7 +197,7 @@ bool TileSetAtlasSourceEditor::TileProxyObject::_set(const StringName &p_name, c return any_valid; } -bool TileSetAtlasSourceEditor::TileProxyObject::_get(const StringName &p_name, Variant &r_ret) const { +bool TileSetAtlasSourceEditor::AtlasTileProxyObject::_get(const StringName &p_name, Variant &r_ret) const { if (!tile_set_atlas_source) { return false; } @@ -237,7 +237,7 @@ bool TileSetAtlasSourceEditor::TileProxyObject::_get(const StringName &p_name, V return false; } -void TileSetAtlasSourceEditor::TileProxyObject::_get_property_list(List<PropertyInfo> *p_list) const { +void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<PropertyInfo> *p_list) const { if (!tile_set_atlas_source) { return; } @@ -310,12 +310,11 @@ void TileSetAtlasSourceEditor::TileProxyObject::_get_property_list(List<Property } } -void TileSetAtlasSourceEditor::TileProxyObject::edit(TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id, Set<TileSelection> p_tiles) { +void TileSetAtlasSourceEditor::AtlasTileProxyObject::edit(TileSetAtlasSource *p_tile_set_atlas_source, Set<TileSelection> p_tiles) { ERR_FAIL_COND(!p_tile_set_atlas_source); - ERR_FAIL_COND(p_source_id < 0); ERR_FAIL_COND(p_tiles.is_empty()); for (Set<TileSelection>::Element *E = p_tiles.front(); E; E = E->next()) { - ERR_FAIL_COND(E->get().tile == TileSetAtlasSource::INVALID_ATLAS_COORDS); + ERR_FAIL_COND(E->get().tile == TileSetSource::INVALID_ATLAS_COORDS); ERR_FAIL_COND(E->get().alternative < 0); } @@ -333,7 +332,6 @@ void TileSetAtlasSourceEditor::TileProxyObject::edit(TileSetAtlasSource *p_tile_ } tile_set_atlas_source = p_tile_set_atlas_source; - source_id = p_source_id; tiles = Set<TileSelection>(p_tiles); // Connect to changes. @@ -352,7 +350,7 @@ void TileSetAtlasSourceEditor::TileProxyObject::edit(TileSetAtlasSource *p_tile_ notify_property_list_changed(); } -void TileSetAtlasSourceEditor::TileProxyObject::_bind_methods() { +void TileSetAtlasSourceEditor::AtlasTileProxyObject::_bind_methods() { ADD_SIGNAL(MethodInfo("changed", PropertyInfo(Variant::STRING, "what"))); } @@ -391,12 +389,12 @@ void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() { // Fix hovered. if (!tile_set_atlas_source->has_tile(hovered_base_tile_coords)) { - hovered_base_tile_coords = TileSetAtlasSource::INVALID_ATLAS_COORDS; + hovered_base_tile_coords = TileSetSource::INVALID_ATLAS_COORDS; } Vector2i coords = Vector2i(hovered_alternative_tile_coords.x, hovered_alternative_tile_coords.y); int alternative = hovered_alternative_tile_coords.z; if (!tile_set_atlas_source->has_tile(coords) || !tile_set_atlas_source->has_alternative_tile(coords, alternative)) { - hovered_alternative_tile_coords = Vector3i(TileSetAtlasSource::INVALID_ATLAS_COORDS.x, TileSetAtlasSource::INVALID_ATLAS_COORDS.y, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + hovered_alternative_tile_coords = Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); } } @@ -405,7 +403,7 @@ void TileSetAtlasSourceEditor::_update_tile_inspector() { // Update the proxy object. if (has_atlas_tile_selected) { - tile_proxy_object->edit(tile_set_atlas_source, tile_set_atlas_source_id, selection); + tile_proxy_object->edit(tile_set_atlas_source, selection); } // Update visibility. @@ -486,7 +484,7 @@ void TileSetAtlasSourceEditor::_update_toolbar() { } void TileSetAtlasSourceEditor::_tile_atlas_control_mouse_exited() { - hovered_base_tile_coords = TileSetAtlasSource::INVALID_ATLAS_COORDS; + hovered_base_tile_coords = TileSetSource::INVALID_ATLAS_COORDS; tile_atlas_control->update(); tile_atlas_control_unscaled->update(); tile_atlas_view->update(); @@ -514,7 +512,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven if (selection.size() == 1) { // Change the cursor depending on the hovered thing. TileSelection selected = selection.front()->get(); - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS && selected.alternative == 0) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS && selected.alternative == 0) { Vector2 mouse_local_pos = tile_atlas_control->get_local_mouse_position(); Vector2i size_in_atlas = tile_set_atlas_source->get_tile_size_in_atlas(selected.tile); Rect2 region = tile_set_atlas_source->get_tile_texture_region(selected.tile); @@ -560,7 +558,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven Vector<Point2i> line = Geometry2D::bresenham_line(last_base_tiles_coords, new_base_tiles_coords); for (int i = 0; i < line.size(); i++) { - if (tile_set_atlas_source->get_tile_at_coords(line[i]) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(line[i]) == TileSetSource::INVALID_ATLAS_COORDS) { tile_set_atlas_source->create_tile(line[i]); drag_modified_tiles.insert(line[i]); } @@ -576,7 +574,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven Vector<Point2i> line = Geometry2D::bresenham_line(last_base_tiles_coords, new_base_tiles_coords); for (int i = 0; i < line.size(); i++) { Vector2i base_tile_coords = tile_set_atlas_source->get_tile_at_coords(line[i]); - if (base_tile_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (base_tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { drag_modified_tiles.insert(base_tile_coords); } } @@ -662,17 +660,17 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven // Remove a first tile. Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { coords = tile_set_atlas_source->get_tile_at_coords(coords); } - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { drag_modified_tiles.insert(coords); } } else { - if (mb->get_shift()) { + if (mb->is_shift_pressed()) { // Create a big tile. Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(mouse_local_pos); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { // Setup the dragging info, only if we start on an empty tile. drag_type = DRAG_TYPE_CREATE_BIG_TILE; drag_start_mouse_pos = mouse_local_pos; @@ -692,7 +690,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven // Create a first tile if needed. Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { tile_set_atlas_source->create_tile(coords); drag_modified_tiles.insert(coords); } @@ -707,10 +705,10 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven drag_start_mouse_pos = mouse_local_pos; drag_last_mouse_pos = drag_start_mouse_pos; } else { - if (mb->get_shift()) { + if (mb->is_shift_pressed()) { // Create a big tile. Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(mouse_local_pos); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS && tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { // Setup the dragging info, only if we start on an empty tile. drag_type = DRAG_TYPE_CREATE_BIG_TILE; drag_start_mouse_pos = mouse_local_pos; @@ -732,7 +730,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven drag_type = DRAG_TYPE_NONE; if (selection.size() == 1) { TileSelection selected = selection.front()->get(); - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS && selected.alternative == 0) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS && selected.alternative == 0) { Vector2i size_in_atlas = tile_set_atlas_source->get_tile_size_in_atlas(selected.tile); Rect2 region = tile_set_atlas_source->get_tile_texture_region(selected.tile); Size2 zoomed_size = resize_handle->get_size() / tile_atlas_view->get_zoom(); @@ -771,17 +769,17 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven // Selecting then dragging a tile. if (drag_type == DRAG_TYPE_NONE) { - TileSelection selected = { TileSetAtlasSource::INVALID_ATLAS_COORDS, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE }; + TileSelection selected = { TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE }; Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(mouse_local_pos); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { coords = tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { selected = { coords, 0 }; } } - bool shift = mb->get_shift(); - if (!shift && selection.size() == 1 && selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS && selection.has(selected)) { + bool shift = mb->is_shift_pressed(); + if (!shift && selection.size() == 1 && selected.tile != TileSetSource::INVALID_ATLAS_COORDS && selection.has(selected)) { // Start move dragging. drag_type = DRAG_TYPE_MOVE_TILE; drag_start_mouse_pos = mouse_local_pos; @@ -812,13 +810,13 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven // Right click pressed. TileSelection selected = { tile_atlas_view->get_atlas_tile_coords_at_pos(mouse_local_pos), 0 }; - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS) { selected.tile = tile_set_atlas_source->get_tile_at_coords(selected.tile); } // Set the selection if needed. if (selection.size() <= 1) { - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS) { undo_redo->create_action(TTR("Select tiles")); undo_redo->add_undo_method(this, "_set_selection_from_array", _get_selection_as_array()); selection.clear(); @@ -831,15 +829,15 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven } // Pops up the correct menu, depending on whether we have a tile or not. - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS && selection.has(selected)) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS && selection.has(selected)) { // We have a tile. menu_option_coords = selected.tile; menu_option_alternative = 0; base_tile_popup_menu->popup(Rect2i(get_global_mouse_position(), Size2i())); - } else if (hovered_base_tile_coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + } else if (hovered_base_tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { // We don't have a tile, but can create one. menu_option_coords = hovered_base_tile_coords; - menu_option_alternative = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + menu_option_alternative = TileSetSource::INVALID_TILE_ALTERNATIVE; empty_base_tile_popup_menu->popup(Rect2i(get_global_mouse_position(), Size2i())); } } else { @@ -902,7 +900,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { undo_redo->add_do_method(tile_set_atlas_source, "create_tile", coords); undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", coords); } @@ -923,7 +921,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { Vector2i coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y)); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { to_delete.insert(coords); } } @@ -964,8 +962,8 @@ void TileSetAtlasSourceEditor::_end_dragging() { case DRAG_TYPE_RECT_SELECT: { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position()); - ERR_FAIL_COND(start_base_tiles_coords == TileSetAtlasSource::INVALID_ATLAS_COORDS); - ERR_FAIL_COND(new_base_tiles_coords == TileSetAtlasSource::INVALID_ATLAS_COORDS); + ERR_FAIL_COND(start_base_tiles_coords == TileSetSource::INVALID_ATLAS_COORDS); + ERR_FAIL_COND(new_base_tiles_coords == TileSetSource::INVALID_ATLAS_COORDS); Rect2i region = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); region.size += Vector2i(1, 1); @@ -977,7 +975,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { bool add_to_selection = true; if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { Vector2i coords = tile_set_atlas_source->get_tile_at_coords(start_base_tiles_coords); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { if (selection.has({ coords, 0 })) { add_to_selection = false; } @@ -991,7 +989,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { for (int y = region.position.y; y < region.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { if (add_to_selection && !selection.has({ coords, 0 })) { selection.insert({ coords, 0 }); } else if (!add_to_selection && selection.has({ coords, 0 })) { @@ -1243,7 +1241,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { Vector2i coords = tile_set_atlas_source->get_tile_at_coords(Vector2i(x, y)); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { to_paint.insert(coords); } } @@ -1266,7 +1264,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { Vector2i origin = margins + (coords * (tile_size + separation)); tile_atlas_control->draw_rect(Rect2i(origin, tile_size), Color(1.0, 1.0, 1.0), false); } @@ -1290,7 +1288,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { Vector2i grid_size = tile_set_atlas_source->get_atlas_grid_size(); if (hovered_base_tile_coords.x >= 0 && hovered_base_tile_coords.y >= 0 && hovered_base_tile_coords.x < grid_size.x && hovered_base_tile_coords.y < grid_size.y) { Vector2i hovered_tile = tile_set_atlas_source->get_tile_at_coords(hovered_base_tile_coords); - if (hovered_tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (hovered_tile != TileSetSource::INVALID_ATLAS_COORDS) { // Draw existing hovered tile. tile_atlas_control->draw_rect(tile_set_atlas_source->get_tile_texture_region(hovered_tile), Color(1.0, 1.0, 1.0), false); } else { @@ -1349,7 +1347,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In selection.clear(); TileSelection selected = { Vector2i(tile.x, tile.y), int(tile.z) }; - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS) { selection.insert(selected); } @@ -1364,7 +1362,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In selection.clear(); TileSelection selected = { Vector2i(tile.x, tile.y), int(tile.z) }; - if (selected.tile != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (selected.tile != TileSetSource::INVALID_ATLAS_COORDS) { selection.insert(selected); } @@ -1387,7 +1385,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In } void TileSetAtlasSourceEditor::_tile_alternatives_control_mouse_exited() { - hovered_alternative_tile_coords = Vector3i(TileSetAtlasSource::INVALID_ATLAS_COORDS.x, TileSetAtlasSource::INVALID_ATLAS_COORDS.y, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + hovered_alternative_tile_coords = Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); tile_atlas_control->update(); tile_atlas_control_unscaled->update(); alternative_tiles_control->update(); @@ -1399,7 +1397,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_draw() { if (tools_button_group->get_pressed_button() == tool_select_button) { // Draw hovered tile. Vector2i coords = Vector2(hovered_alternative_tile_coords.x, hovered_alternative_tile_coords.y); - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (coords != TileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = tile_atlas_view->get_alternative_tile_rect(coords, hovered_alternative_tile_coords.z); if (rect != Rect2i()) { alternative_tiles_control->draw_rect(rect, Color(1.0, 1.0, 1.0), false); @@ -1441,7 +1439,7 @@ void TileSetAtlasSourceEditor::_undo_redo_inspector_callback(Object *p_undo_redo #define ADD_UNDO(obj, property) undo_redo->add_undo_property(obj, property, tile_data->get(property)); - TileProxyObject *tile_data = Object::cast_to<TileProxyObject>(p_edited); + AtlasTileProxyObject *tile_data = Object::cast_to<AtlasTileProxyObject>(p_edited); if (tile_data) { Vector<String> components = String(p_property).split("/", true, 2); if (components.size() == 2 && components[1] == "shapes_count") { @@ -1518,7 +1516,7 @@ void TileSetAtlasSourceEditor::_auto_create_tiles() { for (int x = 0; x < grid_size.x; x++) { // Check if we have a tile at the coord Vector2i coords = Vector2i(x, y); - if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetAtlasSource::INVALID_ATLAS_COORDS) { + if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { // Check if the texture is empty at the given coords. Rect2i region = Rect2i(margins + (coords * (texture_region_size + separation)), texture_region_size); bool is_opaque = false; @@ -1673,7 +1671,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tile_inspector_label->hide(); middle_vbox_container->add_child(tile_inspector_label); - tile_proxy_object = memnew(TileProxyObject(this)); + tile_proxy_object = memnew(AtlasTileProxyObject(this)); tile_proxy_object->connect("changed", callable_mp(this, &TileSetAtlasSourceEditor::_update_atlas_view).unbind(1)); tile_inspector = memnew(EditorInspector); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h index ff68aa8288..70f2cdbe01 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.h +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h @@ -45,8 +45,8 @@ class TileSetAtlasSourceEditor : public HBoxContainer { private: // A class to store which tiles are selected. struct TileSelection { - Vector2i tile = TileSetAtlasSource::INVALID_ATLAS_COORDS; - int alternative = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + Vector2i tile = TileSetSource::INVALID_ATLAS_COORDS; + int alternative = TileSetSource::INVALID_TILE_ALTERNATIVE; bool operator<(const TileSelection &p_other) const { if (tile == p_other.tile) { @@ -80,14 +80,13 @@ private: }; // -- Proxy object for a tile, needed by the inspector -- - class TileProxyObject : public Object { - GDCLASS(TileProxyObject, Object); + class AtlasTileProxyObject : public Object { + GDCLASS(AtlasTileProxyObject, Object); private: TileSetAtlasSourceEditor *tiles_set_atlas_source_editor; TileSetAtlasSource *tile_set_atlas_source = nullptr; - int source_id; Set<TileSelection> tiles = Set<TileSelection>(); protected: @@ -99,10 +98,10 @@ private: public: // Update the proxyed object. - void edit(TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id = -1, Set<TileSelection> p_tiles = Set<TileSelection>()); + void edit(TileSetAtlasSource *p_tile_set_atlas_source, Set<TileSelection> p_tiles = Set<TileSelection>()); - TileProxyObject(TileSetAtlasSourceEditor *p_tiles_editor_source_tab) { - tiles_set_atlas_source_editor = p_tiles_editor_source_tab; + AtlasTileProxyObject(TileSetAtlasSourceEditor *p_tiles_set_atlas_source_editor) { + tiles_set_atlas_source_editor = p_tiles_set_atlas_source_editor; } }; @@ -115,7 +114,7 @@ private: bool tile_set_atlas_source_changed_needs_update = false; // -- Inspector -- - TileProxyObject *tile_proxy_object; + AtlasTileProxyObject *tile_proxy_object; Label *tile_inspector_label; EditorInspector *tile_inspector; String selected_property; @@ -175,7 +174,7 @@ private: ADVANCED_AUTO_REMOVE_TILES, }; Vector2i menu_option_coords; - int menu_option_alternative = TileSetAtlasSource::INVALID_TILE_ALTERNATIVE; + int menu_option_alternative = TileSetSource::INVALID_TILE_ALTERNATIVE; void _menu_option(int p_option); // Tool buttons. @@ -198,7 +197,7 @@ private: Array _get_selection_as_array(); // A control on the tile atlas to draw and handle input events. - Vector2i hovered_base_tile_coords = TileSetAtlasSource::INVALID_ATLAS_COORDS; + Vector2i hovered_base_tile_coords = TileSetSource::INVALID_ATLAS_COORDS; PopupMenu *base_tile_popup_menu; PopupMenu *empty_base_tile_popup_menu; @@ -213,7 +212,7 @@ private: void _tile_atlas_view_transform_changed(); // A control over the alternative tiles. - Vector3i hovered_alternative_tile_coords = Vector3i(TileSetAtlasSource::INVALID_ATLAS_COORDS.x, TileSetAtlasSource::INVALID_ATLAS_COORDS.y, TileSetAtlasSource::INVALID_TILE_ALTERNATIVE); + Vector3i hovered_alternative_tile_coords = Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); PopupMenu *alternative_tile_popup_menu; Control *alternative_tiles_control; diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 8a5890e9a4..05ebe408a5 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -76,7 +76,7 @@ void TileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, C tile_set_atlas_source_editor->init_source(); } - // Update the selected source (thus trigerring an update). + // Update the selected source (thus triggering an update). _update_atlas_sources_list(source_id); } } @@ -140,20 +140,39 @@ void TileSetEditor::_update_atlas_sources_list(int force_selected_id) { for (int i = 0; i < tile_set->get_source_count(); i++) { int source_id = tile_set->get_source_id(i); - // TODO: handle with virtual functions TileSetSource *source = *tile_set->get_source(source_id); + + Ref<Texture2D> texture; + String item_text; + + // Atlas source. TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(source); if (atlas_source) { - Ref<Texture2D> texture = atlas_source->get_texture(); + texture = atlas_source->get_texture(); if (texture.is_valid()) { - sources_list->add_item(vformat("%s - (id:%d)", texture->get_path().get_file(), source_id), texture); + item_text = vformat("%s (id:%d)", texture->get_path().get_file(), source_id); } else { - sources_list->add_item(vformat("No texture atlas source - (id:%d)", source_id), missing_texture_texture); + item_text = vformat(TTR("No Texture Atlas Source (id:%d)"), source_id); } - } else { - sources_list->add_item(vformat("Unknown type source - (id:%d)", source_id), missing_texture_texture); } - sources_list->set_item_metadata(sources_list->get_item_count() - 1, source_id); + + // Scene collection source. + TileSetScenesCollectionSource *scene_collection_source = Object::cast_to<TileSetScenesCollectionSource>(source); + if (scene_collection_source) { + texture = get_theme_icon("PackedScene", "EditorIcons"); + item_text = vformat(TTR("Scene Collection Source (id:%d)"), source_id); + } + + // Use default if not valid. + if (item_text.is_empty()) { + item_text = vformat(TTR("Unknown Type Source (id:%d)"), source_id); + } + if (!texture.is_valid()) { + texture = missing_texture_texture; + } + + sources_list->add_item(item_text, texture); + sources_list->set_item_metadata(i, source_id); } // Set again the current selected item if needed. @@ -193,35 +212,63 @@ void TileSetEditor::_source_selected(int p_source_index) { if (p_source_index >= 0) { int source_id = sources_list->get_item_metadata(p_source_index); TileSetAtlasSource *atlas_source = Object::cast_to<TileSetAtlasSource>(*tile_set->get_source(source_id)); + TileSetScenesCollectionSource *scenes_collection_source = Object::cast_to<TileSetScenesCollectionSource>(*tile_set->get_source(source_id)); if (atlas_source) { - tile_set_atlas_source_editor->edit(*tile_set, atlas_source, source_id); no_source_selected_label->hide(); + tile_set_atlas_source_editor->edit(*tile_set, atlas_source, source_id); tile_set_atlas_source_editor->show(); + tile_set_scenes_collection_source_editor->hide(); + } else if (scenes_collection_source) { + no_source_selected_label->hide(); + tile_set_atlas_source_editor->hide(); + tile_set_scenes_collection_source_editor->edit(*tile_set, scenes_collection_source, source_id); + tile_set_scenes_collection_source_editor->show(); } else { no_source_selected_label->show(); tile_set_atlas_source_editor->hide(); + tile_set_scenes_collection_source_editor->hide(); } } else { no_source_selected_label->show(); tile_set_atlas_source_editor->hide(); + tile_set_scenes_collection_source_editor->hide(); } } -void TileSetEditor::_source_add_pressed() { +void TileSetEditor::_source_add_id_pressed(int p_id_pressed) { ERR_FAIL_COND(!tile_set.is_valid()); - int source_id = tile_set->get_next_source_id(); + switch (p_id_pressed) { + case 0: { + int source_id = tile_set->get_next_source_id(); - Ref<TileSetAtlasSource> atlas_source = memnew(TileSetAtlasSource); + Ref<TileSetAtlasSource> atlas_source = memnew(TileSetAtlasSource); - // Add a new source. - undo_redo->create_action(TTR("Add atlas source")); - undo_redo->add_do_method(*tile_set, "add_source", atlas_source, source_id); - undo_redo->add_do_method(*atlas_source, "set_texture_region_size", tile_set->get_tile_size()); - undo_redo->add_undo_method(*tile_set, "remove_source", source_id); - undo_redo->commit_action(); + // Add a new source. + undo_redo->create_action(TTR("Add atlas source")); + undo_redo->add_do_method(*tile_set, "add_source", atlas_source, source_id); + undo_redo->add_do_method(*atlas_source, "set_texture_region_size", tile_set->get_tile_size()); + undo_redo->add_undo_method(*tile_set, "remove_source", source_id); + undo_redo->commit_action(); + + _update_atlas_sources_list(source_id); + } break; + case 1: { + int source_id = tile_set->get_next_source_id(); + + Ref<TileSetScenesCollectionSource> scene_collection_source = memnew(TileSetScenesCollectionSource); - _update_atlas_sources_list(source_id); + // Add a new source. + undo_redo->create_action(TTR("Add atlas source")); + undo_redo->add_do_method(*tile_set, "add_source", scene_collection_source, source_id); + undo_redo->add_undo_method(*tile_set, "remove_source", source_id); + undo_redo->commit_action(); + + _update_atlas_sources_list(source_id); + } break; + default: + ERR_FAIL(); + } } void TileSetEditor::_source_delete_pressed() { @@ -434,6 +481,7 @@ void TileSetEditor::edit(Ref<TileSet> p_tile_set) { } tile_set_atlas_source_editor->hide(); + tile_set_scenes_collection_source_editor->hide(); no_source_selected_label->show(); } @@ -464,6 +512,7 @@ TileSetEditor::TileSetEditor() { sources_list->connect("item_selected", callable_mp(this, &TileSetEditor::_source_selected)); sources_list->connect("item_selected", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_atlas_sources_lists_current)); sources_list->connect("visibility_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::synchronize_atlas_sources_list), varray(sources_list)); + sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); sources_list->set_drag_forwarding(this); split_container_left_side->add_child(sources_list); @@ -477,11 +526,19 @@ TileSetEditor::TileSetEditor() { sources_delete_button->connect("pressed", callable_mp(this, &TileSetEditor::_source_delete_pressed)); sources_bottom_actions->add_child(sources_delete_button); - sources_add_button = memnew(Button); + sources_add_button = memnew(MenuButton); sources_add_button->set_flat(true); - sources_add_button->connect("pressed", callable_mp(this, &TileSetEditor::_source_add_pressed)); + sources_add_button->get_popup()->add_item(TTR("Atlas")); + sources_add_button->get_popup()->add_item(TTR("Scenes Collection")); + sources_add_button->get_popup()->connect("id_pressed", callable_mp(this, &TileSetEditor::_source_add_id_pressed)); sources_bottom_actions->add_child(sources_add_button); + // Right side container. + VBoxContainer *split_container_right_side = memnew(VBoxContainer); + split_container_right_side->set_h_size_flags(SIZE_EXPAND_FILL); + split_container_right_side->set_v_size_flags(SIZE_EXPAND_FILL); + split_container->add_child(split_container_right_side); + // No source selected. no_source_selected_label = memnew(Label); no_source_selected_label->set_text(TTR("No TileSet source selected. Select or create a TileSet source.")); @@ -489,16 +546,24 @@ TileSetEditor::TileSetEditor() { no_source_selected_label->set_v_size_flags(SIZE_EXPAND_FILL); no_source_selected_label->set_align(Label::ALIGN_CENTER); no_source_selected_label->set_valign(Label::VALIGN_CENTER); - split_container->add_child(no_source_selected_label); + split_container_right_side->add_child(no_source_selected_label); // Atlases editor. tile_set_atlas_source_editor = memnew(TileSetAtlasSourceEditor); tile_set_atlas_source_editor->set_h_size_flags(SIZE_EXPAND_FILL); tile_set_atlas_source_editor->set_v_size_flags(SIZE_EXPAND_FILL); tile_set_atlas_source_editor->connect("source_id_changed", callable_mp(this, &TileSetEditor::_update_atlas_sources_list)); - split_container->add_child(tile_set_atlas_source_editor); + split_container_right_side->add_child(tile_set_atlas_source_editor); tile_set_atlas_source_editor->hide(); + // Scenes collection editor. + tile_set_scenes_collection_source_editor = memnew(TileSetScenesCollectionSourceEditor); + tile_set_scenes_collection_source_editor->set_h_size_flags(SIZE_EXPAND_FILL); + tile_set_scenes_collection_source_editor->set_v_size_flags(SIZE_EXPAND_FILL); + tile_set_scenes_collection_source_editor->connect("source_id_changed", callable_mp(this, &TileSetEditor::_update_atlas_sources_list)); + split_container_right_side->add_child(tile_set_scenes_collection_source_editor); + tile_set_scenes_collection_source_editor->hide(); + // Registers UndoRedo inspector callback. EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &TileSetEditor::_undo_redo_inspector_callback)); } diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h index c4aebb40a2..d508c04319 100644 --- a/editor/plugins/tiles/tile_set_editor.h +++ b/editor/plugins/tiles/tile_set_editor.h @@ -35,6 +35,7 @@ #include "scene/resources/tile_set.h" #include "tile_data_editors.h" #include "tile_set_atlas_source_editor.h" +#include "tile_set_scenes_collection_source_editor.h" class TileSetEditor : public VBoxContainer { GDCLASS(TileSetEditor, VBoxContainer); @@ -47,6 +48,7 @@ private: Label *no_source_selected_label; TileSetAtlasSourceEditor *tile_set_atlas_source_editor; + TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor; UndoRedo *undo_redo = EditorNode::get_undo_redo(); @@ -64,11 +66,11 @@ private: // -- Sources management -- Button *sources_delete_button; - Button *sources_add_button; + MenuButton *sources_add_button; ItemList *sources_list; Ref<Texture2D> missing_texture_texture; void _source_selected(int p_source_index); - void _source_add_pressed(); + void _source_add_id_pressed(int p_id_pressed); void _source_delete_pressed(); void _tile_set_changed(); diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp new file mode 100644 index 0000000000..568d4ca8d7 --- /dev/null +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -0,0 +1,511 @@ +/*************************************************************************/ +/* tile_set_scenes_collection_source_editor.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "tile_set_scenes_collection_source_editor.h" + +#include "editor/editor_resource_preview.h" +#include "editor/editor_scale.h" +#include "editor/editor_settings.h" + +#include "scene/gui/item_list.h" + +#include "core/core_string_names.h" + +void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::set_id(int p_id) { + ERR_FAIL_COND(p_id < 0); + if (source_id == p_id) { + return; + } + ERR_FAIL_COND_MSG(tile_set->has_source(p_id), vformat("Cannot change TileSet Scenes Collection source ID. Another TileSet source exists with id %d.", p_id)); + + int previous_source = source_id; + source_id = p_id; // source_id must be updated before, because it's used by the source list update. + tile_set->set_source_id(previous_source, p_id); + emit_signal("changed", "id"); +} + +int TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::get_id() { + return source_id; +} + +bool TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::_set(const StringName &p_name, const Variant &p_value) { + bool valid = false; + tile_set_scenes_collection_source->set(p_name, p_value, &valid); + if (valid) { + emit_signal("changed", String(p_name).utf8().get_data()); + } + return valid; +} + +bool TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::_get(const StringName &p_name, Variant &r_ret) const { + if (!tile_set_scenes_collection_source) { + return false; + } + bool valid = false; + r_ret = tile_set_scenes_collection_source->get(p_name, &valid); + return valid; +} + +void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::_bind_methods() { + // -- Shape and layout -- + ClassDB::bind_method(D_METHOD("set_id", "id"), &TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::set_id); + ClassDB::bind_method(D_METHOD("get_id"), &TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::get_id); + + ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id"); + + ADD_SIGNAL(MethodInfo("changed", PropertyInfo(Variant::STRING, "what"))); +} + +void TileSetScenesCollectionSourceEditor::TileSetScenesCollectionProxyObject::edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id) { + ERR_FAIL_COND(!p_tile_set.is_valid()); + ERR_FAIL_COND(!p_tile_set_scenes_collection_source); + ERR_FAIL_COND(p_source_id < 0); + ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_scenes_collection_source); + + // Disconnect to changes. + if (tile_set_scenes_collection_source) { + tile_set_scenes_collection_source->disconnect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + } + + tile_set = p_tile_set; + tile_set_scenes_collection_source = p_tile_set_scenes_collection_source; + source_id = p_source_id; + + // Connect to changes. + if (tile_set_scenes_collection_source) { + if (!tile_set_scenes_collection_source->is_connected(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed))) { + tile_set_scenes_collection_source->connect(CoreStringNames::get_singleton()->property_list_changed, callable_mp((Object *)this, &Object::notify_property_list_changed)); + } + } + + notify_property_list_changed(); +} + +// -- Proxy object used by the tile inspector -- +bool TileSetScenesCollectionSourceEditor::SceneTileProxyObject::_set(const StringName &p_name, const Variant &p_value) { + if (!tile_set_scenes_collection_source) { + return false; + } + + if (p_name == "id") { + int as_int = int(p_value); + ERR_FAIL_COND_V(as_int < 0, false); + ERR_FAIL_COND_V(tile_set_scenes_collection_source->has_scene_tile_id(as_int), false); + tile_set_scenes_collection_source->set_scene_tile_id(scene_id, as_int); + scene_id = as_int; + emit_signal("changed", "id"); + for (int i = 0; i < tile_set_scenes_collection_source_editor->scene_tiles_list->get_item_count(); i++) { + if (int(tile_set_scenes_collection_source_editor->scene_tiles_list->get_item_metadata(i)) == scene_id) { + tile_set_scenes_collection_source_editor->scene_tiles_list->select(i); + break; + } + } + return true; + } else if (p_name == "scene") { + tile_set_scenes_collection_source->set_scene_tile_scene(scene_id, p_value); + emit_signal("changed", "scene"); + return true; + } else if (p_name == "display_placeholder") { + tile_set_scenes_collection_source->set_scene_tile_display_placeholder(scene_id, p_value); + emit_signal("changed", "display_placeholder"); + return true; + } + + return false; +} + +bool TileSetScenesCollectionSourceEditor::SceneTileProxyObject::_get(const StringName &p_name, Variant &r_ret) const { + if (!tile_set_scenes_collection_source) { + return false; + } + + if (p_name == "id") { + r_ret = scene_id; + return true; + } else if (p_name == "scene") { + r_ret = tile_set_scenes_collection_source->get_scene_tile_scene(scene_id); + return true; + } else if (p_name == "display_placeholder") { + r_ret = tile_set_scenes_collection_source->get_scene_tile_display_placeholder(scene_id); + return true; + } + + return false; +} + +void TileSetScenesCollectionSourceEditor::SceneTileProxyObject::_get_property_list(List<PropertyInfo> *p_list) const { + if (!tile_set_scenes_collection_source) { + return; + } + + p_list->push_back(PropertyInfo(Variant::INT, "id", PROPERTY_HINT_NONE, "")); + p_list->push_back(PropertyInfo(Variant::OBJECT, "scene", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene")); + p_list->push_back(PropertyInfo(Variant::BOOL, "display_placeholder", PROPERTY_HINT_NONE, "")); +} + +void TileSetScenesCollectionSourceEditor::SceneTileProxyObject::edit(TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_scene_id) { + ERR_FAIL_COND(!p_tile_set_scenes_collection_source); + ERR_FAIL_COND(!p_tile_set_scenes_collection_source->has_scene_tile_id(p_scene_id)); + + tile_set_scenes_collection_source = p_tile_set_scenes_collection_source; + scene_id = p_scene_id; + + notify_property_list_changed(); +} + +void TileSetScenesCollectionSourceEditor::SceneTileProxyObject::_bind_methods() { + ADD_SIGNAL(MethodInfo("changed", PropertyInfo(Variant::STRING, "what"))); +} + +void TileSetScenesCollectionSourceEditor::_scenes_collection_source_proxy_object_changed(String p_what) { + if (p_what == "id") { + emit_signal("source_id_changed", scenes_collection_source_proxy_object->get_id()); + } +} + +void TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed() { + tile_set_scenes_collection_source_changed_needs_update = true; +} + +void TileSetScenesCollectionSourceEditor::_scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud) { + int index = p_ud; + + if (index >= 0 && index < scene_tiles_list->get_item_count()) { + scene_tiles_list->set_item_icon(index, p_preview); + } +} + +void TileSetScenesCollectionSourceEditor::_scenes_list_item_activated(int p_index) { + Ref<PackedScene> packed_scene = tile_set_scenes_collection_source->get_scene_tile_scene(scene_tiles_list->get_item_metadata(p_index)); + if (packed_scene.is_valid()) { + EditorNode::get_singleton()->open_request(packed_scene->get_path()); + } +} + +void TileSetScenesCollectionSourceEditor::_source_add_pressed() { + int scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id(); + undo_redo->create_action(TTR("Add a Scene Tile")); + undo_redo->add_do_method(tile_set_scenes_collection_source, "create_scene_tile", Ref<PackedScene>(), scene_id); + undo_redo->add_undo_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id); + undo_redo->commit_action(); + _update_scenes_list(); + _update_action_buttons(); + _update_tile_inspector(); +} + +void TileSetScenesCollectionSourceEditor::_source_delete_pressed() { + Vector<int> selected_indices = scene_tiles_list->get_selected_items(); + ERR_FAIL_COND(selected_indices.size() <= 0); + int scene_id = scene_tiles_list->get_item_metadata(selected_indices[0]); + + undo_redo->create_action(TTR("Remove a Scene Tile")); + undo_redo->add_do_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id); + undo_redo->add_undo_method(tile_set_scenes_collection_source, "create_scene_tile", tile_set_scenes_collection_source->get_scene_tile_scene(scene_id), scene_id); + undo_redo->commit_action(); + _update_scenes_list(); + _update_action_buttons(); + _update_tile_inspector(); +} + +void TileSetScenesCollectionSourceEditor::_update_source_inspector() { + // Update the proxy object. + scenes_collection_source_proxy_object->edit(tile_set, tile_set_scenes_collection_source, tile_set_source_id); +} + +void TileSetScenesCollectionSourceEditor::_update_tile_inspector() { + Vector<int> selected_indices = scene_tiles_list->get_selected_items(); + bool has_atlas_tile_selected = (selected_indices.size() > 0); + + // Update the proxy object. + if (has_atlas_tile_selected) { + int scene_id = scene_tiles_list->get_item_metadata(selected_indices[0]); + tile_proxy_object->edit(tile_set_scenes_collection_source, scene_id); + } + + // Update visibility. + tile_inspector_label->set_visible(has_atlas_tile_selected); + tile_inspector->set_visible(has_atlas_tile_selected); +} + +void TileSetScenesCollectionSourceEditor::_update_action_buttons() { + Vector<int> selected_indices = scene_tiles_list->get_selected_items(); + scene_tile_delete_button->set_disabled(selected_indices.size() <= 0); +} + +void TileSetScenesCollectionSourceEditor::_update_scenes_list() { + if (!tile_set_scenes_collection_source) { + return; + } + + // Get the previously selected id. + Vector<int> selected_indices = scene_tiles_list->get_selected_items(); + int old_selected_scene_id = (selected_indices.size() > 0) ? int(scene_tiles_list->get_item_metadata(selected_indices[0])) : -1; + + // Clear the list. + scene_tiles_list->clear(); + + // Rebuild the list. + int to_reselect = -1; + for (int i = 0; i < tile_set_scenes_collection_source->get_scene_tiles_count(); i++) { + int scene_id = tile_set_scenes_collection_source->get_scene_tile_id(i); + + Ref<PackedScene> scene = tile_set_scenes_collection_source->get_scene_tile_scene(scene_id); + + int item_index = 0; + if (scene.is_valid()) { + item_index = scene_tiles_list->add_item(vformat("%s (path:%s id:%d)", scene->get_path().get_file().get_basename(), scene->get_path(), scene_id)); + Variant udata = i; + EditorResourcePreview::get_singleton()->queue_edited_resource_preview(scene, this, "_scene_thumbnail_done", udata); + } else { + item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), get_theme_icon("PackedScene", "EditorIcons")); + } + scene_tiles_list->set_item_metadata(item_index, scene_id); + + if (old_selected_scene_id >= 0 && scene_id == old_selected_scene_id) { + to_reselect = i; + } + } + + // Reselect if needed. + if (to_reselect >= 0) { + scene_tiles_list->select(to_reselect); + } + + // Icon size update. + int int_size = int(EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size")) * EDSCALE; + scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); +} + +void TileSetScenesCollectionSourceEditor::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: + scene_tile_add_button->set_icon(get_theme_icon("Add", "EditorIcons")); + scene_tile_delete_button->set_icon(get_theme_icon("Remove", "EditorIcons")); + _update_scenes_list(); + break; + case NOTIFICATION_INTERNAL_PROCESS: + if (tile_set_scenes_collection_source_changed_needs_update) { + // Update everything. + _update_source_inspector(); + _update_scenes_list(); + _update_action_buttons(); + _update_tile_inspector(); + tile_set_scenes_collection_source_changed_needs_update = false; + } + break; + case NOTIFICATION_VISIBILITY_CHANGED: + // Update things just in case. + _update_scenes_list(); + _update_action_buttons(); + break; + default: + break; + } +} + +void TileSetScenesCollectionSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id) { + ERR_FAIL_COND(!p_tile_set.is_valid()); + ERR_FAIL_COND(!p_tile_set_scenes_collection_source); + ERR_FAIL_COND(p_source_id < 0); + ERR_FAIL_COND(p_tile_set->get_source(p_source_id) != p_tile_set_scenes_collection_source); + + if (p_tile_set == tile_set && p_tile_set_scenes_collection_source == tile_set_scenes_collection_source && p_source_id == tile_set_source_id) { + return; + } + + // Remove listener for old objects. + if (tile_set_scenes_collection_source) { + tile_set_scenes_collection_source->disconnect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); + } + + // Change the edited object. + tile_set = p_tile_set; + tile_set_scenes_collection_source = p_tile_set_scenes_collection_source; + tile_set_source_id = p_source_id; + + // Add the listener again. + if (tile_set_scenes_collection_source) { + tile_set_scenes_collection_source->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_tile_set_scenes_collection_source_changed)); + } + + // Update everything. + _update_source_inspector(); + _update_scenes_list(); + _update_action_buttons(); + _update_tile_inspector(); +} + +void TileSetScenesCollectionSourceEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { + if (!can_drop_data_fw(p_point, p_data, p_from)) { + return; + } + + if (p_from == scene_tiles_list) { + // Handle dropping a texture in the list of atlas resources. + int scene_id = -1; + Dictionary d = p_data; + Vector<String> files = d["files"]; + for (int i = 0; i < files.size(); i++) { + Ref<PackedScene> resource = ResourceLoader::load(files[i]); + if (resource.is_valid()) { + scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id(); + undo_redo->create_action(TTR("Add a Scene Tile")); + undo_redo->add_do_method(tile_set_scenes_collection_source, "create_scene_tile", resource, scene_id); + undo_redo->add_undo_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id); + undo_redo->commit_action(); + } + } + + _update_scenes_list(); + _update_action_buttons(); + _update_tile_inspector(); + } +} + +bool TileSetScenesCollectionSourceEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { + if (p_from == scene_tiles_list) { + Dictionary d = p_data; + + if (!d.has("type")) { + return false; + } + + // Check if we have a Texture2D. + if (String(d["type"]) == "files") { + Vector<String> files = d["files"]; + + if (files.size() == 0) { + return false; + } + + for (int i = 0; i < files.size(); i++) { + String file = files[i]; + String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + + if (!ClassDB::is_parent_class(ftype, "PackedScene")) { + return false; + } + } + + return true; + } + } + return false; +} + +void TileSetScenesCollectionSourceEditor::_bind_methods() { + ADD_SIGNAL(MethodInfo("source_id_changed", PropertyInfo(Variant::INT, "source_id"))); + + ClassDB::bind_method(D_METHOD("_scene_thumbnail_done"), &TileSetScenesCollectionSourceEditor::_scene_thumbnail_done); + ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &TileSetScenesCollectionSourceEditor::can_drop_data_fw); + ClassDB::bind_method(D_METHOD("drop_data_fw"), &TileSetScenesCollectionSourceEditor::drop_data_fw); +} + +TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() { + // -- Right side -- + HSplitContainer *split_container_right_side = memnew(HSplitContainer); + split_container_right_side->set_h_size_flags(SIZE_EXPAND_FILL); + add_child(split_container_right_side); + + // Middle panel. + ScrollContainer *middle_panel = memnew(ScrollContainer); + middle_panel->set_enable_h_scroll(false); + middle_panel->set_custom_minimum_size(Size2i(200, 0) * EDSCALE); + split_container_right_side->add_child(middle_panel); + + VBoxContainer *middle_vbox_container = memnew(VBoxContainer); + middle_vbox_container->set_h_size_flags(SIZE_EXPAND_FILL); + middle_panel->add_child(middle_vbox_container); + + // Scenes collection source inspector. + scenes_collection_source_inspector_label = memnew(Label); + scenes_collection_source_inspector_label->set_text(TTR("Scenes collection properties:")); + middle_vbox_container->add_child(scenes_collection_source_inspector_label); + + scenes_collection_source_proxy_object = memnew(TileSetScenesCollectionProxyObject()); + scenes_collection_source_proxy_object->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_scenes_collection_source_proxy_object_changed)); + + scenes_collection_source_inspector = memnew(EditorInspector); + scenes_collection_source_inspector->set_undo_redo(undo_redo); + scenes_collection_source_inspector->set_enable_v_scroll(false); + scenes_collection_source_inspector->edit(scenes_collection_source_proxy_object); + middle_vbox_container->add_child(scenes_collection_source_inspector); + + // Tile inspector. + tile_inspector_label = memnew(Label); + tile_inspector_label->set_text(TTR("Tile properties:")); + tile_inspector_label->hide(); + middle_vbox_container->add_child(tile_inspector_label); + + tile_proxy_object = memnew(SceneTileProxyObject(this)); + tile_proxy_object->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_update_scenes_list).unbind(1)); + tile_proxy_object->connect("changed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_update_action_buttons).unbind(1)); + + tile_inspector = memnew(EditorInspector); + tile_inspector->set_undo_redo(undo_redo); + tile_inspector->set_enable_v_scroll(false); + tile_inspector->edit(tile_proxy_object); + tile_inspector->set_use_folding(true); + middle_vbox_container->add_child(tile_inspector); + + // Scenes list. + VBoxContainer *right_vbox_container = memnew(VBoxContainer); + split_container_right_side->add_child(right_vbox_container); + + scene_tiles_list = memnew(ItemList); + scene_tiles_list->set_h_size_flags(SIZE_EXPAND_FILL); + scene_tiles_list->set_v_size_flags(SIZE_EXPAND_FILL); + scene_tiles_list->set_drag_forwarding(this); + scene_tiles_list->connect("item_selected", callable_mp(this, &TileSetScenesCollectionSourceEditor::_update_tile_inspector).unbind(1)); + scene_tiles_list->connect("item_selected", callable_mp(this, &TileSetScenesCollectionSourceEditor::_update_action_buttons).unbind(1)); + scene_tiles_list->connect("item_activated", callable_mp(this, &TileSetScenesCollectionSourceEditor::_scenes_list_item_activated)); + scene_tiles_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + right_vbox_container->add_child(scene_tiles_list); + + HBoxContainer *scenes_bottom_actions = memnew(HBoxContainer); + right_vbox_container->add_child(scenes_bottom_actions); + + scene_tile_add_button = memnew(Button); + scene_tile_add_button->set_flat(true); + scene_tile_add_button->connect("pressed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_add_pressed)); + scenes_bottom_actions->add_child(scene_tile_add_button); + + scene_tile_delete_button = memnew(Button); + scene_tile_delete_button->set_flat(true); + scene_tile_delete_button->set_disabled(true); + scene_tile_delete_button->connect("pressed", callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_delete_pressed)); + scenes_bottom_actions->add_child(scene_tile_delete_button); +} + +TileSetScenesCollectionSourceEditor::~TileSetScenesCollectionSourceEditor() { + memdelete(scenes_collection_source_proxy_object); + memdelete(tile_proxy_object); +} diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h new file mode 100644 index 0000000000..195aa79bc4 --- /dev/null +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h @@ -0,0 +1,139 @@ +/*************************************************************************/ +/* tile_set_scenes_collection_source_editor.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H +#define TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H + +#include "editor/editor_node.h" +#include "scene/gui/box_container.h" +#include "scene/resources/tile_set.h" + +class TileSetScenesCollectionSourceEditor : public HBoxContainer { + GDCLASS(TileSetScenesCollectionSourceEditor, HBoxContainer); + +private: + // -- Proxy object for an atlas source, needed by the inspector -- + class TileSetScenesCollectionProxyObject : public Object { + GDCLASS(TileSetScenesCollectionProxyObject, Object); + + private: + Ref<TileSet> tile_set; + TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr; + int source_id = -1; + + protected: + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; + static void _bind_methods(); + + public: + void set_id(int p_id); + int get_id(); + + void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id); + }; + + // -- Proxy object for a tile, needed by the inspector -- + class SceneTileProxyObject : public Object { + GDCLASS(SceneTileProxyObject, Object); + + private: + TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor; + + TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr; + int source_id; + int scene_id; + + protected: + bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_ret) const; + void _get_property_list(List<PropertyInfo> *p_list) const; + + static void _bind_methods(); + + public: + // Update the proxyed object. + void edit(TileSetScenesCollectionSource *p_tile_set_atlas_source, int p_scene_id); + + SceneTileProxyObject(TileSetScenesCollectionSourceEditor *p_tiles_set_scenes_collection_source_editor) { + tile_set_scenes_collection_source_editor = p_tiles_set_scenes_collection_source_editor; + } + }; + +private: + Ref<TileSet> tile_set; + TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr; + int tile_set_source_id = -1; + + UndoRedo *undo_redo = EditorNode::get_undo_redo(); + + bool tile_set_scenes_collection_source_changed_needs_update = false; + + // Source inspector. + TileSetScenesCollectionProxyObject *scenes_collection_source_proxy_object; + Label *scenes_collection_source_inspector_label; + EditorInspector *scenes_collection_source_inspector; + + // Tile inspector. + SceneTileProxyObject *tile_proxy_object; + Label *tile_inspector_label; + EditorInspector *tile_inspector; + + ItemList *scene_tiles_list; + Button *scene_tile_add_button; + Button *scene_tile_delete_button; + + void _tile_set_scenes_collection_source_changed(); + void _scenes_collection_source_proxy_object_changed(String p_what); + void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud); + void _scenes_list_item_activated(int p_index); + + void _source_add_pressed(); + void _source_delete_pressed(); + + // Update methods. + void _update_source_inspector(); + void _update_tile_inspector(); + void _update_scenes_list(); + void _update_action_buttons(); + +protected: + void _notification(int p_what); + static void _bind_methods(); + +public: + void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id); + void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); + bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; + TileSetScenesCollectionSourceEditor(); + ~TileSetScenesCollectionSourceEditor(); +}; + +#endif diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 0af3b936cb..75a944e910 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -180,7 +180,7 @@ void VersionControlEditorPlugin::_stage_selected() { staged_files_count = 0; TreeItem *root = stage_files->get_root(); if (root) { - TreeItem *file_entry = root->get_children(); + TreeItem *file_entry = root->get_first_child(); while (file_entry) { if (file_entry->is_checked(0)) { EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0)); @@ -207,7 +207,7 @@ void VersionControlEditorPlugin::_stage_all() { staged_files_count = 0; TreeItem *root = stage_files->get_root(); if (root) { - TreeItem *file_entry = root->get_children(); + TreeItem *file_entry = root->get_first_child(); while (file_entry) { EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0)); file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor")); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 1d4c23fee6..18a1e7f693 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -729,7 +729,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { CodeEdit *expression_box = memnew(CodeEdit); Ref<CodeHighlighter> expression_syntax_highlighter; expression_syntax_highlighter.instance(); - expression_node->set_control(expression_box, 0); + expression_node->set_ctrl_pressed(expression_box, 0); node->add_child(expression_box); register_expression_edit(p_id, expression_box); @@ -1584,7 +1584,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p Ref<VisualShaderNodeExpression> expression_node = Object::cast_to<VisualShaderNodeExpression>(node.ptr()); Control *text_box = nullptr; if (!expression_node.is_null()) { - text_box = expression_node->get_control(0); + text_box = expression_node->is_ctrl_pressed(0); if (text_box) { text_box->set_custom_minimum_size(Size2(0, 0)); } @@ -2427,7 +2427,7 @@ void VisualShaderEditor::_convert_constants_to_uniforms(bool p_vice_versa) { for (Set<int>::Element *E = current_set.front(); E; E = E->next()) { int node_id = E->get(); Ref<VisualShaderNode> node = visual_shader->get_node(type_id, node_id); - bool catched = false; + bool caught = false; Variant var; // float @@ -2436,112 +2436,112 @@ void VisualShaderEditor::_convert_constants_to_uniforms(bool p_vice_versa) { if (float_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeFloatConstant", "VisualShaderNodeFloatUniform"); var = float_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeFloatUniform> float_uniform = Object::cast_to<VisualShaderNodeFloatUniform>(node.ptr()); if (float_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeFloatUniform", "VisualShaderNodeFloatConstant"); var = float_uniform->get_default_value(); - catched = true; + caught = true; } } // int - if (!catched) { + if (!caught) { if (!p_vice_versa) { Ref<VisualShaderNodeIntConstant> int_const = Object::cast_to<VisualShaderNodeIntConstant>(node.ptr()); if (int_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeIntConstant", "VisualShaderNodeIntUniform"); var = int_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeIntUniform> int_uniform = Object::cast_to<VisualShaderNodeIntUniform>(node.ptr()); if (int_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeIntUniform", "VisualShaderNodeIntConstant"); var = int_uniform->get_default_value(); - catched = true; + caught = true; } } } // boolean - if (!catched) { + if (!caught) { if (!p_vice_versa) { Ref<VisualShaderNodeBooleanConstant> boolean_const = Object::cast_to<VisualShaderNodeBooleanConstant>(node.ptr()); if (boolean_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeBooleanConstant", "VisualShaderNodeBooleanUniform"); var = boolean_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeBooleanUniform> boolean_uniform = Object::cast_to<VisualShaderNodeBooleanUniform>(node.ptr()); if (boolean_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeBooleanUniform", "VisualShaderNodeBooleanConstant"); var = boolean_uniform->get_default_value(); - catched = true; + caught = true; } } } // vec3 - if (!catched) { + if (!caught) { if (!p_vice_versa) { Ref<VisualShaderNodeVec3Constant> vec3_const = Object::cast_to<VisualShaderNodeVec3Constant>(node.ptr()); if (vec3_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeVec3Constant", "VisualShaderNodeVec3Uniform"); var = vec3_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeVec3Uniform> vec3_uniform = Object::cast_to<VisualShaderNodeVec3Uniform>(node.ptr()); if (vec3_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeVec3Uniform", "VisualShaderNodeVec3Constant"); var = vec3_uniform->get_default_value(); - catched = true; + caught = true; } } } // color - if (!catched) { + if (!caught) { if (!p_vice_versa) { Ref<VisualShaderNodeColorConstant> color_const = Object::cast_to<VisualShaderNodeColorConstant>(node.ptr()); if (color_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeColorConstant", "VisualShaderNodeColorUniform"); var = color_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeColorUniform> color_uniform = Object::cast_to<VisualShaderNodeColorUniform>(node.ptr()); if (color_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeColorUniform", "VisualShaderNodeColorConstant"); var = color_uniform->get_default_value(); - catched = true; + caught = true; } } } // transform - if (!catched) { + if (!caught) { if (!p_vice_versa) { Ref<VisualShaderNodeTransformConstant> transform_const = Object::cast_to<VisualShaderNodeTransformConstant>(node.ptr()); if (transform_const.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeTransformConstant", "VisualShaderNodeTransformUniform"); var = transform_const->get_constant(); - catched = true; + caught = true; } } else { Ref<VisualShaderNodeTransformUniform> transform_uniform = Object::cast_to<VisualShaderNodeTransformUniform>(node.ptr()); if (transform_uniform.is_valid()) { _replace_node(type_id, node_id, "VisualShaderNodeTransformUniform", "VisualShaderNodeTransformConstant"); var = transform_uniform->get_default_value(); - catched = true; + caught = true; } } } - ERR_CONTINUE(!catched); + ERR_CONTINUE(!caught); int preview_port = node->get_output_port_for_preview(); if (!p_vice_versa) { @@ -2762,10 +2762,10 @@ void VisualShaderEditor::_notification(int p_what) { // collapse tree by default - TreeItem *category = members->get_root()->get_children(); + TreeItem *category = members->get_root()->get_first_child(); while (category) { category->set_collapsed(true); - TreeItem *sub_category = category->get_children(); + TreeItem *sub_category = category->get_first_child(); while (sub_category) { sub_category->set_collapsed(true); sub_category = sub_category->get_next(); @@ -3210,14 +3210,14 @@ void VisualShaderEditor::_member_cancel() { } void VisualShaderEditor::_tools_menu_option(int p_idx) { - TreeItem *category = members->get_root()->get_children(); + TreeItem *category = members->get_root()->get_first_child(); switch (p_idx) { case EXPAND_ALL: while (category) { category->set_collapsed(false); - TreeItem *sub_category = category->get_children(); + TreeItem *sub_category = category->get_first_child(); while (sub_category) { sub_category->set_collapsed(false); sub_category = sub_category->get_next(); @@ -3231,7 +3231,7 @@ void VisualShaderEditor::_tools_menu_option(int p_idx) { while (category) { category->set_collapsed(true); - TreeItem *sub_category = category->get_children(); + TreeItem *sub_category = category->get_first_child(); while (sub_category) { sub_category->set_collapsed(true); sub_category = sub_category->get_next(); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 3ede50320a..9b99372735 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -795,7 +795,7 @@ void ProjectExportDialog::_tree_changed() { } void ProjectExportDialog::_check_dir_recursive(TreeItem *p_dir, bool p_checked) { - for (TreeItem *child = p_dir->get_children(); child; child = child->get_next()) { + for (TreeItem *child = p_dir->get_first_child(); child; child = child->get_next()) { String path = child->get_metadata(0); child->set_checked(0, p_checked); @@ -818,7 +818,7 @@ void ProjectExportDialog::_refresh_parent_checks(TreeItem *p_item) { } bool checked = true; - for (TreeItem *child = parent->get_children(); child; child = child->get_next()) { + for (TreeItem *child = parent->get_first_child(); child; child = child->get_next()) { checked = checked && child->is_checked(0); if (!checked) { break; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 2b75144ac7..49a6d28dc1 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -100,7 +100,6 @@ private: FileDialog *fdialog_install; String zip_path; String zip_title; - String zip_root; AcceptDialog *dialog_error; String fav_dir; @@ -201,9 +200,7 @@ private: char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); - String fname_str = String(fname); - if (fname_str.ends_with("project.godot")) { - zip_root = fname_str.substr(0, fname_str.rfind("project.godot")); + if (String(fname).ends_with("project.godot")) { break; } @@ -524,7 +521,24 @@ private: return; } + // Find the zip_root + String zip_root; int ret = unzGoToFirstFile(pkg); + while (ret == UNZ_OK) { + unz_file_info info; + char fname[16384]; + unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + + String name = fname; + if (name.ends_with("project.godot")) { + zip_root = name.substr(0, name.rfind("project.godot")); + break; + } + + ret = unzGoToNextFile(pkg); + } + + ret = unzGoToFirstFile(pkg); Vector<String> failed_files; @@ -1740,7 +1754,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { const Item &clicked_project = _projects[clicked_index]; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { - if (mb->get_shift() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) { + if (mb->is_shift_pressed() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) { int anchor_index = -1; for (int i = 0; i < _projects.size(); ++i) { const Item &p = _projects[i]; @@ -1752,7 +1766,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { CRASH_COND(anchor_index == -1); select_range(anchor_index, clicked_index); - } else if (mb->get_control()) { + } else if (mb->is_ctrl_pressed()) { toggle_select(clicked_index); } else { @@ -1762,7 +1776,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { emit_signal(SIGNAL_SELECTION_CHANGED); - if (!mb->get_control() && mb->is_double_click()) { + if (!mb->is_ctrl_pressed() && mb->is_double_click()) { emit_signal(SIGNAL_PROJECT_ASK_OPEN); } } @@ -1937,7 +1951,7 @@ void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) { } break; case KEY_UP: { - if (k->get_shift()) { + if (k->is_shift_pressed()) { break; } @@ -1951,7 +1965,7 @@ void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) { break; } case KEY_DOWN: { - if (k->get_shift()) { + if (k->is_shift_pressed()) { break; } @@ -1964,7 +1978,7 @@ void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) { } break; case KEY_F: { - if (k->get_command()) { + if (k->is_command_pressed()) { this->search_box->grab_focus(); } else { keycode_handled = false; @@ -2124,8 +2138,8 @@ void ProjectManager::_run_project_confirm() { const String &selected = selected_list[i].project_key; String path = EditorSettings::get_singleton()->get("projects/" + selected); - // `.right(6)` on `IMPORTED_FILES_PATH` strips away the leading "res://". - if (!DirAccess::exists(path.plus_file(ProjectSettings::IMPORTED_FILES_PATH.right(6)))) { + // `.substr(6)` on `IMPORTED_FILES_PATH` strips away the leading "res://". + if (!DirAccess::exists(path.plus_file(ProjectSettings::IMPORTED_FILES_PATH.substr(6)))) { run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import.")); run_error_diag->popup_centered(); continue; diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index da798962e5..bf31be536c 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -52,7 +52,7 @@ void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) { search_box->accept_event(); TreeItem *root = search_options->get_root(); - if (!root->get_children()) { + if (!root->get_first_child()) { break; } @@ -150,7 +150,7 @@ void PropertySelector::_update_search() { for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { if (E->get().usage == PROPERTY_USAGE_CATEGORY) { - if (category && category->get_children() == nullptr) { + if (category && category->get_first_child() == nullptr) { memdelete(category); //old category was unused } category = search_options->create_item(root); @@ -192,7 +192,7 @@ void PropertySelector::_update_search() { item->set_selectable(0, true); } - if (category && category->get_children() == nullptr) { + if (category && category->get_first_child() == nullptr) { memdelete(category); //old category was unused } } else { @@ -225,7 +225,7 @@ void PropertySelector::_update_search() { for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) { if (E->get().name.begins_with("*")) { - if (category && category->get_children() == nullptr) { + if (category && category->get_first_child() == nullptr) { memdelete(category); //old category was unused } category = search_options->create_item(root); @@ -316,12 +316,12 @@ void PropertySelector::_update_search() { } } - if (category && category->get_children() == nullptr) { + if (category && category->get_first_child() == nullptr) { memdelete(category); //old category was unused } } - get_ok_button()->set_disabled(root->get_children() == nullptr); + get_ok_button()->set_disabled(root->get_first_child() == nullptr); } void PropertySelector::_confirmed() { diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index 7f720d65d0..e8e13bab21 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -102,7 +102,7 @@ void EditorQuickOpen::_update_search() { ti->set_icon(0, *icons.lookup_ptr(entries[i].path.get_extension())); } - TreeItem *to_select = root->get_children(); + TreeItem *to_select = root->get_first_child(); to_select->select(0); to_select->set_as_cursor(0); search_options->scroll_to_item(to_select); @@ -170,7 +170,7 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) { if (allow_multi_select) { TreeItem *root = search_options->get_root(); - if (!root->get_children()) { + if (!root->get_first_child()) { break; } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 4068a102df..349e05b47b 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1833,7 +1833,7 @@ bool SceneTreeDock::_is_collapsed_recursive(TreeItem *p_item) const { TreeItem *item = needs_check.back()->get(); needs_check.pop_back(); - TreeItem *child = item->get_children(); + TreeItem *child = item->get_first_child(); is_branch_collapsed = item->is_collapsed() && child; if (is_branch_collapsed) { @@ -1857,7 +1857,7 @@ void SceneTreeDock::_set_collapsed_recursive(TreeItem *p_item, bool p_collapsed) item->set_collapsed(p_collapsed); - TreeItem *child = item->get_children(); + TreeItem *child = item->get_first_child(); while (child) { to_collapse.push_back(child); child = child->get_next(); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index d0bf83eb2d..6f9b0ae873 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -699,7 +699,7 @@ TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) { return p_node; } - TreeItem *children = p_node->get_children(); + TreeItem *children = p_node->get_first_child(); while (children) { TreeItem *n = _find(children, p_path); if (n) { @@ -883,7 +883,7 @@ void SceneTreeEditor::_update_selection(TreeItem *item) { item->deselect(0); } - TreeItem *c = item->get_children(); + TreeItem *c = item->get_first_child(); while (c) { _update_selection(c); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 541ec224b9..4cdf820877 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -235,8 +235,8 @@ void EditorSettingsDialog::_update_shortcuts() { // Before clearing the tree, take note of which categories are collapsed so that this state can be maintained when the tree is repopulated. Map<String, bool> collapsed; - if (shortcuts->get_root() && shortcuts->get_root()->get_children()) { - for (TreeItem *item = shortcuts->get_root()->get_children(); item; item = item->get_next()) { + if (shortcuts->get_root() && shortcuts->get_root()->get_first_child()) { + for (TreeItem *item = shortcuts->get_root()->get_first_child(); item; item = item->get_next()) { collapsed[item->get_text(0)] = item->is_collapsed(); } } @@ -380,7 +380,7 @@ void EditorSettingsDialog::_update_shortcuts() { // remove sections with no shortcuts for (Map<String, TreeItem *>::Element *E = sections.front(); E; E = E->next()) { TreeItem *section = E->get(); - if (section->get_children() == nullptr) { + if (section->get_first_child() == nullptr) { root->remove_child(section); } } diff --git a/editor/translations/af.po b/editor/translations/af.po index c528e2a063..887b7983eb 100644 --- a/editor/translations/af.po +++ b/editor/translations/af.po @@ -2590,7 +2590,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -3006,6 +3006,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5266,16 +5270,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ar.po b/editor/translations/ar.po index 52c609055c..a93fc9a473 100644 --- a/editor/translations/ar.po +++ b/editor/translations/ar.po @@ -2568,7 +2568,7 @@ msgstr "غير قادر علي تحميل النص البرمجي للإضافة #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "غير قادر علي تحميل النص البرمجي الإضافب من المسار: '%s' يبدو أن شِفرة " @@ -3018,6 +3018,10 @@ msgid "About" msgstr "حول" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "تشغيل المشروع." @@ -5233,18 +5237,9 @@ msgstr "" "[0.0،1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "تم تجميع محرر Godot دون دعم لتتبع الأشعة. لا يمكن بناء خرائط الإضاءة." #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/az.po b/editor/translations/az.po index 266e51d7fe..1dcbe3a7a5 100644 --- a/editor/translations/az.po +++ b/editor/translations/az.po @@ -2512,7 +2512,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2918,6 +2918,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5072,16 +5076,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/bg.po b/editor/translations/bg.po index 6f0b756ce1..4005ff2090 100644 --- a/editor/translations/bg.po +++ b/editor/translations/bg.po @@ -2457,7 +2457,7 @@ msgstr "Не може да се зареди добавката-скрипт о #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Не може да се зареди добавката-скрипт от: „%s“. Изглежда има грешка в кода. " @@ -2886,6 +2886,10 @@ msgid "About" msgstr "Относно" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Пускане на проекта." @@ -5065,18 +5069,9 @@ msgstr "" "принадлежат на квадратната област [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Редакторът на Godot е бил компилиран без поддръжка за трасиране на лъчи. Не " "могат да се изпичат карти на осветеност." diff --git a/editor/translations/bn.po b/editor/translations/bn.po index d47fbe367c..5192cd4164 100644 --- a/editor/translations/bn.po +++ b/editor/translations/bn.po @@ -2655,7 +2655,7 @@ msgstr "%s হতে স্ক্রিপ্ট তুলতে/লোডে #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "'%s' পাথ ব্যাবহার করে অ্যাড-অন স্ক্রিপ্ট লোড করা সম্ভব হয়নি। স্ক্রিপ্টটি টুল মোডে নেই।" @@ -3136,6 +3136,10 @@ msgid "About" msgstr "সম্বন্ধে" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "প্রকল্পটি চালান।" @@ -5550,16 +5554,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/br.po b/editor/translations/br.po index ab03bb5425..dfab47a0e2 100644 --- a/editor/translations/br.po +++ b/editor/translations/br.po @@ -2457,7 +2457,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2863,6 +2863,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5017,16 +5021,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ca.po b/editor/translations/ca.po index 4086771705..3346449af2 100644 --- a/editor/translations/ca.po +++ b/editor/translations/ca.po @@ -2561,7 +2561,7 @@ msgstr "Error carregant l'Script complement des del camí: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "No es pot carregar l'script d'addon des del camí: '%s' Sembla que hi ha un " @@ -3017,6 +3017,10 @@ msgid "About" msgstr "Quant a" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Reprodueix el projecte." @@ -5285,16 +5289,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/cs.po b/editor/translations/cs.po index b0d92db7a0..b37f9a6a3f 100644 --- a/editor/translations/cs.po +++ b/editor/translations/cs.po @@ -2550,7 +2550,7 @@ msgstr "Nelze načíst skript rozšíření z cesty: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Nelze načíst skript rozšíření z cesty: '%s'. Zdá se, že se v kódu nachází " @@ -2994,6 +2994,10 @@ msgid "About" msgstr "O aplikaci" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Spustit projekt." @@ -5215,18 +5219,9 @@ msgstr "" "čtvercové oblasti [0.0, 1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot byl sestaven bez podpory ray tracingu, světelné mapy nelze zapéct." diff --git a/editor/translations/da.po b/editor/translations/da.po index 64e6e1c517..3cb65a5d82 100644 --- a/editor/translations/da.po +++ b/editor/translations/da.po @@ -2639,7 +2639,7 @@ msgstr "Kan ikke indlæse addon script fra stien: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Kan ikke indlæse tilføjelse script fra sti: '%s' Der ser ud til at være en " @@ -3102,6 +3102,10 @@ msgid "About" msgstr "Om" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Spil dit projekt." @@ -5406,16 +5410,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/de.po b/editor/translations/de.po index 4bfa2e5796..1c6136ff6f 100644 --- a/editor/translations/de.po +++ b/editor/translations/de.po @@ -72,8 +72,8 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-05-03 21:29+0000\n" -"Last-Translator: Günther Bohn <ciscouser@gmx.de>\n" +"PO-Revision-Date: 2021-05-14 20:34+0000\n" +"Last-Translator: So Wieso <sowieso@dukun.de>\n" "Language-Team: German <https://hosted.weblate.org/projects/godot-engine/" "godot/de/>\n" "Language: de\n" @@ -2617,14 +2617,14 @@ msgid "Unable to load addon script from path: '%s'." msgstr "Erweiterungsskript konnte nicht geladen werden: ‚%s‘." #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" -"Erweiterungsskript konnte nicht von folgendem Pfad geladen werden: ‚%s‘. Es " -"scheint ein Fehler im Quellcode zu sein. Bitte Syntax überprüfen." +"Erweiterungsskript auf folgendem Pfad konnte nicht geladen werden: ‚%s‘. Es " +"scheint ein Fehler in dessen Quellcode zu sein.\n" +"Die Erweiterung ‚%s‘ wird deaktiviert um weitere Fehler zu verhindern." #: editor/editor_node.cpp msgid "" @@ -3075,6 +3075,10 @@ msgid "About" msgstr "Über" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Projekt abspielen." @@ -5312,20 +5316,11 @@ msgstr "" "Kanals im Bereich von 0.0 bis 1.0 liegen." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" -"Diese Godot-Version wurde ohne Raytracing-Unterstützung erstellt, Lightmaps " +"Der Godot-Editor wurde ohne Raytracing-Unterstützung erstellt; Lightmaps " "können damit nicht gebacken werden." #: editor/plugins/baked_lightmap_editor_plugin.cpp @@ -13333,6 +13328,18 @@ msgid "Constants cannot be modified." msgstr "Konstanten können nicht verändert werden." #~ msgid "" +#~ "Godot editor was built without ray tracing support; lightmaps can't be " +#~ "baked.\n" +#~ "If you are using an Apple Silicon-based Mac, try forcing Rosetta " +#~ "emulation on Godot.app in the application settings\n" +#~ "then restart the editor." +#~ msgstr "" +#~ "Der Godot-Editor wurde ohne Raytracing-Unterstützung gebaut; Lightmaps " +#~ "können nicht gebacken werden.\n" +#~ "Nutzer eines Macs basierend auf Apple Silicon sollten Rosetta-Emulation " +#~ "in den Anwendungseinstellungen aktivieren und den Editor neu starten." + +#~ msgid "" #~ "InterpolatedCamera has been deprecated and will be removed in Godot 4.0." #~ msgstr "" #~ "InterpolatedCamera ist veraltet und wird in Godot 4.0 entfernt werden." diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot index 2483cd1ed4..5ffb9f106d 100644 --- a/editor/translations/editor.pot +++ b/editor/translations/editor.pot @@ -2435,7 +2435,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2841,6 +2841,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -4995,16 +4999,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/el.po b/editor/translations/el.po index bbd2148968..591ad55930 100644 --- a/editor/translations/el.po +++ b/editor/translations/el.po @@ -2560,7 +2560,7 @@ msgstr "Αδύνατη η φόρτωση δέσμης ενεργειών προ #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Αποτυχία φόρτωσης δέσμης ενεργειών προσθέτου από τη διαδρομή: '%s'. Φαίνεται " @@ -3015,6 +3015,10 @@ msgid "About" msgstr "Σχετικά" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Αναπαραγωγή του έργου." @@ -5257,16 +5261,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/eo.po b/editor/translations/eo.po index b03935e346..4bb0dcbeae 100644 --- a/editor/translations/eo.po +++ b/editor/translations/eo.po @@ -2518,7 +2518,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2950,6 +2950,10 @@ msgid "About" msgstr "Pri" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Stari la projekton." @@ -5126,16 +5130,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/es.po b/editor/translations/es.po index 15c577a9c8..643fb16a57 100644 --- a/editor/translations/es.po +++ b/editor/translations/es.po @@ -2614,7 +2614,7 @@ msgstr "No se pudo cargar el script addon desde la ruta: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "No se puede cargar el script de addon desde la ruta: '%s' Parece que hay un " @@ -3068,6 +3068,10 @@ msgid "About" msgstr "Acerca de" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Reproducir el proyecto." @@ -5312,18 +5316,9 @@ msgstr "" "están contenidos dentro de la región cuadrangular [0,0,1,0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "El editor de Godot se construyó sin soporte de trazado de rayos, los " "lightmaps no pueden ser bakeados." diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po index 524f628f6c..5441d3def1 100644 --- a/editor/translations/es_AR.po +++ b/editor/translations/es_AR.po @@ -2567,7 +2567,7 @@ msgstr "No se pudo cargar el script de addon desde la ruta: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "No se pudo cargar el script de addon desde la ruta: '%s' Parece haber un " @@ -3019,6 +3019,10 @@ msgid "About" msgstr "Acerca de" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Reproducir el proyecto." @@ -5262,18 +5266,9 @@ msgstr "" "contenidos dentro de la región cuadrada [0,0,1,0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "El editor de Godot se compiló sin soporte de ray tracing, los lightmaps no " "pueden ser bakeados." diff --git a/editor/translations/et.po b/editor/translations/et.po index cd60a34dc2..e4b33e89a0 100644 --- a/editor/translations/et.po +++ b/editor/translations/et.po @@ -2484,7 +2484,7 @@ msgstr "Lisa-skripti ei olnud võimalik laadida teelt: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Lisa-skripti ei olnud võimalik laadida teelt: '%s'. Tundub, et koodis on " @@ -2897,6 +2897,10 @@ msgid "About" msgstr "Teave" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Mängi projekti." @@ -5054,16 +5058,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/eu.po b/editor/translations/eu.po index 6dc3f5645f..26f1c1a3bd 100644 --- a/editor/translations/eu.po +++ b/editor/translations/eu.po @@ -2450,7 +2450,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2856,6 +2856,10 @@ msgid "About" msgstr "Honi buruz" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5018,16 +5022,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/fa.po b/editor/translations/fa.po index e2acd6a256..54cf408469 100644 --- a/editor/translations/fa.po +++ b/editor/translations/fa.po @@ -2492,7 +2492,7 @@ msgstr "امکان بارگیری اسکریپت افزونه از مسیر وج #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2907,6 +2907,10 @@ msgid "About" msgstr "درباره" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "اجرای پروژه." @@ -5207,16 +5211,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/fi.po b/editor/translations/fi.po index 81688234f2..912e0f14f4 100644 --- a/editor/translations/fi.po +++ b/editor/translations/fi.po @@ -16,7 +16,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-04-22 14:40+0000\n" +"PO-Revision-Date: 2021-05-18 10:00+0000\n" "Last-Translator: Tapani Niemi <tapani.niemi@kapsi.fi>\n" "Language-Team: Finnish <https://hosted.weblate.org/projects/godot-engine/" "godot/fi/>\n" @@ -2539,14 +2539,14 @@ msgid "Unable to load addon script from path: '%s'." msgstr "Virhe ladattaessa lisäosaa polusta: '%s'." #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" -"Virhe ladattaessa lisäosaa polusta: '%s'. Koodissa vaikuttaa olevan virhe, " -"ole hyvä ja tarkista syntaksi." +"Lisäosaskriptin lataus ei onnistunut polusta: '%s'. Tämä saattaa johtua " +"koodivirheestä skriptissä.\n" +"Lisäosa '%s' poistetaan käytöstä tulevien virheiden estämiseksi." #: editor/editor_node.cpp msgid "" @@ -2985,6 +2985,10 @@ msgid "About" msgstr "Tietoja" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Käynnistä projekti." @@ -5218,18 +5222,9 @@ msgstr "" "välisen neliön alueella." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot-editori on käännetty ilman ray tracing -tukea, joten lightmappeja ei " "voi kehittää." @@ -13174,6 +13169,19 @@ msgid "Constants cannot be modified." msgstr "Vakioita ei voi muokata." #~ msgid "" +#~ "Godot editor was built without ray tracing support; lightmaps can't be " +#~ "baked.\n" +#~ "If you are using an Apple Silicon-based Mac, try forcing Rosetta " +#~ "emulation on Godot.app in the application settings\n" +#~ "then restart the editor." +#~ msgstr "" +#~ "Godot-editori on käännetty ilman ray tracing -tukea, joten lightmappeja " +#~ "ei voi kehittää.\n" +#~ "Jos käytät Apple Silicon -pohjaista Mac-tietokonetta, yritä pakottaa " +#~ "Rosetta-emulaatio Godot.app:iin sovelluksen asetuksissa\n" +#~ "ja käynnistä sitten editori uudestaan." + +#~ msgid "" #~ "InterpolatedCamera has been deprecated and will be removed in Godot 4.0." #~ msgstr "" #~ "InterpolatedCamera on vanhentunut ja poistetaan Godot 4.0 versiossa." diff --git a/editor/translations/fil.po b/editor/translations/fil.po index 8798d8034f..525dc19561 100644 --- a/editor/translations/fil.po +++ b/editor/translations/fil.po @@ -2450,7 +2450,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2856,6 +2856,10 @@ msgid "About" msgstr "Tungkol" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5013,16 +5017,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/fr.po b/editor/translations/fr.po index 0e71b3ea89..95af6d8a20 100644 --- a/editor/translations/fr.po +++ b/editor/translations/fr.po @@ -2634,14 +2634,14 @@ msgstr "" "Impossible de charger le script de l’extension depuis le chemin : « %s »." #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" -"Impossible de charger le script de l’extension depuis le chemin : « %s ». Il " -"semble y avoir une erreur dans le code, merci de vérifier la syntaxe." +"Impossible de charger le script de l’extension depuis le chemin : « %s ». " +"Cela peut être dû à une erreur de programmation dans ce script.\n" +"L'extension « %s » a été désactivée pour prévenir de nouvelles erreures." #: editor/editor_node.cpp msgid "" @@ -3092,6 +3092,10 @@ msgid "About" msgstr "À propos" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "Soutenir le développement de Godot" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Lancer le projet." @@ -3198,7 +3202,7 @@ msgstr "" "personnalisé à l'exportation (ajout de modules, modification du fichier " "AndroidManifest.xml, etc.).\n" "Notez que pour faire des compilations personnalisées au lieu d'utiliser des " -"APKs pré-construits, l'option \"Use Custom Build\" doit être activée dans le " +"APKs préconstruits, l'option \"Use Custom Build\" doit être activée dans le " "Preset d'exportation Android." #: editor/editor_node.cpp @@ -5338,20 +5342,10 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -#, fuzzy -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "L'éditeur Godot a été compilé sans support du ray tracing, les lightmaps ne " -"peuvent pas être pré-calculées." +"peuvent pas être précalculées." #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Bake Lightmaps" @@ -5359,7 +5353,7 @@ msgstr "Précalculer les lightmaps" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Select lightmap bake file:" -msgstr "Sélectionnez le fichier de pré-calcul de lightmap :" +msgstr "Sélectionnez le fichier de précalcul de lightmap :" #: editor/plugins/camera_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -11809,7 +11803,7 @@ msgstr "" #: modules/lightmapper_cpu/lightmapper_cpu.cpp msgid "Begin Bake" -msgstr "Commencer le pré-calcul" +msgstr "Commencer le précalcul" #: modules/lightmapper_cpu/lightmapper_cpu.cpp msgid "Preparing data structures" diff --git a/editor/translations/ga.po b/editor/translations/ga.po index 134331d7bf..cbecefd928 100644 --- a/editor/translations/ga.po +++ b/editor/translations/ga.po @@ -2445,7 +2445,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2851,6 +2851,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5010,16 +5014,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/gl.po b/editor/translations/gl.po index 816b4234fa..0e30715772 100644 --- a/editor/translations/gl.po +++ b/editor/translations/gl.po @@ -2544,7 +2544,7 @@ msgstr "" #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Non se puido cargar Script de característica adicional (Addon) na ruta: " @@ -2993,6 +2993,10 @@ msgid "About" msgstr "Acerca De" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Reproduce o proxecto." @@ -5181,16 +5185,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/he.po b/editor/translations/he.po index 831c34978c..bb16512835 100644 --- a/editor/translations/he.po +++ b/editor/translations/he.po @@ -2544,7 +2544,7 @@ msgstr "לא ניתן לטעון סקריפט הרחבה מנתיב: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "לא ניתן לטעון סקריפט הרחבה מנתיב: '%s' נראה שיש שגיאה בקוד, אנא בדוק את " @@ -2980,6 +2980,10 @@ msgid "About" msgstr "על אודות" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "הרצת המיזם." @@ -5230,16 +5234,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/hi.po b/editor/translations/hi.po index d10b2e81c0..cf1ab6d57a 100644 --- a/editor/translations/hi.po +++ b/editor/translations/hi.po @@ -2522,7 +2522,7 @@ msgstr "पथ से ऐडऑन स्क्रिप्ट लोड कर #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "रास्ते से ऐडऑन स्क्रिप्ट लोड करने में असमर्थ: '% एस' कोड में गड़बड़ी लगती है, कृपया सिंटेक्स की " @@ -2961,6 +2961,10 @@ msgid "About" msgstr "के बारे में" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "प्रोजेक्ट चलाएं।" @@ -5152,16 +5156,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/hr.po b/editor/translations/hr.po index 7fec3f22ac..a78a4f01c3 100644 --- a/editor/translations/hr.po +++ b/editor/translations/hr.po @@ -2457,7 +2457,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2863,6 +2863,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5024,16 +5028,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/hu.po b/editor/translations/hu.po index ff223c33d3..76aaf2da96 100644 --- a/editor/translations/hu.po +++ b/editor/translations/hu.po @@ -2564,7 +2564,7 @@ msgstr "Nem sikerült az addon szkript betöltése a következő útvonalról: ' #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Nem lehet betölteni az addon szkriptet a(z) '%s' útvonalról. Úgy tűnik, hiba " @@ -3009,6 +3009,10 @@ msgid "About" msgstr "Névjegy" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Projekt futtatása." @@ -5203,16 +5207,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/id.po b/editor/translations/id.po index a53c0a385a..13ce1dba23 100644 --- a/editor/translations/id.po +++ b/editor/translations/id.po @@ -2564,7 +2564,7 @@ msgstr "Tidak bisa memuat script addon dari lokasi: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Tidak dapat memuat script addon dari path: '%s' Mungkin ada kesalahan dalam " @@ -3011,6 +3011,10 @@ msgid "About" msgstr "Tentang" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Mainkan proyek." @@ -5231,18 +5235,9 @@ msgstr "" "persegi [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Editor Godot di-build tanpa dukungan ray tracing, sehingga lightmaps tidak " "dapat di-bake." diff --git a/editor/translations/is.po b/editor/translations/is.po index 92b71ba410..693a6f9397 100644 --- a/editor/translations/is.po +++ b/editor/translations/is.po @@ -2482,7 +2482,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2891,6 +2891,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5066,16 +5070,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/it.po b/editor/translations/it.po index c98565ba1b..e087489c94 100644 --- a/editor/translations/it.po +++ b/editor/translations/it.po @@ -2609,7 +2609,7 @@ msgstr "" #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Impossibile caricare uno script aggiuntivo dal percorso: \"%s\" Sembra " @@ -3060,6 +3060,10 @@ msgid "About" msgstr "Informazioni su Godot" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Esegui il progetto." @@ -5301,18 +5305,9 @@ msgstr "" "all'interno nella regione [0.0,1.0] quadra." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot Editor è stato costruito senza il supporto per il ray tracing, quindi " "il baking delle lightmaps non è possibile." diff --git a/editor/translations/ja.po b/editor/translations/ja.po index 138cee8cb3..3e03c04b72 100644 --- a/editor/translations/ja.po +++ b/editor/translations/ja.po @@ -2565,7 +2565,7 @@ msgstr "パス '%s' からアドオンスクリプトを読込めません。" #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "パス '%s' からアドオンスクリプトを読み込めません。コードにエラーがある可能性" @@ -3013,6 +3013,10 @@ msgid "About" msgstr "概要" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "プロジェクトを実行。" @@ -5239,18 +5243,9 @@ msgstr "" "ことを確認してください。" #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godotエディタがレイトレーシングに対応せずにビルドされており、ライトマップのベ" "イクができません。" diff --git a/editor/translations/ka.po b/editor/translations/ka.po index a2972e9c1e..fd1f34ae59 100644 --- a/editor/translations/ka.po +++ b/editor/translations/ka.po @@ -2562,7 +2562,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2975,6 +2975,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5192,16 +5196,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/km.po b/editor/translations/km.po index 25785c2415..3d0c4b2f9d 100644 --- a/editor/translations/km.po +++ b/editor/translations/km.po @@ -2441,7 +2441,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2847,6 +2847,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5001,16 +5005,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ko.po b/editor/translations/ko.po index 287df00aab..604479435e 100644 --- a/editor/translations/ko.po +++ b/editor/translations/ko.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-05-03 06:13+0000\n" +"PO-Revision-Date: 2021-05-18 10:00+0000\n" "Last-Translator: Myeongjin Lee <aranet100@gmail.com>\n" "Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/" "godot/ko/>\n" @@ -2544,14 +2544,14 @@ msgid "Unable to load addon script from path: '%s'." msgstr "다음 경로에서 애드온 스크립트를 불러올 수 없음: '%s'." #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" -"다음 경로에서 애드온 스크립트를 불러올 수 없음: '%s' 코드에 오류가 있는 것 같" -"습니다. 문법을 확인해보세요." +"다음 경로에서 애드온 스크립트를 불러올 수 없음: '%s' 해당 스크립트의 코드에 " +"오류가 있는 것 같습니다.\n" +"추가 오류를 방지하려면 '%s'에서 애드온을 비활성화하세요." #: editor/editor_node.cpp msgid "" @@ -2991,6 +2991,10 @@ msgid "About" msgstr "정보" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "프로젝트를 실행합니다." @@ -5203,21 +5207,12 @@ msgstr "" "어 있는지 확인해주세요." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" -"Godot 편집기가 레이 트레이싱 지원 없이 빌드되어 있어, 라이트맵이 구워질 수 없" -"습니다." +"Godot 편집기는 레이 트레이싱 지원 없이 빌드되었으며 라이트맵은 구울 수 없습니" +"다." #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Bake Lightmaps" @@ -13057,6 +13052,19 @@ msgid "Constants cannot be modified." msgstr "상수는 수정할 수 없습니다." #~ msgid "" +#~ "Godot editor was built without ray tracing support; lightmaps can't be " +#~ "baked.\n" +#~ "If you are using an Apple Silicon-based Mac, try forcing Rosetta " +#~ "emulation on Godot.app in the application settings\n" +#~ "then restart the editor." +#~ msgstr "" +#~ "Godot 편집기는 레이 트레이싱 지원 없이 빌드되었으며 라이트맵은 구울 수 없" +#~ "습니다.\n" +#~ "Apple Silicon 기반의 Mac을 사용 중인 경우, 애플리케이션 설정에서 Godot.app" +#~ "의 Rosetta 에뮬레이션 강제로\n" +#~ "시도하고 나서 편집기를 다시 시작하세요." + +#~ msgid "" #~ "InterpolatedCamera has been deprecated and will be removed in Godot 4.0." #~ msgstr "" #~ "InterpolatedCamera는 더 이상 사용되지 않으며 Godot 4.0에서 제거됩니다." diff --git a/editor/translations/lt.po b/editor/translations/lt.po index 6fdb5257d3..6dad903aac 100644 --- a/editor/translations/lt.po +++ b/editor/translations/lt.po @@ -2514,7 +2514,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2927,6 +2927,10 @@ msgid "About" msgstr "Apie" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5160,16 +5164,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/lv.po b/editor/translations/lv.po index 832a099a1c..3333b65210 100644 --- a/editor/translations/lv.po +++ b/editor/translations/lv.po @@ -2487,7 +2487,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2893,6 +2893,10 @@ msgid "About" msgstr "Par" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5053,16 +5057,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/mi.po b/editor/translations/mi.po index f3726999ff..780599c2da 100644 --- a/editor/translations/mi.po +++ b/editor/translations/mi.po @@ -2433,7 +2433,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2839,6 +2839,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -4993,16 +4997,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/mk.po b/editor/translations/mk.po index 1c2910404c..01dbc3ed02 100644 --- a/editor/translations/mk.po +++ b/editor/translations/mk.po @@ -2440,7 +2440,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2846,6 +2846,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5000,16 +5004,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ml.po b/editor/translations/ml.po index ca6259e4d2..b03638aded 100644 --- a/editor/translations/ml.po +++ b/editor/translations/ml.po @@ -2445,7 +2445,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2851,6 +2851,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5008,16 +5012,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/mr.po b/editor/translations/mr.po index 1f44ad0b6a..d7a76e3f10 100644 --- a/editor/translations/mr.po +++ b/editor/translations/mr.po @@ -2440,7 +2440,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2846,6 +2846,10 @@ msgid "About" msgstr "आमच्या बद्दल" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5000,16 +5004,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ms.po b/editor/translations/ms.po index d2cc1c47d9..3798405050 100644 --- a/editor/translations/ms.po +++ b/editor/translations/ms.po @@ -2552,7 +2552,7 @@ msgstr "Tidak dapat memuatkan skrip addon dari laluan: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Tidak dapat memuat skrip addon dari laluan: '%s' Nampaknya terdapat ralat " @@ -3030,6 +3030,10 @@ msgid "About" msgstr "Tentang" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp #, fuzzy msgid "Play the project." msgstr "Main projek." @@ -5345,16 +5349,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/nb.po b/editor/translations/nb.po index b0d147350a..39f45f5ae5 100644 --- a/editor/translations/nb.po +++ b/editor/translations/nb.po @@ -2641,7 +2641,7 @@ msgstr "Kan ikke laste addon-skript fra bane: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Kunne ikke laste tillegsskript fra sti: '%s' Script er ikke i verktøymodus." @@ -3103,6 +3103,10 @@ msgid "About" msgstr "Om" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Spill prosjektet." @@ -5445,16 +5449,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/nl.po b/editor/translations/nl.po index d28d0fbb55..32b3ff9117 100644 --- a/editor/translations/nl.po +++ b/editor/translations/nl.po @@ -2590,7 +2590,7 @@ msgstr "Volgend script kon niet geladen worden: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Script kon niet geladen worden van het pad: '%s'. Er lijkt een fout in de " @@ -3039,6 +3039,10 @@ msgid "About" msgstr "Over" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Speel het project." @@ -5274,16 +5278,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/or.po b/editor/translations/or.po index 7dfd981fba..8e40eb4b04 100644 --- a/editor/translations/or.po +++ b/editor/translations/or.po @@ -2439,7 +2439,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2845,6 +2845,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -4999,16 +5003,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/pl.po b/editor/translations/pl.po index 2ed4d52cc0..483d572041 100644 --- a/editor/translations/pl.po +++ b/editor/translations/pl.po @@ -2575,7 +2575,7 @@ msgstr "Nie można załadować skryptu dodatku z ścieżki: \"%s\"." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Nie można załadować skryptu dodatku ze ścieżki: \"%s\" W kodzie znajduje się " @@ -3022,6 +3022,10 @@ msgid "About" msgstr "O silniku" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Uruchom projekt." @@ -5253,18 +5257,9 @@ msgstr "" "mieszczą się w kwadratowym obszarze [0.0, 1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot został zbudowany bez wsparcia ray tracingu, mapy światła nie mogą być " "wypalone." diff --git a/editor/translations/pr.po b/editor/translations/pr.po index a59c7226f2..a0a9719128 100644 --- a/editor/translations/pr.po +++ b/editor/translations/pr.po @@ -2520,7 +2520,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2937,6 +2937,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5169,16 +5173,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/pt.po b/editor/translations/pt.po index 21fe589473..99f9934e1c 100644 --- a/editor/translations/pt.po +++ b/editor/translations/pt.po @@ -2553,7 +2553,7 @@ msgstr "Incapaz de carregar script addon do caminho: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Incapaz de carregar script addon do caminho: '%s' Parece haver um erro no " @@ -3002,6 +3002,10 @@ msgid "About" msgstr "Sobre" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Executa o projeto." @@ -5231,18 +5235,9 @@ msgstr "" "contidos na região quadrada [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Editor Godot foi compilado sem suporte para ray tracing, lightmaps não podem " "ser consolidados." diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po index 9f9138e20a..25cdec4f49 100644 --- a/editor/translations/pt_BR.po +++ b/editor/translations/pt_BR.po @@ -2653,7 +2653,7 @@ msgstr "" #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Não foi possível localizar a área do script para o complemento do plugin em: " @@ -3102,6 +3102,10 @@ msgid "About" msgstr "Sobre" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Roda o projeto." @@ -5341,18 +5345,9 @@ msgstr "" "contidos na região quadrada [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "O editor Godot foi construído sem suporte à ray tracing, os lightmaps não " "podem ser bakeados." diff --git a/editor/translations/ro.po b/editor/translations/ro.po index fdf99eda10..d2ecad4c74 100644 --- a/editor/translations/ro.po +++ b/editor/translations/ro.po @@ -2560,7 +2560,7 @@ msgstr "Nu a putut fi încărcat scriptul add-on din calea: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Imposibil de încărcat scriptul addon din cale: '%s' Se pare că există o " @@ -3011,6 +3011,10 @@ msgid "About" msgstr "Despre" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Rulează proiectul." @@ -5240,16 +5244,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ru.po b/editor/translations/ru.po index a0f20328ee..dfda002c17 100644 --- a/editor/translations/ru.po +++ b/editor/translations/ru.po @@ -2628,7 +2628,7 @@ msgstr "Не удалось загрузить скрипт из источни #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Невозможно загрузить скрипт аддона из источника: «%s». В коде есть ошибка, " @@ -3075,6 +3075,10 @@ msgid "About" msgstr "О Godot Engine" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Запустить проект." @@ -5304,18 +5308,9 @@ msgstr "" "находятся в квадратной области [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Редактор Godot был собран без поддержки трассировки лучей, карты освещения " "невозможно запечь." diff --git a/editor/translations/si.po b/editor/translations/si.po index f3d3a7039f..7bc9066904 100644 --- a/editor/translations/si.po +++ b/editor/translations/si.po @@ -2465,7 +2465,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2871,6 +2871,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5039,16 +5043,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sk.po b/editor/translations/sk.po index af44e0eac1..3bb1bce542 100644 --- a/editor/translations/sk.po +++ b/editor/translations/sk.po @@ -2534,7 +2534,7 @@ msgstr "Nepodarilo sa načítať addon script z cesty: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Nepodarilo sa nájsť addon script z cesty: '%s' Vyzerá to tak že by mohol byť " @@ -2980,6 +2980,10 @@ msgid "About" msgstr "O nás" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Spustiť projekt." @@ -5200,16 +5204,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sl.po b/editor/translations/sl.po index 8e005a05db..fd38959e1d 100644 --- a/editor/translations/sl.po +++ b/editor/translations/sl.po @@ -2647,7 +2647,7 @@ msgstr "Ni mogoče naložiti dodatno skripto iz poti: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Ni mogoče naložiti dodatno skripto iz poti: '%s' Skripta ni v načinu orodje." @@ -3114,6 +3114,10 @@ msgid "About" msgstr "O Programu" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Zaženi projekt." @@ -5438,16 +5442,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sq.po b/editor/translations/sq.po index f95143dfce..abf3243545 100644 --- a/editor/translations/sq.po +++ b/editor/translations/sq.po @@ -2589,7 +2589,7 @@ msgstr "I paaftë të ngarkojë shkrimin e shtojcës nga rruga: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "I paaftë të ngarkojë shkrimin e shtojcës nga rruga: '%s' Me sa duket është " @@ -3052,6 +3052,10 @@ msgid "About" msgstr "Rreth" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Luaj projektin." @@ -5288,16 +5292,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po index bc417703cc..6518f9b2bd 100644 --- a/editor/translations/sr_Cyrl.po +++ b/editor/translations/sr_Cyrl.po @@ -2764,7 +2764,7 @@ msgstr "Неуспех при учитавању скриптице додатк #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Неуспех при учитавању скриптице додатка са путем „%s“. Скриптица није у " @@ -3242,6 +3242,10 @@ msgid "About" msgstr "О" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Покрени пројекат." @@ -5703,16 +5707,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po index 5f0a7bb237..b646003e1a 100644 --- a/editor/translations/sr_Latn.po +++ b/editor/translations/sr_Latn.po @@ -2478,7 +2478,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2886,6 +2886,10 @@ msgid "About" msgstr "O nama / O Godou" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5063,16 +5067,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/sv.po b/editor/translations/sv.po index cf330e6223..7253693a74 100644 --- a/editor/translations/sv.po +++ b/editor/translations/sv.po @@ -2600,7 +2600,7 @@ msgstr "Kunde inte ladda addon script från sökväg: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Kunde inte ladda addon script från sökväg: '%s' Skript är inte i " @@ -3036,6 +3036,10 @@ msgid "About" msgstr "Om" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Spela projektet." @@ -5298,16 +5302,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/ta.po b/editor/translations/ta.po index 375dbacff3..9107c43f7c 100644 --- a/editor/translations/ta.po +++ b/editor/translations/ta.po @@ -2469,7 +2469,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2877,6 +2877,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5048,16 +5052,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/te.po b/editor/translations/te.po index 41850d2d56..c983fbe90e 100644 --- a/editor/translations/te.po +++ b/editor/translations/te.po @@ -2442,7 +2442,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2848,6 +2848,10 @@ msgid "About" msgstr "గురించి" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5002,16 +5006,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/th.po b/editor/translations/th.po index 38ef19e80c..24b007b891 100644 --- a/editor/translations/th.po +++ b/editor/translations/th.po @@ -2517,7 +2517,7 @@ msgstr "ไม่สามารถโหลดสคริปต์จาก: ' #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "ไม่สามารถโหลดสคริปต์ส่วนเสริมจาก: '%s' เหมือนว่าจะเกิดข้อผิดพลาดขึ้นในโค้ด " @@ -2951,6 +2951,10 @@ msgid "About" msgstr "เกี่ยวกับ" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "เล่นโปรเจกต์" @@ -5141,18 +5145,9 @@ msgid "" msgstr "mesh บางส่วนไม่ถูกต้อง ตรวจสอบให้แน่ใจว่าค่า UV2 อยู่ในพื้นที่สี่เหลี่ยม [0.0,1.0]" #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "ตัวแก้ไข Godot ถูกสร้างโดยไม่ได้สนับสนุน Ray Tracing ดังนั้นจึงไม่สามารถปั้น Lightmap ได้" diff --git a/editor/translations/tr.po b/editor/translations/tr.po index e49efb20b5..43c8aa9e52 100644 --- a/editor/translations/tr.po +++ b/editor/translations/tr.po @@ -2591,7 +2591,7 @@ msgstr "Yoldaki eklenti betiği yüklenemedi: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "'%s' adresindeki eklenti betik yüklenemiyor. Kodun içinde bir hata var gibi " @@ -3038,6 +3038,10 @@ msgid "About" msgstr "Hakkında" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Projeti oynat." @@ -5269,18 +5273,9 @@ msgstr "" "içerdiğinden emin olun." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot editör ışın yansıma desteği olmadan derlenmiş, ışık haritaları " "pişirilemez." diff --git a/editor/translations/tzm.po b/editor/translations/tzm.po index 7980101d8a..a28dce76f9 100644 --- a/editor/translations/tzm.po +++ b/editor/translations/tzm.po @@ -2440,7 +2440,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2846,6 +2846,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5000,16 +5004,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/uk.po b/editor/translations/uk.po index 576ebc4433..251c85a8ba 100644 --- a/editor/translations/uk.po +++ b/editor/translations/uk.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: Ukrainian (Godot Engine)\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-04-22 14:40+0000\n" +"PO-Revision-Date: 2021-05-14 20:34+0000\n" "Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n" "Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/" "godot/uk/>\n" @@ -2556,14 +2556,14 @@ msgid "Unable to load addon script from path: '%s'." msgstr "Неможливо завантажити доповнення скрипт зі шляху: '%s'." #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" -"Неможливо завантажити скрипт доповнення з шляху «%s». Здається, у коді є " -"помилка, будь ласка, перевірте синтаксис." +"Не вдалося завантажити додатковий скрипт з такою адресою: «%s». Причиною " +"може бути помилка у коді цього скрипту.\n" +"Вимикаємо додаток у «%s», щоб запобігти подальшим помилкам." #: editor/editor_node.cpp msgid "" @@ -3010,6 +3010,10 @@ msgid "About" msgstr "Про" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Запустити проєкт." @@ -5247,18 +5251,9 @@ msgstr "" "потрапляють до квадратної області [0.0,1.0]." #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Редактор Godot було зібрано без підтримки трасування променів. Карти " "освітлення не вдасться побудувати." @@ -13235,6 +13230,19 @@ msgid "Constants cannot be modified." msgstr "Сталі не можна змінювати." #~ msgid "" +#~ "Godot editor was built without ray tracing support; lightmaps can't be " +#~ "baked.\n" +#~ "If you are using an Apple Silicon-based Mac, try forcing Rosetta " +#~ "emulation on Godot.app in the application settings\n" +#~ "then restart the editor." +#~ msgstr "" +#~ "Редактор Godot було зібрано без підтримки трасування променів; мапи " +#~ "освітлення створити не вдасться.\n" +#~ "Якщо ви користуєтеся Mac на основі Apple Silicon, спробуйте примусово " +#~ "встановити емуляцію Rosetta для Godot.app у параметрах програми,\n" +#~ "а потім перезапустіть редактор." + +#~ msgid "" #~ "InterpolatedCamera has been deprecated and will be removed in Godot 4.0." #~ msgstr "" #~ "InterpolatedCamera вважається застарілою, її буде вилучено у Godot 4.0." diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po index d71c823f96..32a88830cb 100644 --- a/editor/translations/ur_PK.po +++ b/editor/translations/ur_PK.po @@ -2490,7 +2490,7 @@ msgstr "" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -2900,6 +2900,10 @@ msgid "About" msgstr "" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "" @@ -5106,16 +5110,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/vi.po b/editor/translations/vi.po index b1a6984df9..3939ac7a4d 100644 --- a/editor/translations/vi.po +++ b/editor/translations/vi.po @@ -2535,7 +2535,7 @@ msgstr "Không thể tải tệp addon từ đường dẫn: '%s'." #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" "Không thể nạp tệp lệnh bổ trợ từ đường dẫn: '%s' Có vẻ có lỗi trong mã, hãy " @@ -2971,6 +2971,10 @@ msgid "About" msgstr "Về chúng tôi" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "Chạy dự án." @@ -5172,16 +5176,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po index 57d34e4b6f..3b528525e1 100644 --- a/editor/translations/zh_CN.po +++ b/editor/translations/zh_CN.po @@ -82,8 +82,8 @@ msgid "" msgstr "" "Project-Id-Version: Chinese (Simplified) (Godot Engine)\n" "POT-Creation-Date: 2018-01-20 12:15+0200\n" -"PO-Revision-Date: 2021-04-26 22:32+0000\n" -"Last-Translator: qjyqjyqjyqjy <qjyqjyqjyqjy@sina.com.cn>\n" +"PO-Revision-Date: 2021-05-16 03:32+0000\n" +"Last-Translator: Haoyu Qiu <timothyqiu32@gmail.com>\n" "Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/" "godot-engine/godot/zh_Hans/>\n" "Language: zh_CN\n" @@ -2564,12 +2564,13 @@ msgid "Unable to load addon script from path: '%s'." msgstr "无法从路径 “%s” 中加载加载项脚本。" #: editor/editor_node.cpp -#, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." -msgstr "无法从路径 “%s” 加载加载项脚本:脚本似乎有代码错误,请检查其语法。" +msgstr "" +"无法从路径“%s”加载加载项脚本:该脚本可能有代码错误。\n" +"禁用加载项“%s”可阻止其进一步报错。" #: editor/editor_node.cpp msgid "" @@ -2995,6 +2996,10 @@ msgid "About" msgstr "关于" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "运行此项目。" @@ -5184,19 +5189,10 @@ msgid "" msgstr "某些网格无效。确保UV2通道值包含在[0.0,1.0]平方区域内。" #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." -msgstr "Godot编辑器是在没有光线跟踪支持的情况下构建的,光照贴图无法烘焙。" +"Godot editor was built without ray tracing support, lightmaps can't be baked." +msgstr "Godot 编辑器是在没有光线跟踪支持的情况下构建的;无法烘焙光照贴图。" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Bake Lightmaps" @@ -12935,6 +12931,18 @@ msgid "Constants cannot be modified." msgstr "不允许修改常量。" #~ msgid "" +#~ "Godot editor was built without ray tracing support; lightmaps can't be " +#~ "baked.\n" +#~ "If you are using an Apple Silicon-based Mac, try forcing Rosetta " +#~ "emulation on Godot.app in the application settings\n" +#~ "then restart the editor." +#~ msgstr "" +#~ "Godot 编辑器是在没有光线跟踪支持的情况下构建的;无法烘焙光照贴图。\n" +#~ "如果你使用的是基于 Apple Silicon 的 Mac,可以尝试在应用设置中让 Godot.app " +#~ "强制使用 Rosetta 模拟\n" +#~ "并重启编辑器。" + +#~ msgid "" #~ "InterpolatedCamera has been deprecated and will be removed in Godot 4.0." #~ msgstr "InterpolatedCamera 已废弃,将在 Godot 4.0 中删除。" diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po index 7f181fe4be..2350817f1f 100644 --- a/editor/translations/zh_HK.po +++ b/editor/translations/zh_HK.po @@ -2610,7 +2610,7 @@ msgstr "載入字形出現錯誤" #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "" @@ -3059,6 +3059,10 @@ msgid "About" msgstr "關於" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "運行專案" @@ -5395,16 +5399,7 @@ msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" #: editor/plugins/baked_lightmap_editor_plugin.cpp diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po index f5f0feb333..a24b8831d2 100644 --- a/editor/translations/zh_TW.po +++ b/editor/translations/zh_TW.po @@ -2516,7 +2516,7 @@ msgstr "無法自路徑「%s」載入擴充腳本。" #, fuzzy msgid "" "Unable to load addon script from path: '%s'. This might be due to a code " -"error in that script. \n" +"error in that script.\n" "Disabling the addon at '%s' to prevent further errors." msgstr "無法自路徑「%s」載入擴充腳本。可能為程式碼中有錯誤,請檢查語法。" @@ -2944,6 +2944,10 @@ msgid "About" msgstr "關於" #: editor/editor_node.cpp +msgid "Support Godot Development" +msgstr "" + +#: editor/editor_node.cpp msgid "Play the project." msgstr "執行該專案。" @@ -5133,18 +5137,9 @@ msgid "" msgstr "部分網格無效。請確保 UV2 通道的值位於 [0.0,1.0] 矩形內。" #: editor/plugins/baked_lightmap_editor_plugin.cpp -msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be " -"baked.\n" -"If you are using an Apple Silicon-based Mac, try forcing Rosetta emulation " -"on Godot.app in the application settings\n" -"then restart the editor." -msgstr "" - -#: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "" -"Godot editor was built without ray tracing support; lightmaps can't be baked." +"Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" "Godot 編輯器在建制時未啟用光線追蹤 (Ray Tracing) 支援,無法烘焙光照圖。" |