From bca0d36fe662477eb787b4ddc9b0b69ab4603393 Mon Sep 17 00:00:00 2001 From: trollodel <33117082+trollodel@users.noreply.github.com> Date: Sun, 7 Mar 2021 21:07:30 +0100 Subject: Improve TreeItem API and allow to move nodes --- editor/action_map_editor.cpp | 4 ++-- editor/animation_track_editor.cpp | 8 ++++---- editor/connections_dialog.cpp | 2 +- editor/debugger/script_editor_debugger.cpp | 12 +++++------ editor/dependency_editor.cpp | 4 ++-- editor/editor_asset_installer.cpp | 6 +++--- editor/editor_sectioned_inspector.cpp | 6 +++--- editor/filesystem_dock.cpp | 26 ++++++++++++------------ editor/find_in_files.cpp | 2 +- editor/groups_editor.cpp | 8 ++++---- editor/plugins/script_editor_plugin.cpp | 4 ++-- editor/plugins/theme_editor_plugin.cpp | 8 ++++---- editor/plugins/tiles/tile_map_editor.cpp | 2 +- editor/plugins/version_control_editor_plugin.cpp | 4 ++-- editor/plugins/visual_shader_editor_plugin.cpp | 10 ++++----- editor/project_export.cpp | 4 ++-- editor/property_selector.cpp | 12 +++++------ editor/quick_open.cpp | 4 ++-- editor/scene_tree_dock.cpp | 4 ++-- editor/scene_tree_editor.cpp | 4 ++-- editor/settings_config_dialog.cpp | 6 +++--- 21 files changed, 70 insertions(+), 70 deletions(-) (limited to 'editor') diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index cfc5a2a8db..957e370a27 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -122,9 +122,9 @@ void InputEventConfigurationDialog::_set_event(const Ref &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"); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 00915e4c21..9d5811dcbd 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -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/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 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 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 &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_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/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 3168710e90..ec2358b02f 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -180,12 +180,12 @@ Vector FileSystemDock::_compute_uncollapsed_paths() { Vector 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 needs_check; needs_check.push_back(resTree); @@ -193,7 +193,7 @@ Vector 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"; @@ -1644,7 +1644,7 @@ Vector FileSystemDock::_tree_get_selected(bool remove_self_inclusion) { // Build a list of selected items with the active one at the first position. Vector 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 +1700,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 +2062,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 +2114,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 +2190,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, int drop_position; Vector 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) { @@ -2328,10 +2328,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 +2347,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 diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 47079a92b7..4fa131e991 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -838,7 +838,7 @@ void FindInFilesPanel::_on_replace_all_clicked() { String fpath = file_item->get_metadata(0); Vector 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; } 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/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 893a9356a2..4bc64c9271 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -339,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() { 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_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 91bbd8c080..d4fa575905 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -2587,7 +2587,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref } 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"]; 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 9ed8f6c1fc..e7816002dc 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -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/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 &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::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::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 &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 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::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); } } -- cgit v1.2.3