diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_file_system.cpp | 8 | ||||
-rw-r--r-- | editor/editor_node.cpp | 22 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 14 | ||||
-rw-r--r-- | editor/icons/Texture3D.svg | 2 | ||||
-rw-r--r-- | editor/icons/TextureArray.svg | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 21 |
9 files changed, 52 insertions, 27 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 43f0c9e2bb..a8a7262cf0 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1586,7 +1586,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector f->store_line("importer=\"" + importer->get_importer_name() + "\""); int version = importer->get_format_version(); if (version > 0) { - f->store_line("importer_version=" + itos(importer->get_format_version())); + f->store_line("importer_version=" + itos(version)); } if (importer->get_resource_type() != "") { f->store_line("type=\"" + importer->get_resource_type() + "\""); @@ -1725,7 +1725,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) { importer = ResourceFormatImporter::get_singleton()->get_importer_by_extension(p_file.get_extension()); load_default = true; if (importer.is_null()) { - ERR_PRINT("BUG: File queued for import, but can't be imported!"); + ERR_PRINT("BUG: File queued for import, but can't be imported, importer for type '" + importer_name + "' not found."); ERR_FAIL(); } } @@ -1772,6 +1772,10 @@ void EditorFileSystem::_reimport_file(const String &p_file) { f->store_line("[remap]"); f->store_line(""); f->store_line("importer=\"" + importer->get_importer_name() + "\""); + int version = importer->get_format_version(); + if (version > 0) { + f->store_line("importer_version=" + itos(version)); + } if (importer->get_resource_type() != "") { f->store_line("type=\"" + importer->get_resource_type() + "\""); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index fd02d3a8bb..64b5f50b91 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2743,16 +2743,13 @@ void EditorNode::_tool_menu_option(int p_idx) { } break; case TOOLS_CUSTOM: { if (tool_menu->get_item_submenu(p_idx) == "") { - Array params = tool_menu->get_item_metadata(p_idx); - - Object *handler = ObjectDB::get_instance(params[0]); - String callback = params[1]; - Variant *ud = ¶ms[2]; + Callable callback = tool_menu->get_item_metadata(p_idx); Callable::CallError ce; + Variant result; + callback.call(nullptr, 0, result, ce); - handler->call(callback, (const Variant **)&ud, 1, ce); if (ce.error != Callable::CallError::CALL_OK) { - String err = Variant::get_call_error_text(handler, callback, (const Variant **)&ud, 1, ce); + String err = Variant::get_callable_error_text(callback, nullptr, 0, ce); ERR_PRINT("Error calling function from tool menu: " + err); } } // else it's a submenu so don't do anything. @@ -5086,17 +5083,10 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Control * return drag_data; } -void EditorNode::add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud) { - ERR_FAIL_NULL(p_handler); +void EditorNode::add_tool_menu_item(const String &p_name, const Callable &p_callback) { int idx = tool_menu->get_item_count(); tool_menu->add_item(p_name, TOOLS_CUSTOM); - - Array parameters; - parameters.push_back(p_handler->get_instance_id()); - parameters.push_back(p_callback); - parameters.push_back(p_ud); - - tool_menu->set_item_metadata(idx, parameters); + tool_menu->set_item_metadata(idx, p_callback); } void EditorNode::add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu) { diff --git a/editor/editor_node.h b/editor/editor_node.h index 7eec2f265f..ab8d268801 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -830,7 +830,7 @@ public: Variant drag_resource(const Ref<Resource> &p_res, Control *p_from); Variant drag_files_and_dirs(const Vector<String> &p_paths, Control *p_from); - void add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud = Variant()); + void add_tool_menu_item(const String &p_name, const Callable &p_callback); void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu); void remove_tool_menu_item(const String &p_name); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 49d8e58955..f974ba9998 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -489,8 +489,8 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati } } -void EditorPlugin::add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud) { - EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud); +void EditorPlugin::add_tool_menu_item(const String &p_name, const Callable &p_callable) { + EditorNode::get_singleton()->add_tool_menu_item(p_name, p_callable); } void EditorPlugin::add_tool_submenu_item(const String &p_name, Object *p_submenu) { @@ -826,7 +826,7 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks); ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel); ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container); - ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"), &EditorPlugin::add_tool_menu_item, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "callable"), &EditorPlugin::add_tool_menu_item); ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item); ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"), &EditorPlugin::remove_tool_menu_item); ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script", "icon"), &EditorPlugin::add_custom_type); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 11063066d6..03908b43ca 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -174,7 +174,7 @@ public: void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); - void add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud = Variant()); + void add_tool_menu_item(const String &p_name, const Callable &p_callable); void add_tool_submenu_item(const String &p_name, Object *p_submenu); void remove_tool_menu_item(const String &p_name); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 8c82eca452..076b873eac 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -779,7 +779,19 @@ void FindInFilesPanel::_on_item_edited() { } void FindInFilesPanel::_on_finished() { - _status_label->set_text(TTR("Search complete")); + String results_text; + int result_count = _result_items.size(); + int file_count = _file_items.size(); + + if (result_count == 1 && file_count == 1) { + results_text = vformat(TTR("%d match in %d file."), result_count, file_count); + } else if (result_count != 1 && file_count == 1) { + results_text = vformat(TTR("%d matches in %d file."), result_count, file_count); + } else { + results_text = vformat(TTR("%d matches in %d files."), result_count, file_count); + } + + _status_label->set_text(results_text); update_replace_buttons(); set_progress_visible(false); _refresh_button->show(); diff --git a/editor/icons/Texture3D.svg b/editor/icons/Texture3D.svg index 6bdc599f6d..795dd62ba5 100644 --- a/editor/icons/Texture3D.svg +++ b/editor/icons/Texture3D.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m2 1c-.5522847 0-1 .4477153-1 1v12c0 .552285.4477153 1 1 1h12c.552285 0 1-.447715 1-1v-12c0-.5522847-.447715-1-1-1zm1 2h10v8h-10z" fill-opacity=".99608" transform="translate(.359546 -.287637)"/><g fill-opacity=".996078" stroke-width=".203212" transform="scale(.9167105 1.0908569)"><path d="m5.8175194 8.9717502q-.2194689 0-.4633233-.032514-.2438544-.0243854-.4714519-.0731562-.2275974-.0487709-.4145524-.1056703-.1869551-.0568993-.2926253-.1056702l.2357259-1.0079315q.2113405.089413.5364797.1950835.3332677.097542.8209765.097542.5608651 0 .8209764-.2113404.2601114-.2113405.2601114-.5689936 0-.219469-.097542-.3657816-.089413-.1544415-.2519826-.2438547-.1625696-.0975418-.3901671-.1300557-.2194689-.0406424-.4714518-.0406424h-.4714519v-.9754176h.5364797q.1788266 0 .3413962-.032514.1706981-.032514.3007537-.1056703.1300557-.081285.203212-.2113404.081285-.1381842.081285-.3413962 0-.1544411-.065028-.2682398-.0650278-.1137987-.1706981-.186955-.0975417-.0731563-.2357259-.1056702-.1300557-.0406424-.2682398-.0406424-.3495247 0-.6502784.1056702-.2926253.1056703-.5364797.2601114l-.4308095-.8860043q.1300557-.0812848.3007538-.1706981.1788266-.0894133.390167-.1625696.2113405-.0731563.4470664-.1219272.2438544-.048771.5120943-.048771.4958373 0 .8534904.1219272.3657816.1137987.6015075.3332677.2357259.2113405.3495246.5039657.1137987.2844968.1137987.625893 0 .3332677-.186955.6502784-.186955.3088822-.5039657.4714518.4389379.1788266.6746638.5364797.2438544.3495246.2438544.8453619 0 .3901671-.1300557.7234347-.1300557.3251393-.406424.5689937-.2763683.235726-.7071777.3739101-.422681.1300557-1.0079316.1300557z"/><path d="m10.502445 7.817506q.08941.00813.203212.016257.121927 0 .284497 0 .951032 0 1.406227-.4795803.463323-.4795803.463323-1.3249422 0-.8860044-.438938-1.3411992-.438938-.4551949-1.38997-.4551949-.130055 0-.26824.00813-.138184 0-.260111.016257zm3.665945-1.7882655q0 .7315631-.227598 1.2761713-.227597.5446082-.650278.9022613-.414553.3576531-1.01606.5364797-.601508.1788265-1.349328.1788265-.341396 0-.796591-.032514-.4551948-.0243853-.8941328-.1137986v-5.486724q.438938-.081285.9103898-.1056702.47958-.032514.820976-.032514.723435 0 1.308686.1625696.593379.1625696 1.01606.5120943.422681.3495246.650278.8941328.227598.5446081.227598 1.3086853z"/></g></g></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" transform="translate(-.359546 .287637)"><path d="m2 1c-.5522847 0-1 .4477153-1 1v12c0 .552285.4477153 1 1 1h12c.552285 0 1-.447715 1-1v-12c0-.5522847-.447715-1-1-1zm1 2h10v8h-10z" fill-opacity=".99608" transform="translate(.359546 -.287637)"/><g fill-opacity=".996078" stroke-width=".203212" transform="scale(.9167105 1.0908569)"><path d="m5.8175194 8.9717502q-.2194689 0-.4633233-.032514-.2438544-.0243854-.4714519-.0731562-.2275974-.0487709-.4145524-.1056703-.1869551-.0568993-.2926253-.1056702l.2357259-1.0079315q.2113405.089413.5364797.1950835.3332677.097542.8209765.097542.5608651 0 .8209764-.2113404.2601114-.2113405.2601114-.5689936 0-.219469-.097542-.3657816-.089413-.1544415-.2519826-.2438547-.1625696-.0975418-.3901671-.1300557-.2194689-.0406424-.4714518-.0406424h-.4714519v-.9754176h.5364797q.1788266 0 .3413962-.032514.1706981-.032514.3007537-.1056703.1300557-.081285.203212-.2113404.081285-.1381842.081285-.3413962 0-.1544411-.065028-.2682398-.0650278-.1137987-.1706981-.186955-.0975417-.0731563-.2357259-.1056702-.1300557-.0406424-.2682398-.0406424-.3495247 0-.6502784.1056702-.2926253.1056703-.5364797.2601114l-.4308095-.8860043q.1300557-.0812848.3007538-.1706981.1788266-.0894133.390167-.1625696.2113405-.0731563.4470664-.1219272.2438544-.048771.5120943-.048771.4958373 0 .8534904.1219272.3657816.1137987.6015075.3332677.2357259.2113405.3495246.5039657.1137987.2844968.1137987.625893 0 .3332677-.186955.6502784-.186955.3088822-.5039657.4714518.4389379.1788266.6746638.5364797.2438544.3495246.2438544.8453619 0 .3901671-.1300557.7234347-.1300557.3251393-.406424.5689937-.2763683.235726-.7071777.3739101-.422681.1300557-1.0079316.1300557z"/><path d="m10.502445 7.817506q.08941.00813.203212.016257.121927 0 .284497 0 .951032 0 1.406227-.4795803.463323-.4795803.463323-1.3249422 0-.8860044-.438938-1.3411992-.438938-.4551949-1.38997-.4551949-.130055 0-.26824.00813-.138184 0-.260111.016257zm3.665945-1.7882655q0 .7315631-.227598 1.2761713-.227597.5446082-.650278.9022613-.414553.3576531-1.01606.5364797-.601508.1788265-1.349328.1788265-.341396 0-.796591-.032514-.4551948-.0243853-.8941328-.1137986v-5.486724q.438938-.081285.9103898-.1056702.47958-.032514.820976-.032514.723435 0 1.308686.1625696.593379.1625696 1.01606.5120943.422681.3495246.650278.8941328.227598.5446081.227598 1.3086853z"/></g></g></svg> diff --git a/editor/icons/TextureArray.svg b/editor/icons/TextureArray.svg index 86d4875e12..a71860023b 100644 --- a/editor/icons/TextureArray.svg +++ b/editor/icons/TextureArray.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m2 1c-.5522847 0-1 .4477153-1 1v12c0 .552285.4477153 1 1 1h12c.552285 0 1-.447715 1-1v-12c0-.5522847-.447715-1-1-1zm1 2h10v8h-10z" fill-opacity=".99608" transform="translate(.359546 -.287637)"/><g fill-opacity=".996078" stroke-width=".207395" transform="matrix(1.6197742 0 0 .750929 -3.723153 1.832957)"><path d="m4.7302951 2.4553483h2.2481639v.9872012h-1.0701592v6.0559397h1.0701592v.9872008h-2.2481639z"/><path d="m10.138643 10.48569h-2.2481636v-.9872008h1.0701592v-6.0559397h-1.0701592v-.9872012h2.2481636z"/></g></g></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" transform="translate(-.359546 .287637)"><path d="m2 1c-.5522847 0-1 .4477153-1 1v12c0 .552285.4477153 1 1 1h12c.552285 0 1-.447715 1-1v-12c0-.5522847-.447715-1-1-1zm1 2h10v8h-10z" fill-opacity=".99608" transform="translate(.359546 -.287637)"/><g fill-opacity=".996078" stroke-width=".207395" transform="matrix(1.6197742 0 0 .750929 -3.723153 1.832957)"><path d="m4.9900159 2.5027746h1.85211v1.3316838h-.926055v5.3267353h.926055v1.3316833h-1.85211z"/><path d="m9.9289759 10.492877h-1.85211v-1.3316833h.926055v-5.3267353h-.926055v-1.3316838h1.85211z"/></g></g></svg> diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index c4fdf9f4bb..ff3b50303f 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2657,11 +2657,30 @@ void Node3DEditorViewport::_draw() { if (_edit.mode == TRANSFORM_ROTATE) { Point2 center = _point_to_screen(_edit.center); + + Color handle_color; + switch (_edit.plane) { + case TRANSFORM_X_AXIS: + handle_color = get_theme_color("axis_x_color", "Editor"); + break; + case TRANSFORM_Y_AXIS: + handle_color = get_theme_color("axis_y_color", "Editor"); + break; + case TRANSFORM_Z_AXIS: + handle_color = get_theme_color("axis_z_color", "Editor"); + break; + default: + handle_color = get_theme_color("accent_color", "Editor"); + break; + } + handle_color.a = 1.0; + handle_color *= Color(1.3, 1.3, 1.3, 1.0); + RenderingServer::get_singleton()->canvas_item_add_line( ci, _edit.mouse_pos, center, - get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.6), + handle_color, Math::round(2 * EDSCALE)); } if (previewing) { |