You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-30 16:26:50 +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:
@@ -53,12 +53,12 @@ void EditorAutoloadSettings::_notification(int p_what) {
|
||||
for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
|
||||
AutoLoadInfo &info = E->get();
|
||||
if (info.node && info.in_editor) {
|
||||
get_tree()->get_root()->call_deferred("add_child", info.node);
|
||||
get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node);
|
||||
}
|
||||
}
|
||||
browse_button->set_icon(get_theme_icon("Folder", "EditorIcons"));
|
||||
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
browse_button->set_icon(get_theme_icon("Folder", "EditorIcons"));
|
||||
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,10 +453,10 @@ void EditorAutoloadSettings::update_autoload() {
|
||||
item->set_editable(2, true);
|
||||
item->set_text(2, TTR("Enable"));
|
||||
item->set_checked(2, info.is_singleton);
|
||||
item->add_button(3, get_theme_icon("Load", "EditorIcons"), BUTTON_OPEN);
|
||||
item->add_button(3, get_theme_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
|
||||
item->add_button(3, get_theme_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
|
||||
item->add_button(3, get_theme_icon("Remove", "EditorIcons"), BUTTON_DELETE);
|
||||
item->add_button(3, get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), BUTTON_OPEN);
|
||||
item->add_button(3, get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")), BUTTON_MOVE_UP);
|
||||
item->add_button(3, get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")), BUTTON_MOVE_DOWN);
|
||||
item->add_button(3, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_DELETE);
|
||||
item->set_selectable(3, false);
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ void EditorAutoloadSettings::update_autoload() {
|
||||
}
|
||||
if (info.in_editor) {
|
||||
ERR_CONTINUE(!info.node);
|
||||
get_tree()->get_root()->call_deferred("remove_child", info.node);
|
||||
get_tree()->get_root()->call_deferred(SNAME("remove_child"), info.node);
|
||||
}
|
||||
|
||||
if (info.node) {
|
||||
@@ -914,7 +914,7 @@ EditorAutoloadSettings::~EditorAutoloadSettings() {
|
||||
|
||||
void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) {
|
||||
autoload_add_path->set_text(p_text);
|
||||
autoload_add_path->emit_signal("text_submitted", p_text);
|
||||
autoload_add_path->emit_signal(SNAME("text_submitted"), p_text);
|
||||
}
|
||||
|
||||
void EditorAutoloadSettings::_browse_autoload_add_path() {
|
||||
|
||||
Reference in New Issue
Block a user