You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-07 19:53:17 +00:00
Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
This commit is contained in:
@@ -94,7 +94,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
|
||||
|
||||
if (!_can_edit(p_current, selected_group)) {
|
||||
node->set_selectable(0, false);
|
||||
node->set_custom_color(0, groups->get_theme_color("disabled_font_color", "Editor"));
|
||||
node->set_custom_color(0, groups->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ void GroupDialog::_add_group(String p_name) {
|
||||
|
||||
TreeItem *new_group = groups->create_item(groups_root);
|
||||
new_group->set_text(0, name);
|
||||
new_group->add_button(0, groups->get_theme_icon("Remove", "EditorIcons"), 0);
|
||||
new_group->add_button(0, groups->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), 0);
|
||||
new_group->set_editable(0, true);
|
||||
new_group->select(0);
|
||||
groups->ensure_cursor_is_visible();
|
||||
@@ -365,16 +365,16 @@ void GroupDialog::_notification(int p_what) {
|
||||
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
if (is_layout_rtl()) {
|
||||
add_button->set_icon(groups->get_theme_icon("Back", "EditorIcons"));
|
||||
remove_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons"));
|
||||
add_button->set_icon(groups->get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
|
||||
remove_button->set_icon(groups->get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
|
||||
} else {
|
||||
add_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons"));
|
||||
remove_button->set_icon(groups->get_theme_icon("Back", "EditorIcons"));
|
||||
add_button->set_icon(groups->get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
|
||||
remove_button->set_icon(groups->get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
|
||||
}
|
||||
|
||||
add_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons"));
|
||||
add_filter->set_right_icon(groups->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||
add_filter->set_clear_button_enabled(true);
|
||||
remove_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons"));
|
||||
remove_filter->set_right_icon(groups->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||
remove_filter->set_clear_button_enabled(true);
|
||||
} break;
|
||||
}
|
||||
@@ -655,7 +655,7 @@ void GroupsEditor::update_tree() {
|
||||
TreeItem *item = tree->create_item(root);
|
||||
item->set_text(0, gi.name);
|
||||
if (can_be_deleted) {
|
||||
item->add_button(0, get_theme_icon("Remove", "EditorIcons"), 0);
|
||||
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), 0);
|
||||
} else {
|
||||
item->set_selectable(0, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user