You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Various fixes and style nitpicks
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include "scene/gui/split_container.h"
|
||||
|
||||
SnapshotRefCountedView::SnapshotRefCountedView() {
|
||||
set_name(TTR("RefCounted"));
|
||||
set_name(TTRC("RefCounted"));
|
||||
}
|
||||
|
||||
void SnapshotRefCountedView::show_snapshot(GameStateSnapshot *p_data, GameStateSnapshot *p_diff_data) {
|
||||
@@ -59,21 +59,21 @@ void SnapshotRefCountedView::show_snapshot(GameStateSnapshot *p_data, GameStateS
|
||||
// Tree of Refs.
|
||||
refs_list = memnew(Tree);
|
||||
|
||||
filter_bar = memnew(TreeSortAndFilterBar(refs_list, TTR("Filter RefCounteds")));
|
||||
filter_bar = memnew(TreeSortAndFilterBar(refs_list, TTRC("Filter RefCounteds")));
|
||||
refs_column->add_child(filter_bar);
|
||||
int offset = diff_data ? 1 : 0;
|
||||
if (diff_data) {
|
||||
filter_bar->add_sort_option(TTR("Snapshot"), TreeSortAndFilterBar::SortType::ALPHA_SORT, 0);
|
||||
filter_bar->add_sort_option(TTRC("Snapshot"), TreeSortAndFilterBar::SortType::ALPHA_SORT, 0);
|
||||
}
|
||||
filter_bar->add_sort_option(TTR("Class"), TreeSortAndFilterBar::SortType::ALPHA_SORT, offset + 0);
|
||||
filter_bar->add_sort_option(TTR("Name"), TreeSortAndFilterBar::SortType::ALPHA_SORT, offset + 1);
|
||||
filter_bar->add_sort_option(TTRC("Class"), TreeSortAndFilterBar::SortType::ALPHA_SORT, offset + 0);
|
||||
filter_bar->add_sort_option(TTRC("Name"), TreeSortAndFilterBar::SortType::ALPHA_SORT, offset + 1);
|
||||
TreeSortAndFilterBar::SortOptionIndexes default_sort = filter_bar->add_sort_option(
|
||||
TTR("Native Refs"),
|
||||
TTRC("Native Refs"),
|
||||
TreeSortAndFilterBar::SortType::NUMERIC_SORT,
|
||||
offset + 2);
|
||||
filter_bar->add_sort_option(TTR("ObjectDB Refs"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 3);
|
||||
filter_bar->add_sort_option(TTR("Total Refs"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 4);
|
||||
filter_bar->add_sort_option(TTR("ObjectDB Cycles"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 5);
|
||||
filter_bar->add_sort_option(TTRC("ObjectDB Refs"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 3);
|
||||
filter_bar->add_sort_option(TTRC("Total Refs"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 4);
|
||||
filter_bar->add_sort_option(TTRC("ObjectDB Cycles"), TreeSortAndFilterBar::SortType::NUMERIC_SORT, offset + 5);
|
||||
|
||||
refs_list->set_select_mode(Tree::SelectMode::SELECT_ROW);
|
||||
refs_list->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
|
||||
@@ -82,30 +82,38 @@ void SnapshotRefCountedView::show_snapshot(GameStateSnapshot *p_data, GameStateS
|
||||
refs_list->set_hide_root(true);
|
||||
refs_list->set_columns(diff_data ? 7 : 6);
|
||||
refs_list->set_column_titles_visible(true);
|
||||
|
||||
if (diff_data) {
|
||||
refs_list->set_column_title(0, TTR("Snapshot"));
|
||||
refs_list->set_column_title(0, TTRC("Snapshot"));
|
||||
refs_list->set_column_expand(0, false);
|
||||
refs_list->set_column_title_tooltip_text(0, "A: " + snapshot_data->name + ", B: " + diff_data->name);
|
||||
}
|
||||
refs_list->set_column_title(offset + 0, TTR("Class"));
|
||||
|
||||
refs_list->set_column_title(offset + 0, TTRC("Class"));
|
||||
refs_list->set_column_expand(offset + 0, true);
|
||||
refs_list->set_column_title_tooltip_text(offset + 0, TTR("Object's class"));
|
||||
refs_list->set_column_title(offset + 1, TTR("Name"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 0, TTRC("Object's class"));
|
||||
|
||||
refs_list->set_column_title(offset + 1, TTRC("Name"));
|
||||
refs_list->set_column_expand(offset + 1, true);
|
||||
refs_list->set_column_expand_ratio(offset + 1, 2);
|
||||
refs_list->set_column_title_tooltip_text(offset + 1, TTR("Object's name"));
|
||||
refs_list->set_column_title(offset + 2, TTR("Native Refs"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 1, TTRC("Object's name"));
|
||||
|
||||
refs_list->set_column_title(offset + 2, TTRC("Native Refs"));
|
||||
refs_list->set_column_expand(offset + 2, false);
|
||||
refs_list->set_column_title_tooltip_text(offset + 2, TTR("References not owned by the ObjectDB"));
|
||||
refs_list->set_column_title(offset + 3, TTR("ObjectDB Refs"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 2, TTRC("References not owned by the ObjectDB"));
|
||||
|
||||
refs_list->set_column_title(offset + 3, TTRC("ObjectDB Refs"));
|
||||
refs_list->set_column_expand(offset + 3, false);
|
||||
refs_list->set_column_title_tooltip_text(offset + 3, TTR("References owned by the ObjectDB"));
|
||||
refs_list->set_column_title(offset + 4, TTR("Total Refs"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 3, TTRC("References owned by the ObjectDB"));
|
||||
|
||||
refs_list->set_column_title(offset + 4, TTRC("Total Refs"));
|
||||
refs_list->set_column_expand(offset + 4, false);
|
||||
refs_list->set_column_title_tooltip_text(offset + 4, TTR("ObjectDB References + Native References"));
|
||||
refs_list->set_column_title(offset + 5, TTR("ObjectDB Cycles"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 4, TTRC("ObjectDB References + Native References"));
|
||||
|
||||
refs_list->set_column_title(offset + 5, TTRC("ObjectDB Cycles"));
|
||||
refs_list->set_column_expand(offset + 5, false);
|
||||
refs_list->set_column_title_tooltip_text(offset + 5, TTR("Cycles detected in the ObjectDB"));
|
||||
refs_list->set_column_title_tooltip_text(offset + 5, TTRC("Cycles detected in the ObjectDB"));
|
||||
|
||||
refs_list->connect(SceneStringName(item_selected), callable_mp(this, &SnapshotRefCountedView::_refcounted_selected));
|
||||
refs_list->set_h_size_flags(SizeFlags::SIZE_EXPAND_FILL);
|
||||
refs_list->set_v_size_flags(SizeFlags::SIZE_EXPAND_FILL);
|
||||
@@ -118,9 +126,9 @@ void SnapshotRefCountedView::show_snapshot(GameStateSnapshot *p_data, GameStateS
|
||||
ref_details->set_v_size_flags(SizeFlags::SIZE_EXPAND_FILL);
|
||||
|
||||
refs_list->create_item();
|
||||
_insert_data(snapshot_data, TTR("A"));
|
||||
_insert_data(snapshot_data, TTRC("A"));
|
||||
if (diff_data) {
|
||||
_insert_data(diff_data, TTR("B"));
|
||||
_insert_data(diff_data, TTRC("B"));
|
||||
}
|
||||
|
||||
// Push the split as far right as possible.
|
||||
@@ -154,11 +162,14 @@ void SnapshotRefCountedView::_insert_data(GameStateSnapshot *p_snapshot, const S
|
||||
if (diff_data) {
|
||||
item->set_text(0, p_name);
|
||||
item->set_tooltip_text(0, p_snapshot->name);
|
||||
item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
item->set_text(offset + 0, pair.value->type_name);
|
||||
item->set_auto_translate_mode(offset + 0, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
item->set_text(offset + 1, pair.value->get_name());
|
||||
item->set_auto_translate_mode(offset + 1, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
item->set_text(offset + 2, String::num_uint64(native_refs));
|
||||
item->set_text(offset + 3, String::num_uint64(objectdb_refs));
|
||||
item->set_text(offset + 4, String::num_uint64(total_refs));
|
||||
@@ -179,7 +190,7 @@ void SnapshotRefCountedView::_refcounted_selected() {
|
||||
}
|
||||
|
||||
SnapshotDataObject *d = item_data_map[refs_list->get_selected()];
|
||||
EditorNode::get_singleton()->push_item((Object *)d);
|
||||
EditorNode::get_singleton()->push_item(static_cast<Object *>(d));
|
||||
|
||||
DarkPanelContainer *refcounted_panel = memnew(DarkPanelContainer);
|
||||
VBoxContainer *refcounted_panel_content = memnew(VBoxContainer);
|
||||
@@ -211,10 +222,10 @@ void SnapshotRefCountedView::_refcounted_selected() {
|
||||
Array ref_cycles = (Array)d->extra_debug_data["ref_cycles"];
|
||||
|
||||
String count_str = "[ul]\n";
|
||||
count_str += TTR(" Native References: ") + String::num_uint64(native_refs) + "\n";
|
||||
count_str += TTR(" ObjectDB References: ") + String::num_uint64(objectdb_refs) + "\n";
|
||||
count_str += TTR(" Total References: ") + String::num_uint64(total_refs) + "\n";
|
||||
count_str += TTR(" ObjectDB Cycles: ") + String::num_uint64(ref_cycles.size()) + "\n";
|
||||
count_str += vformat(TTRC("Native References: %d\n"), native_refs);
|
||||
count_str += vformat(TTRC("ObjectDB References: %d\n"), objectdb_refs);
|
||||
count_str += vformat(TTRC("Total References: %d\n"), total_refs);
|
||||
count_str += vformat(TTRC("ObjectDB Cycles: %d\n"), ref_cycles.size());
|
||||
count_str += "[/ul]\n";
|
||||
RichTextLabel *counts = memnew(RichTextLabel(count_str));
|
||||
counts->set_use_bbcode(true);
|
||||
@@ -223,7 +234,7 @@ void SnapshotRefCountedView::_refcounted_selected() {
|
||||
properties_container->add_child(counts);
|
||||
|
||||
if (d->inbound_references.size() > 0) {
|
||||
RichTextLabel *inbound_lbl = memnew(RichTextLabel(TTR("[center]ObjectDB References[center]")));
|
||||
RichTextLabel *inbound_lbl = memnew(RichTextLabel(TTRC("[center]ObjectDB References[center]")));
|
||||
inbound_lbl->set_fit_content(true);
|
||||
inbound_lbl->set_use_bbcode(true);
|
||||
properties_container->add_child(inbound_lbl);
|
||||
@@ -234,17 +245,17 @@ void SnapshotRefCountedView::_refcounted_selected() {
|
||||
inbound_tree->set_hide_root(true);
|
||||
inbound_tree->set_columns(3);
|
||||
inbound_tree->set_column_titles_visible(true);
|
||||
inbound_tree->set_column_title(0, TTR("Source"));
|
||||
inbound_tree->set_column_title(0, TTRC("Source"));
|
||||
inbound_tree->set_column_expand(0, true);
|
||||
inbound_tree->set_column_clip_content(0, false);
|
||||
inbound_tree->set_column_title_tooltip_text(0, TTR("Other object referencing this object"));
|
||||
inbound_tree->set_column_title(1, TTR("Property"));
|
||||
inbound_tree->set_column_title_tooltip_text(0, TTRC("Other object referencing this object"));
|
||||
inbound_tree->set_column_title(1, TTRC("Property"));
|
||||
inbound_tree->set_column_expand(1, true);
|
||||
inbound_tree->set_column_clip_content(1, true);
|
||||
inbound_tree->set_column_title_tooltip_text(1, TTR("Property of other object referencing this object"));
|
||||
inbound_tree->set_column_title(2, TTR("Duplicate?"));
|
||||
inbound_tree->set_column_title_tooltip_text(1, TTRC("Property of other object referencing this object"));
|
||||
inbound_tree->set_column_title(2, TTRC("Duplicate?"));
|
||||
inbound_tree->set_column_expand(2, false);
|
||||
inbound_tree->set_column_title_tooltip_text(2, TTR("Was the same reference returned by multiple getters on the source object?"));
|
||||
inbound_tree->set_column_title_tooltip_text(2, TTRC("Was the same reference returned by multiple getters on the source object?"));
|
||||
inbound_tree->set_h_size_flags(SizeFlags::SIZE_EXPAND_FILL);
|
||||
inbound_tree->set_v_size_flags(SizeFlags::SIZE_EXPAND_FILL);
|
||||
inbound_tree->set_v_scroll_enabled(false);
|
||||
@@ -266,14 +277,16 @@ void SnapshotRefCountedView::_refcounted_selected() {
|
||||
TreeItem *i = inbound_tree->create_item(root);
|
||||
SnapshotDataObject *target = d->snapshot->objects[ob.value];
|
||||
i->set_text(0, target->get_name());
|
||||
i->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
i->set_text(1, ob.key);
|
||||
i->set_text(2, property_repeat_count[ob.value] > 1 ? TTR("Yes") : TTR("No"));
|
||||
i->set_auto_translate_mode(1, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
i->set_text(2, property_repeat_count[ob.value] > 1 ? TTRC("Yes") : TTRC("No"));
|
||||
reference_item_map[i] = data_item_map[target];
|
||||
}
|
||||
}
|
||||
|
||||
if (ref_cycles.size() > 0) {
|
||||
properties_container->add_child(memnew(SpanningHeader(TTR("ObjectDB Cycles"))));
|
||||
properties_container->add_child(memnew(SpanningHeader(TTRC("ObjectDB Cycles"))));
|
||||
Tree *cycles_tree = memnew(Tree);
|
||||
cycles_tree->set_hide_folding(true);
|
||||
properties_container->add_child(cycles_tree);
|
||||
|
||||
Reference in New Issue
Block a user