diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml
index 0090fb555f8..13f2c7120cc 100644
--- a/doc/classes/TreeItem.xml
+++ b/doc/classes/TreeItem.xml
@@ -390,7 +390,7 @@
- Propagates this item's checked status to its children and parents for the given [code]column[/code]. It is possible to process the items affected by this method call by connecting to [signal Tree.check_propagated_to_item]. The order that the items affected will be processed is as follows: the item invoking this method, children of that item, and finally parents of that item. If [code]emit_signal[/code] is set to false, then [signal Tree.check_propagated_to_item] will not be emitted.
+ Propagates this item's checked status to its children and parents for the given [code]column[/code]. It is possible to process the items affected by this method call by connecting to [signal Tree.check_propagated_to_item]. The order that the items affected will be processed is as follows: the item invoking this method, children of that item, and finally parents of that item. If [code]emit_signal[/code] is [code]false[/code], then [signal Tree.check_propagated_to_item] will not be emitted.
diff --git a/editor/import/dynamicfont_import_settings.cpp b/editor/import/dynamicfont_import_settings.cpp
index f4b14683148..81b98c1d45e 100644
--- a/editor/import/dynamicfont_import_settings.cpp
+++ b/editor/import/dynamicfont_import_settings.cpp
@@ -427,6 +427,7 @@ void DynamicFontImportSettings::_add_glyph_range_item(int32_t p_start, int32_t p
for (int i = 0; i < pages; i++) {
TreeItem *item = glyph_tree->create_item(glyph_root);
ERR_FAIL_NULL(item);
+ item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_text(0, _pad_zeros(String::num_int64(start, 16)) + " - " + _pad_zeros(String::num_int64(start + page_size, 16)));
item->set_text(1, p_name);
item->set_metadata(0, Vector2i(start, start + page_size));
@@ -435,6 +436,7 @@ void DynamicFontImportSettings::_add_glyph_range_item(int32_t p_start, int32_t p
if (remain > 0) {
TreeItem *item = glyph_tree->create_item(glyph_root);
ERR_FAIL_NULL(item);
+ item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_text(0, _pad_zeros(String::num_int64(start, 16)) + " - " + _pad_zeros(String::num_int64(p_end, 16)));
item->set_text(1, p_name);
item->set_metadata(0, Vector2i(start, p_end));
@@ -656,6 +658,30 @@ void DynamicFontImportSettings::_glyph_selected() {
}
}
label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
+
+ item = glyph_tree->get_selected();
+ ERR_FAIL_NULL(item);
+ Vector2i range = item->get_metadata(0);
+
+ int total_chars = range.y - range.x;
+ int selected_count = 0;
+ for (int i = range.x; i < range.y; i++) {
+ if (!font_main->has_char(i)) {
+ total_chars--;
+ }
+
+ if (selected_chars.has(i)) {
+ selected_count++;
+ }
+ }
+
+ if (selected_count == total_chars) {
+ item->set_checked(0, true);
+ } else if (selected_count > 0) {
+ item->set_indeterminate(0, true);
+ } else {
+ item->set_checked(0, false);
+ }
}
void DynamicFontImportSettings::_range_edited() {
@@ -760,6 +786,10 @@ void DynamicFontImportSettings::_range_update(int32_t p_start, int32_t p_end) {
}
}
_edit_range(p_start, p_end);
+
+ TreeItem *item = glyph_tree->get_selected();
+ ERR_FAIL_NULL(item);
+ item->set_checked(0, !all_selected);
}
/*************************************************************************/