You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +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:
@@ -49,10 +49,10 @@ void OpenTypeFeaturesEditor::update_property() {
|
||||
|
||||
void OpenTypeFeaturesEditor::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
Color base = get_theme_color("accent_color", "Editor");
|
||||
Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
|
||||
button->set_icon(get_theme_icon("Remove", "EditorIcons"));
|
||||
button->set_size(get_theme_icon("Remove", "EditorIcons")->get_size());
|
||||
button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
|
||||
button->set_size(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))->get_size());
|
||||
spin->set_custom_label_color(true, base);
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void OpenTypeFeaturesAdd::update_property() {
|
||||
bool have_ss = false;
|
||||
bool have_cv = false;
|
||||
bool have_cu = false;
|
||||
Dictionary features = Object::cast_to<Control>(get_edited_object())->get_theme_font("font")->get_feature_list();
|
||||
Dictionary features = Object::cast_to<Control>(get_edited_object())->get_theme_font(SNAME("font"))->get_feature_list();
|
||||
for (const Variant *ftr = features.next(nullptr); ftr != nullptr; ftr = features.next(ftr)) {
|
||||
String ftr_name = TS->tag_to_name(*ftr);
|
||||
if (ftr_name.begins_with("stylistic_set_")) {
|
||||
@@ -142,8 +142,8 @@ void OpenTypeFeaturesAdd::_features_menu() {
|
||||
void OpenTypeFeaturesAdd::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
||||
set_label("");
|
||||
button->set_icon(get_theme_icon("Add", "EditorIcons"));
|
||||
button->set_size(get_theme_icon("Add", "EditorIcons")->get_size());
|
||||
button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||
button->set_size(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))->get_size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user