diff options
Diffstat (limited to 'editor')
22 files changed, 308 insertions, 129 deletions
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5d654ca756..a9cb1a0131 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -655,6 +655,17 @@ void EditorDebuggerNode::live_debug_reparent_node(const NodePath &p_at, const No }); } +void EditorDebuggerNode::set_camera_override(CameraOverride p_override) { + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + dbg->set_camera_override(p_override); + }); + camera_override = p_override; +} + +EditorDebuggerNode::CameraOverride EditorDebuggerNode::get_camera_override() { + return camera_override; +} + void EditorDebuggerNode::add_debugger_plugin(const Ref<Script> &p_script) { ERR_FAIL_COND_MSG(debugger_plugins.has(p_script), "Debugger plugin already exists."); ERR_FAIL_COND_MSG(p_script.is_null(), "Debugger plugin script is null"); diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 0849ecf1c9..39a95326be 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -185,9 +185,8 @@ public: void live_debug_duplicate_node(const NodePath &p_at, const String &p_new_name); void live_debug_reparent_node(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos); - // Camera - void set_camera_override(CameraOverride p_override) { camera_override = p_override; } - CameraOverride get_camera_override() { return camera_override; } + void set_camera_override(CameraOverride p_override); + CameraOverride get_camera_override(); Error start(const String &p_protocol = "tcp://"); diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 56a9d2c258..8d1c22dabd 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -245,9 +245,6 @@ void DocTools::generate(bool p_basic_types) { } String cname = name; - if (cname.begins_with("_")) { //proxy class - cname = cname.substr(1, name.length()); - } class_list[cname] = DocData::ClassDoc(); DocData::ClassDoc &c = class_list[cname]; @@ -740,9 +737,6 @@ void DocTools::generate(bool p_basic_types) { while (String(ClassDB::get_parent_class(pd.type)) != "Object") { pd.type = ClassDB::get_parent_class(pd.type); } - if (pd.type.begins_with("_")) { - pd.type = pd.type.substr(1, pd.type.length()); - } c.properties.push_back(pd); } diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index 6349beeef4..cf6ede2277 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -70,8 +70,12 @@ void EditorCommandPalette::_update_command_search(const String &search_text) { r.key_name = command_keys[i]; r.display_name = commands[r.key_name].name; r.shortcut_text = commands[r.key_name].shortcut; + if (search_text.is_subsequence_ofi(r.display_name)) { - r.score = _score_path(search_text, r.display_name.to_lower()); + if (!search_text.is_empty()) { + r.score = _score_path(search_text, r.display_name.to_lower()); + } + entries.push_back(r); } } @@ -81,60 +85,55 @@ void EditorCommandPalette::_update_command_search(const String &search_text) { TreeItem *root = search_options->get_root(); root->clear_children(); - if (entries.size() > 0) { - if (!search_text.is_empty()) { - SortArray<CommandEntry, CommandEntryComparator> sorter; - sorter.sort(entries.ptrw(), entries.size()); - } + if (entries.is_empty()) { + get_ok_button()->set_disabled(true); - const int entry_limit = MIN(entries.size(), 300); - for (int i = 0; i < entry_limit; i++) { - String section_name = entries[i].key_name.get_slice("/", 0); - TreeItem *section; + return; + } - if (sections.has(section_name)) { - section = sections[section_name]; - } else { - section = search_options->create_item(root); + if (!search_text.is_empty()) { + SortArray<CommandEntry, CommandEntryComparator> sorter; + sorter.sort(entries.ptrw(), entries.size()); + } - if (!first_section) { - first_section = section; - } + const int entry_limit = MIN(entries.size(), 300); + for (int i = 0; i < entry_limit; i++) { + String section_name = entries[i].key_name.get_slice("/", 0); + TreeItem *section; - String item_name = section_name.capitalize(); - section->set_text(0, item_name); + if (sections.has(section_name)) { + section = sections[section_name]; + } else { + section = search_options->create_item(root); - sections[section_name] = section; - section->set_custom_bg_color(0, search_options->get_theme_color("prop_subsection", "Editor")); - section->set_custom_bg_color(1, search_options->get_theme_color("prop_subsection", "Editor")); + if (!first_section) { + first_section = section; } - TreeItem *ti = search_options->create_item(section); - String shortcut_text = entries[i].shortcut_text == "None" ? "" : entries[i].shortcut_text; - ti->set_text(0, entries[i].display_name); - ti->set_metadata(0, entries[i].key_name); - ti->set_text_align(1, TreeItem::TextAlign::ALIGN_RIGHT); - ti->set_text(1, shortcut_text); - Color c = Color(1, 1, 1, 0.5); - ti->set_custom_color(1, c); - } - - TreeItem *to_select = first_section->get_first_child(); - to_select->select(0); - to_select->set_as_cursor(0); - search_options->scroll_to_item(to_select); + String item_name = section_name.capitalize(); + section->set_text(0, item_name); + section->set_selectable(0, false); + section->set_selectable(1, false); + section->set_custom_bg_color(0, search_options->get_theme_color("prop_subsection", "Editor")); + section->set_custom_bg_color(1, search_options->get_theme_color("prop_subsection", "Editor")); - get_ok_button()->set_disabled(false); - } else { - TreeItem *ti = search_options->create_item(root); - ti->set_text(0, TTR("No matching commands found")); - ti->set_metadata(0, ""); - Color c = Color(0.5, 0.5, 0.5, 0.5); - ti->set_custom_color(0, c); - search_options->deselect_all(); + sections[section_name] = section; + } - get_ok_button()->set_disabled(true); + TreeItem *ti = search_options->create_item(section); + String shortcut_text = entries[i].shortcut_text == "None" ? "" : entries[i].shortcut_text; + ti->set_text(0, entries[i].display_name); + ti->set_metadata(0, entries[i].key_name); + ti->set_text_align(1, TreeItem::TextAlign::ALIGN_RIGHT); + ti->set_text(1, shortcut_text); + Color c = Color(1, 1, 1, 0.5); + ti->set_custom_color(1, c); } + + TreeItem *to_select = first_section->get_first_child(); + to_select->select(0); + to_select->set_as_cursor(0); + search_options->ensure_cursor_is_visible(); } void EditorCommandPalette::_bind_methods() { @@ -169,8 +168,11 @@ void EditorCommandPalette::_confirmed() { void EditorCommandPalette::open_popup() { popup_centered_clamped(Size2i(600, 440), 0.8f); + command_search_box->clear(); command_search_box->grab_focus(); + + search_options->scroll_to_item(search_options->get_root()); } void EditorCommandPalette::get_actions_list(List<String> *p_list) const { @@ -258,6 +260,9 @@ EditorCommandPalette *EditorCommandPalette::get_singleton() { } EditorCommandPalette::EditorCommandPalette() { + set_hide_on_ok(false); + connect("confirmed", callable_mp(this, &EditorCommandPalette::_confirmed)); + VBoxContainer *vbc = memnew(VBoxContainer); vbc->connect("theme_changed", callable_mp(this, &EditorCommandPalette::_theme_changed)); add_child(vbc); @@ -275,18 +280,15 @@ EditorCommandPalette::EditorCommandPalette() { search_options = memnew(Tree); search_options->connect("item_activated", callable_mp(this, &EditorCommandPalette::_confirmed)); + search_options->connect("item_selected", callable_mp((BaseButton *)get_ok_button(), &BaseButton::set_disabled), varray(false)); + search_options->connect("nothing_selected", callable_mp((BaseButton *)get_ok_button(), &BaseButton::set_disabled), varray(true)); search_options->create_item(); search_options->set_hide_root(true); - search_options->set_hide_folding(true); - search_options->add_theme_constant_override("draw_guides", 1); search_options->set_columns(2); search_options->set_v_size_flags(Control::SIZE_EXPAND_FILL); search_options->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_options->set_column_custom_minimum_width(0, int(8 * EDSCALE)); vbc->add_child(search_options, true); - - connect("confirmed", callable_mp(this, &EditorCommandPalette::_confirmed)); - set_hide_on_ok(false); } Ref<Shortcut> ED_SHORTCUT_AND_COMMAND(const String &p_path, const String &p_name, Key p_keycode, String p_command_name) { diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 9de8b0451a..b3ce11028b 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2243,6 +2243,13 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo undo_redo->add_do_property(object, p_name, p_value); undo_redo->add_undo_property(object, p_name, object->get(p_name)); + PropertyInfo prop_info; + if (ClassDB::get_property_info(object->get_class_name(), p_name, &prop_info)) { + for (const String &linked_prop : prop_info.linked_properties) { + undo_redo->add_undo_property(object, linked_prop, object->get(linked_prop)); + } + } + Variant v_undo_redo = (Object *)undo_redo; Variant v_object = object; Variant v_name = p_name; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 3adb7688b0..08585030de 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -388,14 +388,16 @@ void EditorNode::_version_control_menu_option(int p_idx) { } void EditorNode::_update_title() { - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname); - String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); + const String appname = ProjectSettings::get_singleton()->get("application/config/name"); + String title = (appname.is_empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME; + const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); if (!edited.is_empty()) { - title += " - " + String(edited.get_file()); + // Display the edited scene name before the program name so that it can be seen in the OS task bar. + title = vformat("%s - %s", edited.get_file(), title); } if (unsaved_cache) { - title += " (*)"; + // Display the "modified" mark before anything else so that it can always be seen in the OS task bar. + title = vformat("(*) %s", title); } DisplayServer::get_singleton()->window_set_title(title); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 7f8229e5e8..4496180ddd 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -219,6 +219,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = exceptions.insert("DefaultProjectIcon"); exceptions.insert("GuiChecked"); exceptions.insert("GuiRadioChecked"); + exceptions.insert("GuiIndeterminate"); exceptions.insert("GuiCloseCustomizable"); exceptions.insert("GuiGraphNodePort"); exceptions.insert("GuiResizer"); @@ -817,6 +818,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Tree theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons")); + theme->set_icon("indeterminate", "Tree", theme->get_icon("GuiIndeterminate", "EditorIcons")); theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons")); theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); diff --git a/editor/icons/GuiIndeterminate.svg b/editor/icons/GuiIndeterminate.svg new file mode 100644 index 0000000000..79e5d95c9a --- /dev/null +++ b/editor/icons/GuiIndeterminate.svg @@ -0,0 +1 @@ +<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m3.333 1c-1.288 0-2.333 1.045-2.333 2.333v9.334c0 1.288 1.045 2.333 2.333 2.333h9.334c1.288 0 2.333-1.045 2.333-2.333v-9.334c0-1.288-1.045-2.333-2.333-2.333z" fill="#699ce8" fill-rule="nonzero"/><path d="m3 7h10.058v2.12h-10.058z" fill="#fff" transform="matrix(.99428 0 0 .943295 .017161 .396936)"/></svg> diff --git a/editor/icons/VisualShaderNodeTexture2DUniformTriplanar.svg b/editor/icons/VisualShaderNodeTexture2DArrayUniform.svg index ed9e084fd3..ed9e084fd3 100644 --- a/editor/icons/VisualShaderNodeTexture2DUniformTriplanar.svg +++ b/editor/icons/VisualShaderNodeTexture2DArrayUniform.svg diff --git a/editor/icons/VisualShaderNodeTexture3DUniform.svg b/editor/icons/VisualShaderNodeTexture3DUniform.svg new file mode 100644 index 0000000000..ed9e084fd3 --- /dev/null +++ b/editor/icons/VisualShaderNodeTexture3DUniform.svg @@ -0,0 +1 @@ +<svg height="14" viewBox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg"><path d="m2 0c-1.1045695 0-2 .8954-2 2v10c0 1.1046.8954305 2 2 2h10c1.104569 0 2-.8954 2-2v-10c0-1.1046-.895431-2-2-2zm0 2h10v10h-10zm9 2-4 4-2-2-2 3h8z" fill="#eae068"/></svg> diff --git a/editor/icons/VisualShaderNodeTextureUniform.svg b/editor/icons/VisualShaderNodeTextureUniform.svg new file mode 100644 index 0000000000..ed9e084fd3 --- /dev/null +++ b/editor/icons/VisualShaderNodeTextureUniform.svg @@ -0,0 +1 @@ +<svg height="14" viewBox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg"><path d="m2 0c-1.1045695 0-2 .8954-2 2v10c0 1.1046.8954305 2 2 2h10c1.104569 0 2-.8954 2-2v-10c0-1.1046-.895431-2-2-2zm0 2h10v10h-10zm9 2-4 4-2-2-2 3h8z" fill="#eae068"/></svg> diff --git a/editor/icons/VisualShaderNodeTextureUniformTriplanar.svg b/editor/icons/VisualShaderNodeTextureUniformTriplanar.svg new file mode 100644 index 0000000000..ed9e084fd3 --- /dev/null +++ b/editor/icons/VisualShaderNodeTextureUniformTriplanar.svg @@ -0,0 +1 @@ +<svg height="14" viewBox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg"><path d="m2 0c-1.1045695 0-2 .8954-2 2v10c0 1.1046.8954305 2 2 2h10c1.104569 0 2-.8954 2-2v-10c0-1.1046-.895431-2-2-2zm0 2h10v10h-10zm9 2-4 4-2-2-2 3h8z" fill="#eae068"/></svg> diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp index aa9700716d..71930e1e59 100644 --- a/editor/import/collada.cpp +++ b/editor/import/collada.cpp @@ -960,6 +960,7 @@ void Collada::_parse_mesh_geometry(XMLParser &parser, String p_id, String p_name } else if (section == "vertices") { MeshData::Vertices vert; String id = parser.get_attribute_value("id"); + int last_ref = 0; while (parser.read() == OK) { if (parser.get_node_type() == XMLParser::NODE_ELEMENT) { @@ -967,6 +968,10 @@ void Collada::_parse_mesh_geometry(XMLParser &parser, String p_id, String p_name String semantic = parser.get_attribute_value("semantic"); String source = _uri_to_id(parser.get_attribute_value("source")); + if (semantic == "TEXCOORD") { + semantic = "TEXCOORD" + itos(last_ref++); + } + vert.sources[semantic] = source; COLLADA_PRINT(section + " input semantic: " + semantic + " source: " + source); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 54b93edcdd..7ab80ac3b4 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -504,61 +504,121 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImpor const Collada::MeshData::Source *normal_src = nullptr; int normal_ofs = 0; - if (p.sources.has("NORMAL")) { - String normal_source_id = p.sources["NORMAL"].source; - normal_ofs = p.sources["NORMAL"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(normal_source_id), ERR_INVALID_DATA); - normal_src = &meshdata.sources[normal_source_id]; + { + String normal_source_id = ""; + + if (p.sources.has("NORMAL")) { + normal_source_id = p.sources["NORMAL"].source; + normal_ofs = p.sources["NORMAL"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("NORMAL")) { + normal_source_id = meshdata.vertices[vertex_src_id].sources["NORMAL"]; + normal_ofs = vertex_ofs; + } + + if (normal_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(normal_source_id), ERR_INVALID_DATA); + normal_src = &meshdata.sources[normal_source_id]; + } } const Collada::MeshData::Source *binormal_src = nullptr; int binormal_ofs = 0; - if (p.sources.has("TEXBINORMAL")) { - String binormal_source_id = p.sources["TEXBINORMAL"].source; - binormal_ofs = p.sources["TEXBINORMAL"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(binormal_source_id), ERR_INVALID_DATA); - binormal_src = &meshdata.sources[binormal_source_id]; + { + String binormal_source_id = ""; + + if (p.sources.has("TEXBINORMAL")) { + binormal_source_id = p.sources["TEXBINORMAL"].source; + binormal_ofs = p.sources["TEXBINORMAL"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("TEXBINORMAL")) { + binormal_source_id = meshdata.vertices[vertex_src_id].sources["TEXBINORMAL"]; + binormal_ofs = vertex_ofs; + } + + if (binormal_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(binormal_source_id), ERR_INVALID_DATA); + binormal_src = &meshdata.sources[binormal_source_id]; + } } const Collada::MeshData::Source *tangent_src = nullptr; int tangent_ofs = 0; - if (p.sources.has("TEXTANGENT")) { - String tangent_source_id = p.sources["TEXTANGENT"].source; - tangent_ofs = p.sources["TEXTANGENT"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(tangent_source_id), ERR_INVALID_DATA); - tangent_src = &meshdata.sources[tangent_source_id]; + { + String tangent_source_id = ""; + + if (p.sources.has("TEXTANGENT")) { + tangent_source_id = p.sources["TEXTANGENT"].source; + tangent_ofs = p.sources["TEXTANGENT"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("TEXTANGENT")) { + tangent_source_id = meshdata.vertices[vertex_src_id].sources["TEXTANGENT"]; + tangent_ofs = vertex_ofs; + } + + if (tangent_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(tangent_source_id), ERR_INVALID_DATA); + tangent_src = &meshdata.sources[tangent_source_id]; + } } const Collada::MeshData::Source *uv_src = nullptr; int uv_ofs = 0; - if (p.sources.has("TEXCOORD0")) { - String uv_source_id = p.sources["TEXCOORD0"].source; - uv_ofs = p.sources["TEXCOORD0"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(uv_source_id), ERR_INVALID_DATA); - uv_src = &meshdata.sources[uv_source_id]; + { + String uv_source_id = ""; + + if (p.sources.has("TEXCOORD0")) { + uv_source_id = p.sources["TEXCOORD0"].source; + uv_ofs = p.sources["TEXCOORD0"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("TEXCOORD0")) { + uv_source_id = meshdata.vertices[vertex_src_id].sources["TEXCOORD0"]; + uv_ofs = vertex_ofs; + } + + if (uv_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(uv_source_id), ERR_INVALID_DATA); + uv_src = &meshdata.sources[uv_source_id]; + } } const Collada::MeshData::Source *uv2_src = nullptr; int uv2_ofs = 0; - if (p.sources.has("TEXCOORD1")) { - String uv2_source_id = p.sources["TEXCOORD1"].source; - uv2_ofs = p.sources["TEXCOORD1"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(uv2_source_id), ERR_INVALID_DATA); - uv2_src = &meshdata.sources[uv2_source_id]; + { + String uv2_source_id = ""; + + if (p.sources.has("TEXCOORD1")) { + uv2_source_id = p.sources["TEXCOORD1"].source; + uv2_ofs = p.sources["TEXCOORD1"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("TEXCOORD1")) { + uv2_source_id = meshdata.vertices[vertex_src_id].sources["TEXCOORD1"]; + uv2_ofs = vertex_ofs; + } + + if (uv2_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(uv2_source_id), ERR_INVALID_DATA); + uv2_src = &meshdata.sources[uv2_source_id]; + } } const Collada::MeshData::Source *color_src = nullptr; int color_ofs = 0; - if (p.sources.has("COLOR")) { - String color_source_id = p.sources["COLOR"].source; - color_ofs = p.sources["COLOR"].offset; - ERR_FAIL_COND_V(!meshdata.sources.has(color_source_id), ERR_INVALID_DATA); - color_src = &meshdata.sources[color_source_id]; + { + String color_source_id = ""; + + if (p.sources.has("COLOR")) { + color_source_id = p.sources["COLOR"].source; + color_ofs = p.sources["COLOR"].offset; + } else if (meshdata.vertices[vertex_src_id].sources.has("COLOR")) { + color_source_id = meshdata.vertices[vertex_src_id].sources["COLOR"]; + color_ofs = vertex_ofs; + } + + if (color_source_id != "") { + ERR_FAIL_COND_V(!meshdata.sources.has(color_source_id), ERR_INVALID_DATA); + color_src = &meshdata.sources[color_source_id]; + } } //find largest source.. diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 69206daea8..030d90eeca 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -126,6 +126,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { graph->add_child(node); Ref<AnimationNode> agnode = blend_tree->get_node(E); + ERR_CONTINUE(!agnode.is_valid()); node->set_position_offset(blend_tree->get_node_position(E) * EDSCALE); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 486f947e43..c2684305ef 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -50,12 +50,7 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const { switch (shape_type) { case CAPSULE_SHAPE: { Ref<CapsuleShape2D> capsule = node->get_shape(); - - if (idx == 0) { - return capsule->get_radius(); - } else if (idx == 1) { - return capsule->get_height(); - } + return Vector2(capsule->get_radius(), capsule->get_height()); } break; @@ -209,17 +204,17 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) { case CAPSULE_SHAPE: { Ref<CapsuleShape2D> capsule = node->get_shape(); + Vector2 values = p_org; + if (idx == 0) { undo_redo->add_do_method(capsule.ptr(), "set_radius", capsule->get_radius()); - undo_redo->add_do_method(canvas_item_editor, "update_viewport"); - undo_redo->add_undo_method(capsule.ptr(), "set_radius", p_org); - undo_redo->add_do_method(canvas_item_editor, "update_viewport"); } else if (idx == 1) { undo_redo->add_do_method(capsule.ptr(), "set_height", capsule->get_height()); - undo_redo->add_do_method(canvas_item_editor, "update_viewport"); - undo_redo->add_undo_method(capsule.ptr(), "set_height", p_org); - undo_redo->add_undo_method(canvas_item_editor, "update_viewport"); } + undo_redo->add_do_method(canvas_item_editor, "update_viewport"); + undo_redo->add_undo_method(capsule.ptr(), "set_radius", values[0]); + undo_redo->add_undo_method(capsule.ptr(), "set_height", values[1]); + undo_redo->add_undo_method(canvas_item_editor, "update_viewport"); } break; diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index b93e12d7fa..a42f94ed3d 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -2104,7 +2104,7 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { grests.resize(skel->get_bone_count()); LocalVector<int> bones; - LocalVector<real_t> weights; + LocalVector<float> weights; bones.resize(4); weights.resize(4); @@ -4114,7 +4114,7 @@ Variant CollisionShape3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p if (Object::cast_to<CapsuleShape3D>(*s)) { Ref<CapsuleShape3D> cs2 = s; - return p_id == 0 ? cs2->get_radius() : cs2->get_height(); + return Vector2(cs2->get_radius(), cs2->get_height()); } if (Object::cast_to<CylinderShape3D>(*s)) { @@ -4261,12 +4261,11 @@ void CollisionShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo if (Object::cast_to<CapsuleShape3D>(*s)) { Ref<CapsuleShape3D> ss = s; + Vector2 values = p_restore; + if (p_cancel) { - if (p_id == 0) { - ss->set_radius(p_restore); - } else { - ss->set_height(p_restore); - } + ss->set_radius(values[0]); + ss->set_height(values[1]); return; } @@ -4274,12 +4273,12 @@ void CollisionShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo if (p_id == 0) { ur->create_action(TTR("Change Capsule Shape Radius")); ur->add_do_method(ss.ptr(), "set_radius", ss->get_radius()); - ur->add_undo_method(ss.ptr(), "set_radius", p_restore); } else { ur->create_action(TTR("Change Capsule Shape Height")); ur->add_do_method(ss.ptr(), "set_height", ss->get_height()); - ur->add_undo_method(ss.ptr(), "set_height", p_restore); } + ur->add_undo_method(ss.ptr(), "set_radius", values[0]); + ur->add_undo_method(ss.ptr(), "set_height", values[1]); ur->commit_action(); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index bd90fa82f2..5c1e557286 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -104,11 +104,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { List<StringName> types; ClassDB::get_class_list(&types); for (const StringName &E : types) { - String n = E; - if (n.begins_with("_")) { - n = n.substr(1, n.length()); - } - highlighter->add_keyword_color(n, type_color); + highlighter->add_keyword_color(E, type_color); } /* User types. */ diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 7f2908eada..5f48106afc 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -758,8 +758,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c } else if (script->get_language()->lookup_code(code_editor->get_text_editor()->get_text_for_symbol_lookup(), p_symbol, script->get_path(), base, result) == OK) { _goto_line(p_row); - result.class_name = result.class_name.trim_prefix("_"); - switch (result.type) { case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: { if (result.script.is_valid()) { diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2dd8270ee3..d84ed4828c 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1219,8 +1219,88 @@ void VisualShaderEditor::_update_options_menu() { Vector<AddOption> custom_options; Vector<AddOption> embedded_options; + static Vector<String> type_filter_exceptions; + if (type_filter_exceptions.is_empty()) { + type_filter_exceptions.append("VisualShaderNodeExpression"); + } + for (int i = 0; i < add_options.size(); i++) { if (!use_filter || add_options[i].name.findn(filter) != -1) { + // port type filtering + if (members_output_port_type != VisualShaderNode::PORT_TYPE_MAX || members_input_port_type != VisualShaderNode::PORT_TYPE_MAX) { + Ref<VisualShaderNode> vsn; + int check_result = 0; + + if (!add_options[i].is_custom) { + vsn = Ref<VisualShaderNode>(Object::cast_to<VisualShaderNode>(ClassDB::instantiate(add_options[i].type))); + if (!vsn.is_valid()) { + continue; + } + + if (type_filter_exceptions.has(add_options[i].type)) { + check_result = 1; + } + + Ref<VisualShaderNodeInput> input = Object::cast_to<VisualShaderNodeInput>(vsn.ptr()); + if (input.is_valid()) { + input->set_shader_mode(visual_shader->get_mode()); + input->set_shader_type(visual_shader->get_shader_type()); + input->set_input_name(add_options[i].sub_func_str); + } + + Ref<VisualShaderNodeExpression> expression = Object::cast_to<VisualShaderNodeExpression>(vsn.ptr()); + if (expression.is_valid()) { + if (members_input_port_type == VisualShaderNode::PORT_TYPE_SAMPLER) { + check_result = -1; // expressions creates a port with required type automatically (except for sampler output) + } + } + + Ref<VisualShaderNodeUniformRef> uniform_ref = Object::cast_to<VisualShaderNodeUniformRef>(vsn.ptr()); + if (uniform_ref.is_valid()) { + check_result = -1; + + if (members_input_port_type != VisualShaderNode::PORT_TYPE_MAX) { + for (int j = 0; j < uniform_ref->get_uniforms_count(); j++) { + if (visual_shader->is_port_types_compatible(uniform_ref->get_port_type_by_index(j), members_input_port_type)) { + check_result = 1; + break; + } + } + } + } + } else { + check_result = 1; + } + + if (members_output_port_type != VisualShaderNode::PORT_TYPE_MAX) { + if (check_result == 0) { + for (int j = 0; j < vsn->get_input_port_count(); j++) { + if (visual_shader->is_port_types_compatible(vsn->get_input_port_type(j), members_output_port_type)) { + check_result = 1; + break; + } + } + } + + if (check_result != 1) { + continue; + } + } + if (members_input_port_type != VisualShaderNode::PORT_TYPE_MAX) { + if (check_result == 0) { + for (int j = 0; j < vsn->get_output_port_count(); j++) { + if (visual_shader->is_port_types_compatible(vsn->get_output_port_type(j), members_input_port_type)) { + check_result = 1; + break; + } + } + } + + if (check_result != 1) { + continue; + } + } + } if ((add_options[i].func != current_func && add_options[i].func != -1) || !_is_available(add_options[i].mode)) { continue; } @@ -2588,13 +2668,25 @@ void VisualShaderEditor::_disconnection_request(const String &p_from, int p_from void VisualShaderEditor::_connection_to_empty(const String &p_from, int p_from_slot, const Vector2 &p_release_position) { from_node = p_from.to_int(); from_slot = p_from_slot; - _show_members_dialog(true); + VisualShaderNode::PortType input_port_type = VisualShaderNode::PORT_TYPE_MAX; + VisualShaderNode::PortType output_port_type = VisualShaderNode::PORT_TYPE_MAX; + Ref<VisualShaderNode> node = visual_shader->get_node(get_current_shader_type(), from_node); + if (node.is_valid()) { + output_port_type = node->get_output_port_type(from_slot); + } + _show_members_dialog(true, input_port_type, output_port_type); } void VisualShaderEditor::_connection_from_empty(const String &p_to, int p_to_slot, const Vector2 &p_release_position) { to_node = p_to.to_int(); to_slot = p_to_slot; - _show_members_dialog(true); + VisualShaderNode::PortType input_port_type = VisualShaderNode::PORT_TYPE_MAX; + VisualShaderNode::PortType output_port_type = VisualShaderNode::PORT_TYPE_MAX; + Ref<VisualShaderNode> node = visual_shader->get_node(get_current_shader_type(), to_node); + if (node.is_valid()) { + input_port_type = node->get_input_port_type(to_slot); + } + _show_members_dialog(true, input_port_type, output_port_type); } void VisualShaderEditor::_delete_nodes(int p_type, const List<int> &p_nodes) { @@ -3036,7 +3128,13 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { } } -void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos) { +void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNode::PortType p_input_port_type, VisualShaderNode::PortType p_output_port_type) { + if (members_input_port_type != p_input_port_type || members_output_port_type != p_output_port_type) { + members_input_port_type = p_input_port_type; + members_output_port_type = p_output_port_type; + _update_options_menu(); + } + if (at_mouse_pos) { saved_node_pos_dirty = true; saved_node_pos = graph->get_local_mouse_position(); @@ -3114,7 +3212,7 @@ void VisualShaderEditor::_notification(int p_what) { { Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color"); Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color"); - Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color"); Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color"); Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); Color symbol_color = EDITOR_GET("text_editor/theme/highlighting/symbol_color"); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 87bab16a45..fbfe1197a3 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -160,6 +160,8 @@ class VisualShaderEditor : public VBoxContainer { bool saved_node_pos_dirty; ConfirmationDialog *members_dialog; + VisualShaderNode::PortType members_input_port_type = VisualShaderNode::PORT_TYPE_MAX; + VisualShaderNode::PortType members_output_port_type = VisualShaderNode::PORT_TYPE_MAX; PopupMenu *popup_menu; PopupMenu *constants_submenu = nullptr; MenuButton *tools; @@ -227,7 +229,7 @@ class VisualShaderEditor : public VBoxContainer { Label *highend_label; void _tools_menu_option(int p_idx); - void _show_members_dialog(bool at_mouse_pos); + void _show_members_dialog(bool at_mouse_pos, VisualShaderNode::PortType p_input_port_type = VisualShaderNode::PORT_TYPE_MAX, VisualShaderNode::PortType p_output_port_type = VisualShaderNode::PORT_TYPE_MAX); void _update_graph(); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index ee100ca938..71802d1737 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -250,6 +250,8 @@ void EditorSettingsDialog::_update_shortcuts() { sections["Common"] = common_section; common_section->set_text(0, TTR("Common")); + common_section->set_selectable(0, false); + common_section->set_selectable(1, false); if (collapsed.has("Common")) { common_section->set_collapsed(collapsed["Common"]); } @@ -343,14 +345,16 @@ void EditorSettingsDialog::_update_shortcuts() { String item_name = section_name.capitalize(); section->set_text(0, item_name); + section->set_selectable(0, false); + section->set_selectable(1, false); + section->set_custom_bg_color(0, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); + section->set_custom_bg_color(1, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); if (collapsed.has(item_name)) { section->set_collapsed(collapsed[item_name]); } sections[section_name] = section; - section->set_custom_bg_color(0, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); - section->set_custom_bg_color(1, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); } // Don't match unassigned shortcuts when searching for assigned keys in search results. |