You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +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:
@@ -316,7 +316,7 @@ void EditorNode::_update_scene_tabs() {
|
||||
disambiguate_filenames(full_path_names, disambiguated_scene_names);
|
||||
|
||||
scene_tabs->clear_tabs();
|
||||
Ref<Texture2D> script_icon = gui_base->get_theme_icon("Script", "EditorIcons");
|
||||
Ref<Texture2D> script_icon = gui_base->get_theme_icon(SNAME("Script"), SNAME("EditorIcons"));
|
||||
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
|
||||
Node *type_node = editor_data.get_edited_scene_root(i);
|
||||
Ref<Texture2D> icon;
|
||||
@@ -427,7 +427,7 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_script", p_event)) {
|
||||
_editor_select(EDITOR_SCRIPT);
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
|
||||
emit_signal("request_help_search", "");
|
||||
emit_signal(SNAME("request_help_search"), "");
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && StreamPeerSSL::is_available()) {
|
||||
_editor_select(EDITOR_ASSETLIB);
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
|
||||
@@ -553,7 +553,7 @@ void EditorNode::_notification(int p_what) {
|
||||
if (settings_changed) {
|
||||
_update_from_settings();
|
||||
settings_changed = false;
|
||||
emit_signal("project_settings_changed");
|
||||
emit_signal(SNAME("project_settings_changed"));
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -642,17 +642,17 @@ void EditorNode::_notification(int p_what) {
|
||||
theme_base->set_theme(theme);
|
||||
gui_base->set_theme(theme);
|
||||
|
||||
gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles"));
|
||||
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox("Content", "EditorStyles"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
|
||||
scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
|
||||
scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
|
||||
gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
|
||||
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
|
||||
scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
|
||||
scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
|
||||
|
||||
file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
|
||||
if (EDITOR_GET("interface/scene_tabs/resize_if_many_tabs")) {
|
||||
scene_tabs->set_min_width(int(EDITOR_GET("interface/scene_tabs/minimum_width")) * EDSCALE);
|
||||
@@ -665,7 +665,7 @@ void EditorNode::_notification(int p_what) {
|
||||
|
||||
// debugger area
|
||||
if (EditorDebuggerNode::get_singleton()->is_visible()) {
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles")));
|
||||
}
|
||||
|
||||
// update_icons
|
||||
@@ -683,17 +683,17 @@ void EditorNode::_notification(int p_what) {
|
||||
|
||||
_build_icon_type_cache();
|
||||
|
||||
play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons"));
|
||||
pause_button->set_icon(gui_base->get_theme_icon("Pause", "EditorIcons"));
|
||||
stop_button->set_icon(gui_base->get_theme_icon("Stop", "EditorIcons"));
|
||||
play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
|
||||
pause_button->set_icon(gui_base->get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
|
||||
stop_button->set_icon(gui_base->get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
|
||||
|
||||
prev_scene->set_icon(gui_base->get_theme_icon("PrevScene", "EditorIcons"));
|
||||
distraction_free->set_icon(gui_base->get_theme_icon("DistractionFree", "EditorIcons"));
|
||||
scene_tab_add->set_icon(gui_base->get_theme_icon("Add", "EditorIcons"));
|
||||
prev_scene->set_icon(gui_base->get_theme_icon(SNAME("PrevScene"), SNAME("EditorIcons")));
|
||||
distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")));
|
||||
scene_tab_add->set_icon(gui_base->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||
|
||||
bottom_panel_raise->set_icon(gui_base->get_theme_icon("ExpandBottomDock", "EditorIcons"));
|
||||
bottom_panel_raise->set_icon(gui_base->get_theme_icon(SNAME("ExpandBottomDock"), SNAME("EditorIcons")));
|
||||
|
||||
// clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons")); don't have access to that node. needs to become a class property
|
||||
if (gui_base->is_layout_rtl()) {
|
||||
@@ -705,19 +705,19 @@ void EditorNode::_notification(int p_what) {
|
||||
}
|
||||
|
||||
PopupMenu *p = help_menu->get_popup();
|
||||
p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_theme_icon("HelpSearch", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_REPORT_A_BUG), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_SUGGEST_A_FEATURE), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_SEND_DOCS_FEEDBACK), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_SUPPORT_GODOT_DEVELOPMENT), gui_base->get_theme_icon("Heart", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_REPORT_A_BUG), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_SUGGEST_A_FEATURE), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_SEND_DOCS_FEEDBACK), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon(SNAME("Godot"), SNAME("EditorIcons")));
|
||||
p->set_item_icon(p->get_item_index(HELP_SUPPORT_GODOT_DEVELOPMENT), gui_base->get_theme_icon(SNAME("Heart"), SNAME("EditorIcons")));
|
||||
|
||||
for (int i = 0; i < main_editor_buttons.size(); i++) {
|
||||
main_editor_buttons.write[i]->add_theme_font_override("font", gui_base->get_theme_font("main_button_font", "EditorFonts"));
|
||||
main_editor_buttons.write[i]->add_theme_font_size_override("font_size", gui_base->get_theme_font_size("main_button_font_size", "EditorFonts"));
|
||||
main_editor_buttons.write[i]->add_theme_font_override("font", gui_base->get_theme_font(SNAME("main_button_font"), SNAME("EditorFonts")));
|
||||
main_editor_buttons.write[i]->add_theme_font_size_override("font_size", gui_base->get_theme_font_size(SNAME("main_button_font_size"), SNAME("EditorFonts")));
|
||||
}
|
||||
|
||||
_update_update_spinner();
|
||||
@@ -972,7 +972,7 @@ void EditorNode::_scan_external_changes() {
|
||||
}
|
||||
|
||||
if (need_reload) {
|
||||
disk_changed->call_deferred("popup_centered_ratio", 0.5);
|
||||
disk_changed->call_deferred(SNAME("popup_centered_ratio"), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
|
||||
}
|
||||
|
||||
((Resource *)p_resource.ptr())->set_path(path);
|
||||
emit_signal("resource_saved", p_resource);
|
||||
emit_signal(SNAME("resource_saved"), p_resource);
|
||||
editor_data.notify_resource_saved(p_resource);
|
||||
}
|
||||
|
||||
@@ -2217,11 +2217,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
|
||||
}
|
||||
|
||||
play_button->set_pressed(false);
|
||||
play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons"));
|
||||
play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
|
||||
play_scene_button->set_pressed(false);
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
|
||||
play_custom_scene_button->set_pressed(false);
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
|
||||
|
||||
String run_filename;
|
||||
String args;
|
||||
@@ -2294,17 +2294,17 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit_signal("play_pressed");
|
||||
emit_signal(SNAME("play_pressed"));
|
||||
if (p_current) {
|
||||
play_scene_button->set_pressed(true);
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
|
||||
} else if (p_custom != "") {
|
||||
run_custom_filename = p_custom;
|
||||
play_custom_scene_button->set_pressed(true);
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
|
||||
} else {
|
||||
play_button->set_pressed(true);
|
||||
play_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons"));
|
||||
play_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
|
||||
}
|
||||
stop_button->set_disabled(false);
|
||||
|
||||
@@ -2324,7 +2324,7 @@ void EditorNode::_run_native(const Ref<EditorExportPreset> &p_preset) {
|
||||
}
|
||||
|
||||
EditorDebuggerNode::get_singleton()->start(p_preset->get_platform()->get_debug_protocol());
|
||||
emit_signal("play_pressed");
|
||||
emit_signal(SNAME("play_pressed"));
|
||||
editor_run.run_native_notify();
|
||||
}
|
||||
}
|
||||
@@ -2639,11 +2639,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
editor_run.stop();
|
||||
run_custom_filename.clear();
|
||||
play_button->set_pressed(false);
|
||||
play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons"));
|
||||
play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
|
||||
play_scene_button->set_pressed(false);
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
|
||||
play_custom_scene_button->set_pressed(false);
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
|
||||
stop_button->set_disabled(true);
|
||||
|
||||
if (bool(EDITOR_GET("run/output/always_close_output_on_stop"))) {
|
||||
@@ -2655,7 +2655,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
}
|
||||
}
|
||||
EditorDebuggerNode::get_singleton()->stop();
|
||||
emit_signal("stop_pressed");
|
||||
emit_signal(SNAME("stop_pressed"));
|
||||
|
||||
} break;
|
||||
|
||||
@@ -2793,7 +2793,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
|
||||
} break;
|
||||
case HELP_SEARCH: {
|
||||
emit_signal("request_help_search", "");
|
||||
emit_signal(SNAME("request_help_search"), "");
|
||||
} break;
|
||||
case HELP_DOCS: {
|
||||
OS::get_singleton()->shell_open("https://docs.godotengine.org/");
|
||||
@@ -3067,8 +3067,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
|
||||
tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), "EditorIcons"));
|
||||
}
|
||||
|
||||
tb->add_theme_font_override("font", singleton->gui_base->get_theme_font("main_button_font", "EditorFonts"));
|
||||
tb->add_theme_font_size_override("font_size", singleton->gui_base->get_theme_font_size("main_button_font_size", "EditorFonts"));
|
||||
tb->add_theme_font_override("font", singleton->gui_base->get_theme_font(SNAME("main_button_font"), SNAME("EditorFonts")));
|
||||
tb->add_theme_font_size_override("font_size", singleton->gui_base->get_theme_font_size(SNAME("main_button_font_size"), SNAME("EditorFonts")));
|
||||
|
||||
tb->set_name(p_editor->get_name());
|
||||
singleton->main_editor_buttons.push_back(tb);
|
||||
@@ -3366,7 +3366,7 @@ void EditorNode::set_current_scene(int p_idx) {
|
||||
editor_folding.load_scene_folding(editor_data.get_edited_scene_root(p_idx), editor_data.get_scene_path(p_idx));
|
||||
}
|
||||
|
||||
call_deferred("_clear_undo_history");
|
||||
call_deferred(SNAME("_clear_undo_history"));
|
||||
}
|
||||
|
||||
changing_scene = true;
|
||||
@@ -3403,7 +3403,7 @@ void EditorNode::set_current_scene(int p_idx) {
|
||||
|
||||
_update_title();
|
||||
|
||||
call_deferred("_set_main_scene_state", state, get_edited_scene()); //do after everything else is done setting up
|
||||
call_deferred(SNAME("_set_main_scene_state"), state, get_edited_scene()); //do after everything else is done setting up
|
||||
}
|
||||
|
||||
bool EditorNode::is_scene_open(const String &p_path) {
|
||||
@@ -3650,7 +3650,7 @@ void EditorNode::_add_to_recent_scenes(const String &p_scene) {
|
||||
void EditorNode::_open_recent_scene(int p_idx) {
|
||||
if (p_idx == recent_scenes->get_item_count() - 1) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("recent_files", "scenes", Array());
|
||||
call_deferred("_update_recent_scenes");
|
||||
call_deferred(SNAME("_update_recent_scenes"));
|
||||
} else {
|
||||
Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array());
|
||||
ERR_FAIL_INDEX(p_idx, rc.size());
|
||||
@@ -3712,7 +3712,7 @@ void EditorNode::add_io_error(const String &p_error) {
|
||||
|
||||
void EditorNode::_load_error_notify(void *p_ud, const String &p_text) {
|
||||
EditorNode *en = (EditorNode *)p_ud;
|
||||
en->load_errors->add_image(en->gui_base->get_theme_icon("Error", "EditorIcons"));
|
||||
en->load_errors->add_image(en->gui_base->get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
|
||||
en->load_errors->add_text(p_text + "\n");
|
||||
en->load_error_dialog->popup_centered_ratio(0.5);
|
||||
}
|
||||
@@ -3939,7 +3939,7 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
|
||||
}
|
||||
|
||||
if (p_fallback.length()) {
|
||||
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
|
||||
return gui_base->get_theme_icon(p_fallback, SNAME("EditorIcons"));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -3980,12 +3980,12 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
|
||||
}
|
||||
}
|
||||
|
||||
if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
|
||||
return gui_base->get_theme_icon(p_class, "EditorIcons");
|
||||
if (gui_base->has_theme_icon(p_class, SNAME("EditorIcons"))) {
|
||||
return gui_base->get_theme_icon(p_class, SNAME("EditorIcons"));
|
||||
}
|
||||
|
||||
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) {
|
||||
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
|
||||
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, SNAME("EditorIcons"))) {
|
||||
return gui_base->get_theme_icon(p_fallback, SNAME("EditorIcons"));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -4289,7 +4289,7 @@ void EditorNode::_dock_select_draw() {
|
||||
|
||||
Color used = Color(0.6, 0.6, 0.6, 0.8);
|
||||
Color used_selected = Color(0.8, 0.8, 0.8, 0.8);
|
||||
Color tab_selected = theme_base->get_theme_color("mono_color", "Editor");
|
||||
Color tab_selected = theme_base->get_theme_color(SNAME("mono_color"), SNAME("Editor"));
|
||||
Color unused = used;
|
||||
unused.a = 0.4;
|
||||
Color unusable = unused;
|
||||
@@ -5052,9 +5052,9 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
|
||||
bottom_panel_items[i].control->set_visible(i == p_idx);
|
||||
}
|
||||
if (EditorDebuggerNode::get_singleton() == bottom_panel_items[p_idx].control) { // this is the debug panel which uses tabs, so the top section should be smaller
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles")));
|
||||
} else {
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
|
||||
}
|
||||
center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
|
||||
center_split->set_collapsed(false);
|
||||
@@ -5064,7 +5064,7 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
|
||||
bottom_panel_raise->show();
|
||||
|
||||
} else {
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
|
||||
bottom_panel_items[p_idx].button->set_pressed(false);
|
||||
bottom_panel_items[p_idx].control->set_visible(false);
|
||||
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
|
||||
@@ -5153,7 +5153,7 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
|
||||
|
||||
{
|
||||
//todo make proper previews
|
||||
Ref<ImageTexture> texture = gui_base->get_theme_icon("FileBigThumb", "EditorIcons");
|
||||
Ref<ImageTexture> texture = gui_base->get_theme_icon(SNAME("FileBigThumb"), SNAME("EditorIcons"));
|
||||
Ref<Image> img = texture->get_image();
|
||||
img = img->duplicate();
|
||||
img->resize(48, 48); //meh
|
||||
@@ -5205,10 +5205,10 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Control *
|
||||
|
||||
if (p_paths[i].ends_with("/")) {
|
||||
label->set_text(p_paths[i].substr(0, p_paths[i].length() - 1).get_file());
|
||||
icon->set_texture(gui_base->get_theme_icon("Folder", "EditorIcons"));
|
||||
icon->set_texture(gui_base->get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||
} else {
|
||||
label->set_text(p_paths[i].get_file());
|
||||
icon->set_texture(gui_base->get_theme_icon("File", "EditorIcons"));
|
||||
icon->set_texture(gui_base->get_theme_icon(SNAME("File"), SNAME("EditorIcons")));
|
||||
}
|
||||
icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
|
||||
icon->set_size(Size2(16, 16));
|
||||
@@ -5480,7 +5480,7 @@ void EditorNode::_update_video_driver_color() {
|
||||
if (video_driver->get_text() == "GLES2") {
|
||||
video_driver->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
|
||||
} else if (video_driver->get_text() == "Vulkan") {
|
||||
video_driver->add_theme_color_override("font_color", theme_base->get_theme_color("vulkan_color", "Editor"));
|
||||
video_driver->add_theme_color_override("font_color", theme_base->get_theme_color(SNAME("vulkan_color"), SNAME("Editor")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5910,7 +5910,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
theme_base->set_theme(theme);
|
||||
gui_base->set_theme(theme);
|
||||
gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles"));
|
||||
gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
|
||||
|
||||
resource_preview = memnew(EditorResourcePreview);
|
||||
add_child(resource_preview);
|
||||
@@ -6091,8 +6091,8 @@ EditorNode::EditorNode() {
|
||||
tab_preview_panel->add_child(tab_preview);
|
||||
|
||||
scene_tabs = memnew(Tabs);
|
||||
scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles"));
|
||||
scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles"));
|
||||
scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
|
||||
scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
|
||||
scene_tabs->set_select_with_rmb(true);
|
||||
scene_tabs->add_tab("unsaved");
|
||||
scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
|
||||
@@ -6126,7 +6126,7 @@ EditorNode::EditorNode() {
|
||||
#endif
|
||||
distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
|
||||
distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
|
||||
distraction_free->set_icon(gui_base->get_theme_icon("DistractionFree", "EditorIcons"));
|
||||
distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")));
|
||||
distraction_free->set_toggle_mode(true);
|
||||
|
||||
scene_tab_add = memnew(Button);
|
||||
@@ -6134,13 +6134,13 @@ EditorNode::EditorNode() {
|
||||
tabbar_container->add_child(scene_tab_add);
|
||||
tabbar_container->add_child(distraction_free);
|
||||
scene_tab_add->set_tooltip(TTR("Add a new scene."));
|
||||
scene_tab_add->set_icon(gui_base->get_theme_icon("Add", "EditorIcons"));
|
||||
scene_tab_add->set_icon(gui_base->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||
scene_tab_add->add_theme_color_override("icon_normal_color", Color(0.6f, 0.6f, 0.6f, 0.8f));
|
||||
scene_tab_add->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_NEW_SCENE));
|
||||
|
||||
scene_root_parent = memnew(PanelContainer);
|
||||
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
|
||||
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox("Content", "EditorStyles"));
|
||||
scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
|
||||
scene_root_parent->set_draw_behind_parent(true);
|
||||
srt->add_child(scene_root_parent);
|
||||
scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
@@ -6164,12 +6164,12 @@ EditorNode::EditorNode() {
|
||||
file_menu->set_flat(false);
|
||||
file_menu->set_switch_on_hover(true);
|
||||
file_menu->set_text(TTR("Scene"));
|
||||
file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
left_menu_hb->add_child(file_menu);
|
||||
|
||||
prev_scene = memnew(Button);
|
||||
prev_scene->set_flat(true);
|
||||
prev_scene->set_icon(gui_base->get_theme_icon("PrevScene", "EditorIcons"));
|
||||
prev_scene->set_icon(gui_base->get_theme_icon(SNAME("PrevScene"), SNAME("EditorIcons")));
|
||||
prev_scene->set_tooltip(TTR("Go to previously opened scene."));
|
||||
prev_scene->set_disabled(true);
|
||||
prev_scene->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_OPEN_PREV));
|
||||
@@ -6268,7 +6268,7 @@ EditorNode::EditorNode() {
|
||||
project_menu->set_switch_on_hover(true);
|
||||
project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
|
||||
project_menu->set_text(TTR("Project"));
|
||||
project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
left_menu_hb->add_child(project_menu);
|
||||
|
||||
p = project_menu->get_popup();
|
||||
@@ -6319,7 +6319,7 @@ EditorNode::EditorNode() {
|
||||
debug_menu->set_flat(false);
|
||||
debug_menu->set_switch_on_hover(true);
|
||||
debug_menu->set_text(TTR("Debug"));
|
||||
debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
left_menu_hb->add_child(debug_menu);
|
||||
|
||||
menu_hb->add_spacer();
|
||||
@@ -6328,7 +6328,7 @@ EditorNode::EditorNode() {
|
||||
settings_menu->set_flat(false);
|
||||
settings_menu->set_switch_on_hover(true);
|
||||
settings_menu->set_text(TTR("Editor"));
|
||||
settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
left_menu_hb->add_child(settings_menu);
|
||||
|
||||
p = settings_menu->get_popup();
|
||||
@@ -6381,26 +6381,26 @@ EditorNode::EditorNode() {
|
||||
help_menu->set_flat(false);
|
||||
help_menu->set_switch_on_hover(true);
|
||||
help_menu->set_text(TTR("Help"));
|
||||
help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles"));
|
||||
help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
|
||||
left_menu_hb->add_child(help_menu);
|
||||
|
||||
p = help_menu->get_popup();
|
||||
p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
|
||||
#ifdef OSX_ENABLED
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_MASK_ALT | KEY_SPACE), HELP_SEARCH);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_MASK_ALT | KEY_SPACE), HELP_SEARCH);
|
||||
#else
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F1), HELP_SEARCH);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F1), HELP_SEARCH);
|
||||
#endif
|
||||
p->add_separator();
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Questions & Answers")), HELP_QA);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/report_a_bug", TTR("Report a Bug")), HELP_REPORT_A_BUG);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/suggest_a_feature", TTR("Suggest a Feature")), HELP_SUGGEST_A_FEATURE);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/send_docs_feedback", TTR("Send Docs Feedback")), HELP_SEND_DOCS_FEEDBACK);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/q&a", TTR("Questions & Answers")), HELP_QA);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/report_a_bug", TTR("Report a Bug")), HELP_REPORT_A_BUG);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/suggest_a_feature", TTR("Suggest a Feature")), HELP_SUGGEST_A_FEATURE);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/send_docs_feedback", TTR("Send Docs Feedback")), HELP_SEND_DOCS_FEEDBACK);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY);
|
||||
p->add_separator();
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Godot", "EditorIcons"), ED_SHORTCUT("editor/about", TTR("About Godot")), HELP_ABOUT);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon("Heart", "EditorIcons"), ED_SHORTCUT("editor/support_development", TTR("Support Godot Development")), HELP_SUPPORT_GODOT_DEVELOPMENT);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Godot"), SNAME("EditorIcons")), ED_SHORTCUT("editor/about", TTR("About Godot")), HELP_ABOUT);
|
||||
p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Heart"), SNAME("EditorIcons")), ED_SHORTCUT("editor/support_development", TTR("Support Godot Development")), HELP_SUPPORT_GODOT_DEVELOPMENT);
|
||||
|
||||
HBoxContainer *play_hb = memnew(HBoxContainer);
|
||||
menu_hb->add_child(play_hb);
|
||||
@@ -6409,7 +6409,7 @@ EditorNode::EditorNode() {
|
||||
play_button->set_flat(true);
|
||||
play_hb->add_child(play_button);
|
||||
play_button->set_toggle_mode(true);
|
||||
play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons"));
|
||||
play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
|
||||
play_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY));
|
||||
play_button->set_tooltip(TTR("Play the project."));
|
||||
@@ -6422,7 +6422,7 @@ EditorNode::EditorNode() {
|
||||
pause_button = memnew(Button);
|
||||
pause_button->set_flat(true);
|
||||
pause_button->set_toggle_mode(true);
|
||||
pause_button->set_icon(gui_base->get_theme_icon("Pause", "EditorIcons"));
|
||||
pause_button->set_icon(gui_base->get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
|
||||
pause_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
pause_button->set_tooltip(TTR("Pause the scene execution for debugging."));
|
||||
pause_button->set_disabled(true);
|
||||
@@ -6437,7 +6437,7 @@ EditorNode::EditorNode() {
|
||||
stop_button->set_flat(true);
|
||||
play_hb->add_child(stop_button);
|
||||
stop_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
stop_button->set_icon(gui_base->get_theme_icon("Stop", "EditorIcons"));
|
||||
stop_button->set_icon(gui_base->get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
|
||||
stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP));
|
||||
stop_button->set_tooltip(TTR("Stop the scene."));
|
||||
stop_button->set_disabled(true);
|
||||
@@ -6456,7 +6456,7 @@ EditorNode::EditorNode() {
|
||||
play_hb->add_child(play_scene_button);
|
||||
play_scene_button->set_toggle_mode(true);
|
||||
play_scene_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")));
|
||||
play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE));
|
||||
play_scene_button->set_tooltip(TTR("Play the edited scene."));
|
||||
#ifdef OSX_ENABLED
|
||||
@@ -6470,7 +6470,7 @@ EditorNode::EditorNode() {
|
||||
play_hb->add_child(play_custom_scene_button);
|
||||
play_custom_scene_button->set_toggle_mode(true);
|
||||
play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE);
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons")));
|
||||
play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE));
|
||||
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
|
||||
#ifdef OSX_ENABLED
|
||||
@@ -6486,8 +6486,8 @@ EditorNode::EditorNode() {
|
||||
video_driver = memnew(OptionButton);
|
||||
video_driver->set_focus_mode(Control::FOCUS_NONE);
|
||||
video_driver->connect("item_selected", callable_mp(this, &EditorNode::_video_driver_selected));
|
||||
video_driver->add_theme_font_override("font", gui_base->get_theme_font("bold", "EditorFonts"));
|
||||
video_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size("bold_size", "EditorFonts"));
|
||||
video_driver->add_theme_font_override("font", gui_base->get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
|
||||
video_driver->add_theme_font_size_override("font_size", gui_base->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")));
|
||||
// TODO: Show again when OpenGL is ported.
|
||||
video_driver->set_visible(false);
|
||||
right_menu_hb->add_child(video_driver);
|
||||
@@ -6529,7 +6529,7 @@ EditorNode::EditorNode() {
|
||||
update_spinner = memnew(MenuButton);
|
||||
update_spinner->set_tooltip(TTR("Spins when the editor window redraws."));
|
||||
right_menu_hb->add_child(update_spinner);
|
||||
update_spinner->set_icon(gui_base->get_theme_icon("Progress1", "EditorIcons"));
|
||||
update_spinner->set_icon(gui_base->get_theme_icon(SNAME("Progress1"), SNAME("EditorIcons")));
|
||||
update_spinner->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
|
||||
p = update_spinner->get_popup();
|
||||
p->add_radio_check_item(TTR("Update Continuously"), SETTINGS_UPDATE_CONTINUOUSLY);
|
||||
@@ -6606,7 +6606,7 @@ EditorNode::EditorNode() {
|
||||
// Bottom panels
|
||||
|
||||
bottom_panel = memnew(PanelContainer);
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
|
||||
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
|
||||
center_split->add_child(bottom_panel);
|
||||
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
|
||||
|
||||
@@ -6649,7 +6649,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
bottom_panel_raise = memnew(Button);
|
||||
bottom_panel_raise->set_flat(true);
|
||||
bottom_panel_raise->set_icon(gui_base->get_theme_icon("ExpandBottomDock", "EditorIcons"));
|
||||
bottom_panel_raise->set_icon(gui_base->get_theme_icon(SNAME("ExpandBottomDock"), SNAME("EditorIcons")));
|
||||
|
||||
bottom_panel_raise->set_shortcut(ED_SHORTCUT("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KEY_MASK_SHIFT | KEY_F12));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user