From 6631f66c2a9d54dc80d57df60376c84ce1252d08 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 17 Jul 2021 18:22:52 -0300 Subject: 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. --- core/input/input.cpp | 2 +- core/io/multiplayer_api.cpp | 12 +- core/object/undo_redo.cpp | 6 +- core/string/string_name.cpp | 36 ++- core/string/string_name.h | 20 +- editor/action_map_editor.cpp | 44 ++-- editor/animation_bezier_editor.cpp | 50 ++-- editor/animation_track_editor.cpp | 284 ++++++++++----------- editor/animation_track_editor_plugins.cpp | 130 +++++----- editor/audio_stream_preview.cpp | 4 +- editor/code_editor.cpp | 120 ++++----- editor/connections_dialog.cpp | 24 +- editor/create_dialog.cpp | 16 +- editor/debugger/editor_debugger_inspector.cpp | 8 +- editor/debugger/editor_debugger_node.cpp | 28 +- editor/debugger/editor_debugger_node.h | 2 +- editor/debugger/editor_debugger_tree.cpp | 10 +- editor/debugger/editor_network_profiler.cpp | 22 +- editor/debugger/editor_performance_profiler.cpp | 10 +- editor/debugger/editor_profiler.cpp | 18 +- editor/debugger/editor_visual_profiler.cpp | 22 +- editor/debugger/script_editor_debugger.cpp | 88 +++---- editor/dependency_editor.cpp | 18 +- editor/editor_about.cpp | 6 +- editor/editor_asset_installer.cpp | 92 +++---- editor/editor_audio_buses.cpp | 92 +++---- editor/editor_autoload_settings.cpp | 18 +- editor/editor_data.cpp | 8 +- editor/editor_dir_dialog.cpp | 4 +- editor/editor_feature_profile.cpp | 4 +- editor/editor_file_dialog.cpp | 92 +++---- editor/editor_file_system.cpp | 30 +-- editor/editor_help.cpp | 80 +++--- editor/editor_help_search.cpp | 22 +- editor/editor_inspector.cpp | 188 +++++++------- editor/editor_layouts_dialog.cpp | 4 +- editor/editor_log.cpp | 44 ++-- editor/editor_node.cpp | 200 +++++++-------- editor/editor_path.cpp | 4 +- editor/editor_plugin.cpp | 14 +- editor/editor_plugin_settings.cpp | 2 +- editor/editor_properties.cpp | 100 ++++---- editor/editor_properties_array_dict.cpp | 16 +- editor/editor_resource_picker.cpp | 48 ++-- editor/editor_resource_preview.cpp | 4 +- editor/editor_run_native.cpp | 2 +- editor/editor_sectioned_inspector.cpp | 4 +- editor/editor_settings.cpp | 4 +- editor/editor_spin_slider.cpp | 36 +-- editor/editor_themes.cpp | 2 +- editor/editor_zoom_widget.cpp | 10 +- editor/export_template_manager.cpp | 16 +- editor/filesystem_dock.cpp | 166 ++++++------ editor/find_in_files.cpp | 40 +-- editor/groups_editor.cpp | 18 +- editor/import/scene_import_settings.cpp | 44 ++-- editor/import_defaults_editor.cpp | 2 +- editor/import_dock.cpp | 8 +- editor/inspector_dock.cpp | 68 ++--- editor/localization_editor.cpp | 10 +- editor/node_3d_editor_gizmos.cpp | 26 +- editor/node_dock.cpp | 4 +- editor/plugin_config_dialog.cpp | 6 +- editor/plugins/abstract_polygon_2d_editor.cpp | 14 +- editor/plugins/animation_blend_space_1d_editor.cpp | 34 +-- editor/plugins/animation_blend_space_2d_editor.cpp | 46 ++-- .../plugins/animation_blend_tree_editor_plugin.cpp | 20 +- editor/plugins/animation_player_editor_plugin.cpp | 38 +-- editor/plugins/animation_state_machine_editor.cpp | 78 +++--- editor/plugins/asset_library_editor_plugin.cpp | 44 ++-- editor/plugins/audio_stream_editor_plugin.cpp | 32 +-- editor/plugins/canvas_item_editor_plugin.cpp | 232 ++++++++--------- .../plugins/collision_polygon_3d_editor_plugin.cpp | 6 +- .../plugins/collision_shape_2d_editor_plugin.cpp | 2 +- editor/plugins/cpu_particles_2d_editor_plugin.cpp | 2 +- editor/plugins/cpu_particles_3d_editor_plugin.cpp | 2 +- editor/plugins/curve_editor_plugin.cpp | 26 +- editor/plugins/editor_debugger_plugin.cpp | 8 +- editor/plugins/font_editor_plugin.cpp | 18 +- editor/plugins/gpu_particles_2d_editor_plugin.cpp | 2 +- editor/plugins/gpu_particles_3d_editor_plugin.cpp | 2 +- .../gpu_particles_collision_sdf_editor_plugin.cpp | 8 +- editor/plugins/item_list_editor_plugin.cpp | 4 +- editor/plugins/lightmap_gi_editor_plugin.cpp | 2 +- editor/plugins/material_editor_plugin.cpp | 18 +- editor/plugins/mesh_editor_plugin.cpp | 8 +- editor/plugins/mesh_instance_3d_editor_plugin.cpp | 2 +- editor/plugins/mesh_library_editor_plugin.cpp | 2 +- editor/plugins/multimesh_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 244 +++++++++--------- .../plugins/occluder_instance_3d_editor_plugin.cpp | 2 +- editor/plugins/ot_features_plugin.cpp | 12 +- editor/plugins/path_2d_editor_plugin.cpp | 18 +- editor/plugins/path_3d_editor_plugin.cpp | 18 +- editor/plugins/physical_bone_3d_editor_plugin.cpp | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 40 +-- .../plugins/resource_preloader_editor_plugin.cpp | 8 +- editor/plugins/root_motion_editor_plugin.cpp | 6 +- editor/plugins/script_editor_plugin.cpp | 56 ++-- editor/plugins/script_text_editor.cpp | 62 ++--- editor/plugins/shader_editor_plugin.cpp | 20 +- editor/plugins/shader_file_editor_plugin.cpp | 12 +- editor/plugins/skeleton_2d_editor_plugin.cpp | 2 +- editor/plugins/skeleton_3d_editor_plugin.cpp | 22 +- editor/plugins/skeleton_ik_3d_editor_plugin.cpp | 2 +- editor/plugins/sprite_2d_editor_plugin.cpp | 2 +- editor/plugins/sprite_frames_editor_plugin.cpp | 38 +-- editor/plugins/text_editor.cpp | 22 +- editor/plugins/texture_3d_editor_plugin.cpp | 2 +- editor/plugins/texture_layered_editor_plugin.cpp | 2 +- editor/plugins/texture_region_editor_plugin.cpp | 16 +- editor/plugins/theme_editor_plugin.cpp | 220 ++++++++-------- editor/plugins/theme_editor_preview.cpp | 20 +- editor/plugins/tiles/tile_atlas_view.cpp | 18 +- editor/plugins/tiles/tile_data_editors.cpp | 50 ++-- editor/plugins/tiles/tile_map_editor.cpp | 42 +-- .../plugins/tiles/tile_set_atlas_source_editor.cpp | 52 ++-- editor/plugins/tiles/tile_set_editor.cpp | 12 +- .../tile_set_scenes_collection_source_editor.cpp | 18 +- editor/plugins/tiles/tiles_editor_plugin.cpp | 4 +- editor/plugins/version_control_editor_plugin.cpp | 28 +- editor/plugins/visual_shader_editor_plugin.cpp | 118 ++++----- editor/plugins/voxel_gi_editor_plugin.cpp | 8 +- editor/progress_dialog.cpp | 2 +- editor/project_export.cpp | 16 +- editor/project_manager.cpp | 66 ++--- editor/project_settings_editor.cpp | 14 +- editor/property_editor.cpp | 94 +++---- editor/property_selector.cpp | 70 ++--- editor/quick_open.cpp | 6 +- editor/rename_dialog.cpp | 10 +- editor/reparent_dialog.cpp | 2 +- editor/scene_tree_dock.cpp | 104 ++++---- editor/scene_tree_editor.cpp | 88 +++---- editor/script_create_dialog.cpp | 24 +- editor/settings_config_dialog.cpp | 38 +-- editor/shader_globals_editor.cpp | 4 +- modules/csg/csg_shape.cpp | 2 +- modules/enet/enet_multiplayer_peer.cpp | 16 +- .../gdnative/gdnative_library_editor_plugin.cpp | 24 +- modules/gdscript/editor/gdscript_highlighter.cpp | 2 +- modules/gdscript/gdscript_function.cpp | 4 +- .../language_server/gdscript_text_document.cpp | 4 +- modules/gridmap/grid_map.cpp | 2 +- modules/gridmap/grid_map_editor_plugin.cpp | 8 +- modules/mono/editor/editor_internal_calls.cpp | 2 +- modules/navigation/godot_navigation_server.cpp | 2 +- .../navigation/navigation_mesh_editor_plugin.cpp | 4 +- modules/opensimplex/noise_texture.cpp | 4 +- modules/visual_script/visual_script.cpp | 4 +- modules/visual_script/visual_script_editor.cpp | 198 +++++++------- modules/visual_script/visual_script_nodes.cpp | 2 +- .../visual_script_property_selector.cpp | 66 ++--- modules/webrtc/webrtc_multiplayer_peer.cpp | 12 +- modules/webrtc/webrtc_peer_connection_js.cpp | 6 +- modules/websocket/websocket_client.cpp | 14 +- modules/websocket/websocket_multiplayer_peer.cpp | 8 +- modules/websocket/websocket_server.cpp | 12 +- modules/webxr/webxr_interface_js.cpp | 12 +- platform/android/java_godot_lib_jni.cpp | 2 +- platform/android/plugin/godot_plugin_jni.cpp | 2 +- platform/javascript/javascript_main.cpp | 2 +- scene/2d/audio_stream_player_2d.cpp | 2 +- scene/2d/navigation_agent_2d.cpp | 8 +- scene/2d/skeleton_2d.cpp | 6 +- scene/2d/tile_map.cpp | 16 +- scene/2d/touch_screen_button.cpp | 4 +- scene/3d/audio_stream_player_3d.cpp | 2 +- scene/3d/navigation_agent_3d.cpp | 8 +- scene/3d/navigation_region_3d.cpp | 8 +- scene/3d/path_3d.cpp | 2 +- scene/3d/proximity_group_3d.cpp | 2 +- scene/3d/soft_body_3d.cpp | 4 +- scene/3d/xr_nodes.cpp | 8 +- scene/animation/animation_blend_space_1d.cpp | 8 +- scene/animation/animation_blend_space_2d.cpp | 14 +- scene/animation/animation_blend_tree.cpp | 10 +- scene/animation/animation_node_state_machine.cpp | 14 +- scene/animation/animation_player.cpp | 2 +- scene/animation/animation_tree.cpp | 2 +- scene/animation/tween.cpp | 14 +- scene/audio/audio_stream_player.cpp | 2 +- scene/gui/base_button.cpp | 12 +- scene/gui/box_container.cpp | 4 +- scene/gui/button.cpp | 114 ++++----- scene/gui/check_box.cpp | 20 +- scene/gui/check_button.cpp | 8 +- scene/gui/code_edit.cpp | 54 ++-- scene/gui/color_picker.cpp | 82 +++--- scene/gui/dialogs.cpp | 18 +- scene/gui/file_dialog.cpp | 44 ++-- scene/gui/gradient_edit.cpp | 14 +- scene/gui/graph_edit.cpp | 108 ++++---- scene/gui/graph_node.cpp | 76 +++--- scene/gui/grid_container.cpp | 8 +- scene/gui/item_list.cpp | 80 +++--- scene/gui/label.cpp | 44 ++-- scene/gui/line_edit.cpp | 70 ++--- scene/gui/link_button.cpp | 24 +- scene/gui/margin_container.cpp | 16 +- scene/gui/option_button.cpp | 44 ++-- scene/gui/panel.cpp | 2 +- scene/gui/panel_container.cpp | 18 +- scene/gui/popup.cpp | 6 +- scene/gui/popup_menu.cpp | 96 +++---- scene/gui/progress_bar.cpp | 22 +- scene/gui/range.cpp | 4 +- scene/gui/rich_text_label.cpp | 106 ++++---- scene/gui/scroll_bar.cpp | 52 ++-- scene/gui/scroll_container.cpp | 14 +- scene/gui/separator.cpp | 6 +- scene/gui/slider.cpp | 10 +- scene/gui/spin_box.cpp | 8 +- scene/gui/split_container.cpp | 28 +- scene/gui/tab_container.cpp | 120 ++++----- scene/gui/tabs.cpp | 126 ++++----- scene/gui/text_edit.cpp | 76 +++--- scene/gui/tree.cpp | 196 +++++++------- scene/main/http_request.cpp | 44 ++-- scene/main/node.cpp | 4 +- scene/main/scene_tree.cpp | 8 +- scene/main/timer.cpp | 4 +- scene/main/viewport.cpp | 40 +-- scene/main/window.cpp | 20 +- scene/resources/curve.cpp | 4 +- scene/resources/syntax_highlighter.cpp | 2 +- scene/resources/texture.cpp | 2 +- scene/resources/tile_set.cpp | 64 ++--- scene/resources/visual_shader.cpp | 8 +- scene/resources/visual_shader_nodes.cpp | 6 +- servers/audio_server.cpp | 10 +- servers/camera_server.cpp | 4 +- servers/navigation_server_2d.cpp | 2 +- servers/rendering/rendering_server_default.cpp | 4 +- servers/xr_server.cpp | 8 +- tests/test_gui.cpp | 2 +- 236 files changed, 3720 insertions(+), 3696 deletions(-) diff --git a/core/input/input.cpp b/core/input/input.cpp index a712394b35..f57985831a 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -438,7 +438,7 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S } joy_names[p_idx] = js; - emit_signal("joy_connection_changed", p_idx, p_connected); + emit_signal(SNAME("joy_connection_changed"), p_idx, p_connected); } Vector3 Input::get_gravity() const { diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index 9f92388196..0745757d48 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -941,7 +941,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, uint16_t p_rpc_id, const void MultiplayerAPI::_add_peer(int p_id) { connected_peers.insert(p_id); path_get_cache.insert(p_id, PathGetCache()); - emit_signal("network_peer_connected", p_id); + emit_signal(SNAME("network_peer_connected"), p_id); } void MultiplayerAPI::_del_peer(int p_id) { @@ -956,19 +956,19 @@ void MultiplayerAPI::_del_peer(int p_id) { PathSentCache *psc = path_send_cache.getptr(E->get()); psc->confirmed_peers.erase(p_id); } - emit_signal("network_peer_disconnected", p_id); + emit_signal(SNAME("network_peer_disconnected"), p_id); } void MultiplayerAPI::_connected_to_server() { - emit_signal("connected_to_server"); + emit_signal(SNAME("connected_to_server")); } void MultiplayerAPI::_connection_failed() { - emit_signal("connection_failed"); + emit_signal(SNAME("connection_failed")); } void MultiplayerAPI::_server_disconnected() { - emit_signal("server_disconnected"); + emit_signal(SNAME("server_disconnected")); } void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) { @@ -1059,7 +1059,7 @@ void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_pac uint8_t *w = out.ptrw(); memcpy(&w[0], &p_packet[1], len); } - emit_signal("network_peer_packet", p_from, out); + emit_signal(SNAME("network_peer_packet"), p_from, out); } int MultiplayerAPI::get_network_unique_id() const { diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp index 96c96c1efb..0b3d93dc3a 100644 --- a/core/object/undo_redo.cpp +++ b/core/object/undo_redo.cpp @@ -65,7 +65,7 @@ bool UndoRedo::_redo(bool p_execute) { _process_operation_list(actions.write[current_action].do_ops.front()); } version++; - emit_signal("version_changed"); + emit_signal(SNAME("version_changed")); return true; } @@ -352,7 +352,7 @@ bool UndoRedo::undo() { _process_operation_list(actions.write[current_action].undo_ops.front()); current_action--; version--; - emit_signal("version_changed"); + emit_signal(SNAME("version_changed")); return true; } @@ -385,7 +385,7 @@ void UndoRedo::clear_history(bool p_increase_version) { if (p_increase_version) { version++; - emit_signal("version_changed"); + emit_signal(SNAME("version_changed")); } } diff --git a/core/string/string_name.cpp b/core/string/string_name.cpp index 14b87072bb..44ebafc643 100644 --- a/core/string/string_name.cpp +++ b/core/string/string_name.cpp @@ -41,8 +41,8 @@ StaticCString StaticCString::create(const char *p_ptr) { StringName::_Data *StringName::_table[STRING_TABLE_LEN]; -StringName _scs_create(const char *p_chr) { - return (p_chr[0] ? StringName(StaticCString::create(p_chr)) : StringName()); +StringName _scs_create(const char *p_chr, bool p_static) { + return (p_chr[0] ? StringName(StaticCString::create(p_chr), p_static) : StringName()); } bool StringName::configured = false; @@ -64,7 +64,7 @@ void StringName::cleanup() { while (_table[i]) { _Data *d = _table[i]; lost_strings++; - if (OS::get_singleton()->is_stdout_verbose()) { + if (d->static_count.get() != d->refcount.get() && OS::get_singleton()->is_stdout_verbose()) { if (d->cname) { print_line("Orphan StringName: " + String(d->cname)); } else { @@ -79,6 +79,7 @@ void StringName::cleanup() { if (lost_strings) { print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit."); } + configured = false; } void StringName::unref() { @@ -87,6 +88,13 @@ void StringName::unref() { if (_data && _data->refcount.unref()) { MutexLock lock(mutex); + if (_data->static_count.get() > 0) { + if (_data->cname) { + ERR_PRINT("BUG: Unreferenced static string to 0: " + String(_data->cname)); + } else { + ERR_PRINT("BUG: Unreferenced static string to 0: " + String(_data->name)); + } + } if (_data->prev) { _data->prev->next = _data->next; } else { @@ -153,7 +161,7 @@ StringName::StringName(const StringName &p_name) { } } -StringName::StringName(const char *p_name) { +StringName::StringName(const char *p_name, bool p_static) { _data = nullptr; ERR_FAIL_COND(!configured); @@ -181,6 +189,9 @@ StringName::StringName(const char *p_name) { if (_data) { if (_data->refcount.ref()) { // exists + if (p_static) { + _data->static_count.increment(); + } return; } } @@ -188,6 +199,7 @@ StringName::StringName(const char *p_name) { _data = memnew(_Data); _data->name = p_name; _data->refcount.init(); + _data->static_count.set(p_static ? 1 : 0); _data->hash = hash; _data->idx = idx; _data->cname = nullptr; @@ -199,7 +211,7 @@ StringName::StringName(const char *p_name) { _table[idx] = _data; } -StringName::StringName(const StaticCString &p_static_string) { +StringName::StringName(const StaticCString &p_static_string, bool p_static) { _data = nullptr; ERR_FAIL_COND(!configured); @@ -225,6 +237,9 @@ StringName::StringName(const StaticCString &p_static_string) { if (_data) { if (_data->refcount.ref()) { // exists + if (p_static) { + _data->static_count.increment(); + } return; } } @@ -232,6 +247,7 @@ StringName::StringName(const StaticCString &p_static_string) { _data = memnew(_Data); _data->refcount.init(); + _data->static_count.set(p_static ? 1 : 0); _data->hash = hash; _data->idx = idx; _data->cname = p_static_string.ptr; @@ -243,7 +259,7 @@ StringName::StringName(const StaticCString &p_static_string) { _table[idx] = _data; } -StringName::StringName(const String &p_name) { +StringName::StringName(const String &p_name, bool p_static) { _data = nullptr; ERR_FAIL_COND(!configured); @@ -269,6 +285,9 @@ StringName::StringName(const String &p_name) { if (_data) { if (_data->refcount.ref()) { // exists + if (p_static) { + _data->static_count.increment(); + } return; } } @@ -276,6 +295,7 @@ StringName::StringName(const String &p_name) { _data = memnew(_Data); _data->name = p_name; _data->refcount.init(); + _data->static_count.set(p_static ? 1 : 0); _data->hash = hash; _data->idx = idx; _data->cname = nullptr; @@ -374,10 +394,6 @@ StringName StringName::search(const String &p_name) { return StringName(); //does not exist } -StringName::~StringName() { - unref(); -} - bool operator==(const String &p_name, const StringName &p_string_name) { return p_name == p_string_name.operator String(); } diff --git a/core/string/string_name.h b/core/string/string_name.h index 44d0ea14fa..ead321c5b0 100644 --- a/core/string/string_name.h +++ b/core/string/string_name.h @@ -44,13 +44,15 @@ struct StaticCString { class StringName { enum { - STRING_TABLE_BITS = 12, + STRING_TABLE_BITS = 16, STRING_TABLE_LEN = 1 << STRING_TABLE_BITS, STRING_TABLE_MASK = STRING_TABLE_LEN - 1 }; struct _Data { SafeRefCount refcount; + SafeNumeric static_count; + SafeRefCount static_refcount; const char *cname = nullptr; String name; @@ -146,12 +148,16 @@ public: }; void operator=(const StringName &p_name); - StringName(const char *p_name); + StringName(const char *p_name, bool p_static = false); StringName(const StringName &p_name); - StringName(const String &p_name); - StringName(const StaticCString &p_static_string); + StringName(const String &p_name, bool p_static = false); + StringName(const StaticCString &p_static_string, bool p_static = false); StringName() {} - ~StringName(); + _FORCE_INLINE_ ~StringName() { + if (likely(configured) && _data) { //only free if configured + unref(); + } + } }; bool operator==(const String &p_name, const StringName &p_string_name); @@ -159,6 +165,8 @@ bool operator!=(const String &p_name, const StringName &p_string_name); bool operator==(const char *p_name, const StringName &p_string_name); bool operator!=(const char *p_name, const StringName &p_string_name); -StringName _scs_create(const char *p_chr); +StringName _scs_create(const char *p_chr, bool p_static = false); + +#define SNAME(m_arg) ([]() { static StringName sname = _scs_create(m_arg, true); return sname; })() #endif // STRING_NAME_H diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 1c3ba89cd3..04c1c9951b 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -200,7 +200,7 @@ void InputEventConfigurationDialog::_tab_selected(int p_tab) { if (is_connected("window_input", signal_method)) { disconnect("window_input", signal_method); } - input_list_tree->call_deferred("ensure_cursor_is_visible"); + input_list_tree->call_deferred(SNAME("ensure_cursor_is_visible")); if (input_list_tree->get_selected() == nullptr) { // If nothing selected, scroll to top. input_list_tree->scroll_to_item(input_list_tree->get_root()); @@ -532,14 +532,14 @@ void InputEventConfigurationDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - input_list_search->set_right_icon(input_list_search->get_theme_icon("Search", "EditorIcons")); + input_list_search->set_right_icon(input_list_search->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); - physical_key_checkbox->set_icon(get_theme_icon("KeyboardPhysical", "EditorIcons")); + physical_key_checkbox->set_icon(get_theme_icon(SNAME("KeyboardPhysical"), SNAME("EditorIcons"))); - icon_cache.keyboard = get_theme_icon("Keyboard", "EditorIcons"); - icon_cache.mouse = get_theme_icon("Mouse", "EditorIcons"); - icon_cache.joypad_button = get_theme_icon("JoyButton", "EditorIcons"); - icon_cache.joypad_axis = get_theme_icon("JoyAxis", "EditorIcons"); + icon_cache.keyboard = get_theme_icon(SNAME("Keyboard"), SNAME("EditorIcons")); + icon_cache.mouse = get_theme_icon(SNAME("Mouse"), SNAME("EditorIcons")); + icon_cache.joypad_button = get_theme_icon(SNAME("JoyButton"), SNAME("EditorIcons")); + icon_cache.joypad_axis = get_theme_icon(SNAME("JoyAxis"), SNAME("EditorIcons")); _update_input_list(); } break; @@ -724,7 +724,7 @@ void ActionMapEditor::_event_config_confirmed() { } new_action["events"] = events; - emit_signal("action_edited", current_action_name, new_action); + emit_signal(SNAME("action_edited"), current_action_name, new_action); } void ActionMapEditor::_add_action_pressed() { @@ -738,7 +738,7 @@ void ActionMapEditor::_add_action(const String &p_name) { } add_edit->clear(); - emit_signal("action_added", p_name); + emit_signal(SNAME("action_added"), p_name); } void ActionMapEditor::_action_edited() { @@ -762,7 +762,7 @@ void ActionMapEditor::_action_edited() { return; } - emit_signal("action_renamed", old_name, new_name); + emit_signal(SNAME("action_renamed"), old_name, new_name); } else if (action_tree->get_selected_column() == 1) { // Deadzone Edited String name = ti->get_meta("__name"); @@ -771,7 +771,7 @@ void ActionMapEditor::_action_edited() { new_action["deadzone"] = ti->get_range(1); // Call deferred so that input can finish propagating through tree, allowing re-making of tree to occur. - call_deferred("emit_signal", "action_edited", name, new_action); + call_deferred(SNAME("emit_signal"), "action_edited", name, new_action); } } @@ -808,7 +808,7 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i case ActionMapEditor::BUTTON_REMOVE_ACTION: { // Send removed action name String name = item->get_meta("__name"); - emit_signal("action_removed", name); + emit_signal(SNAME("action_removed"), name); } break; case ActionMapEditor::BUTTON_REMOVE_EVENT: { // Remove event and send updated action @@ -821,7 +821,7 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i events.remove(event_index); action["events"] = events; - emit_signal("action_edited", action_name, action); + emit_signal(SNAME("action_edited"), action_name, action); } break; default: break; @@ -922,7 +922,7 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, // Change action order. String relative_to = target->get_meta("__name"); String action_name = selected->get_meta("__name"); - emit_signal("action_reordered", action_name, relative_to, drop_above); + emit_signal(SNAME("action_reordered"), action_name, relative_to, drop_above); } else if (d["input_type"] == "event") { // Change event order @@ -956,7 +956,7 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, } new_action["events"] = new_events; - emit_signal("action_edited", selected->get_parent()->get_meta("__name"), new_action); + emit_signal(SNAME("action_edited"), selected->get_parent()->get_meta("__name"), new_action); } } @@ -964,7 +964,7 @@ void ActionMapEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - action_list_search->set_right_icon(get_theme_icon("Search", "EditorIcons")); + action_list_search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); } break; default: break; @@ -1038,11 +1038,11 @@ void ActionMapEditor::update_action_list(const Vector &p_action_info action_item->set_range(1, deadzone); // Third column - buttons - action_item->add_button(2, action_tree->get_theme_icon("Add", "EditorIcons"), BUTTON_ADD_EVENT, false, TTR("Add Event")); - action_item->add_button(2, action_tree->get_theme_icon("Remove", "EditorIcons"), BUTTON_REMOVE_ACTION, !action_info.editable, action_info.editable ? "Remove Action" : "Cannot Remove Action"); + action_item->add_button(2, action_tree->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")), BUTTON_ADD_EVENT, false, TTR("Add Event")); + action_item->add_button(2, action_tree->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_ACTION, !action_info.editable, action_info.editable ? "Remove Action" : "Cannot Remove Action"); - action_item->set_custom_bg_color(0, action_tree->get_theme_color("prop_subsection", "Editor")); - action_item->set_custom_bg_color(1, action_tree->get_theme_color("prop_subsection", "Editor")); + action_item->set_custom_bg_color(0, action_tree->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); + action_item->set_custom_bg_color(1, action_tree->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); for (int evnt_idx = 0; evnt_idx < events.size(); evnt_idx++) { Ref event = events[evnt_idx]; @@ -1058,8 +1058,8 @@ void ActionMapEditor::update_action_list(const Vector &p_action_info event_item->set_meta("__index", evnt_idx); // Third Column - Buttons - event_item->add_button(2, action_tree->get_theme_icon("Edit", "EditorIcons"), BUTTON_EDIT_EVENT, false, TTR("Edit Event")); - event_item->add_button(2, action_tree->get_theme_icon("Remove", "EditorIcons"), BUTTON_REMOVE_EVENT, false, TTR("Remove Event")); + event_item->add_button(2, action_tree->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), BUTTON_EDIT_EVENT, false, TTR("Edit Event")); + event_item->add_button(2, action_tree->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event")); event_item->set_button_color(2, 0, Color(1, 1, 1, 0.75)); event_item->set_button_color(2, 1, Color(1, 1, 1, 0.75)); } diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 63ffab6727..05db9045bd 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -217,19 +217,19 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V void AnimationBezierTrackEdit::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { - bezier_icon = get_theme_icon("KeyBezierPoint", "EditorIcons"); - bezier_handle_icon = get_theme_icon("KeyBezierHandle", "EditorIcons"); - selected_icon = get_theme_icon("KeyBezierSelected", "EditorIcons"); + bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons")); + bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons")); + selected_icon = get_theme_icon(SNAME("KeyBezierSelected"), SNAME("EditorIcons")); if (handle_mode_option->get_item_count() == 0) { - handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE); - handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED); - handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR); + handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesFree"), SNAME("EditorIcons")), TTR("Free"), HANDLE_MODE_FREE); + handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesBalanced"), SNAME("EditorIcons")), TTR("Balanced"), HANDLE_MODE_BALANCED); + handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesMirror"), SNAME("EditorIcons")), TTR("Mirror"), HANDLE_MODE_MIRROR); } } if (p_what == NOTIFICATION_RESIZED) { int right_limit = get_size().width - timeline->get_buttons_width(); - int hsep = get_theme_constant("hseparation", "ItemList"); - int vsep = get_theme_constant("vseparation", "ItemList"); + int hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList")); + int vsep = get_theme_constant(SNAME("vseparation"), SNAME("ItemList")); handle_mode_option->set_position(Vector2(right_limit + hsep, get_size().height - handle_mode_option->get_combined_minimum_size().height - vsep)); handle_mode_option->set_size(Vector2(timeline->get_buttons_width() - hsep * 2, handle_mode_option->get_combined_minimum_size().height)); @@ -242,16 +242,16 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int limit = timeline->get_name_limit(); if (has_focus()) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - Color color = get_theme_color("font_color", "Label"); - int hsep = get_theme_constant("hseparation", "ItemList"); - int vsep = get_theme_constant("vseparation", "ItemList"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); + int hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList")); + int vsep = get_theme_constant(SNAME("vseparation"), SNAME("ItemList")); Color linecolor = color; linecolor.a = 0.2; @@ -261,7 +261,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { draw_line(Point2(right_limit, 0), Point2(right_limit, get_size().height), linecolor); - Ref close_icon = get_theme_icon("Close", "EditorIcons"); + Ref close_icon = get_theme_icon(SNAME("Close"), SNAME("EditorIcons")); close_icon_rect.position = Vector2(get_size().width - close_icon->get_width() - hsep, hsep); close_icon_rect.size = close_icon->get_size(); @@ -349,7 +349,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { subtracks[i] = rect; } else { - Color ac = get_theme_color("accent_color", "Editor"); + Color ac = get_theme_color(SNAME("accent_color"), SNAME("Editor")); ac.a = 0.5; draw_rect(rect, ac); } @@ -360,7 +360,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { vofs += text_buf.get_size().y + vsep; } - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); { //guides float min_left_scale = font->get_height(font_size) + vsep; @@ -401,7 +401,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { { //draw OTHER curves float scale = timeline->get_zoom_scale(); - Ref point = get_theme_icon("KeyValue", "EditorIcons"); + Ref point = get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")); for (Map::Element *E = subtrack_colors.front(); E; E = E->next()) { _draw_track(E->key(), E->get()); @@ -418,7 +418,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { } //draw edited curve - const Color highlight = get_theme_color("highlight_color", "Editor"); + const Color highlight = get_theme_color(SNAME("highlight_color"), SNAME("Editor")); _draw_track(track, highlight); } @@ -547,7 +547,7 @@ void AnimationBezierTrackEdit::_play_position_draw() { int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color color = get_theme_color("accent_color", "Editor"); + Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE)); } } @@ -576,7 +576,7 @@ String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const { void AnimationBezierTrackEdit::_clear_selection() { selection.clear(); - emit_signal("clear_selection"); + emit_signal(SNAME("clear_selection")); update(); } @@ -597,7 +597,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref &p_anim, int ERR_FAIL_COND(idx < 0); selection.insert(idx); - emit_signal("select_key", idx, true); + emit_signal(SNAME("select_key"), idx, true); update(); } @@ -663,9 +663,9 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT); if (selection.size()) { menu->add_separator(); - menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); + menu->add_icon_item(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); menu->add_separator(); - menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); + menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); } menu->set_as_minsize(); @@ -676,7 +676,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (close_icon_rect.has_point(mb->get_position())) { - emit_signal("close_request"); + emit_signal(SNAME("close_request")); return; } for (Map::Element *E = subtracks.front(); E; E = E->next()) { diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 05945a8ae2..174f19280a 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1290,7 +1290,7 @@ public: void AnimationTimelineEdit::_zoom_changed(double) { update(); play_position->update(); - emit_signal("zoom_changed"); + emit_signal(SNAME("zoom_changed")); } float AnimationTimelineEdit::get_zoom_scale() const { @@ -1321,7 +1321,7 @@ void AnimationTimelineEdit::_anim_length_changed(double p_new_len) { editing = false; update(); - emit_signal("length_changed", p_new_len); + emit_signal(SNAME("length_changed"), p_new_len); } void AnimationTimelineEdit::_anim_loop_pressed() { @@ -1332,11 +1332,11 @@ void AnimationTimelineEdit::_anim_loop_pressed() { } int AnimationTimelineEdit::get_buttons_width() const { - Ref interp_mode = get_theme_icon("TrackContinuous", "EditorIcons"); - Ref interp_type = get_theme_icon("InterpRaw", "EditorIcons"); - Ref loop_type = get_theme_icon("InterpWrapClamp", "EditorIcons"); - Ref remove_icon = get_theme_icon("Remove", "EditorIcons"); - Ref down_icon = get_theme_icon("select_arrow", "Tree"); + Ref interp_mode = get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")); + Ref interp_type = get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")); + Ref loop_type = get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")); + Ref remove_icon = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")); + Ref down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree")); int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width(); total_w += (down_icon->get_width() + 4 * EDSCALE) * 4; @@ -1345,7 +1345,7 @@ int AnimationTimelineEdit::get_buttons_width() const { } int AnimationTimelineEdit::get_name_limit() const { - Ref hsize_icon = get_theme_icon("Hsize", "EditorIcons"); + Ref hsize_icon = get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons")); int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width()); @@ -1356,17 +1356,17 @@ int AnimationTimelineEdit::get_name_limit() const { void AnimationTimelineEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - add_track->set_icon(get_theme_icon("Add", "EditorIcons")); - loop->set_icon(get_theme_icon("Loop", "EditorIcons")); - time_icon->set_texture(get_theme_icon("Time", "EditorIcons")); + add_track->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); + loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons"))); + time_icon->set_texture(get_theme_icon(SNAME("Time"), SNAME("EditorIcons"))); add_track->get_popup()->clear(); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyValue", "EditorIcons"), TTR("Property Track")); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track")); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyCall", "EditorIcons"), TTR("Call Method Track")); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track")); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track")); - add_track->get_popup()->add_icon_item(get_theme_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")), TTR("Property Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyXform"), SNAME("EditorIcons")), TTR("3D Transform Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyCall"), SNAME("EditorIcons")), TTR("Call Method Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")), TTR("Bezier Curve Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")), TTR("Audio Playback Track")); + add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons")), TTR("Animation Playback Track")); } if (p_what == NOTIFICATION_RESIZED) { @@ -1381,9 +1381,9 @@ void AnimationTimelineEdit::_notification(int p_what) { return; } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - Color color = get_theme_color("font_color", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); int zoomw = key_range; float scale = get_zoom_scale(); @@ -1394,7 +1394,7 @@ void AnimationTimelineEdit::_notification(int p_what) { l = 0.001; //avoid crashor } - Ref hsize_icon = get_theme_icon("Hsize", "EditorIcons"); + Ref hsize_icon = get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons")); hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height()); draw_texture(hsize_icon, hsize_rect.position); @@ -1443,7 +1443,7 @@ void AnimationTimelineEdit::_notification(int p_what) { int end_px = (l - get_value()) * scale; int begin_px = -get_value() * scale; - Color notimecol = get_theme_color("dark_color_2", "Editor"); + Color notimecol = get_theme_color(SNAME("dark_color_2"), SNAME("Editor")); Color timecolor = color; timecolor.a = 0.2; Color linecolor = color; @@ -1568,10 +1568,10 @@ void AnimationTimelineEdit::set_animation(const Ref &p_animation) { Size2 AnimationTimelineEdit::get_minimum_size() const { Size2 ms = add_track->get_minimum_size(); - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); ms.height = MAX(ms.height, font->get_height(font_size)); - ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_theme_icon("Hsize", "EditorIcons")->get_width() + 2; + ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons"))->get_width() + 2; return ms; } @@ -1633,11 +1633,11 @@ void AnimationTimelineEdit::_play_position_draw() { int px = (-get_value() + play_position_pos) * scale + get_name_limit(); if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) { - Color color = get_theme_color("accent_color", "Editor"); + Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE)); play_position->draw_texture( - get_theme_icon("TimelineIndicator", "EditorIcons"), - Point2(px - get_theme_icon("TimelineIndicator", "EditorIcons")->get_width() * 0.5, 0), + get_theme_icon(SNAME("TimelineIndicator"), SNAME("EditorIcons")), + Point2(px - get_theme_icon(SNAME("TimelineIndicator"), SNAME("EditorIcons"))->get_width() * 0.5, 0), color); } } @@ -1685,7 +1685,7 @@ void AnimationTimelineEdit::_gui_input(const Ref &p_event) { int x = mb->get_position().x - get_name_limit(); float ofs = x / get_zoom_scale() + get_value(); - emit_signal("timeline_changed", ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT)); + emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT)); dragging_timeline = true; } if (!dragging_timeline && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) { @@ -1718,13 +1718,13 @@ void AnimationTimelineEdit::_gui_input(const Ref &p_event) { int ofs = mm->get_position().x - dragging_hsize_from; name_limit = dragging_hsize_at + ofs; update(); - emit_signal("name_limit_changed"); + emit_signal(SNAME("name_limit_changed")); play_position->update(); } if (dragging_timeline) { int x = mm->get_position().x - get_name_limit(); float ofs = x / get_zoom_scale() + get_value(); - emit_signal("timeline_changed", ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT)); + emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT)); } if (panning_timeline) { int x = mm->get_position().x - get_name_limit(); @@ -1750,7 +1750,7 @@ void AnimationTimelineEdit::set_hscroll(HScrollBar *p_hscroll) { } void AnimationTimelineEdit::_track_added(int p_track) { - emit_signal("track_added", p_track); + emit_signal(SNAME("track_added"), p_track); } void AnimationTimelineEdit::_bind_methods() { @@ -1832,31 +1832,31 @@ void AnimationTrackEdit::_notification(int p_what) { int limit = timeline->get_name_limit(); if (has_focus()) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); accent.a *= 0.7; // Offside so the horizontal sides aren't cutoff. draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), accent, false); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - Color color = get_theme_color("font_color", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); Ref type_icons[6] = { - get_theme_icon("KeyValue", "EditorIcons"), - get_theme_icon("KeyXform", "EditorIcons"), - get_theme_icon("KeyCall", "EditorIcons"), - get_theme_icon("KeyBezier", "EditorIcons"), - get_theme_icon("KeyAudio", "EditorIcons"), - get_theme_icon("KeyAnimation", "EditorIcons") + get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyXform"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyCall"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons")) }; - int hsep = get_theme_constant("hseparation", "ItemList"); + int hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList")); Color linecolor = color; linecolor.a = 0.2; // NAMES AND ICONS // { - Ref check = animation->track_is_enabled(track) ? get_theme_icon("checked", "CheckBox") : get_theme_icon("unchecked", "CheckBox"); + Ref check = animation->track_is_enabled(track) ? get_theme_icon(SNAME("checked"), SNAME("CheckBox")) : get_theme_icon(SNAME("unchecked"), SNAME("CheckBox")); int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but.. @@ -1877,7 +1877,7 @@ void AnimationTrackEdit::_notification(int p_what) { String text; Color text_color = color; if (node && EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) { - text_color = get_theme_color("accent_color", "Editor"); + text_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); } if (in_group) { @@ -1952,25 +1952,25 @@ void AnimationTrackEdit::_notification(int p_what) { { Ref wrap_icon[2] = { - get_theme_icon("InterpWrapClamp", "EditorIcons"), - get_theme_icon("InterpWrapLoop", "EditorIcons"), + get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")), + get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")), }; Ref interp_icon[3] = { - get_theme_icon("InterpRaw", "EditorIcons"), - get_theme_icon("InterpLinear", "EditorIcons"), - get_theme_icon("InterpCubic", "EditorIcons") + get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")), + get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")), + get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")) }; Ref cont_icon[4] = { - get_theme_icon("TrackContinuous", "EditorIcons"), - get_theme_icon("TrackDiscrete", "EditorIcons"), - get_theme_icon("TrackTrigger", "EditorIcons"), - get_theme_icon("TrackCapture", "EditorIcons") + get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), + get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), + get_theme_icon(SNAME("TrackTrigger"), SNAME("EditorIcons")), + get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")) }; int ofs = get_size().width - timeline->get_buttons_width(); - Ref down_icon = get_theme_icon("select_arrow", "Tree"); + Ref down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree")); draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE)); @@ -2007,7 +2007,7 @@ void AnimationTrackEdit::_notification(int p_what) { update_mode_rect.size.x += down_icon->get_width(); bezier_edit_rect = Rect2(); } else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) { - Ref bezier_icon = get_theme_icon("EditBezier", "EditorIcons"); + Ref bezier_icon = get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons")); update_mode_rect.size.x += down_icon->get_width(); bezier_edit_rect.position = update_mode_rect.position + (update_mode_rect.size - bezier_icon->get_size()) / 2; bezier_edit_rect.size = bezier_icon->get_size(); @@ -2092,7 +2092,7 @@ void AnimationTrackEdit::_notification(int p_what) { { //erase - Ref icon = get_theme_icon("Remove", "EditorIcons"); + Ref icon = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")); remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width()) / 2; remove_rect.position.y = int(get_size().height - icon->get_height()) / 2; @@ -2109,7 +2109,7 @@ void AnimationTrackEdit::_notification(int p_what) { } if (dropping_at != 0) { - Color drop_color = get_theme_color("accent_color", "Editor"); + Color drop_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); if (dropping_at < 0) { draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE)); } else { @@ -2161,7 +2161,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x, return; } - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); color.a = 0.5; int from_x = MAX(p_x, p_clip_left); @@ -2186,16 +2186,16 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool const Variant &v = animation->track_get_key_value(track, p_index); Variant::Type valid_type = Variant::NIL; if (!_is_value_key_valid(v, valid_type)) { - icon_to_draw = get_theme_icon("KeyInvalid", "EditorIcons"); + icon_to_draw = get_theme_icon(SNAME("KeyInvalid"), SNAME("EditorIcons")); } } Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2); if (animation->track_get_type(track) == Animation::TYPE_METHOD) { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - Color color = get_theme_color("font_color", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); color.a = 0.5; Dictionary d = animation->track_get_key_value(track, p_index); @@ -2298,19 +2298,19 @@ void AnimationTrackEdit::set_animation_and_track(const Ref &p_animati update(); Ref type_icons[6] = { - get_theme_icon("KeyValue", "EditorIcons"), - get_theme_icon("KeyXform", "EditorIcons"), - get_theme_icon("KeyCall", "EditorIcons"), - get_theme_icon("KeyBezier", "EditorIcons"), - get_theme_icon("KeyAudio", "EditorIcons"), - get_theme_icon("KeyAnimation", "EditorIcons") + get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyXform"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyCall"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")), + get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons")) }; ERR_FAIL_INDEX(track, animation->get_track_count()); node_path = animation->track_get_path(p_track); type_icon = type_icons[animation->track_get_type(track)]; - selected_icon = get_theme_icon("KeySelected", "EditorIcons"); + selected_icon = get_theme_icon(SNAME("KeySelected"), SNAME("EditorIcons")); } NodePath AnimationTrackEdit::get_path() const { @@ -2318,10 +2318,10 @@ NodePath AnimationTrackEdit::get_path() const { } Size2 AnimationTrackEdit::get_minimum_size() const { - Ref texture = get_theme_icon("Object", "EditorIcons"); - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - int separation = get_theme_constant("vseparation", "ItemList"); + Ref texture = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + int separation = get_theme_constant(SNAME("vseparation"), SNAME("ItemList")); int max_h = MAX(texture->get_height(), font->get_height(font_size)); max_h = MAX(max_h, get_key_height()); @@ -2355,7 +2355,7 @@ void AnimationTrackEdit::_play_position_draw() { int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color color = get_theme_color("accent_color", "Editor"); + Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE)); } } @@ -2556,17 +2556,17 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { if (p_event->is_pressed()) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { - emit_signal("duplicate_request"); + emit_signal(SNAME("duplicate_request")); accept_event(); } if (ED_GET_SHORTCUT("animation_editor/duplicate_selection_transposed")->is_shortcut(p_event)) { - emit_signal("duplicate_transpose_request"); + emit_signal(SNAME("duplicate_transpose_request")); accept_event(); } if (ED_GET_SHORTCUT("animation_editor/delete_selection")->is_shortcut(p_event)) { - emit_signal("delete_request"); + emit_signal(SNAME("delete_request")); accept_event(); } } @@ -2597,10 +2597,10 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_theme_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); - menu->add_icon_item(get_theme_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE); - menu->add_icon_item(get_theme_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER); - menu->add_icon_item(get_theme_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE); + menu->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); + menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE); + menu->add_icon_item(get_theme_icon(SNAME("TrackTrigger"), SNAME("EditorIcons")), TTR("Trigger"), MENU_CALL_MODE_TRIGGER); + menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE); menu->set_as_minsize(); Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height); @@ -2616,9 +2616,9 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_theme_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST); - menu->add_icon_item(get_theme_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR); - menu->add_icon_item(get_theme_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC); + menu->add_icon_item(get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")), TTR("Nearest"), MENU_INTERPOLATION_NEAREST); + menu->add_icon_item(get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")), TTR("Linear"), MENU_INTERPOLATION_LINEAR); + menu->add_icon_item(get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")), TTR("Cubic"), MENU_INTERPOLATION_CUBIC); menu->set_as_minsize(); Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height); @@ -2634,8 +2634,8 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_theme_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP); - menu->add_icon_item(get_theme_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP); + menu->add_icon_item(get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP); + menu->add_icon_item(get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP); menu->set_as_minsize(); Vector2 popup_pos = get_screen_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height); @@ -2645,13 +2645,13 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } if (remove_rect.has_point(pos)) { - emit_signal("remove_request", track); + emit_signal(SNAME("remove_request"), track); accept_event(); return; } if (bezier_edit_rect.has_point(pos)) { - emit_signal("bezier_edit"); + emit_signal(SNAME("bezier_edit")); accept_event(); } @@ -2692,16 +2692,16 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { if (key_idx != -1) { if (mb->is_command_pressed() || mb->is_shift_pressed()) { if (editor->is_key_selected(track, key_idx)) { - emit_signal("deselect_key", key_idx); + emit_signal(SNAME("deselect_key"), key_idx); } else { - emit_signal("select_key", key_idx, false); + emit_signal(SNAME("select_key"), key_idx, false); moving_selection_attempt = true; select_single_attempt = -1; moving_selection_from_ofs = (mb->get_position().x - limit) / timeline->get_zoom_scale(); } } else { if (!editor->is_key_selected(track, key_idx)) { - emit_signal("select_key", key_idx, true); + emit_signal(SNAME("select_key"), key_idx, true); select_single_attempt = -1; } else { select_single_attempt = key_idx; @@ -2727,12 +2727,12 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } menu->clear(); - menu->add_icon_item(get_theme_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT); + menu->add_icon_item(get_theme_icon(SNAME("Key"), SNAME("EditorIcons")), TTR("Insert Key"), MENU_KEY_INSERT); if (editor->is_selection_active()) { menu->add_separator(); - menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE); + menu->add_icon_item(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE); menu->add_separator(); - menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE); + menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Key(s)"), MENU_KEY_DELETE); } menu->set_as_minsize(); @@ -2757,7 +2757,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } path->set_text(animation->track_get_path(track)); - Vector2 theme_ofs = path->get_theme_stylebox("normal", "LineEdit")->get_offset(); + Vector2 theme_ofs = path->get_theme_stylebox(SNAME("normal"), SNAME("LineEdit"))->get_offset(); path_popup->set_position(get_screen_position() + path_rect.position - theme_ofs); path_popup->set_size(path_rect.size); path_popup->popup(); @@ -2770,9 +2770,9 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { moving_selection_attempt = false; if (moving_selection) { - emit_signal("move_selection_commit"); + emit_signal(SNAME("move_selection_commit")); } else if (select_single_attempt != -1) { - emit_signal("select_key", select_single_attempt, true); + emit_signal(SNAME("select_key"), select_single_attempt, true); } moving_selection = false; select_single_attempt = -1; @@ -2781,7 +2781,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { if (moving_selection && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { moving_selection_attempt = false; moving_selection = false; - emit_signal("move_selection_cancel"); + emit_signal(SNAME("move_selection_cancel")); } } @@ -2789,11 +2789,11 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && moving_selection_attempt) { if (!moving_selection) { moving_selection = true; - emit_signal("move_selection_begin"); + emit_signal(SNAME("move_selection_begin")); } float new_ofs = (mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale(); - emit_signal("move_selection", new_ofs - moving_selection_from_ofs); + emit_signal(SNAME("move_selection"), new_ofs - moving_selection_from_ofs); } } @@ -2847,7 +2847,7 @@ bool AnimationTrackEdit::can_drop_data(const Point2 &p_point, const Variant &p_d } const_cast(this)->update(); - const_cast(this)->emit_signal("drop_attempted", track); + const_cast(this)->emit_signal(SNAME("drop_attempted"), track); return true; } @@ -2875,9 +2875,9 @@ void AnimationTrackEdit::drop_data(const Point2 &p_point, const Variant &p_data) int from_track = d["index"]; if (dropping_at < 0) { - emit_signal("dropped", from_track, track); + emit_signal(SNAME("dropped"), from_track, track); } else { - emit_signal("dropped", from_track, track + 1); + emit_signal(SNAME("dropped"), from_track, track + 1); } } @@ -2916,14 +2916,14 @@ void AnimationTrackEdit::_menu_selected(int p_index) { } break; case MENU_KEY_INSERT: { - emit_signal("insert_key", insert_at_pos); + emit_signal(SNAME("insert_key"), insert_at_pos); } break; case MENU_KEY_DUPLICATE: { - emit_signal("duplicate_request"); + emit_signal(SNAME("duplicate_request")); } break; case MENU_KEY_DELETE: { - emit_signal("delete_request"); + emit_signal(SNAME("delete_request")); } break; } @@ -2956,9 +2956,9 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselect if (select_rect.intersects(rect)) { if (p_deselection) { - emit_signal("deselect_key", i); + emit_signal(SNAME("deselect_key"), i); } else { - emit_signal("select_key", i, false); + emit_signal(SNAME("select_key"), i, false); } } } @@ -3057,19 +3057,19 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object void AnimationTrackEditGroup::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - int separation = get_theme_constant("hseparation", "ItemList"); - Color color = get_theme_color("font_color", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + int separation = get_theme_constant(SNAME("hseparation"), SNAME("ItemList")); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); if (root && root->has_node(node)) { Node *n = root->get_node(node); if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) { - color = get_theme_color("accent_color", "Editor"); + color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); } } - Color bgcol = get_theme_color("dark_color_2", "Editor"); + Color bgcol = get_theme_color(SNAME("dark_color_2"), SNAME("Editor")); bgcol.a *= 0.6; draw_rect(Rect2(Point2(), get_size()), bgcol); Color linecolor = color; @@ -3087,7 +3087,7 @@ void AnimationTrackEditGroup::_notification(int p_what) { int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE)); } } @@ -3102,9 +3102,9 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref &p_type, co } Size2 AnimationTrackEditGroup::get_minimum_size() const { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); - int separation = get_theme_constant("vseparation", "ItemList"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + int separation = get_theme_constant(SNAME("vseparation"), SNAME("ItemList")); return Vector2(0, MAX(font->get_height(font_size), icon->get_height()) + separation); } @@ -3226,7 +3226,7 @@ void AnimationTrackEditor::update_keying() { keying = keying_enabled; - emit_signal("keying_changed"); + emit_signal(SNAME("keying_changed")); } bool AnimationTrackEditor::has_keying() const { @@ -3283,7 +3283,7 @@ void AnimationTrackEditor::_name_limit_changed() { } void AnimationTrackEditor::_timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only) { - emit_signal("timeline_changed", p_new_pos, p_drag, p_timeline_only); + emit_signal(SNAME("timeline_changed"), p_new_pos, p_drag, p_timeline_only); } void AnimationTrackEditor::_track_remove_request(int p_track) { @@ -3430,14 +3430,14 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) { insert_confirm->popup_centered(); insert_query = true; } else { - call_deferred("_insert_delay", reset_allowed && EDITOR_GET("editors/animation/default_create_reset_tracks"), all_bezier && EDITOR_GET("editors/animation/default_create_bezier_tracks")); + call_deferred(SNAME("_insert_delay"), reset_allowed && EDITOR_GET("editors/animation/default_create_reset_tracks"), all_bezier && EDITOR_GET("editors/animation/default_create_bezier_tracks")); insert_queue = true; } } else { if (!insert_query && !insert_queue) { // Create Beziers wouldn't make sense in this case, where no tracks are being created - call_deferred("_insert_delay", reset_allowed && EDITOR_GET("editors/animation/default_create_reset_tracks"), false); + call_deferred(SNAME("_insert_delay"), reset_allowed && EDITOR_GET("editors/animation/default_create_reset_tracks"), false); insert_queue = true; } } @@ -3482,7 +3482,7 @@ void AnimationTrackEditor::_insert_delay(bool p_create_reset, bool p_create_bezi pos = animation->get_length(); } set_anim_pos(pos); - emit_signal("timeline_changed", pos, true); + emit_signal(SNAME("timeline_changed"), pos, true); } insert_queue = false; } @@ -4166,7 +4166,7 @@ void AnimationTrackEditor::_update_tracks() { if (!group_sort.has(base_path)) { AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup); - Ref icon = get_theme_icon("Node", "EditorIcons"); + Ref icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons")); String name = base_path; String tooltip; if (root && root->has_node(base_path)) { @@ -4245,7 +4245,7 @@ void AnimationTrackEditor::_animation_changed() { } animation_changing_awaiting_update = true; - call_deferred("_animation_update"); + call_deferred(SNAME("_animation_update")); } void AnimationTrackEditor::_snap_mode_changed(int p_mode) { @@ -4313,8 +4313,8 @@ void AnimationTrackEditor::_animation_update() { bezier_edit->update(); _update_step_spinbox(); - emit_signal("animation_step_changed", animation->get_step()); - emit_signal("animation_len_changed", animation->get_length()); + emit_signal(SNAME("animation_step_changed"), animation->get_step()); + emit_signal(SNAME("animation_len_changed"), animation->get_length()); animation_changing_awaiting_update = false; } @@ -4325,13 +4325,13 @@ MenuButton *AnimationTrackEditor::get_edit_menu() { void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { - zoom_icon->set_texture(get_theme_icon("Zoom", "EditorIcons")); - snap->set_icon(get_theme_icon("Snap", "EditorIcons")); + zoom_icon->set_texture(get_theme_icon(SNAME("Zoom"), SNAME("EditorIcons"))); + snap->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); - selected_filter->set_icon(get_theme_icon("AnimationFilter", "EditorIcons")); - imported_anim_warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); - main_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); - edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon("Reload", "EditorIcons")); + selected_filter->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons"))); + imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons"))); + main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); + edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); } if (p_what == NOTIFICATION_READY) { @@ -4341,7 +4341,7 @@ void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { update_keying(); EditorNode::get_singleton()->update_keying(); - emit_signal("keying_changed"); + emit_signal(SNAME("keying_changed")); } } @@ -4367,11 +4367,11 @@ void AnimationTrackEditor::_update_step(double p_new_step) { step->set_block_signals(true); undo_redo->commit_action(); step->set_block_signals(false); - emit_signal("animation_step_changed", step_value); + emit_signal(SNAME("animation_step_changed"), step_value); } void AnimationTrackEditor::_update_length(double p_new_len) { - emit_signal("animation_len_changed", p_new_len); + emit_signal(SNAME("animation_len_changed"), p_new_len); } void AnimationTrackEditor::_dropped_track(int p_from_track, int p_to_track) { @@ -4980,8 +4980,8 @@ float AnimationTrackEditor::get_moving_selection_offset() const { void AnimationTrackEditor::_box_selection_draw() { const Rect2 selection_rect = Rect2(Point2(), box_selection->get_size()); - box_selection->draw_rect(selection_rect, get_theme_color("box_selection_fill_color", "Editor")); - box_selection->draw_rect(selection_rect, get_theme_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE)); + box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_fill_color"), SNAME("Editor"))); + box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_stroke_color"), SNAME("Editor")), false, Math::round(EDSCALE)); } void AnimationTrackEditor::_scroll_input(const Ref &p_event) { @@ -5201,7 +5201,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) { pos = 0; } set_anim_pos(pos); - emit_signal("timeline_changed", pos, true); + emit_signal(SNAME("timeline_changed"), pos, true); } void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) { @@ -5228,7 +5228,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) { } set_anim_pos(pos); - emit_signal("timeline_changed", pos, true); + emit_signal(SNAME("timeline_changed"), pos, true); } void AnimationTrackEditor::_edit_menu_pressed(int p_option) { @@ -5247,7 +5247,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } String text; - Ref icon = get_theme_icon("Node", "EditorIcons"); + Ref icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons")); if (node) { if (has_theme_icon(node->get_class(), "EditorIcons")) { icon = get_theme_icon(node->get_class(), "EditorIcons"); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 54c1e89d1e..0caed1e8e3 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -42,12 +42,12 @@ /// BOOL /// int AnimationTrackEditBool::get_key_height() const { - Ref checked = get_theme_icon("checked", "CheckBox"); + Ref checked = get_theme_icon(SNAME("checked"), SNAME("CheckBox")); return checked->get_height(); } Rect2 AnimationTrackEditBool::get_key_rect(int p_index, float p_pixels_sec) { - Ref checked = get_theme_icon("checked", "CheckBox"); + Ref checked = get_theme_icon(SNAME("checked"), SNAME("CheckBox")); return Rect2(-checked->get_width() / 2, 0, checked->get_width(), get_size().height); } @@ -72,7 +72,7 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, draw_texture(icon, ofs); if (p_selected) { - Color color = get_theme_color("accent_color", "Editor"); + Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect_clipped(Rect2(ofs, icon->get_size()), color, false); } } @@ -80,14 +80,14 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, /// COLOR /// int AnimationTrackEditColor::get_key_height() const { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return font->get_height(font_size) * 0.8; } Rect2 AnimationTrackEditColor::get_key_rect(int p_index, float p_pixels_sec) { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; return Rect2(-fh / 2, 0, fh, get_size().height); } @@ -97,8 +97,8 @@ bool AnimationTrackEditColor::is_key_selectable_by_distance() const { } void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = (font->get_height(font_size) * 0.8); fh /= 3; @@ -167,8 +167,8 @@ void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) { Color color = get_animation()->track_get_key_value(get_track(), p_index); - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; Rect2 rect(Vector2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh, fh)); @@ -180,7 +180,7 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, draw_rect_clipped(rect, color); if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect_clipped(rect, accent, false); } } @@ -206,8 +206,8 @@ int AnimationTrackEditAudio::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return int(font->get_height(font_size) * 1.5); } @@ -239,8 +239,8 @@ Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) { return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -303,8 +303,8 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, return; } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); float fh = int(font->get_height(font_size) * 1.5); Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh); draw_rect(rect, Color(0.25, 0.25, 0.25)); @@ -330,20 +330,20 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color); if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); draw_rect(rect, color); if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } @@ -367,8 +367,8 @@ int AnimationTrackEditSpriteFrame::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return int(font->get_height(font_size) * 2); } @@ -435,8 +435,8 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se size = size.floor(); - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int height = int(font->get_height(font_size) * 2); int width = height * size.width / size.height; @@ -526,8 +526,8 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in region.size = texture->get_size(); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int height = int(font->get_height(font_size) * 2); int width = height * region.size.width / region.size.height; @@ -542,7 +542,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in return; } - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); Color bg = accent; bg.a = 0.15; @@ -570,8 +570,8 @@ int AnimationTrackEditSubAnim::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return int(font->get_height(font_size) * 1.5); } @@ -599,8 +599,8 @@ Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) { return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -654,13 +654,13 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_ return; } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 1.5; Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh); - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); Color bg = color; bg.r = 1 - color.r; bg.g = 1 - color.g; @@ -703,20 +703,20 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_ } if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); draw_rect(rect, color); if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } @@ -729,12 +729,12 @@ void AnimationTrackEditSubAnim::set_node(Object *p_object) { //// VOLUME DB //// int AnimationTrackEditVolumeDB::get_key_height() const { - Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon(SNAME("ColorTrackVu"), SNAME("EditorIcons")); return volume_texture->get_height() * 1.2; } void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) { - Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon(SNAME("ColorTrackVu"), SNAME("EditorIcons")); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; @@ -745,7 +745,7 @@ void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) { } void AnimationTrackEditVolumeDB::draw_fg(int p_clip_left, int p_clip_right) { - Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon(SNAME("ColorTrackVu"), SNAME("EditorIcons")); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; int db0 = y_from + (24 / 80.0) * tex_h; @@ -780,12 +780,12 @@ void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec, to_x = p_clip_right; } - Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon(SNAME("ColorTrackVu"), SNAME("EditorIcons")); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); color.a *= 0.7; draw_line(Point2(from_x, y_from + h * tex_h), Point2(to_x, y_from + h_n * tex_h), color, 2); @@ -806,8 +806,8 @@ void AnimationTrackEditTypeAudio::_preview_changed(ObjectID p_which) { } int AnimationTrackEditTypeAudio::get_key_height() const { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return int(font->get_height(font_size) * 1.5); } @@ -871,8 +871,8 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int } } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); float fh = int(font->get_height(font_size) * 1.5); float len = stream->get_length(); @@ -947,7 +947,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color); - Color cut_color = get_theme_color("accent_color", "Editor"); + Color cut_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); cut_color.a = 0.7; if (start_ofs > 0 && pixel_begin > p_clip_left) { draw_rect(Rect2(pixel_begin, rect.position.y, 1, rect.size.y), cut_color); @@ -957,7 +957,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int } if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } @@ -1143,8 +1143,8 @@ int AnimationTrackEditTypeAnimation::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); return int(font->get_height(font_size) * 1.5); } @@ -1172,8 +1172,8 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_ return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -1227,13 +1227,13 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, return; } - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 1.5; Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh); - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); Color bg = color; bg.r = 1 - color.r; bg.g = 1 - color.g; @@ -1276,20 +1276,20 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, } if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } else { - Ref font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_theme_color("font_color", "Label"); + Color color = get_theme_color(SNAME("font_color"), SNAME("Label")); draw_rect(rect, color); if (p_selected) { - Color accent = get_theme_color("accent_color", "Editor"); + Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_rect(rect, accent, false); } } diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp index ad6e3ac1dc..f7f4988873 100644 --- a/editor/audio_stream_preview.cpp +++ b/editor/audio_stream_preview.cpp @@ -97,7 +97,7 @@ AudioStreamPreview::AudioStreamPreview() { //// void AudioStreamPreviewGenerator::_update_emit(ObjectID p_id) { - emit_signal("preview_updated", p_id); + emit_signal(SNAME("preview_updated"), p_id); } void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) { @@ -150,7 +150,7 @@ void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) { } frames_todo -= to_read; - singleton->call_deferred("_update_emit", preview->id); + singleton->call_deferred(SNAME("_update_emit"), preview->id); } preview->playback->stop(); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 03914bec3b..b0ec346afe 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -88,23 +88,23 @@ GotoLineDialog::GotoLineDialog() { void FindReplaceBar::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); + find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); + hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process_unhandled_input(is_visible_in_tree()); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); + find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); + hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_THEME_CHANGED) { - matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); } else if (p_what == NOTIFICATION_PREDELETE) { if (base_text_editor) { base_text_editor->remove_find_replace_bar(); @@ -304,10 +304,10 @@ void FindReplaceBar::_replace_all() { } text_editor->set_v_scroll(vsval); - matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); matches_label->set_text(vformat(TTR("%d replaced."), rc)); - text_editor->call_deferred("connect", "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); + text_editor->call_deferred(SNAME("connect"), "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed)); results_count = -1; } @@ -368,7 +368,7 @@ void FindReplaceBar::_update_matches_label() { } else { matches_label->show(); - matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor"))); matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } @@ -480,10 +480,10 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) { if (p_focus_replace) { search_text->deselect(); - replace_text->call_deferred("grab_focus"); + replace_text->call_deferred(SNAME("grab_focus")); } else { replace_text->deselect(); - search_text->call_deferred("grab_focus"); + search_text->call_deferred(SNAME("grab_focus")); } if (text_editor->is_selection_active() && !selection_only->is_pressed()) { @@ -585,7 +585,7 @@ bool FindReplaceBar::is_selection_only() const { } void FindReplaceBar::set_error(const String &p_label) { - emit_signal("error", p_label); + emit_signal(SNAME("error"), p_label); } void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) { @@ -760,10 +760,10 @@ void CodeTextEditor::_text_editor_gui_input(const Ref &p_event) { Ref magnify_gesture = p_event; if (magnify_gesture.is_valid()) { - font_size = text_editor->get_theme_font_size("font_size"); + font_size = text_editor->get_theme_font_size(SNAME("font_size")); font_size *= powf(magnify_gesture->get_factor(), 0.25); - _add_font_size((int)font_size - text_editor->get_theme_font_size("font_size")); + _add_font_size((int)font_size - text_editor->get_theme_font_size(SNAME("font_size"))); return; } @@ -875,38 +875,38 @@ Ref CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp if (has_theme_icon(p_option.display, "EditorIcons")) { tex = get_theme_icon(p_option.display, "EditorIcons"); } else { - tex = get_theme_icon("Object", "EditorIcons"); + tex = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } } break; case ScriptCodeCompletionOption::KIND_ENUM: - tex = get_theme_icon("Enum", "EditorIcons"); + tex = get_theme_icon(SNAME("Enum"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_FILE_PATH: - tex = get_theme_icon("File", "EditorIcons"); + tex = get_theme_icon(SNAME("File"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_NODE_PATH: - tex = get_theme_icon("NodePath", "EditorIcons"); + tex = get_theme_icon(SNAME("NodePath"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_VARIABLE: - tex = get_theme_icon("Variant", "EditorIcons"); + tex = get_theme_icon(SNAME("Variant"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_CONSTANT: - tex = get_theme_icon("MemberConstant", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberConstant"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_MEMBER: - tex = get_theme_icon("MemberProperty", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberProperty"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_SIGNAL: - tex = get_theme_icon("MemberSignal", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberSignal"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_FUNCTION: - tex = get_theme_icon("MemberMethod", "EditorIcons"); + tex = get_theme_icon(SNAME("MemberMethod"), SNAME("EditorIcons")); break; case ScriptCodeCompletionOption::KIND_PLAIN_TEXT: - tex = get_theme_icon("BoxMesh", "EditorIcons"); + tex = get_theme_icon(SNAME("BoxMesh"), SNAME("EditorIcons")); break; default: - tex = get_theme_icon("String", "EditorIcons"); + tex = get_theme_icon(SNAME("String"), SNAME("EditorIcons")); break; } return tex; @@ -919,7 +919,7 @@ void CodeTextEditor::_font_resize_timeout() { } bool CodeTextEditor::_add_font_size(int p_delta) { - int old_size = text_editor->get_theme_font_size("font_size"); + int old_size = text_editor->get_theme_font_size(SNAME("font_size")); int new_size = CLAMP(old_size + p_delta, 8 * EDSCALE, 96 * EDSCALE); if (new_size != old_size) { @@ -1411,19 +1411,19 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) { void CodeTextEditor::goto_line(int p_line) { text_editor->deselect(); text_editor->unfold_line(p_line); - text_editor->call_deferred("cursor_set_line", p_line); + text_editor->call_deferred(SNAME("cursor_set_line"), p_line); } void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) { text_editor->unfold_line(p_line); - text_editor->call_deferred("cursor_set_line", p_line); - text_editor->call_deferred("cursor_set_column", p_begin); + text_editor->call_deferred(SNAME("cursor_set_line"), p_line); + text_editor->call_deferred(SNAME("cursor_set_column"), p_begin); text_editor->select(p_line, p_begin, p_line, p_end); } void CodeTextEditor::goto_line_centered(int p_line) { goto_line(p_line); - text_editor->call_deferred("center_viewport_to_cursor"); + text_editor->call_deferred(SNAME("center_viewport_to_cursor")); } void CodeTextEditor::set_executing_line(int p_line) { @@ -1542,20 +1542,20 @@ void CodeTextEditor::_update_text_editor_theme() { text_editor->add_theme_color_override("search_result_color", EDITOR_GET("text_editor/highlighting/search_result_color")); text_editor->add_theme_color_override("search_result_border_color", EDITOR_GET("text_editor/highlighting/search_result_border_color")); text_editor->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); - emit_signal("load_theme_settings"); + emit_signal(SNAME("load_theme_settings")); _load_theme_settings(); } void CodeTextEditor::_update_font() { - text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts")); - text_editor->add_theme_font_size_override("font_size", get_theme_font_size("source_size", "EditorFonts")); + text_editor->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + text_editor->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); - error->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts")); - error->add_theme_font_size_override("font_size", get_theme_font_size("status_source_size", "EditorFonts")); - error->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + error->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + error->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); + error->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - Ref status_bar_font = get_theme_font("status_source", "EditorFonts"); - int status_bar_font_size = get_theme_font_size("status_source_size", "EditorFonts"); + Ref status_bar_font = get_theme_font(SNAME("status_source"), SNAME("EditorFonts")); + int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")); error->add_theme_font_override("font", status_bar_font); error->add_theme_font_size_override("font_size", status_bar_font_size); int count = status_bar->get_child_count(); @@ -1614,7 +1614,7 @@ void CodeTextEditor::_on_settings_change() { void CodeTextEditor::_text_changed_idle_timeout() { _validate_script(); - emit_signal("validate_script"); + emit_signal(SNAME("validate_script")); } void CodeTextEditor::validate_script() { @@ -1633,19 +1633,19 @@ void CodeTextEditor::_warning_button_pressed() { void CodeTextEditor::_set_show_errors_panel(bool p_show) { is_errors_panel_opened = p_show; - emit_signal("show_errors_panel", p_show); + emit_signal(SNAME("show_errors_panel"), p_show); } void CodeTextEditor::_set_show_warnings_panel(bool p_show) { is_warnings_panel_opened = p_show; - emit_signal("show_warnings_panel", p_show); + emit_signal(SNAME("show_warnings_panel"), p_show); } void CodeTextEditor::_toggle_scripts_pressed() { if (is_layout_rtl()) { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Forward", "EditorIcons") : get_theme_icon("Back", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon(SNAME("Back"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Forward"), SNAME("EditorIcons"))); } } @@ -1666,8 +1666,8 @@ void CodeTextEditor::_notification(int p_what) { _update_font(); } break; case NOTIFICATION_ENTER_TREE: { - error_button->set_icon(get_theme_icon("StatusError", "EditorIcons")); - warning_button->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); + warning_button->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons"))); add_theme_constant_override("separation", 4 * EDSCALE); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -1779,9 +1779,9 @@ void CodeTextEditor::show_toggle_scripts_button() { void CodeTextEditor::update_toggle_scripts_button() { if (is_layout_rtl()) { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Forward", "EditorIcons") : get_theme_icon("Back", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Back"), SNAME("EditorIcons"))); } else { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon(SNAME("Back"), SNAME("EditorIcons")) : get_theme_icon(SNAME("Forward"), SNAME("EditorIcons"))); } toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); } @@ -1871,9 +1871,9 @@ CodeTextEditor::CodeTextEditor() { error_button->connect("pressed", callable_mp(this, &CodeTextEditor::_error_button_pressed)); error_button->set_tooltip(TTR("Errors")); - error_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); - error_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - error_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + error_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), SNAME("Editor"))); + error_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + error_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); is_errors_panel_opened = false; set_error_count(0); @@ -1887,9 +1887,9 @@ CodeTextEditor::CodeTextEditor() { warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed)); warning_button->set_tooltip(TTR("Warnings")); - warning_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor")); - warning_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - warning_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + warning_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + warning_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + warning_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); is_warnings_panel_opened = false; set_warning_count(0); @@ -1898,8 +1898,8 @@ CodeTextEditor::CodeTextEditor() { line_and_col_txt = memnew(Label); status_bar->add_child(line_and_col_txt); line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); - line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); - line_and_col_txt->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts")); + line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts"))); + line_and_col_txt->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"))); line_and_col_txt->set_tooltip(TTR("Line and column numbers.")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index c79a8d9a0e..c439d6a1d4 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -134,7 +134,7 @@ void ConnectDialog::ok_pressed() { return; } } - emit_signal("connected"); + emit_signal(SNAME("connected")); hide(); } @@ -360,7 +360,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) { void ConnectDialog::popup_dialog(const String &p_for_signal) { from_signal->set_text(p_for_signal); - error_label->add_theme_color_override("font_color", error_label->get_theme_color("error_color", "Editor")); + error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), SNAME("Editor"))); if (!advanced->is_pressed()) { error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); } @@ -509,13 +509,13 @@ ConnectDialog::~ConnectDialog() { // Originally copied and adapted from EditorProperty, try to keep style in sync. Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const { EditorHelpBit *help_bit = memnew(EditorHelpBit); - help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel")); + help_bit->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"))); help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]"; text += p_text.get_slice("::", 1).strip_edges() + "\n"; text += p_text.get_slice("::", 2).strip_edges(); - help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene + help_bit->call_deferred(SNAME("set_text"), text); //hack so it uses proper theme once inside scene return help_bit; } @@ -591,7 +591,7 @@ void ConnectionsDock::_make_or_edit_connection() { it = nullptr; if (add_script_function) { - editor->emit_signal("script_add_function_request", target, cToMake.method, script_function_args); + editor->emit_signal(SNAME("script_add_function_request"), target, cToMake.method, script_function_args); hide(); } @@ -921,14 +921,14 @@ void ConnectionsDock::update_tree() { } } else { ClassDB::get_signal_list(base, &node_signals2, true); - if (has_theme_icon(base, "EditorIcons")) { - icon = get_theme_icon(base, "EditorIcons"); + if (has_theme_icon(base, SNAME("EditorIcons"))) { + icon = get_theme_icon(base, SNAME("EditorIcons")); } name = base; } if (!icon.is_valid()) { - icon = get_theme_icon("Object", "EditorIcons"); + icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } TreeItem *section_item = nullptr; @@ -940,7 +940,7 @@ void ConnectionsDock::update_tree() { section_item->set_icon(0, icon); section_item->set_selectable(0, false); section_item->set_editable(0, false); - section_item->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor")); + section_item->set_custom_bg_color(0, get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); node_signals2.sort(); } @@ -982,7 +982,7 @@ void ConnectionsDock::update_tree() { sinfo["name"] = signal_name; sinfo["args"] = argnames; signal_item->set_metadata(0, sinfo); - signal_item->set_icon(0, get_theme_icon("Signal", "EditorIcons")); + signal_item->set_icon(0, get_theme_icon(SNAME("Signal"), SNAME("EditorIcons"))); // Set tooltip with the signal's documentation. { @@ -1059,7 +1059,7 @@ void ConnectionsDock::update_tree() { connection_item->set_text(0, path); Connection cd = c; connection_item->set_metadata(0, cd); - connection_item->set_icon(0, get_theme_icon("Slot", "EditorIcons")); + connection_item->set_icon(0, get_theme_icon(SNAME("Slot"), SNAME("EditorIcons"))); } } @@ -1083,7 +1083,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_placeholder(TTR("Filter signals")); - search_box->set_right_icon(get_theme_icon("Search", "EditorIcons")); + search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); search_box->set_clear_button_enabled(true); search_box->connect("text_changed", callable_mp(this, &ConnectionsDock::_filter_changed)); vbc->add_child(search_box); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 027cee3f1c..3b002961f9 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -40,7 +40,7 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_select_type) { _fill_type_list(); - icon_fallback = search_options->has_theme_icon(base_type, "EditorIcons") ? base_type : "Object"; + icon_fallback = search_options->has_theme_icon(base_type, SNAME("EditorIcons")) ? base_type : "Object"; if (p_dont_clear) { search_box->select_all(); @@ -168,7 +168,7 @@ void CreateDialog::_update_search() { TreeItem *root = search_options->create_item(); root->set_text(0, base_type); - root->set_icon(0, search_options->get_theme_icon(icon_fallback, "EditorIcons")); + root->set_icon(0, search_options->get_theme_icon(icon_fallback, SNAME("EditorIcons"))); search_options_types[base_type] = root; _configure_search_option_item(root, base_type, ClassDB::class_exists(base_type)); @@ -236,7 +236,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String bool can_instantiate = (p_cpp_type && ClassDB::can_instantiate(p_type)) || !p_cpp_type; if (!can_instantiate) { - r_item->set_custom_color(0, search_options->get_theme_color("disabled_font_color", "Editor")); + r_item->set_custom_color(0, search_options->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))); r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, "NodeDisabled")); r_item->set_selectable(0, false); } else { @@ -338,7 +338,7 @@ void CreateDialog::_confirmed() { memdelete(f); } - emit_signal("create"); + emit_signal(SNAME("create")); hide(); _cleanup(); } @@ -366,16 +366,16 @@ void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); - search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); search_box->set_clear_button_enabled(true); - favorite->set_icon(search_options->get_theme_icon("Favorites", "EditorIcons")); + favorite->set_icon(search_options->get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons"))); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (is_visible()) { - search_box->call_deferred("grab_focus"); // still not visible + search_box->call_deferred(SNAME("grab_focus")); // still not visible search_box->select_all(); } else { EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size())); @@ -607,7 +607,7 @@ void CreateDialog::_save_and_update_favorite_list() { memdelete(f); } - emit_signal("favorites_updated"); + emit_signal(SNAME("favorites_updated")); } void CreateDialog::_load_favorites_and_history() { diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 6035cc072e..a629bf6159 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -41,7 +41,7 @@ bool EditorDebuggerRemoteObject::_set(const StringName &p_name, const Variant &p } prop_values[p_name] = p_value; - emit_signal("value_edited", remote_object_id, p_name, p_value); + emit_signal(SNAME("value_edited"), remote_object_id, p_name, p_value); return true; } @@ -114,11 +114,11 @@ void EditorDebuggerInspector::_notification(int p_what) { } void EditorDebuggerInspector::_object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value) { - emit_signal("object_edited", p_id, p_prop, p_value); + emit_signal(SNAME("object_edited"), p_id, p_prop, p_value); } void EditorDebuggerInspector::_object_selected(ObjectID p_object) { - emit_signal("object_selected", p_object); + emit_signal(SNAME("object_selected"), p_object); } ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { @@ -190,7 +190,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) { //only some may have changed, if so, then update those, if exist for (Set::Element *E = changed.front(); E; E = E->next()) { - emit_signal("object_property_updated", debugObj->remote_object_id, E->get()); + emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get()); } } else { //full update, because props were added or removed diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5f90680115..690ce98cb9 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -55,8 +55,8 @@ EditorDebuggerNode::EditorDebuggerNode() { singleton = this; } - add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_LEFT)); - add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT)); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); @@ -112,7 +112,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { if (tabs->get_tab_count() > 1) { node->clear_style(); tabs->set_tabs_visible(true); - tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); } if (!debugger_plugins.is_empty()) { @@ -135,7 +135,7 @@ void EditorDebuggerNode::_stack_frame_selected(int p_debugger) { void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p_debugger) { Ref