summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/2d/navigation_agent_2d.cpp8
-rw-r--r--scene/2d/skeleton_2d.cpp6
-rw-r--r--scene/2d/tile_map.cpp16
-rw-r--r--scene/2d/touch_screen_button.cpp4
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/navigation_agent_3d.cpp8
-rw-r--r--scene/3d/navigation_region_3d.cpp8
-rw-r--r--scene/3d/path_3d.cpp2
-rw-r--r--scene/3d/proximity_group_3d.cpp2
-rw-r--r--scene/3d/soft_body_3d.cpp4
-rw-r--r--scene/3d/xr_nodes.cpp8
-rw-r--r--scene/animation/animation_blend_space_1d.cpp8
-rw-r--r--scene/animation/animation_blend_space_2d.cpp14
-rw-r--r--scene/animation/animation_blend_tree.cpp10
-rw-r--r--scene/animation/animation_node_state_machine.cpp14
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/animation/animation_tree.cpp2
-rw-r--r--scene/animation/tween.cpp14
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--scene/gui/base_button.cpp12
-rw-r--r--scene/gui/box_container.cpp4
-rw-r--r--scene/gui/button.cpp114
-rw-r--r--scene/gui/check_box.cpp20
-rw-r--r--scene/gui/check_button.cpp8
-rw-r--r--scene/gui/code_edit.cpp54
-rw-r--r--scene/gui/color_picker.cpp82
-rw-r--r--scene/gui/dialogs.cpp18
-rw-r--r--scene/gui/file_dialog.cpp44
-rw-r--r--scene/gui/gradient_edit.cpp14
-rw-r--r--scene/gui/graph_edit.cpp108
-rw-r--r--scene/gui/graph_node.cpp76
-rw-r--r--scene/gui/grid_container.cpp8
-rw-r--r--scene/gui/item_list.cpp80
-rw-r--r--scene/gui/label.cpp44
-rw-r--r--scene/gui/line_edit.cpp70
-rw-r--r--scene/gui/link_button.cpp24
-rw-r--r--scene/gui/margin_container.cpp16
-rw-r--r--scene/gui/option_button.cpp44
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/panel_container.cpp18
-rw-r--r--scene/gui/popup.cpp6
-rw-r--r--scene/gui/popup_menu.cpp96
-rw-r--r--scene/gui/progress_bar.cpp22
-rw-r--r--scene/gui/range.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp106
-rw-r--r--scene/gui/scroll_bar.cpp52
-rw-r--r--scene/gui/scroll_container.cpp14
-rw-r--r--scene/gui/separator.cpp6
-rw-r--r--scene/gui/slider.cpp10
-rw-r--r--scene/gui/spin_box.cpp8
-rw-r--r--scene/gui/split_container.cpp28
-rw-r--r--scene/gui/tab_container.cpp120
-rw-r--r--scene/gui/tabs.cpp126
-rw-r--r--scene/gui/text_edit.cpp76
-rw-r--r--scene/gui/tree.cpp196
-rw-r--r--scene/main/http_request.cpp44
-rw-r--r--scene/main/node.cpp4
-rw-r--r--scene/main/scene_tree.cpp8
-rw-r--r--scene/main/timer.cpp4
-rw-r--r--scene/main/viewport.cpp40
-rw-r--r--scene/main/window.cpp20
-rw-r--r--scene/resources/curve.cpp4
-rw-r--r--scene/resources/syntax_highlighter.cpp2
-rw-r--r--scene/resources/texture.cpp2
-rw-r--r--scene/resources/tile_set.cpp64
-rw-r--r--scene/resources/visual_shader.cpp8
-rw-r--r--scene/resources/visual_shader_nodes.cpp6
68 files changed, 1036 insertions, 1036 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 860ccfec64..4b96689613 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -255,7 +255,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
//stop playing if no longer active
if (!active.is_set()) {
set_physics_process_internal(false);
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
}
}
}
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index f9cbdbf377..e9a95b680c 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -235,7 +235,7 @@ void NavigationAgent2D::_avoidance_done(Vector3 p_new_velocity) {
}
velocity_submitted = false;
- emit_signal("velocity_computed", velocity);
+ emit_signal(SNAME("velocity_computed"), velocity);
}
TypedArray<String> NavigationAgent2D::get_configuration_warnings() const {
@@ -287,7 +287,7 @@ void NavigationAgent2D::update_navigation() {
navigation_path = NavigationServer2D::get_singleton()->map_get_path(agent_parent->get_world_2d()->get_navigation_map(), o, target_location, true, navigable_layers);
navigation_finished = false;
nav_path_index = 0;
- emit_signal("path_changed");
+ emit_signal(SNAME("path_changed"));
}
if (navigation_path.size() == 0) {
@@ -303,7 +303,7 @@ void NavigationAgent2D::update_navigation() {
_check_distance_to_target();
nav_path_index -= 1;
navigation_finished = true;
- emit_signal("navigation_finished");
+ emit_signal(SNAME("navigation_finished"));
break;
}
}
@@ -313,7 +313,7 @@ void NavigationAgent2D::update_navigation() {
void NavigationAgent2D::_check_distance_to_target() {
if (!target_reached) {
if (distance_to_target() < target_desired_distance) {
- emit_signal("target_reached");
+ emit_signal(SNAME("target_reached"));
target_reached = true;
}
}
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 8f1f5fadbc..15cbdf535e 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -568,7 +568,7 @@ void Skeleton2D::_make_bone_setup_dirty() {
}
bone_setup_dirty = true;
if (is_inside_tree()) {
- call_deferred("_update_bone_setup");
+ call_deferred(SNAME("_update_bone_setup"));
}
}
@@ -597,7 +597,7 @@ void Skeleton2D::_update_bone_setup() {
transform_dirty = true;
_update_transform();
- emit_signal("bone_setup_changed");
+ emit_signal(SNAME("bone_setup_changed"));
}
void Skeleton2D::_make_transform_dirty() {
@@ -606,7 +606,7 @@ void Skeleton2D::_make_transform_dirty() {
}
transform_dirty = true;
if (is_inside_tree()) {
- call_deferred("_update_transform");
+ call_deferred(SNAME("_update_transform"));
}
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index e39c8841cd..6d1e27bf1b 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -299,7 +299,7 @@ void TileMap::set_tileset(const Ref<TileSet> &p_tileset) {
_recreate_quadrants();
}
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileMap::get_quadrant_size() const {
@@ -311,13 +311,13 @@ void TileMap::set_quadrant_size(int p_size) {
quadrant_size = p_size;
_recreate_quadrants();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileMap::set_collision_visibility_mode(TileMap::VisibilityMode p_show_collision) {
show_collision = p_show_collision;
_recreate_quadrants();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
TileMap::VisibilityMode TileMap::get_collision_visibility_mode() {
@@ -327,7 +327,7 @@ TileMap::VisibilityMode TileMap::get_collision_visibility_mode() {
void TileMap::set_navigation_visibility_mode(TileMap::VisibilityMode p_show_navigation) {
show_navigation = p_show_navigation;
_recreate_quadrants();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
TileMap::VisibilityMode TileMap::get_navigation_visibility_mode() {
@@ -337,7 +337,7 @@ TileMap::VisibilityMode TileMap::get_navigation_visibility_mode() {
void TileMap::set_y_sort_enabled(bool p_enable) {
Node2D::set_y_sort_enabled(p_enable);
_recreate_quadrants();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileMap::update_dirty_quadrants() {
@@ -480,7 +480,7 @@ void TileMap::_make_all_quadrants_dirty(bool p_update) {
return;
}
if (p_update) {
- call_deferred("update_dirty_quadrants");
+ call_deferred(SNAME("update_dirty_quadrants"));
}
}
@@ -500,7 +500,7 @@ void TileMap::_make_quadrant_dirty(Map<Vector2i, TileMapQuadrant>::Element *Q, b
}
if (p_update) {
- call_deferred("update_dirty_quadrants");
+ call_deferred(SNAME("update_dirty_quadrants"));
}
}
@@ -1764,7 +1764,7 @@ void TileMap::_bind_methods() {
}
void TileMap::_tile_set_changed() {
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
_make_all_quadrants_dirty(true);
}
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp
index 0a6393551c..7c345ad377 100644
--- a/scene/2d/touch_screen_button.cpp
+++ b/scene/2d/touch_screen_button.cpp
@@ -294,7 +294,7 @@ void TouchScreenButton::_press(int p_finger_pressed) {
get_viewport()->input(iea, true);
}
- emit_signal("pressed");
+ emit_signal(SNAME("pressed"));
update();
}
@@ -313,7 +313,7 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
}
if (!p_exiting_tree) {
- emit_signal("released");
+ emit_signal(SNAME("released"));
update();
}
}
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index ba559b4ecb..dd8cb1f20d 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -607,7 +607,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
//stop playing if no longer active
if (!active.is_set()) {
set_physics_process_internal(false);
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
}
}
}
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 64cfe4dca7..f890ceeb95 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -242,7 +242,7 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) {
}
velocity_submitted = false;
- emit_signal("velocity_computed", p_new_velocity);
+ emit_signal(SNAME("velocity_computed"), p_new_velocity);
}
TypedArray<String> NavigationAgent3D::get_configuration_warnings() const {
@@ -296,7 +296,7 @@ void NavigationAgent3D::update_navigation() {
navigation_path = NavigationServer3D::get_singleton()->map_get_path(agent_parent->get_world_3d()->get_navigation_map(), o, target_location, true);
navigation_finished = false;
nav_path_index = 0;
- emit_signal("path_changed");
+ emit_signal(SNAME("path_changed"));
}
if (navigation_path.size() == 0) {
@@ -312,7 +312,7 @@ void NavigationAgent3D::update_navigation() {
_check_distance_to_target();
nav_path_index -= 1;
navigation_finished = true;
- emit_signal("navigation_finished");
+ emit_signal(SNAME("navigation_finished"));
break;
}
}
@@ -322,7 +322,7 @@ void NavigationAgent3D::update_navigation() {
void NavigationAgent3D::_check_distance_to_target() {
if (!target_reached) {
if (distance_to_target() < target_desired_distance) {
- emit_signal("target_reached");
+ emit_signal(SNAME("target_reached"));
target_reached = true;
}
}
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 0afad62404..19abb3f33a 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -132,7 +132,7 @@ void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmes
Object::cast_to<MeshInstance3D>(debug_view)->set_mesh(navmesh->get_debug_mesh());
}
- emit_signal("navigation_mesh_changed");
+ emit_signal(SNAME("navigation_mesh_changed"));
update_gizmo();
update_configuration_warnings();
@@ -153,11 +153,11 @@ void _bake_navigation_mesh(void *p_user_data) {
Ref<NavigationMesh> nav_mesh = args->nav_region->get_navigation_mesh()->duplicate();
NavigationServer3D::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region);
- args->nav_region->call_deferred("_bake_finished", nav_mesh);
+ args->nav_region->call_deferred(SNAME("_bake_finished"), nav_mesh);
memdelete(args);
} else {
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
- args->nav_region->call_deferred("_bake_finished", Ref<NavigationMesh>());
+ args->nav_region->call_deferred(SNAME("_bake_finished"), Ref<NavigationMesh>());
memdelete(args);
}
}
@@ -174,7 +174,7 @@ void NavigationRegion3D::bake_navigation_mesh() {
void NavigationRegion3D::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
set_navigation_mesh(p_nav_mesh);
bake_thread.wait_to_finish();
- emit_signal("bake_finished");
+ emit_signal(SNAME("bake_finished"));
}
TypedArray<String> NavigationRegion3D::get_configuration_warnings() const {
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp
index de115b35e3..54ae2cef75 100644
--- a/scene/3d/path_3d.cpp
+++ b/scene/3d/path_3d.cpp
@@ -41,7 +41,7 @@ void Path3D::_curve_changed() {
update_gizmo();
}
if (is_inside_tree()) {
- emit_signal("curve_changed");
+ emit_signal(SNAME("curve_changed"));
}
// update the configuration warnings of all children of type PathFollow
diff --git a/scene/3d/proximity_group_3d.cpp b/scene/3d/proximity_group_3d.cpp
index 9d9fea68b0..037110eaa1 100644
--- a/scene/3d/proximity_group_3d.cpp
+++ b/scene/3d/proximity_group_3d.cpp
@@ -130,7 +130,7 @@ void ProximityGroup3D::_proximity_group_broadcast(String p_method, Variant p_par
if (dispatch_mode == MODE_PROXY) {
get_parent()->call(p_method, p_parameters);
} else {
- emit_signal("broadcast", p_method, p_parameters);
+ emit_signal(SNAME("broadcast"), p_method, p_parameters);
}
}
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index efd8a2b50c..05530c39a1 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -425,8 +425,8 @@ void SoftBody3D::_draw_soft_mesh() {
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
simulation_started = true;
- call_deferred("set_as_top_level", true);
- call_deferred("set_transform", Transform3D());
+ call_deferred(SNAME("set_as_top_level"), true);
+ call_deferred(SNAME("set_transform"), Transform3D());
}
_update_physics_server();
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index a91e712b0b..b04c7e2858 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -207,10 +207,10 @@ void XRController3D::_notification(int p_what) {
bool is_pressed = Input::get_singleton()->is_joy_button_pressed(joy_id, (JoyButton)i);
if (!was_pressed && is_pressed) {
- emit_signal("button_pressed", i);
+ emit_signal(SNAME("button_pressed"), i);
button_states += mask;
} else if (was_pressed && !is_pressed) {
- emit_signal("button_released", i);
+ emit_signal(SNAME("button_released"), i);
button_states -= mask;
};
@@ -225,7 +225,7 @@ void XRController3D::_notification(int p_what) {
Ref<Mesh> trackerMesh = tracker->get_mesh();
if (mesh != trackerMesh) {
mesh = trackerMesh;
- emit_signal("mesh_updated", mesh);
+ emit_signal(SNAME("mesh_updated"), mesh);
}
};
}; break;
@@ -422,7 +422,7 @@ void XRAnchor3D::_notification(int p_what) {
Ref<Mesh> trackerMesh = tracker->get_mesh();
if (mesh != trackerMesh) {
mesh = trackerMesh;
- emit_signal("mesh_updated", mesh);
+ emit_signal(SNAME("mesh_updated"), mesh);
}
};
}; break;
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index 3818c7edd1..6e5d964b76 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -54,7 +54,7 @@ void AnimationNodeBlendSpace1D::_validate_property(PropertyInfo &property) const
}
void AnimationNodeBlendSpace1D::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace1D::_bind_methods() {
@@ -120,7 +120,7 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_
blend_points[p_at_index].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace1D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
blend_points_used++;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace1D::set_blend_point_position(int p_point, float p_position) {
@@ -140,7 +140,7 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Ref<Anim
blend_points[p_point].node = p_node;
blend_points[p_point].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace1D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const {
@@ -164,7 +164,7 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) {
}
blend_points_used--;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
int AnimationNodeBlendSpace1D::get_blend_point_count() const {
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 0871423fbd..6878cbaa12 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -84,7 +84,7 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_
_queue_auto_triangles();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace2D::set_blend_point_position(int p_point, const Vector2 &p_position) {
@@ -103,7 +103,7 @@ void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Ref<Anim
blend_points[p_point].node = p_node;
blend_points[p_point].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace2D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const {
@@ -143,7 +143,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
blend_points[i] = blend_points[i + 1];
}
blend_points_used--;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
int AnimationNodeBlendSpace2D::get_blend_point_count() const {
@@ -321,7 +321,7 @@ void AnimationNodeBlendSpace2D::_queue_auto_triangles() {
}
trianges_dirty = true;
- call_deferred("_update_triangles");
+ call_deferred(SNAME("_update_triangles"));
}
void AnimationNodeBlendSpace2D::_update_triangles() {
@@ -332,7 +332,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
trianges_dirty = false;
triangles.clear();
if (blend_points_used < 3) {
- emit_signal("triangles_updated");
+ emit_signal(SNAME("triangles_updated"));
return;
}
@@ -347,7 +347,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
for (int i = 0; i < triangles.size(); i++) {
add_triangle(triangles[i].points[0], triangles[i].points[1], triangles[i].points[2]);
}
- emit_signal("triangles_updated");
+ emit_signal(SNAME("triangles_updated"));
}
Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
@@ -586,7 +586,7 @@ Ref<AnimationNode> AnimationNodeBlendSpace2D::get_child_by_name(const StringName
}
void AnimationNodeBlendSpace2D::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace2D::set_blend_mode(BlendMode p_blend_mode) {
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 6a988042b5..200a688067 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -816,7 +816,7 @@ void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNod
nodes[p_name] = n;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendTree::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
p_node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed), varray(p_name), CONNECT_REFERENCE_COUNTED);
@@ -896,7 +896,7 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
}
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringName &p_new_name) {
@@ -921,7 +921,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN
//connection must be done with new name
nodes[p_new_name].node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed), varray(p_new_name), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) {
@@ -1125,11 +1125,11 @@ void AnimationNodeBlendTree::reset_state() {
graph_offset = Vector2();
nodes.clear();
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::_node_changed(const StringName &p_node) {
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index f494f5c163..6496331cb0 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -57,7 +57,7 @@ void AnimationNodeStateMachineTransition::set_advance_condition(const StringName
} else {
advance_condition_name = StringName();
}
- emit_signal("advance_condition_changed");
+ emit_signal(SNAME("advance_condition_changed"));
}
StringName AnimationNodeStateMachineTransition::get_advance_condition() const {
@@ -539,7 +539,7 @@ void AnimationNodeStateMachine::add_node(const StringName &p_name, Ref<Animation
states[p_name] = state;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeStateMachine::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
@@ -559,7 +559,7 @@ void AnimationNodeStateMachine::replace_node(const StringName &p_name, Ref<Anima
states[p_name].node = p_node;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeStateMachine::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
@@ -636,7 +636,7 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) {
}*/
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::rename_node(const StringName &p_name, const StringName &p_new_name) {
@@ -669,7 +669,7 @@ void AnimationNodeStateMachine::rename_node(const StringName &p_name, const Stri
}*/
//path.clear(); //clear path
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
@@ -923,7 +923,7 @@ void AnimationNodeStateMachine::reset_state() {
graph_offset = Vector2();
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::set_node_position(const StringName &p_name, const Vector2 &p_position) {
@@ -937,7 +937,7 @@ Vector2 AnimationNodeStateMachine::get_node_position(const StringName &p_name) c
}
void AnimationNodeStateMachine::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::_bind_methods() {
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 6154eef3cf..5d731629ca 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1325,7 +1325,7 @@ float AnimationPlayer::get_current_animation_length() const {
void AnimationPlayer::_animation_changed() {
clear_caches();
- emit_signal("caches_cleared");
+ emit_signal(SNAME("caches_cleared"));
if (is_playing()) {
playback.seeked = true; //need to restart stuff, like audio
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 1e07f83d09..ef3a8840d0 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -1327,7 +1327,7 @@ void AnimationTree::_tree_changed() {
return;
}
- call_deferred("_update_properties");
+ call_deferred(SNAME("_update_properties"));
properties_dirty = true;
}
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 7bf616e602..761046c14a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -264,7 +264,7 @@ bool Tween::step(float p_delta) {
rem_delta = step_delta;
if (!step_active) {
- emit_signal("step_finished", current_step);
+ emit_signal(SNAME("step_finished"), current_step);
current_step++;
if (current_step == tweeners.size()) {
@@ -272,9 +272,9 @@ bool Tween::step(float p_delta) {
if (loops_done == loops) {
running = false;
dead = true;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
} else {
- emit_signal("loop_finished", loops_done);
+ emit_signal(SNAME("loop_finished"), loops_done);
current_step = 0;
start_tweeners();
}
@@ -690,7 +690,7 @@ bool PropertyTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - delay - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}
@@ -745,7 +745,7 @@ bool IntervalTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}
@@ -784,7 +784,7 @@ bool CallbackTweener::step(float &r_delta) {
finished = true;
r_delta = elapsed_time - delay;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
@@ -854,7 +854,7 @@ bool MethodTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - delay - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 1478cbf69e..298d75b668 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -146,7 +146,7 @@ void AudioStreamPlayer::_notification(int p_what) {
if (!active.is_set() || (setseek.get() < 0 && !stream_playback->is_playing())) {
active.clear();
set_process_internal(false);
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
}
}
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 8414c4dc78..75a4464a40 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -125,7 +125,7 @@ void BaseButton::_pressed() {
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed);
}
pressed();
- emit_signal("pressed");
+ emit_signal(SNAME("pressed"));
}
void BaseButton::_toggled(bool p_pressed) {
@@ -133,14 +133,14 @@ void BaseButton::_toggled(bool p_pressed) {
get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, p_pressed);
}
toggled(p_pressed);
- emit_signal("toggled", p_pressed);
+ emit_signal(SNAME("toggled"), p_pressed);
}
void BaseButton::on_action_event(Ref<InputEvent> p_event) {
if (p_event->is_pressed()) {
status.press_attempt = true;
status.pressing_inside = true;
- emit_signal("button_down");
+ emit_signal(SNAME("button_down"));
}
if (status.press_attempt && status.pressing_inside) {
@@ -153,7 +153,7 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
status.pressed = !status.pressed;
_unpress_group();
if (button_group.is_valid()) {
- button_group->emit_signal("pressed", this);
+ button_group->emit_signal(SNAME("pressed"), this);
}
_toggled(status.pressed);
_pressed();
@@ -174,7 +174,7 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
}
status.press_attempt = false;
status.pressing_inside = false;
- emit_signal("button_up");
+ emit_signal(SNAME("button_up"));
}
update();
@@ -218,7 +218,7 @@ void BaseButton::set_pressed(bool p_pressed) {
if (p_pressed) {
_unpress_group();
if (button_group.is_valid()) {
- button_group->emit_signal("pressed", this);
+ button_group->emit_signal(SNAME("pressed"), this);
}
}
_toggled(status.pressed);
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 40a49dbb58..a2f1d2b15a 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -43,7 +43,7 @@ void BoxContainer::_resort() {
Size2i new_size = get_size();
- int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant(SNAME("separation")); //,vertical?"VBoxContainer":"HBoxContainer");
bool rtl = is_layout_rtl();
bool first = true;
@@ -247,7 +247,7 @@ Size2 BoxContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant(SNAME("separation")); //,vertical?"VBoxContainer":"HBoxContainer");
bool first = true;
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index bcc273114b..4b6c0ef697 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -41,8 +41,8 @@ Size2 Button::get_minimum_size() const {
if (!expand_icon) {
Ref<Texture2D> _icon;
- if (icon.is_null() && has_theme_icon("icon")) {
- _icon = Control::get_theme_icon("icon");
+ if (icon.is_null() && has_theme_icon(SNAME("icon"))) {
+ _icon = Control::get_theme_icon(SNAME("icon"));
} else {
_icon = icon;
}
@@ -53,7 +53,7 @@ Size2 Button::get_minimum_size() const {
if (icon_align != ALIGN_CENTER) {
minsize.width += _icon->get_width();
if (xl_text != "") {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
} else {
minsize.width = MAX(minsize.width, _icon->get_width());
@@ -61,12 +61,12 @@ Size2 Button::get_minimum_size() const {
}
}
- Ref<Font> font = get_theme_font("font");
- float font_height = font->get_height(get_theme_font_size("font_size"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ float font_height = font->get_height(get_theme_font_size(SNAME("font_size")));
minsize.height = MAX(font_height, minsize.height);
- return get_theme_stylebox("normal")->get_minimum_size() + minsize;
+ return get_theme_stylebox(SNAME("normal"))->get_minimum_size() + minsize;
}
void Button::_set_internal_margin(Side p_side, float p_value) {
@@ -97,43 +97,43 @@ void Button::_notification(int p_what) {
Color color;
Color color_icon(1, 1, 1, 1);
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- if (rtl && has_theme_stylebox("normal_mirrored")) {
- style = get_theme_stylebox("normal_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("normal_mirrored"))) {
+ style = get_theme_stylebox(SNAME("normal_mirrored"));
} else {
- style = get_theme_stylebox("normal");
+ style = get_theme_stylebox(SNAME("normal"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_color");
- if (has_theme_color("icon_normal_color")) {
- color_icon = get_theme_color("icon_normal_color");
+ color = get_theme_color(SNAME("font_color"));
+ if (has_theme_color(SNAME("icon_normal_color"))) {
+ color_icon = get_theme_color(SNAME("icon_normal_color"));
}
} break;
case DRAW_HOVER_PRESSED: {
- if (has_theme_stylebox("hover_pressed") && has_theme_stylebox_override("hover_pressed")) {
- if (rtl && has_theme_stylebox("hover_pressed_mirrored")) {
- style = get_theme_stylebox("hover_pressed_mirrored");
+ if (has_theme_stylebox(SNAME("hover_pressed")) && has_theme_stylebox_override("hover_pressed")) {
+ if (rtl && has_theme_stylebox(SNAME("hover_pressed_mirrored"))) {
+ style = get_theme_stylebox(SNAME("hover_pressed_mirrored"));
} else {
- style = get_theme_stylebox("hover_pressed");
+ style = get_theme_stylebox(SNAME("hover_pressed"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- if (has_theme_color("font_hover_pressed_color")) {
- color = get_theme_color("font_hover_pressed_color");
+ if (has_theme_color(SNAME("font_hover_pressed_color"))) {
+ color = get_theme_color(SNAME("font_hover_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
- if (has_theme_color("icon_hover_pressed_color")) {
- color_icon = get_theme_color("icon_hover_pressed_color");
+ if (has_theme_color(SNAME("icon_hover_pressed_color"))) {
+ color_icon = get_theme_color(SNAME("icon_hover_pressed_color"));
}
break;
@@ -141,67 +141,67 @@ void Button::_notification(int p_what) {
[[fallthrough]];
}
case DRAW_PRESSED: {
- if (rtl && has_theme_stylebox("pressed_mirrored")) {
- style = get_theme_stylebox("pressed_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("pressed_mirrored"))) {
+ style = get_theme_stylebox(SNAME("pressed_mirrored"));
} else {
- style = get_theme_stylebox("pressed");
+ style = get_theme_stylebox(SNAME("pressed"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- if (has_theme_color("font_pressed_color")) {
- color = get_theme_color("font_pressed_color");
+ if (has_theme_color(SNAME("font_pressed_color"))) {
+ color = get_theme_color(SNAME("font_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
- if (has_theme_color("icon_pressed_color")) {
- color_icon = get_theme_color("icon_pressed_color");
+ if (has_theme_color(SNAME("icon_pressed_color"))) {
+ color_icon = get_theme_color(SNAME("icon_pressed_color"));
}
} break;
case DRAW_HOVER: {
- if (rtl && has_theme_stylebox("hover_mirrored")) {
- style = get_theme_stylebox("hover_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("hover_mirrored"))) {
+ style = get_theme_stylebox(SNAME("hover_mirrored"));
} else {
- style = get_theme_stylebox("hover");
+ style = get_theme_stylebox(SNAME("hover"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_hover_color");
- if (has_theme_color("icon_hover_color")) {
- color_icon = get_theme_color("icon_hover_color");
+ color = get_theme_color(SNAME("font_hover_color"));
+ if (has_theme_color(SNAME("icon_hover_color"))) {
+ color_icon = get_theme_color(SNAME("icon_hover_color"));
}
} break;
case DRAW_DISABLED: {
- if (rtl && has_theme_stylebox("disabled_mirrored")) {
- style = get_theme_stylebox("disabled_mirrored");
+ if (rtl && has_theme_stylebox(SNAME("disabled_mirrored"))) {
+ style = get_theme_stylebox(SNAME("disabled_mirrored"));
} else {
- style = get_theme_stylebox("disabled");
+ style = get_theme_stylebox(SNAME("disabled"));
}
if (!flat) {
style->draw(ci, Rect2(Point2(0, 0), size));
}
- color = get_theme_color("font_disabled_color");
- if (has_theme_color("icon_disabled_color")) {
- color_icon = get_theme_color("icon_disabled_color");
+ color = get_theme_color(SNAME("font_disabled_color"));
+ if (has_theme_color(SNAME("icon_disabled_color"))) {
+ color_icon = get_theme_color(SNAME("icon_disabled_color"));
}
} break;
}
if (has_focus()) {
- Ref<StyleBox> style2 = get_theme_stylebox("focus");
+ Ref<StyleBox> style2 = get_theme_stylebox(SNAME("focus"));
style2->draw(ci, Rect2(Point2(), size));
}
Ref<Texture2D> _icon;
- if (icon.is_null() && has_theme_icon("icon")) {
- _icon = Control::get_theme_icon("icon");
+ if (icon.is_null() && has_theme_icon(SNAME("icon"))) {
+ _icon = Control::get_theme_icon(SNAME("icon"));
} else {
_icon = icon;
}
@@ -234,21 +234,21 @@ void Button::_notification(int p_what) {
if (icon_align_rtl_checked == ALIGN_LEFT) {
style_offset.x = style->get_margin(SIDE_LEFT);
if (_internal_margin[SIDE_LEFT] > 0) {
- icon_ofs_region = _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ icon_ofs_region = _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
}
} else if (icon_align_rtl_checked == ALIGN_CENTER) {
style_offset.x = 0.0;
} else if (icon_align_rtl_checked == ALIGN_RIGHT) {
style_offset.x = -style->get_margin(SIDE_RIGHT);
if (_internal_margin[SIDE_RIGHT] > 0) {
- icon_ofs_region = -_internal_margin[SIDE_RIGHT] - get_theme_constant("hseparation");
+ icon_ofs_region = -_internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
}
}
style_offset.y = style->get_margin(SIDE_TOP);
if (expand_icon) {
Size2 _size = get_size() - style->get_offset() * 2;
- _size.width -= get_theme_constant("hseparation") + icon_ofs_region;
+ _size.width -= get_theme_constant(SNAME("hseparation")) + icon_ofs_region;
if (!clip_text && icon_align_rtl_checked != ALIGN_CENTER) {
_size.width -= text_buf->get_size().width;
}
@@ -276,7 +276,7 @@ void Button::_notification(int p_what) {
}
}
- Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant("hseparation"), 0) : Point2();
+ Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant(SNAME("hseparation")), 0) : Point2();
if (align_rtl_checked == ALIGN_CENTER && icon_align_rtl_checked == ALIGN_CENTER) {
icon_ofs.x = 0.0;
}
@@ -286,10 +286,10 @@ void Button::_notification(int p_what) {
int text_width = clip_text ? MIN(text_clip, text_buf->get_size().x) : text_buf->get_size().x;
if (_internal_margin[SIDE_LEFT] > 0) {
- text_clip -= _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ text_clip -= _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
}
if (_internal_margin[SIDE_RIGHT] > 0) {
- text_clip -= _internal_margin[SIDE_RIGHT] + get_theme_constant("hseparation");
+ text_clip -= _internal_margin[SIDE_RIGHT] + get_theme_constant(SNAME("hseparation"));
}
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - text_buf->get_size() - Point2(_internal_margin[SIDE_RIGHT] - _internal_margin[SIDE_LEFT], 0)) / 2.0;
@@ -300,7 +300,7 @@ void Button::_notification(int p_what) {
icon_ofs.x = 0.0;
}
if (_internal_margin[SIDE_LEFT] > 0) {
- text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x + _internal_margin[SIDE_LEFT] + get_theme_constant("hseparation");
+ text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x + _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
} else {
text_ofs.x = style->get_margin(SIDE_LEFT) + icon_ofs.x;
}
@@ -317,7 +317,7 @@ void Button::_notification(int p_what) {
} break;
case ALIGN_RIGHT: {
if (_internal_margin[SIDE_RIGHT] > 0) {
- text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width - _internal_margin[SIDE_RIGHT] - get_theme_constant("hseparation");
+ text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width - _internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
} else {
text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width;
}
@@ -328,8 +328,8 @@ void Button::_notification(int p_what) {
} break;
}
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
text_buf->draw_outline(ci, text_ofs, outline_size, font_outline_color);
}
@@ -340,8 +340,8 @@ void Button::_notification(int p_what) {
}
void Button::_shape() {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
text_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index c0650a8f3f..d93107df2d 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -33,12 +33,12 @@
#include "servers/rendering_server.h"
Size2 CheckBox::get_icon_size() const {
- Ref<Texture2D> checked = Control::get_theme_icon("checked");
- Ref<Texture2D> checked_disabled = Control::get_theme_icon("checked_disabled");
- Ref<Texture2D> unchecked = Control::get_theme_icon("unchecked");
- Ref<Texture2D> unchecked_disabled = Control::get_theme_icon("unchecked_disabled");
- Ref<Texture2D> radio_checked = Control::get_theme_icon("radio_checked");
- Ref<Texture2D> radio_unchecked = Control::get_theme_icon("radio_unchecked");
+ Ref<Texture2D> checked = Control::get_theme_icon(SNAME("checked"));
+ Ref<Texture2D> checked_disabled = Control::get_theme_icon(SNAME("checked_disabled"));
+ Ref<Texture2D> unchecked = Control::get_theme_icon(SNAME("unchecked"));
+ Ref<Texture2D> unchecked_disabled = Control::get_theme_icon(SNAME("unchecked_disabled"));
+ Ref<Texture2D> radio_checked = Control::get_theme_icon(SNAME("radio_checked"));
+ Ref<Texture2D> radio_unchecked = Control::get_theme_icon(SNAME("radio_unchecked"));
Size2 tex_size = Size2(0, 0);
if (!checked.is_null()) {
@@ -61,9 +61,9 @@ Size2 CheckBox::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0) {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(SIDE_TOP) + sb->get_margin(SIDE_BOTTOM));
return minsize;
@@ -83,7 +83,7 @@ void CheckBox::_notification(int p_what) {
Ref<Texture2D> on = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_checked" : "checked", is_disabled() ? "_disabled" : ""));
Ref<Texture2D> off = Control::get_theme_icon(vformat("%s%s", is_radio() ? "radio_unchecked" : "unchecked", is_disabled() ? "_disabled" : ""));
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
Vector2 ofs;
if (is_layout_rtl()) {
@@ -91,7 +91,7 @@ void CheckBox::_notification(int p_what) {
} else {
ofs.x = sb->get_margin(SIDE_LEFT);
}
- ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant("check_vadjust");
+ ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant(SNAME("check_vadjust"));
if (is_pressed()) {
on->draw(ci, ofs);
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index a8bf449355..162a256d23 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -52,9 +52,9 @@ Size2 CheckButton::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0) {
- minsize.width += get_theme_constant("hseparation");
+ minsize.width += get_theme_constant(SNAME("hseparation"));
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(SIDE_TOP) + sb->get_margin(SIDE_BOTTOM));
return minsize;
@@ -86,7 +86,7 @@ void CheckButton::_notification(int p_what) {
off = Control::get_theme_icon(is_disabled() ? "off_disabled" : "off");
}
- Ref<StyleBox> sb = get_theme_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("normal"));
Vector2 ofs;
Size2 tex_size = get_icon_size();
@@ -95,7 +95,7 @@ void CheckButton::_notification(int p_what) {
} else {
ofs.x = get_size().width - (tex_size.width + sb->get_margin(SIDE_RIGHT));
}
- ofs.y = (get_size().height - tex_size.height) / 2 + get_theme_constant("check_vadjust");
+ ofs.y = (get_size().height - tex_size.height) / 2 + get_theme_constant(SNAME("check_vadjust"));
if (is_pressed()) {
on->draw(ci, ofs);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index ba1534ed5c..2e6befb706 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -50,28 +50,28 @@ void CodeEdit::_notification(int p_what) {
set_gutter_width(line_number_gutter, (line_number_digits + 1) * cache.font->get_char_size('0', 0, cache.font_size).width);
set_gutter_width(fold_gutter, get_row_height() / 1.2);
- breakpoint_color = get_theme_color("breakpoint_color");
- breakpoint_icon = get_theme_icon("breakpoint");
+ breakpoint_color = get_theme_color(SNAME("breakpoint_color"));
+ breakpoint_icon = get_theme_icon(SNAME("breakpoint"));
- bookmark_color = get_theme_color("bookmark_color");
- bookmark_icon = get_theme_icon("bookmark");
+ bookmark_color = get_theme_color(SNAME("bookmark_color"));
+ bookmark_icon = get_theme_icon(SNAME("bookmark"));
- executing_line_color = get_theme_color("executing_line_color");
- executing_line_icon = get_theme_icon("executing_line");
+ executing_line_color = get_theme_color(SNAME("executing_line_color"));
+ executing_line_icon = get_theme_icon(SNAME("executing_line"));
- line_number_color = get_theme_color("line_number_color");
+ line_number_color = get_theme_color(SNAME("line_number_color"));
- folding_color = get_theme_color("code_folding_color");
- can_fold_icon = get_theme_icon("can_fold");
- folded_icon = get_theme_icon("folded");
+ folding_color = get_theme_color(SNAME("code_folding_color"));
+ can_fold_icon = get_theme_icon(SNAME("can_fold"));
+ folded_icon = get_theme_icon(SNAME("folded"));
- code_completion_max_width = get_theme_constant("completion_max_width") * cache.font->get_char_size('x').x;
- code_completion_max_lines = get_theme_constant("completion_lines");
- code_completion_scroll_width = get_theme_constant("completion_scroll_width");
- code_completion_scroll_color = get_theme_color("completion_scroll_color");
- code_completion_background_color = get_theme_color("completion_background_color");
- code_completion_selected_color = get_theme_color("completion_selected_color");
- code_completion_existing_color = get_theme_color("completion_existing_color");
+ code_completion_max_width = get_theme_constant(SNAME("completion_max_width")) * cache.font->get_char_size('x').x;
+ code_completion_max_lines = get_theme_constant(SNAME("completion_lines"));
+ code_completion_scroll_width = get_theme_constant(SNAME("completion_scroll_width"));
+ code_completion_scroll_color = get_theme_color(SNAME("completion_scroll_color"));
+ code_completion_background_color = get_theme_color(SNAME("completion_background_color"));
+ code_completion_selected_color = get_theme_color(SNAME("completion_selected_color"));
+ code_completion_existing_color = get_theme_color(SNAME("completion_existing_color"));
} break;
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
@@ -81,11 +81,11 @@ void CodeEdit::_notification(int p_what) {
bool code_completion_below = false;
if (caret_visible && code_completion_active && code_completion_options.size() > 0) {
- Ref<StyleBox> csb = get_theme_stylebox("completion");
+ Ref<StyleBox> csb = get_theme_stylebox(SNAME("completion"));
const int code_completion_options_count = code_completion_options.size();
const int lines = MIN(code_completion_options_count, code_completion_max_lines);
- const int icon_hsep = get_theme_constant("hseparation", "ItemList");
+ const int icon_hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList"));
const Size2 icon_area_size(row_height, row_height);
code_completion_rect.size.width = code_completion_longest_line + icon_hsep + icon_area_size.width + 2;
@@ -164,8 +164,8 @@ void CodeEdit::_notification(int p_what) {
if (caret_visible && code_hint != "" && (!code_completion_active || (code_completion_below != code_hint_draw_below))) {
const Ref<Font> font = cache.font;
const int font_height = font->get_height(cache.font_size);
- Ref<StyleBox> sb = get_theme_stylebox("panel", "TooltipPanel");
- Color font_color = get_theme_color("font_color", "TooltipLabel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"));
+ Color font_color = get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"));
Vector<String> code_hint_lines = code_hint.split("\n");
int line_count = code_hint_lines.size();
@@ -969,7 +969,7 @@ void CodeEdit::set_line_as_breakpoint(int p_line, bool p_breakpointed) {
} else if (breakpointed_lines.has(p_line)) {
breakpointed_lines.erase(p_line);
}
- emit_signal("breakpoint_toggled", p_line);
+ emit_signal(SNAME("breakpoint_toggled"), p_line);
update();
}
@@ -1551,7 +1551,7 @@ void CodeEdit::request_code_completion(bool p_force) {
}
if (p_force) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
return;
}
@@ -1559,9 +1559,9 @@ void CodeEdit::request_code_completion(bool p_force) {
int ofs = CLAMP(cursor_get_column(), 0, line.length());
if (ofs > 0 && (is_in_string(cursor_get_line(), ofs) != -1 || _is_char(line[ofs - 1]) || code_completion_prefixes.has(String::chr(line[ofs - 1])))) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
} else if (ofs > 1 && line[ofs - 1] == ' ' && code_completion_prefixes.has(String::chr(line[ofs - 2]))) {
- emit_signal("request_code_completion");
+ emit_signal(SNAME("request_code_completion"));
}
}
@@ -2534,9 +2534,9 @@ void CodeEdit::_lines_edited_from(int p_from_line, int p_to_line) {
}
breakpointed_lines.erase(line);
- emit_signal("breakpoint_toggled", line);
+ emit_signal(SNAME("breakpoint_toggled"), line);
if (line_count > 0 || line >= p_from_line) {
- emit_signal("breakpoint_toggled", line + line_count);
+ emit_signal(SNAME("breakpoint_toggled"), line + line_count);
breakpointed_lines[line + line_count] = true;
continue;
}
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 842cef3b83..eaad887032 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -45,14 +45,14 @@ List<Color> ColorPicker::preset_cache;
void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_theme_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon(SNAME("screen_picker"), SNAME("ColorPicker")));
+ bt_add_preset->set_icon(get_theme_icon(SNAME("add_preset")));
_update_controls();
} break;
case NOTIFICATION_ENTER_TREE: {
- btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_theme_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon(SNAME("screen_picker"), SNAME("ColorPicker")));
+ bt_add_preset->set_icon(get_theme_icon(SNAME("add_preset")));
_update_controls();
_update_color();
@@ -75,13 +75,13 @@ void ColorPicker::_notification(int p_what) {
} break;
case NOTIFICATION_PARENTED: {
for (int i = 0; i < 4; i++) {
- set_offset((Side)i, get_offset((Side)i) + get_theme_constant("margin"));
+ set_offset((Side)i, get_offset((Side)i) + get_theme_constant(SNAME("margin")));
}
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
Popup *p = Object::cast_to<Popup>(get_parent());
if (p) {
- p->set_size(Size2(get_combined_minimum_size().width + get_theme_constant("margin") * 2, get_combined_minimum_size().height + get_theme_constant("margin") * 2));
+ p->set_size(Size2(get_combined_minimum_size().width + get_theme_constant(SNAME("margin")) * 2, get_combined_minimum_size().height + get_theme_constant(SNAME("margin")) * 2));
}
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -142,7 +142,7 @@ void ColorPicker::finish_shaders() {
}
void ColorPicker::set_focus_on_line_edit() {
- c_text->call_deferred("grab_focus");
+ c_text->call_deferred(SNAME("grab_focus"));
}
void ColorPicker::_update_controls() {
@@ -180,7 +180,7 @@ void ColorPicker::_update_controls() {
}
} else {
Ref<StyleBoxEmpty> style_box_empty(memnew(StyleBoxEmpty));
- Ref<Texture2D> bar_arrow = get_theme_icon("bar_arrow");
+ Ref<Texture2D> bar_arrow = get_theme_icon(SNAME("bar_arrow"));
for (int i = 0; i < 4; i++) {
scroll[i]->add_theme_icon_override("grabber", bar_arrow);
@@ -294,7 +294,7 @@ void ColorPicker::_value_changed(double) {
}
_set_pick_color(color, false);
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPicker::_html_submitted(const String &p_html) {
@@ -313,7 +313,7 @@ void ColorPicker::_html_submitted(const String &p_html) {
}
set_pick_color(color);
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPicker::_update_color(bool p_update_sliders) {
@@ -388,7 +388,7 @@ void ColorPicker::_text_type_toggled() {
text_is_constructor = !text_is_constructor;
if (text_is_constructor) {
text_type->set_text("");
- text_type->set_icon(get_theme_icon("Script", "EditorIcons"));
+ text_type->set_icon(get_theme_icon(SNAME("Script"), SNAME("EditorIcons")));
c_text->set_editable(false);
} else {
@@ -537,7 +537,7 @@ void ColorPicker::_sample_input(const Ref<InputEvent> &p_event) {
// Revert to the old color when left-clicking the old color sample.
color = old_color;
_update_color();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -554,28 +554,28 @@ void ColorPicker::_sample_draw() {
const Rect2 rect_old = Rect2(Point2(), Size2(sample->get_size().width * 0.5, sample->get_size().height * 0.95));
if (display_old_color && old_color.a < 1.0) {
- sample->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), rect_old, true);
+ sample->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), rect_old, true);
}
sample->draw_rect(rect_old, old_color);
if (old_color.r > 1 || old_color.g > 1 || old_color.b > 1) {
// Draw an indicator to denote that the old color is "overbright" and can't be displayed accurately in the preview.
- sample->draw_texture(get_theme_icon("overbright_indicator", "ColorPicker"), Point2());
+ sample->draw_texture(get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), Point2());
}
} else {
rect_new = Rect2(Point2(), Size2(sample->get_size().width, sample->get_size().height * 0.95));
}
if (color.a < 1.0) {
- sample->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), rect_new, true);
+ sample->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), rect_new, true);
}
sample->draw_rect(rect_new, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the new color is "overbright" and can't be displayed accurately in the preview.
- sample->draw_texture(get_theme_icon("overbright_indicator", "ColorPicker"), Point2(uv_edit->get_size().width * 0.5, 0));
+ sample->draw_texture(get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), Point2(uv_edit->get_size().width * 0.5, 0));
}
}
@@ -649,7 +649,7 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
default: {
}
}
- Ref<Texture2D> cursor = get_theme_icon("picker_cursor", "ColorPicker");
+ Ref<Texture2D> cursor = get_theme_icon(SNAME("picker_cursor"), SNAME("ColorPicker"));
int x;
int y;
if (picker_type == SHAPE_VHS_CIRCLE) {
@@ -679,7 +679,7 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
} else if (p_which == 1) {
if (picker_type == SHAPE_HSV_RECTANGLE) {
- Ref<Texture2D> hue = get_theme_icon("color_hue", "ColorPicker");
+ Ref<Texture2D> hue = get_theme_icon(SNAME("color_hue"), SNAME("ColorPicker"));
c->draw_texture_rect(hue, Rect2(Point2(), c->get_size()));
int y = c->get_size().y - c->get_size().y * (1.0 - h);
Color col;
@@ -728,7 +728,7 @@ void ColorPicker::_slider_draw(int p_which) {
#endif
if (p_which == 3) {
- scroll[p_which]->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), Rect2(Point2(0, margin), Size2(size.x, margin)), true);
+ scroll[p_which]->draw_texture_rect(get_theme_icon(SNAME("preset_bg"), SNAME("ColorPicker")), Rect2(Point2(0, margin), Size2(size.x, margin)), true);
left_color = color;
left_color.a = 0;
@@ -740,7 +740,7 @@ void ColorPicker::_slider_draw(int p_which) {
}
if (hsv_mode_enabled) {
if (p_which == 0) {
- Ref<Texture2D> hue = get_theme_icon("color_hue", "ColorPicker");
+ Ref<Texture2D> hue = get_theme_icon(SNAME("color_hue"), SNAME("ColorPicker"));
scroll[p_which]->draw_set_transform(Point2(), -Math_PI / 2, Size2(1.0, 1.0));
scroll[p_which]->draw_texture_rect(hue, Rect2(Vector2(margin * -2, 0), Vector2(scroll[p_which]->get_size().x, margin)), false, Color(1, 1, 1), true);
return;
@@ -826,10 +826,10 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
} else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
changing_color = false;
spinning = false;
} else {
@@ -873,7 +873,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -898,9 +898,9 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
} else if (!bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
@@ -921,7 +921,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
set_pick_color(color);
_update_color();
if (!deferred_mode_enabled) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
}
}
@@ -941,12 +941,12 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
}
set_pick_color(presets[index]);
_update_color();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
} else if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_RIGHT && presets_enabled) {
index = bev->get_position().x / (preset->get_size().x / presets.size());
Color clicked_preset = presets[index];
erase_preset(clicked_preset);
- emit_signal("preset_removed", clicked_preset);
+ emit_signal(SNAME("preset_removed"), clicked_preset);
bt_add_preset->show();
}
}
@@ -972,7 +972,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid() && bev->get_button_index() == MOUSE_BUTTON_LEFT && !bev->is_pressed()) {
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
screen->hide();
}
@@ -995,7 +995,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
void ColorPicker::_add_preset_pressed() {
add_preset(color);
- emit_signal("preset_added", color);
+ emit_signal(SNAME("preset_added"), color);
}
void ColorPicker::_screen_pick_pressed() {
@@ -1012,7 +1012,7 @@ void ColorPicker::_screen_pick_pressed() {
screen->set_default_cursor_shape(CURSOR_POINTING_HAND);
screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input));
// It immediately toggles off in the first press otherwise.
- screen->call_deferred("connect", "hidden", Callable(btn_pick, "set_pressed"), varray(false));
+ screen->call_deferred(SNAME("connect"), "hidden", Callable(btn_pick, "set_pressed"), varray(false));
}
screen->raise();
#ifndef _MSC_VER
@@ -1131,7 +1131,7 @@ ColorPicker::ColorPicker() :
uv_edit->set_mouse_filter(MOUSE_FILTER_PASS);
uv_edit->set_h_size_flags(SIZE_EXPAND_FILL);
uv_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- uv_edit->set_custom_minimum_size(Size2(get_theme_constant("sv_width"), get_theme_constant("sv_height")));
+ uv_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("sv_width")), get_theme_constant(SNAME("sv_height"))));
uv_edit->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, uv_edit));
HBoxContainer *hb_smpl = memnew(HBoxContainer);
@@ -1161,7 +1161,7 @@ ColorPicker::ColorPicker() :
HBoxContainer *hbc = memnew(HBoxContainer);
labels[i] = memnew(Label());
- labels[i]->set_custom_minimum_size(Size2(get_theme_constant("label_width"), 0));
+ labels[i]->set_custom_minimum_size(Size2(get_theme_constant(SNAME("label_width")), 0));
labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER);
hbc->add_child(labels[i]);
@@ -1220,7 +1220,7 @@ ColorPicker::ColorPicker() :
wheel_edit->set_h_size_flags(SIZE_EXPAND_FILL);
wheel_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- wheel_edit->set_custom_minimum_size(Size2(get_theme_constant("sv_width"), get_theme_constant("sv_height")));
+ wheel_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("sv_width")), get_theme_constant(SNAME("sv_height"))));
hb_edit->add_child(wheel_edit);
wheel_mat.instantiate();
@@ -1245,7 +1245,7 @@ ColorPicker::ColorPicker() :
wheel_uv->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, wheel_uv));
hb_edit->add_child(w_edit);
- w_edit->set_custom_minimum_size(Size2(get_theme_constant("h_width"), 0));
+ w_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("h_width")), 0));
w_edit->set_h_size_flags(SIZE_FILL);
w_edit->set_v_size_flags(SIZE_EXPAND_FILL);
w_edit->connect("gui_input", callable_mp(this, &ColorPicker::_w_input));
@@ -1285,11 +1285,11 @@ void ColorPickerButton::_about_to_popup() {
void ColorPickerButton::_color_changed(const Color &p_color) {
color = p_color;
update();
- emit_signal("color_changed", color);
+ emit_signal(SNAME("color_changed"), color);
}
void ColorPickerButton::_modal_closed() {
- emit_signal("popup_closed");
+ emit_signal(SNAME("popup_closed"));
set_pressed(false);
}
@@ -1327,14 +1327,14 @@ void ColorPickerButton::pressed() {
void ColorPickerButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- const Ref<StyleBox> normal = get_theme_stylebox("normal");
+ const Ref<StyleBox> normal = get_theme_stylebox(SNAME("normal"));
const Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
- draw_texture_rect(Control::get_theme_icon("bg", "ColorPickerButton"), r, true);
+ draw_texture_rect(Control::get_theme_icon(SNAME("bg"), SNAME("ColorPickerButton")), r, true);
draw_rect(r, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the color is "overbright" and can't be displayed accurately in the preview
- draw_texture(Control::get_theme_icon("overbright_indicator", "ColorPicker"), normal->get_offset());
+ draw_texture(Control::get_theme_icon(SNAME("overbright_indicator"), SNAME("ColorPicker")), normal->get_offset());
}
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -1399,7 +1399,7 @@ void ColorPickerButton::_update_picker() {
picker->set_pick_color(color);
picker->set_edit_alpha(edit_alpha);
picker->set_display_old_color(true);
- emit_signal("picker_created");
+ emit_signal(SNAME("picker_created"));
}
}
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 9d0a6a3380..f5c764e9cc 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -76,7 +76,7 @@ void AcceptDialog::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- bg->add_theme_style_override("panel", bg->get_theme_stylebox("panel", "AcceptDialog"));
+ bg->add_theme_style_override("panel", bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -106,7 +106,7 @@ void AcceptDialog::_ok_pressed() {
set_visible(false);
}
ok_pressed();
- emit_signal("confirmed");
+ emit_signal(SNAME("confirmed"));
}
void AcceptDialog::_cancel_pressed() {
@@ -116,9 +116,9 @@ void AcceptDialog::_cancel_pressed() {
parent_visible = nullptr;
}
- call_deferred("hide");
+ call_deferred(SNAME("hide"));
- emit_signal("cancelled");
+ emit_signal(SNAME("cancelled"));
cancel_pressed();
@@ -168,7 +168,7 @@ void AcceptDialog::_update_child_rects() {
if (label->get_text().is_empty()) {
label_size.height = 0;
}
- int margin = hbc->get_theme_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
Size2 size = get_size();
Size2 hminsize = hbc->get_combined_minimum_size();
@@ -200,7 +200,7 @@ void AcceptDialog::_update_child_rects() {
}
Size2 AcceptDialog::_get_contents_minimum_size() const {
- int margin = hbc->get_theme_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
Size2 minsize = label->get_combined_minimum_size();
for (int i = 0; i < get_child_count(); i++) {
@@ -230,7 +230,7 @@ Size2 AcceptDialog::_get_contents_minimum_size() const {
}
void AcceptDialog::_custom_action(const String &p_action) {
- emit_signal("custom_action", p_action);
+ emit_signal(SNAME("custom_action"), p_action);
custom_action(p_action);
}
@@ -326,8 +326,8 @@ AcceptDialog::AcceptDialog() {
hbc = memnew(HBoxContainer);
- int margin = hbc->get_theme_constant("margin", "Dialogs");
- int button_margin = hbc->get_theme_constant("button_margin", "Dialogs");
+ int margin = hbc->get_theme_constant(SNAME("margin"), SNAME("Dialogs"));
+ int button_margin = hbc->get_theme_constant(SNAME("button_margin"), SNAME("Dialogs"));
label = memnew(Label);
label->set_anchor(SIDE_RIGHT, Control::ANCHOR_END);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index f8cee6daec..9ed3a2244e 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -49,9 +49,9 @@ VBoxContainer *FileDialog::get_vbox() {
}
void FileDialog::_theme_changed() {
- Color font_color = vbox->get_theme_color("font_color", "Button");
- Color font_hover_color = vbox->get_theme_color("font_hover_color", "Button");
- Color font_pressed_color = vbox->get_theme_color("font_pressed_color", "Button");
+ Color font_color = vbox->get_theme_color(SNAME("font_color"), SNAME("Button"));
+ Color font_hover_color = vbox->get_theme_color(SNAME("font_hover_color"), SNAME("Button"));
+ Color font_pressed_color = vbox->get_theme_color(SNAME("font_pressed_color"), SNAME("Button"));
dir_up->add_theme_color_override("icon_normal_color", font_color);
dir_up->add_theme_color_override("icon_hover_color", font_hover_color);
@@ -81,16 +81,16 @@ void FileDialog::_notification(int p_what) {
}
}
if (p_what == NOTIFICATION_ENTER_TREE) {
- dir_up->set_icon(vbox->get_theme_icon("parent_folder", "FileDialog"));
+ dir_up->set_icon(vbox->get_theme_icon(SNAME("parent_folder"), SNAME("FileDialog")));
if (vbox->is_layout_rtl()) {
- dir_prev->set_icon(vbox->get_theme_icon("forward_folder", "FileDialog"));
- dir_next->set_icon(vbox->get_theme_icon("back_folder", "FileDialog"));
+ dir_prev->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
+ dir_next->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog")));
} else {
- dir_prev->set_icon(vbox->get_theme_icon("back_folder", "FileDialog"));
- dir_next->set_icon(vbox->get_theme_icon("forward_folder", "FileDialog"));
+ dir_prev->set_icon(vbox->get_theme_icon(SNAME("back_folder"), SNAME("FileDialog")));
+ dir_next->set_icon(vbox->get_theme_icon(SNAME("forward_folder"), SNAME("FileDialog")));
}
- refresh->set_icon(vbox->get_theme_icon("reload", "FileDialog"));
- show_hidden->set_icon(vbox->get_theme_icon("toggle_hidden", "FileDialog"));
+ refresh->set_icon(vbox->get_theme_icon(SNAME("reload"), SNAME("FileDialog")));
+ show_hidden->set_icon(vbox->get_theme_icon(SNAME("toggle_hidden"), SNAME("FileDialog")));
_theme_changed();
}
}
@@ -170,7 +170,7 @@ void FileDialog::_file_submitted(const String &p_file) {
void FileDialog::_save_confirm_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
}
@@ -224,7 +224,7 @@ void FileDialog::_action_pressed() {
}
if (files.size()) {
- emit_signal("files_selected", files);
+ emit_signal(SNAME("files_selected"), files);
hide();
}
@@ -234,7 +234,7 @@ void FileDialog::_action_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
} else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) {
String path = dir_access->get_current_dir();
@@ -248,7 +248,7 @@ void FileDialog::_action_pressed() {
}
}
- emit_signal("dir_selected", path);
+ emit_signal(SNAME("dir_selected"), path);
hide();
}
@@ -308,7 +308,7 @@ void FileDialog::_action_pressed() {
confirm_save->set_text(TTRC("File exists, overwrite?"));
confirm_save->popup_centered(Size2(200, 80));
} else {
- emit_signal("file_selected", f);
+ emit_signal(SNAME("file_selected"), f);
hide();
}
}
@@ -437,8 +437,8 @@ void FileDialog::_tree_item_activated() {
if (mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES || mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
file->set_text("");
}
- call_deferred("_update_file_list");
- call_deferred("_update_dir");
+ call_deferred(SNAME("_update_file_list"));
+ call_deferred(SNAME("_update_dir"));
_push_history();
} else {
_action_pressed();
@@ -468,10 +468,10 @@ void FileDialog::update_file_list() {
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();
- Ref<Texture2D> folder = vbox->get_theme_icon("folder", "FileDialog");
- Ref<Texture2D> file_icon = vbox->get_theme_icon("file", "FileDialog");
- const Color folder_color = vbox->get_theme_color("folder_icon_modulate", "FileDialog");
- const Color file_color = vbox->get_theme_color("file_icon_modulate", "FileDialog");
+ Ref<Texture2D> folder = vbox->get_theme_icon(SNAME("folder"), SNAME("FileDialog"));
+ Ref<Texture2D> file_icon = vbox->get_theme_icon(SNAME("file"), SNAME("FileDialog"));
+ const Color folder_color = vbox->get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog"));
+ const Color file_color = vbox->get_theme_color(SNAME("file_icon_modulate"), SNAME("FileDialog"));
List<String> files;
List<String> dirs;
@@ -573,7 +573,7 @@ void FileDialog::update_file_list() {
ti->set_icon_modulate(0, file_color);
if (mode == FILE_MODE_OPEN_DIR) {
- ti->set_custom_color(0, vbox->get_theme_color("files_disabled", "FileDialog"));
+ ti->set_custom_color(0, vbox->get_theme_color(SNAME("files_disabled"), SNAME("FileDialog")));
ti->set_selectable(0, false);
}
Dictionary d;
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 7278ca6e94..83ecf1d534 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -101,7 +101,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = -1;
grabbing = false;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
accept_event();
}
@@ -121,7 +121,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = -1;
grabbing = false;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
accept_event();
}
}
@@ -145,7 +145,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
update();
}
}
@@ -214,13 +214,13 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
if (grabbing) {
grabbing = false;
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
update();
}
@@ -288,7 +288,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
update();
}
@@ -436,7 +436,7 @@ void GradientEdit::_color_changed(const Color &p_color) {
}
points.write[grabbed].color = p_color;
update();
- emit_signal("ramp_changed");
+ emit_signal(SNAME("ramp_changed"));
}
void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 39aa6749e7..2281fb19c6 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -162,7 +162,7 @@ void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
if (mb->is_pressed()) {
is_pressing = true;
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
Rect2 resizer_hitbox = Rect2(Point2(), resizer->get_size());
if (resizer_hitbox.has_point(mb->get_position())) {
is_resizing = true;
@@ -257,7 +257,7 @@ Vector2 GraphEdit::get_scroll_ofs() const {
void GraphEdit::_scroll_moved(double) {
if (!awaiting_scroll_offset_update) {
- call_deferred("_update_scroll_offset");
+ call_deferred(SNAME("_update_scroll_offset"));
awaiting_scroll_offset_update = true;
}
top_layer->update();
@@ -265,7 +265,7 @@ void GraphEdit::_scroll_moved(double) {
update();
if (!setting_scroll_ofs) { //in godot, signals on change value are avoided as a convention
- emit_signal("scroll_offset_changed", get_scroll_ofs());
+ emit_signal(SNAME("scroll_offset_changed"), get_scroll_ofs());
}
}
@@ -345,7 +345,7 @@ void GraphEdit::_update_scroll() {
set_block_minimum_size_adjust(false);
if (!awaiting_scroll_offset_update) {
- call_deferred("_update_scroll_offset");
+ call_deferred(SNAME("_update_scroll_offset"));
awaiting_scroll_offset_update = true;
}
@@ -371,7 +371,7 @@ void GraphEdit::_graph_node_raised(Node *p_gn) {
move_child(connections_layer, first_not_comment);
top_layer->raise();
- emit_signal("node_selected", p_gn);
+ emit_signal(SNAME("node_selected"), p_gn);
}
void GraphEdit::_graph_node_moved(Node *p_gn) {
@@ -395,7 +395,7 @@ void GraphEdit::_graph_node_slot_updated(int p_index, Node *p_gn) {
void GraphEdit::add_child_notify(Node *p_child) {
Control::add_child_notify(p_child);
- top_layer->call_deferred("raise"); // Top layer always on top!
+ top_layer->call_deferred(SNAME("raise")); // Top layer always on top!
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
if (gn) {
@@ -421,7 +421,7 @@ void GraphEdit::remove_child_notify(Node *p_child) {
}
if (top_layer != nullptr && is_inside_tree()) {
- top_layer->call_deferred("raise"); // Top layer always on top!
+ top_layer->call_deferred(SNAME("raise")); // Top layer always on top!
}
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
@@ -442,14 +442,14 @@ void GraphEdit::remove_child_notify(Node *p_child) {
void GraphEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- port_grab_distance_horizontal = get_theme_constant("port_grab_distance_horizontal");
- port_grab_distance_vertical = get_theme_constant("port_grab_distance_vertical");
-
- zoom_minus->set_icon(get_theme_icon("minus"));
- zoom_reset->set_icon(get_theme_icon("reset"));
- zoom_plus->set_icon(get_theme_icon("more"));
- snap_button->set_icon(get_theme_icon("snap"));
- minimap_button->set_icon(get_theme_icon("minimap"));
+ port_grab_distance_horizontal = get_theme_constant(SNAME("port_grab_distance_horizontal"));
+ port_grab_distance_vertical = get_theme_constant(SNAME("port_grab_distance_vertical"));
+
+ zoom_minus->set_icon(get_theme_icon(SNAME("minus")));
+ zoom_reset->set_icon(get_theme_icon(SNAME("reset")));
+ zoom_plus->set_icon(get_theme_icon(SNAME("more")));
+ snap_button->set_icon(get_theme_icon(SNAME("snap")));
+ minimap_button->set_icon(get_theme_icon(SNAME("minimap")));
}
if (p_what == NOTIFICATION_READY) {
Size2 hmin = h_scroll->get_combined_minimum_size();
@@ -466,7 +466,7 @@ void GraphEdit::_notification(int p_what) {
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
}
if (p_what == NOTIFICATION_DRAW) {
- draw_style_box(get_theme_stylebox("bg"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("bg")), Rect2(Point2(), get_size()));
if (is_using_snap()) {
//draw grid
@@ -479,8 +479,8 @@ void GraphEdit::_notification(int p_what) {
Point2i from = (offset / float(snap)).floor();
Point2i len = (size / float(snap)).floor() + Vector2(1, 1);
- Color grid_minor = get_theme_color("grid_minor");
- Color grid_major = get_theme_color("grid_major");
+ Color grid_minor = get_theme_color(SNAME("grid_minor"));
+ Color grid_major = get_theme_color(SNAME("grid_major"));
for (int i = from.x; i < from.x + len.x; i++) {
Color color;
@@ -518,7 +518,7 @@ void GraphEdit::_notification(int p_what) {
}
bool GraphEdit::_filter_input(const Point2 &p_point) {
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -548,7 +548,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
connecting_valid = false;
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
click_pos = mb->get_position() / zoom;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -574,7 +574,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_to = pos;
just_disconnected = true;
- emit_signal("disconnection_request", E->get().from, E->get().from_port, E->get().to, E->get().to_port);
+ emit_signal(SNAME("disconnection_request"), E->get().from, E->get().from_port, E->get().to, E->get().to_port);
to = get_node(String(connecting_from)); //maybe it was erased
if (Object::cast_to<GraphNode>(to)) {
connecting = true;
@@ -616,7 +616,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_to = pos;
just_disconnected = true;
- emit_signal("disconnection_request", E->get().from, E->get().from_port, E->get().to, E->get().to_port);
+ emit_signal(SNAME("disconnection_request"), E->get().from, E->get().from_port, E->get().to, E->get().to_port);
fr = get_node(String(connecting_from)); //maybe it was erased
if (Object::cast_to<GraphNode>(fr)) {
connecting = true;
@@ -652,7 +652,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_valid = just_disconnected || click_pos.distance_to(connecting_to / zoom) > 20.0 * zoom;
if (connecting_valid) {
- Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"), SNAME("GraphNode"));
Vector2 mpos = mm->get_position() / zoom;
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
@@ -701,7 +701,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
SWAP(from, to);
SWAP(from_slot, to_slot);
}
- emit_signal("connection_request", from, from_slot, to, to_slot);
+ emit_signal(SNAME("connection_request"), from, from_slot, to, to_slot);
} else if (!just_disconnected) {
String from = connecting_from;
@@ -709,9 +709,9 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Vector2 ofs = Vector2(mb->get_position().x, mb->get_position().y);
if (!connecting_out) {
- emit_signal("connection_from_empty", from, from_slot, ofs);
+ emit_signal(SNAME("connection_from_empty"), from, from_slot, ofs);
} else {
- emit_signal("connection_to_empty", from, from_slot, ofs);
+ emit_signal(SNAME("connection_to_empty"), from, from_slot, ofs);
}
}
}
@@ -819,8 +819,8 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
//cubic bezier code
float diff = p_to.x - p_from.x;
float cp_offset;
- int cp_len = get_theme_constant("bezier_len_pos") * p_bezier_ratio;
- int cp_neg_len = get_theme_constant("bezier_len_neg") * p_bezier_ratio;
+ int cp_len = get_theme_constant(SNAME("bezier_len_pos")) * p_bezier_ratio;
+ int cp_neg_len = get_theme_constant(SNAME("bezier_len_neg")) * p_bezier_ratio;
if (diff > 0) {
cp_offset = MIN(cp_len, diff * 0.5);
@@ -849,7 +849,7 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
}
void GraphEdit::_connections_layer_draw() {
- Color activity_color = get_theme_color("activity");
+ Color activity_color = get_theme_color(SNAME("activity"));
//draw connections
List<List<Connection>::Element *> to_erase;
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
@@ -934,8 +934,8 @@ void GraphEdit::_top_layer_draw() {
}
if (box_selecting) {
- top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_fill"));
- top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_stroke"), false);
+ top_layer->draw_rect(box_selecting_rect, get_theme_color(SNAME("selection_fill")));
+ top_layer->draw_rect(box_selecting_rect, get_theme_color(SNAME("selection_stroke")), false);
}
}
@@ -948,7 +948,7 @@ void GraphEdit::_minimap_draw() {
// Draw the minimap background.
Rect2 minimap_rect = Rect2(Point2(), minimap->get_size());
- minimap->draw_style_box(minimap->get_theme_stylebox("bg"), minimap_rect);
+ minimap->draw_style_box(minimap->get_theme_stylebox(SNAME("bg")), minimap_rect);
Vector2 graph_offset = minimap->_get_graph_offset();
Vector2 minimap_offset = minimap->minimap_offset;
@@ -964,7 +964,7 @@ void GraphEdit::_minimap_draw() {
Vector2 node_size = minimap->_convert_from_graph_position(gn->get_size() * zoom);
Rect2 node_rect = Rect2(node_position, node_size);
- Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox("node")->duplicate();
+ Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox(SNAME("node"))->duplicate();
// Override default values with colors provided by the GraphNode's stylebox, if possible.
Ref<StyleBoxFlat> sbf = gn->get_theme_stylebox(gn->is_selected() ? "commentfocus" : "comment");
@@ -987,7 +987,7 @@ void GraphEdit::_minimap_draw() {
Vector2 node_size = minimap->_convert_from_graph_position(gn->get_size() * zoom);
Rect2 node_rect = Rect2(node_position, node_size);
- Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox("node")->duplicate();
+ Ref<StyleBoxFlat> sb_minimap = minimap->get_theme_stylebox(SNAME("node"))->duplicate();
// Override default values with colors provided by the GraphNode's stylebox, if possible.
Ref<StyleBoxFlat> sbf = gn->get_theme_stylebox(gn->is_selected() ? "selectedframe" : "frame");
@@ -1000,7 +1000,7 @@ void GraphEdit::_minimap_draw() {
}
// Draw node connections.
- Color activity_color = get_theme_color("activity");
+ Color activity_color = get_theme_color(SNAME("activity"));
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
NodePath fromnp(E->get().from);
@@ -1039,11 +1039,11 @@ void GraphEdit::_minimap_draw() {
// Draw the "camera" viewport.
Rect2 camera_rect = minimap->get_camera_rect();
- minimap->draw_style_box(minimap->get_theme_stylebox("camera"), camera_rect);
+ minimap->draw_style_box(minimap->get_theme_stylebox(SNAME("camera")), camera_rect);
// Draw the resizer control.
- Ref<Texture2D> resizer = minimap->get_theme_icon("resizer");
- Color resizer_color = minimap->get_theme_color("resizer_color");
+ Ref<Texture2D> resizer = minimap->get_theme_icon(SNAME("resizer"));
+ Color resizer_color = minimap->get_theme_color(SNAME("resizer_color"));
minimap->draw_texture(resizer, Point2(), resizer_color);
}
@@ -1070,7 +1070,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (mm.is_valid() && dragging) {
if (!moving_selection) {
- emit_signal("begin_node_move");
+ emit_signal(SNAME("begin_node_move"));
moving_selection = true;
}
@@ -1113,17 +1113,17 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (in_box) {
if (!gn->is_selected() && box_selection_mode_additive) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
} else if (gn->is_selected() && !box_selection_mode_additive) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
}
gn->set_selected(box_selection_mode_additive);
} else {
bool select = (previous_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
} else if (!gn->is_selected() && select) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
}
gn->set_selected(select);
}
@@ -1146,9 +1146,9 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
bool select = (previous_selected.find(gn) != nullptr);
if (gn->is_selected() && !select) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
} else if (!gn->is_selected() && select) {
- emit_signal("node_selected", gn);
+ emit_signal(SNAME("node_selected"), gn);
}
gn->set_selected(select);
}
@@ -1160,7 +1160,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
top_layer->update();
minimap->update();
} else {
- emit_signal("popup_request", b->get_global_position());
+ emit_signal(SNAME("popup_request"), b->get_global_position());
}
}
}
@@ -1175,7 +1175,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
Rect2 r = gn->get_rect();
r.size *= zoom;
if (r.has_point(b->get_position())) {
- emit_signal("node_deselected", gn);
+ emit_signal(SNAME("node_deselected"), gn);
gn->set_selected(false);
}
}
@@ -1192,7 +1192,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (moving_selection) {
- emit_signal("end_node_move");
+ emit_signal(SNAME("end_node_move"));
moving_selection = false;
}
@@ -1238,7 +1238,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
o_gn->set_selected(true);
} else {
if (o_gn->is_selected()) {
- emit_signal("node_deselected", o_gn);
+ emit_signal(SNAME("node_deselected"), o_gn);
}
o_gn->set_selected(false);
}
@@ -1298,7 +1298,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
continue;
}
if (gn2->is_selected()) {
- emit_signal("node_deselected", gn2);
+ emit_signal(SNAME("node_deselected"), gn2);
}
gn2->set_selected(false);
}
@@ -1333,16 +1333,16 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (p_ev->is_pressed()) {
if (p_ev->is_action("ui_graph_duplicate")) {
- emit_signal("duplicate_nodes_request");
+ emit_signal(SNAME("duplicate_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_copy")) {
- emit_signal("copy_nodes_request");
+ emit_signal(SNAME("copy_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_paste")) {
- emit_signal("paste_nodes_request");
+ emit_signal(SNAME("paste_nodes_request"));
accept_event();
} else if (p_ev->is_action("ui_graph_delete")) {
- emit_signal("delete_nodes_request");
+ emit_signal(SNAME("delete_nodes_request"));
accept_event();
}
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 836bffdf46..e85cefcb7b 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -180,9 +180,9 @@ void GraphNode::_resort() {
/** First pass, determine minimum size AND amount of stretchable elements */
Size2i new_size = get_size();
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
bool first = true;
int children_count = 0;
@@ -323,8 +323,8 @@ void GraphNode::_resort() {
bool GraphNode::has_point(const Point2 &p_point) const {
if (comment) {
- Ref<StyleBox> comment = get_theme_stylebox("comment");
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<StyleBox> comment = get_theme_stylebox(SNAME("comment"));
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
if (Rect2(get_size() - resizer->get_size(), resizer->get_size()).has_point(p_point)) {
return true;
@@ -355,18 +355,18 @@ void GraphNode::_notification(int p_what) {
//sb=sb->duplicate();
//sb->call("set_modulate",modulate);
- Ref<Texture2D> port = get_theme_icon("port");
- Ref<Texture2D> close = get_theme_icon("close");
- Ref<Texture2D> resizer = get_theme_icon("resizer");
- int close_offset = get_theme_constant("close_offset");
- int close_h_offset = get_theme_constant("close_h_offset");
- Color close_color = get_theme_color("close_color");
- Color resizer_color = get_theme_color("resizer_color");
- int title_offset = get_theme_constant("title_offset");
- int title_h_offset = get_theme_constant("title_h_offset");
- Color title_color = get_theme_color("title_color");
+ Ref<Texture2D> port = get_theme_icon(SNAME("port"));
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
+ int close_offset = get_theme_constant(SNAME("close_offset"));
+ int close_h_offset = get_theme_constant(SNAME("close_h_offset"));
+ Color close_color = get_theme_color(SNAME("close_color"));
+ Color resizer_color = get_theme_color(SNAME("resizer_color"));
+ int title_offset = get_theme_constant(SNAME("title_offset"));
+ int title_h_offset = get_theme_constant(SNAME("title_h_offset"));
+ Color title_color = get_theme_color(SNAME("title_color"));
Point2i icofs = -port->get_size() * 0.5;
- int edgeofs = get_theme_constant("port_offset");
+ int edgeofs = get_theme_constant(SNAME("port_offset"));
icofs.y += sb->get_margin(SIDE_TOP);
draw_style_box(sb, Rect2(Point2(), get_size()));
@@ -375,10 +375,10 @@ void GraphNode::_notification(int p_what) {
case OVERLAY_DISABLED: {
} break;
case OVERLAY_BREAKPOINT: {
- draw_style_box(get_theme_stylebox("breakpoint"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("breakpoint")), Rect2(Point2(), get_size()));
} break;
case OVERLAY_POSITION: {
- draw_style_box(get_theme_stylebox("position"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox(SNAME("position")), Rect2(Point2(), get_size()));
} break;
}
@@ -446,8 +446,8 @@ void GraphNode::_notification(int p_what) {
}
void GraphNode::_shape() {
- Ref<Font> font = get_theme_font("title_font");
- int font_size = get_theme_font_size("title_font_size");
+ Ref<Font> font = get_theme_font(SNAME("title_font"));
+ int font_size = get_theme_font_size(SNAME("title_font_size"));
title_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -481,7 +481,7 @@ void GraphNode::set_slot(int p_idx, bool p_enable_left, int p_type_left, const C
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::clear_slot(int p_idx) {
@@ -510,7 +510,7 @@ void GraphNode::set_slot_enabled_left(int p_idx, bool p_enable_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::set_slot_type_left(int p_idx, int p_type_left) {
@@ -520,7 +520,7 @@ void GraphNode::set_slot_type_left(int p_idx, int p_type_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
int GraphNode::get_slot_type_left(int p_idx) const {
@@ -537,7 +537,7 @@ void GraphNode::set_slot_color_left(int p_idx, const Color &p_color_left) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
Color GraphNode::get_slot_color_left(int p_idx) const {
@@ -561,7 +561,7 @@ void GraphNode::set_slot_enabled_right(int p_idx, bool p_enable_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
void GraphNode::set_slot_type_right(int p_idx, int p_type_right) {
@@ -571,7 +571,7 @@ void GraphNode::set_slot_type_right(int p_idx, int p_type_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
int GraphNode::get_slot_type_right(int p_idx) const {
@@ -588,7 +588,7 @@ void GraphNode::set_slot_color_right(int p_idx, const Color &p_color_right) {
update();
connpos_dirty = true;
- emit_signal("slot_updated", p_idx);
+ emit_signal(SNAME("slot_updated"), p_idx);
}
Color GraphNode::get_slot_color_right(int p_idx) const {
@@ -599,14 +599,14 @@ Color GraphNode::get_slot_color_right(int p_idx) const {
}
Size2 GraphNode::get_minimum_size() const {
- int sep = get_theme_constant("separation");
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ int sep = get_theme_constant(SNAME("separation"));
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
bool first = true;
Size2 minsize;
minsize.x = title_buf->get_size().x;
if (show_close) {
- Ref<Texture2D> close = get_theme_icon("close");
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
minsize.x += sep + close->get_width();
}
@@ -699,7 +699,7 @@ String GraphNode::get_language() const {
void GraphNode::set_position_offset(const Vector2 &p_offset) {
position_offset = p_offset;
- emit_signal("position_offset_changed");
+ emit_signal(SNAME("position_offset_changed"));
update();
}
@@ -720,7 +720,7 @@ void GraphNode::set_drag(bool p_drag) {
if (p_drag) {
drag_from = get_position_offset();
} else {
- emit_signal("dragged", drag_from, get_position_offset()); //useful for undo/redo
+ emit_signal(SNAME("dragged"), drag_from, get_position_offset()); //useful for undo/redo
}
}
@@ -738,10 +738,10 @@ bool GraphNode::is_close_button_visible() const {
}
void GraphNode::_connpos_update() {
- int edgeofs = get_theme_constant("port_offset");
- int sep = get_theme_constant("separation");
+ int edgeofs = get_theme_constant(SNAME("port_offset"));
+ int sep = get_theme_constant(SNAME("separation"));
- Ref<StyleBox> sb = get_theme_stylebox("frame");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("frame"));
conn_input_cache.clear();
conn_output_cache.clear();
int vofs = 0;
@@ -875,12 +875,12 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
//send focus to parent
get_parent_control()->grab_focus();
- emit_signal("close_request");
+ emit_signal(SNAME("close_request"));
accept_event();
return;
}
- Ref<Texture2D> resizer = get_theme_icon("resizer");
+ Ref<Texture2D> resizer = get_theme_icon(SNAME("resizer"));
if (resizable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
resizing = true;
@@ -890,7 +890,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
return;
}
- emit_signal("raise_request");
+ emit_signal(SNAME("raise_request"));
}
if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@@ -904,7 +904,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Vector2 diff = mpos - resizing_from;
- emit_signal("resize_request", resizing_from_size + diff);
+ emit_signal(SNAME("resize_request"), resizing_from_size + diff);
}
}
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index a54f5eef06..1107e3a4af 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -38,8 +38,8 @@ void GridContainer::_notification(int p_what) {
Set<int> col_expanded; // Columns which have the SIZE_EXPAND flag set.
Set<int> row_expanded; // Rows which have the SIZE_EXPAND flag set.
- int hsep = get_theme_constant("hseparation");
- int vsep = get_theme_constant("vseparation");
+ int hsep = get_theme_constant(SNAME("hseparation"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
int max_col = MIN(get_child_count(), columns);
int max_row = ceil((float)get_child_count() / (float)columns);
@@ -213,8 +213,8 @@ Size2 GridContainer::get_minimum_size() const {
Map<int, int> col_minw;
Map<int, int> row_minh;
- int hsep = get_theme_constant("hseparation");
- int vsep = get_theme_constant("vseparation");
+ int hsep = get_theme_constant(SNAME("hseparation"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
int max_row = 0;
int max_col = 0;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index b0d54bf8c9..fdf6181f1d 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -42,7 +42,7 @@ void ItemList::_shape(int p_idx) {
} else {
item.text_buf->set_direction((TextServer::Direction)item.text_direction);
}
- item.text_buf->add_string(item.text, get_theme_font("font"), get_theme_font_size("font_size"), item.opentype_features, (item.language != "") ? item.language : TranslationServer::get_singleton()->get_tool_locale());
+ item.text_buf->add_string(item.text, get_theme_font(SNAME("font")), get_theme_font_size(SNAME("font_size")), item.opentype_features, (item.language != "") ? item.language : TranslationServer::get_singleton()->get_tool_locale());
if (icon_mode == ICON_MODE_TOP && max_text_lines > 0) {
item.text_buf->set_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND);
} else {
@@ -548,7 +548,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
select(defer_select_single, true);
- emit_signal("multi_selected", defer_select_single, true);
+ emit_signal(SNAME("multi_selected"), defer_select_single, true);
defer_select_single = -1;
return;
}
@@ -556,7 +556,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == MOUSE_BUTTON_RIGHT)) && mb->is_pressed()) {
search_string = ""; //any mousepress cancels
Vector2 pos = mb->get_position();
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -583,7 +583,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (select_mode == SELECT_MULTI && items[i].selected && mb->is_command_pressed()) {
deselect(i);
- emit_signal("multi_selected", i, false);
+ emit_signal(SNAME("multi_selected"), i, false);
} else if (select_mode == SELECT_MULTI && mb->is_shift_pressed() && current >= 0 && current < items.size() && current != i) {
int from = current;
@@ -595,12 +595,12 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
bool selected = !items[j].selected;
select(j, false);
if (selected) {
- emit_signal("multi_selected", j, true);
+ emit_signal(SNAME("multi_selected"), j, true);
}
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
}
} else {
if (!mb->is_double_click() && !mb->is_command_pressed() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
@@ -609,7 +609,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
}
if (items[i].selected && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
} else {
bool selected = items[i].selected;
@@ -617,16 +617,16 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (!selected || allow_reselect) {
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", i);
+ emit_signal(SNAME("item_selected"), i);
} else {
- emit_signal("multi_selected", i, true);
+ emit_signal(SNAME("multi_selected"), i, true);
}
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", i, get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), i, get_local_mouse_position());
} else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_double_click()) {
- emit_signal("item_activated", i);
+ emit_signal(SNAME("item_activated"), i);
}
}
}
@@ -634,13 +634,13 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- emit_signal("rmb_clicked", mb->get_position());
+ emit_signal(SNAME("rmb_clicked"), mb->get_position());
return;
}
// Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting.
- emit_signal("nothing_selected");
+ emit_signal(SNAME("nothing_selected"));
}
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8);
@@ -661,7 +661,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
@@ -676,7 +676,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - current_columns);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -691,7 +691,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
}
@@ -705,7 +705,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + current_columns);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -717,7 +717,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - current_columns * i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
break;
@@ -731,7 +731,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + current_columns * i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
@@ -745,7 +745,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current - 1);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -756,7 +756,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(current + 1);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
accept_event();
}
@@ -766,17 +766,17 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (current >= 0 && current < items.size()) {
if (items[current].selectable && !items[current].disabled && !items[current].selected) {
select(current, false);
- emit_signal("multi_selected", current, true);
+ emit_signal(SNAME("multi_selected"), current, true);
} else if (items[current].selected) {
deselect(current);
- emit_signal("multi_selected", current, false);
+ emit_signal(SNAME("multi_selected"), current, false);
}
}
} else if (p_event->is_action("ui_accept")) {
search_string = ""; //any mousepress cancels
if (current >= 0 && current < items.size()) {
- emit_signal("item_activated", current);
+ emit_signal(SNAME("item_activated"), current);
}
} else {
Ref<InputEventKey> k = p_event;
@@ -812,7 +812,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
set_current(i);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
break;
}
@@ -867,7 +867,7 @@ void ItemList::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
int mw = scroll_bar->get_minimum_size().x;
scroll_bar->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -mw);
@@ -884,24 +884,24 @@ void ItemList::_notification(int p_what) {
draw_style_box(bg, Rect2(Point2(), size));
- int hseparation = get_theme_constant("hseparation");
- int vseparation = get_theme_constant("vseparation");
- int icon_margin = get_theme_constant("icon_margin");
- int line_separation = get_theme_constant("line_separation");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ int hseparation = get_theme_constant(SNAME("hseparation"));
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int icon_margin = get_theme_constant(SNAME("icon_margin"));
+ int line_separation = get_theme_constant(SNAME("line_separation"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
- Ref<StyleBox> sbsel = has_focus() ? get_theme_stylebox("selected_focus") : get_theme_stylebox("selected");
- Ref<StyleBox> cursor = has_focus() ? get_theme_stylebox("cursor") : get_theme_stylebox("cursor_unfocused");
+ Ref<StyleBox> sbsel = has_focus() ? get_theme_stylebox(SNAME("selected_focus")) : get_theme_stylebox(SNAME("selected"));
+ Ref<StyleBox> cursor = has_focus() ? get_theme_stylebox(SNAME("cursor")) : get_theme_stylebox(SNAME("cursor_unfocused"));
bool rtl = is_layout_rtl();
- Color guide_color = get_theme_color("guide_color");
- Color font_color = get_theme_color("font_color");
- Color font_selected_color = get_theme_color("font_selected_color");
+ Color guide_color = get_theme_color(SNAME("guide_color"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true);
- draw_style_box(get_theme_stylebox("bg_focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("bg_focus")), Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false);
}
@@ -1299,7 +1299,7 @@ void ItemList::_scroll_changed(double) {
int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -1337,7 +1337,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
}
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 78b9ad2569..06faf3fa3e 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -64,7 +64,7 @@ bool Label::is_uppercase() const {
}
int Label::get_line_height(int p_line) const {
- Ref<Font> font = get_theme_font("font");
+ Ref<Font> font = get_theme_font(SNAME("font"));
if (p_line >= 0 && p_line < lines_rid.size()) {
return TS->shaped_text_get_size(lines_rid[p_line]).y + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM);
} else if (lines_rid.size() > 0) {
@@ -74,12 +74,12 @@ int Label::get_line_height(int p_line) const {
}
return h;
} else {
- return font->get_height(get_theme_font_size("font_size"));
+ return font->get_height(get_theme_font_size(SNAME("font_size")));
}
}
void Label::_shape() {
- Ref<StyleBox> style = get_theme_stylebox("normal", "Label");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"), SNAME("Label"));
int width = (get_size().width - style->get_minimum_size().width);
if (dirty) {
@@ -89,7 +89,7 @@ void Label::_shape() {
} else {
TS->shaped_text_set_direction(text_rid, (TextServer::Direction)text_direction);
}
- TS->shaped_text_add_string(text_rid, (uppercase) ? xl_text.to_upper() : xl_text, get_theme_font("font")->get_rids(), get_theme_font_size("font_size"), opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
+ TS->shaped_text_add_string(text_rid, (uppercase) ? xl_text.to_upper() : xl_text, get_theme_font(SNAME("font"))->get_rids(), get_theme_font_size(SNAME("font_size")), opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
TS->shaped_text_set_bidi_override(text_rid, structured_text_parser(st_parser, st_args, xl_text));
dirty = false;
lines_dirty = true;
@@ -200,9 +200,9 @@ void Label::_shape() {
}
void Label::_update_visible() {
- int line_spacing = get_theme_constant("line_spacing", "Label");
- Ref<StyleBox> style = get_theme_stylebox("normal", "Label");
- Ref<Font> font = get_theme_font("font");
+ int line_spacing = get_theme_constant(SNAME("line_spacing"), SNAME("Label"));
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
int lines_visible = lines_rid.size();
if (max_lines_visible >= 0 && lines_visible > max_lines_visible) {
@@ -244,15 +244,15 @@ void Label::_notification(int p_what) {
Size2 string_size;
Size2 size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("normal");
- Ref<Font> font = get_theme_font("font");
- Color font_color = get_theme_color("font_color");
- Color font_shadow_color = get_theme_color("font_shadow_color");
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
- int line_spacing = get_theme_constant("line_spacing");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- int shadow_outline_size = get_theme_constant("shadow_outline_size");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_shadow_color = get_theme_color(SNAME("font_shadow_color"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
+ int line_spacing = get_theme_constant(SNAME("line_spacing"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ int shadow_outline_size = get_theme_constant(SNAME("shadow_outline_size"));
bool rtl = is_layout_rtl();
style->draw(ci, Rect2(Point2(0, 0), get_size()));
@@ -429,10 +429,10 @@ Size2 Label::get_minimum_size() const {
Size2 min_size = minsize;
- Ref<Font> font = get_theme_font("font");
- min_size.height = MAX(min_size.height, font->get_height(get_theme_font_size("font_size")) + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ min_size.height = MAX(min_size.height, font->get_height(get_theme_font_size(SNAME("font_size"))) + font->get_spacing(Font::SPACING_TOP) + font->get_spacing(Font::SPACING_BOTTOM));
- Size2 min_style = get_theme_stylebox("normal")->get_minimum_size();
+ Size2 min_style = get_theme_stylebox(SNAME("normal"))->get_minimum_size();
if (autowrap_mode != AUTOWRAP_OFF) {
return Size2(1, (clip || overrun_behavior != OVERRUN_NO_TRIMMING) ? 1 : min_size.height) + min_style;
} else {
@@ -455,9 +455,9 @@ int Label::get_line_count() const {
}
int Label::get_visible_line_count() const {
- Ref<Font> font = get_theme_font("font");
- Ref<StyleBox> style = get_theme_stylebox("normal");
- int line_spacing = get_theme_constant("line_spacing");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ int line_spacing = get_theme_constant(SNAME("line_spacing"));
int lines_visible = 0;
float total_h = 0.0;
for (int64_t i = lines_skipped; i < lines_rid.size(); i++) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index c862624f98..8248cfbe4a 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -350,7 +350,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (context_menu_enabled) {
if (k->is_action("ui_menu", true)) {
_ensure_menu();
- Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + get_theme_font("font")->get_height(get_theme_font_size("font_size"))) / 2);
+ Point2 pos = Point2(get_caret_pixel_pos().x, (get_size().y + get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")))) / 2);
menu->set_position(get_global_transform().xform(pos));
menu->set_size(Vector2(1, 1));
_generate_context_menu();
@@ -361,7 +361,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
// Default is ENTER and KP_ENTER. Cannot use ui_accept as default includes SPACE
if (k->is_action("ui_text_submit", false)) {
- emit_signal("text_submitted", text);
+ emit_signal(SNAME("text_submitted"), text);
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD) && virtual_keyboard_enabled) {
DisplayServer::get_singleton()->virtual_keyboard_hide();
}
@@ -569,8 +569,8 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
if (!clear_button_enabled || !has_point(p_pos)) {
return false;
}
- Ref<Texture2D> icon = Control::get_theme_icon("clear");
- int x_ofs = get_theme_stylebox("normal")->get_offset().x;
+ Ref<Texture2D> icon = Control::get_theme_icon(SNAME("clear"));
+ int x_ofs = get_theme_stylebox(SNAME("normal"))->get_offset().x;
return p_pos.x > get_size().width - icon->get_width() - x_ofs;
}
@@ -627,17 +627,17 @@ void LineEdit::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
if (!is_editable()) {
- style = get_theme_stylebox("read_only");
+ style = get_theme_stylebox(SNAME("read_only"));
draw_caret = false;
}
- Ref<Font> font = get_theme_font("font");
+ Ref<Font> font = get_theme_font(SNAME("font"));
style->draw(ci, Rect2(Point2(), size));
if (has_focus()) {
- get_theme_stylebox("focus")->draw(ci, Rect2(Point2(), size));
+ get_theme_stylebox(SNAME("focus"))->draw(ci, Rect2(Point2(), size));
}
int x_ofs = 0;
@@ -675,10 +675,10 @@ void LineEdit::_notification(int p_what) {
int y_area = height - style->get_minimum_size().height;
int y_ofs = style->get_offset().y + (y_area - text_height) / 2;
- Color selection_color = get_theme_color("selection_color");
- Color font_color = is_editable() ? get_theme_color("font_color") : get_theme_color("font_uneditable_color");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color caret_color = get_theme_color("caret_color");
+ Color selection_color = get_theme_color(SNAME("selection_color"));
+ Color font_color = is_editable() ? get_theme_color(SNAME("font_color")) : get_theme_color(SNAME("font_uneditable_color"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color caret_color = get_theme_color(SNAME("caret_color"));
// Draw placeholder color.
if (using_placeholder) {
@@ -687,13 +687,13 @@ void LineEdit::_notification(int p_what) {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
Color color_icon(1, 1, 1, !is_editable() ? .5 * .9 : .9);
if (display_clear_icon) {
if (clear_button_status.press_attempt && clear_button_status.pressing_inside) {
- color_icon = get_theme_color("clear_button_color_pressed");
+ color_icon = get_theme_color(SNAME("clear_button_color_pressed"));
} else {
- color_icon = get_theme_color("clear_button_color");
+ color_icon = get_theme_color(SNAME("clear_button_color"));
}
}
@@ -740,8 +740,8 @@ void LineEdit::_notification(int p_what) {
// Draw text.
ofs.y += TS->shaped_text_get_ascent(text_rid);
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
Vector2 oofs = ofs;
for (int i = 0; i < gl_size; i++) {
@@ -786,7 +786,7 @@ void LineEdit::_notification(int p_what) {
if (l_caret == Rect2() && t_caret == Rect2()) {
// No carets, add one at the start.
- int h = get_theme_font("font")->get_height(get_theme_font_size("font_size"));
+ int h = get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")));
int y = style->get_offset().y + (y_area - h) / 2;
if (rtl) {
l_dir = TextServer::DIRECTION_RTL;
@@ -1008,7 +1008,7 @@ void LineEdit::shift_selection_check_post(bool p_shift) {
}
void LineEdit::set_caret_at_pixel_pos(int p_x) {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1041,7 +1041,7 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1056,7 +1056,7 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
}
Vector2i LineEdit::get_caret_pixel_pos() {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1089,7 +1089,7 @@ Vector2i LineEdit::get_caret_pixel_pos() {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1402,7 +1402,7 @@ void LineEdit::set_caret_column(int p_column) {
return;
}
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
bool rtl = is_layout_rtl();
int x_ofs = 0;
@@ -1436,7 +1436,7 @@ void LineEdit::set_caret_column(int p_column) {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
if (align == ALIGN_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
@@ -1480,7 +1480,7 @@ void LineEdit::insert_text_at_caret(String p_text) {
// Truncate text to append to fit in max_length, if needed.
int available_chars = max_length - text.length();
if (p_text.length() > available_chars) {
- emit_signal("text_change_rejected", p_text.substr(available_chars));
+ emit_signal(SNAME("text_change_rejected"), p_text.substr(available_chars));
p_text = p_text.substr(0, available_chars);
}
}
@@ -1507,15 +1507,15 @@ void LineEdit::clear_internal() {
}
Size2 LineEdit::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("normal");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
Size2 min_size;
// Minimum size of text.
int em_space_size = font->get_char_size('M', 0, font_size).x;
- min_size.width = get_theme_constant("minimum_character_width") * em_space_size;
+ min_size.width = get_theme_constant(SNAME("minimum_character_width")) * em_space_size;
if (expand_to_text_length) {
// Add a space because some fonts are too exact, and because caret needs a bit more when at the end.
@@ -1528,7 +1528,7 @@ Size2 LineEdit::get_minimum_size() const {
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
min_size.width += r_icon->get_width();
min_size.height = MAX(min_size.height, r_icon->get_height());
}
@@ -1908,7 +1908,7 @@ void LineEdit::_text_changed() {
}
void LineEdit::_emit_text_change() {
- emit_signal("text_changed", text);
+ emit_signal(SNAME("text_changed"), text);
text_changed_dirty = false;
}
@@ -1935,8 +1935,8 @@ void LineEdit::_shape() {
}
TS->shaped_text_set_preserve_control(text_rid, draw_control_chars);
- const Ref<Font> &font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ const Ref<Font> &font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
TS->shaped_text_add_string(text_rid, t, font->get_rids(), font_size, opentype_features, (language != "") ? language : TranslationServer::get_singleton()->get_tool_locale());
TS->shaped_text_set_bidi_override(text_rid, structured_text_parser(st_parser, st_args, t));
@@ -1952,12 +1952,12 @@ void LineEdit::_shape() {
void LineEdit::_fit_to_width() {
if (align == ALIGN_FILL) {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
int t_width = get_size().width - style->get_margin(SIDE_RIGHT) - style->get_margin(SIDE_LEFT);
bool using_placeholder = text.is_empty() && ime_text.is_empty();
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
t_width -= r_icon->get_width();
}
TS->shaped_text_fit_to_width(text_rid, MAX(t_width, full_width));
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index ee0618a991..419d49bccf 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -32,8 +32,8 @@
#include "core/string/translation.h"
void LinkButton::_shape() {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
text_buf->clear();
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -158,41 +158,41 @@ void LinkButton::_notification(int p_what) {
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
case DRAW_HOVER_PRESSED:
case DRAW_PRESSED: {
- if (has_theme_color("font_pressed_color")) {
- color = get_theme_color("font_pressed_color");
+ if (has_theme_color(SNAME("font_pressed_color"))) {
+ color = get_theme_color(SNAME("font_pressed_color"));
} else {
- color = get_theme_color("font_color");
+ color = get_theme_color(SNAME("font_color"));
}
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_HOVER: {
- color = get_theme_color("font_hover_color");
+ color = get_theme_color(SNAME("font_hover_color"));
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_DISABLED: {
- color = get_theme_color("font_disabled_color");
+ color = get_theme_color(SNAME("font_disabled_color"));
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
}
if (has_focus()) {
- Ref<StyleBox> style = get_theme_stylebox("focus");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("focus"));
style->draw(ci, Rect2(Point2(), size));
}
int width = text_buf->get_line_width();
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (is_layout_rtl()) {
if (outline_size > 0 && font_outline_color.a > 0) {
text_buf->draw_outline(get_canvas_item(), Vector2(size.width - width, 0), outline_size, font_outline_color);
@@ -206,7 +206,7 @@ void LinkButton::_notification(int p_what) {
}
if (do_underline) {
- int underline_spacing = get_theme_constant("underline_spacing") + text_buf->get_line_underline_position();
+ int underline_spacing = get_theme_constant(SNAME("underline_spacing")) + text_buf->get_line_underline_position();
int y = text_buf->get_line_ascent() + underline_spacing;
if (is_layout_rtl()) {
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 0e9610d0a3..50b4d192a9 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -31,10 +31,10 @@
#include "margin_container.h"
Size2 MarginContainer::get_minimum_size() const {
- int margin_left = get_theme_constant("margin_left");
- int margin_top = get_theme_constant("margin_top");
- int margin_right = get_theme_constant("margin_right");
- int margin_bottom = get_theme_constant("margin_bottom");
+ int margin_left = get_theme_constant(SNAME("margin_left"));
+ int margin_top = get_theme_constant(SNAME("margin_top"));
+ int margin_right = get_theme_constant(SNAME("margin_right"));
+ int margin_bottom = get_theme_constant(SNAME("margin_bottom"));
Size2 max;
@@ -68,10 +68,10 @@ Size2 MarginContainer::get_minimum_size() const {
void MarginContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
- int margin_left = get_theme_constant("margin_left");
- int margin_top = get_theme_constant("margin_top");
- int margin_right = get_theme_constant("margin_right");
- int margin_bottom = get_theme_constant("margin_bottom");
+ int margin_left = get_theme_constant(SNAME("margin_left"));
+ int margin_top = get_theme_constant(SNAME("margin_top"));
+ int margin_right = get_theme_constant(SNAME("margin_right"));
+ int margin_bottom = get_theme_constant(SNAME("margin_bottom"));
Size2 s = get_size();
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index e52b6917be..cd55f258b3 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -35,12 +35,12 @@
Size2 OptionButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
- if (has_theme_icon("arrow")) {
- const Size2 padding = get_theme_stylebox("normal")->get_minimum_size();
- const Size2 arrow_size = Control::get_theme_icon("arrow")->get_size();
+ if (has_theme_icon(SNAME("arrow"))) {
+ const Size2 padding = get_theme_stylebox(SNAME("normal"))->get_minimum_size();
+ const Size2 arrow_size = Control::get_theme_icon(SNAME("arrow"))->get_size();
Size2 content_size = minsize - padding;
- content_size.width += arrow_size.width + get_theme_constant("hseparation");
+ content_size.width += arrow_size.width + get_theme_constant(SNAME("hseparation"));
content_size.height = MAX(content_size.height, arrow_size.height);
minsize = content_size + padding;
@@ -52,26 +52,26 @@ Size2 OptionButton::get_minimum_size() const {
void OptionButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- if (!has_theme_icon("arrow")) {
+ if (!has_theme_icon(SNAME("arrow"))) {
return;
}
RID ci = get_canvas_item();
- Ref<Texture2D> arrow = Control::get_theme_icon("arrow");
+ Ref<Texture2D> arrow = Control::get_theme_icon(SNAME("arrow"));
Color clr = Color(1, 1, 1);
- if (get_theme_constant("modulate_arrow")) {
+ if (get_theme_constant(SNAME("modulate_arrow"))) {
switch (get_draw_mode()) {
case DRAW_PRESSED:
- clr = get_theme_color("font_pressed_color");
+ clr = get_theme_color(SNAME("font_pressed_color"));
break;
case DRAW_HOVER:
- clr = get_theme_color("font_hover_color");
+ clr = get_theme_color(SNAME("font_hover_color"));
break;
case DRAW_DISABLED:
- clr = get_theme_color("font_disabled_color");
+ clr = get_theme_color(SNAME("font_disabled_color"));
break;
default:
- clr = get_theme_color("font_color");
+ clr = get_theme_color(SNAME("font_color"));
}
}
@@ -79,22 +79,22 @@ void OptionButton::_notification(int p_what) {
Point2 ofs;
if (is_layout_rtl()) {
- ofs = Point2(get_theme_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
+ ofs = Point2(get_theme_constant(SNAME("arrow_margin")), int(Math::abs((size.height - arrow->get_height()) / 2)));
} else {
- ofs = Point2(size.width - arrow->get_width() - get_theme_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
+ ofs = Point2(size.width - arrow->get_width() - get_theme_constant(SNAME("arrow_margin")), int(Math::abs((size.height - arrow->get_height()) / 2)));
}
arrow->draw(ci, ofs, clr);
} break;
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
- if (has_theme_icon("arrow")) {
+ if (has_theme_icon(SNAME("arrow"))) {
if (is_layout_rtl()) {
- _set_internal_margin(SIDE_LEFT, Control::get_theme_icon("arrow")->get_width());
+ _set_internal_margin(SIDE_LEFT, Control::get_theme_icon(SNAME("arrow"))->get_width());
_set_internal_margin(SIDE_RIGHT, 0.f);
} else {
_set_internal_margin(SIDE_LEFT, 0.f);
- _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon("arrow")->get_width());
+ _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
}
} break;
@@ -107,7 +107,7 @@ void OptionButton::_notification(int p_what) {
}
void OptionButton::_focused(int p_which) {
- emit_signal("item_focused", p_which);
+ emit_signal(SNAME("item_focused"), p_which);
}
void OptionButton::_selected(int p_which) {
@@ -220,7 +220,7 @@ void OptionButton::_select(int p_which, bool p_emit) {
set_icon(popup->get_item_icon(current));
if (is_inside_tree() && p_emit) {
- emit_signal("item_selected", current);
+ emit_signal(SNAME("item_selected"), current);
}
}
@@ -339,12 +339,12 @@ OptionButton::OptionButton() {
set_toggle_mode(true);
set_text_align(ALIGN_LEFT);
if (is_layout_rtl()) {
- if (has_theme_icon("arrow")) {
- _set_internal_margin(SIDE_LEFT, Control::get_theme_icon("arrow")->get_width());
+ if (has_theme_icon(SNAME("arrow"))) {
+ _set_internal_margin(SIDE_LEFT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
} else {
- if (has_theme_icon("arrow")) {
- _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon("arrow")->get_width());
+ if (has_theme_icon(SNAME("arrow"))) {
+ _set_internal_margin(SIDE_RIGHT, Control::get_theme_icon(SNAME("arrow"))->get_width());
}
}
set_action_mode(ACTION_MODE_BUTTON_PRESS);
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 995e985c3a..e8e7e3d997 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -35,7 +35,7 @@
void Panel::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_theme_stylebox("panel") : get_theme_stylebox("panel_fg");
+ Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_theme_stylebox(SNAME("panel")) : get_theme_stylebox(SNAME("panel_fg"));
style->draw(ci, Rect2(Point2(), get_size()));
}
}
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 11d822c5e1..d910e1e882 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -33,10 +33,10 @@
Size2 PanelContainer::get_minimum_size() const {
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
Size2 ms;
@@ -65,10 +65,10 @@ void PanelContainer::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
style->draw(ci, Rect2(Point2(), get_size()));
@@ -77,10 +77,10 @@ void PanelContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
Ref<StyleBox> style;
- if (has_theme_stylebox("panel")) {
- style = get_theme_stylebox("panel");
+ if (has_theme_stylebox(SNAME("panel"))) {
+ style = get_theme_stylebox(SNAME("panel"));
} else {
- style = get_theme_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox(SNAME("panel"), SNAME("PanelContainer"));
}
Size2 size = get_size();
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 36bcca61a7..5e1c8cec37 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -71,7 +71,7 @@ void Popup::_notification(int p_what) {
_initialize_visible_parents();
} else {
_deinitialize_visible_parents();
- emit_signal("popup_hide");
+ emit_signal(SNAME("popup_hide"));
}
} break;
@@ -103,9 +103,9 @@ void Popup::_close_pressed() {
_deinitialize_visible_parents();
- call_deferred("hide");
+ call_deferred(SNAME("hide"));
- emit_signal("cancelled");
+ emit_signal(SNAME("cancelled"));
}
void Popup::set_as_minsize() {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 2100707d2d..ee9e0e8ab8 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -46,15 +46,15 @@ String PopupMenu::_get_accel_text(const Item &p_item) const {
}
Size2 PopupMenu::_get_contents_minimum_size() const {
- int vseparation = get_theme_constant("vseparation");
- int hseparation = get_theme_constant("hseparation");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int hseparation = get_theme_constant(SNAME("hseparation"));
- Size2 minsize = get_theme_stylebox("panel")->get_minimum_size(); // Accounts for margin in the margin container
+ Size2 minsize = get_theme_stylebox(SNAME("panel"))->get_minimum_size(); // Accounts for margin in the margin container
minsize.x += scroll_container->get_v_scrollbar()->get_size().width * 2; // Adds a buffer so that the scrollbar does not render over the top of content
float max_w = 0.0;
float icon_w = 0.0;
- int check_w = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
+ int check_w = MAX(get_theme_icon(SNAME("checked"))->get_width(), get_theme_icon(SNAME("radio_checked"))->get_width()) + hseparation;
int accel_max_w = 0;
bool has_check = false;
@@ -81,7 +81,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
}
if (items[i].submenu != "") {
- size.width += get_theme_icon("submenu")->get_width();
+ size.width += get_theme_icon(SNAME("submenu"))->get_width();
}
max_w = MAX(max_w, size.width);
@@ -89,7 +89,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
minsize.height += size.height;
}
- int item_side_padding = get_theme_constant("item_start_padding") + get_theme_constant("item_end_padding");
+ int item_side_padding = get_theme_constant(SNAME("item_start_padding")) + get_theme_constant(SNAME("item_end_padding"));
minsize.width += max_w + icon_w + accel_max_w + item_side_padding;
if (has_check) {
@@ -112,24 +112,24 @@ int PopupMenu::_get_item_height(int p_item) const {
int icon_height = items[p_item].get_icon_size().height;
if (items[p_item].checkable_type) {
- icon_height = MAX(icon_height, MAX(get_theme_icon("checked")->get_height(), get_theme_icon("radio_checked")->get_height()));
+ icon_height = MAX(icon_height, MAX(get_theme_icon(SNAME("checked"))->get_height(), get_theme_icon(SNAME("radio_checked"))->get_height()));
}
int text_height = items[p_item].text_buf->get_size().height;
if (text_height == 0 && !items[p_item].separator) {
- text_height = get_theme_font("font")->get_height(get_theme_font_size("font_size"));
+ text_height = get_theme_font(SNAME("font"))->get_height(get_theme_font_size(SNAME("font_size")));
}
int separator_height = 0;
if (items[p_item].separator) {
- separator_height = MAX(get_theme_stylebox("separator")->get_minimum_size().height, MAX(get_theme_stylebox("labeled_separator_left")->get_minimum_size().height, get_theme_stylebox("labeled_separator_right")->get_minimum_size().height));
+ separator_height = MAX(get_theme_stylebox(SNAME("separator"))->get_minimum_size().height, MAX(get_theme_stylebox(SNAME("labeled_separator_left"))->get_minimum_size().height, get_theme_stylebox(SNAME("labeled_separator_right"))->get_minimum_size().height));
}
return MAX(separator_height, MAX(text_height, icon_height));
}
int PopupMenu::_get_items_total_height() const {
- int vsep = get_theme_constant("vseparation");
+ int vsep = get_theme_constant(SNAME("vseparation"));
// Get total height of all items by taking max of icon height and font height
int items_total_height = 0;
@@ -163,9 +163,9 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
return -1;
}
- Ref<StyleBox> style = get_theme_stylebox("panel"); // Accounts for margin in the margin container
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel")); // Accounts for margin in the margin container
- int vseparation = get_theme_constant("vseparation");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
Point2 ofs = style->get_offset() + Point2(0, vseparation / 2);
@@ -195,8 +195,8 @@ void PopupMenu::_activate_submenu(int p_over) {
return; //already visible!
}
- Ref<StyleBox> style = get_theme_stylebox("panel");
- int vsep = get_theme_constant("vseparation");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
+ int vsep = get_theme_constant(SNAME("vseparation"));
Point2 this_pos = get_position();
Rect2 this_rect(this_pos, get_size());
@@ -264,7 +264,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = search_from; i < items.size(); i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -278,7 +278,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = 0; i < search_from; i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -296,7 +296,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = search_from; i >= 0; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -310,7 +310,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (int i = items.size() - 1; i >= search_from; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -459,7 +459,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (items[i].text.findn(search_string) == 0) {
mouse_over = i;
- emit_signal("id_focused", i);
+ emit_signal(SNAME("id_focused"), i);
_scroll_to_item(i);
control->update();
set_input_as_handled();
@@ -474,37 +474,37 @@ void PopupMenu::_draw_items() {
RID ci = control->get_canvas_item();
Size2 margin_size;
- margin_size.width = margin_container->get_theme_constant("margin_right") + margin_container->get_theme_constant("margin_left");
- margin_size.height = margin_container->get_theme_constant("margin_top") + margin_container->get_theme_constant("margin_bottom");
+ margin_size.width = margin_container->get_theme_constant(SNAME("margin_right")) + margin_container->get_theme_constant(SNAME("margin_left"));
+ margin_size.height = margin_container->get_theme_constant(SNAME("margin_top")) + margin_container->get_theme_constant(SNAME("margin_bottom"));
// Space between the item content and the sides of popup menu.
- int item_start_padding = get_theme_constant("item_start_padding");
- int item_end_padding = get_theme_constant("item_end_padding");
+ int item_start_padding = get_theme_constant(SNAME("item_start_padding"));
+ int item_end_padding = get_theme_constant(SNAME("item_end_padding"));
bool rtl = control->is_layout_rtl();
- Ref<StyleBox> style = get_theme_stylebox("panel");
- Ref<StyleBox> hover = get_theme_stylebox("hover");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
+ Ref<StyleBox> hover = get_theme_stylebox(SNAME("hover"));
// In Item::checkable_type enum order (less the non-checkable member)
- Ref<Texture2D> check[] = { get_theme_icon("checked"), get_theme_icon("radio_checked") };
- Ref<Texture2D> uncheck[] = { get_theme_icon("unchecked"), get_theme_icon("radio_unchecked") };
+ Ref<Texture2D> check[] = { get_theme_icon(SNAME("checked")), get_theme_icon(SNAME("radio_checked")) };
+ Ref<Texture2D> uncheck[] = { get_theme_icon(SNAME("unchecked")), get_theme_icon(SNAME("radio_unchecked")) };
Ref<Texture2D> submenu;
if (rtl) {
- submenu = get_theme_icon("submenu_mirrored");
+ submenu = get_theme_icon(SNAME("submenu_mirrored"));
} else {
- submenu = get_theme_icon("submenu");
+ submenu = get_theme_icon(SNAME("submenu"));
}
- Ref<StyleBox> separator = get_theme_stylebox("separator");
- Ref<StyleBox> labeled_separator_left = get_theme_stylebox("labeled_separator_left");
- Ref<StyleBox> labeled_separator_right = get_theme_stylebox("labeled_separator_right");
+ Ref<StyleBox> separator = get_theme_stylebox(SNAME("separator"));
+ Ref<StyleBox> labeled_separator_left = get_theme_stylebox(SNAME("labeled_separator_left"));
+ Ref<StyleBox> labeled_separator_right = get_theme_stylebox(SNAME("labeled_separator_right"));
- int vseparation = get_theme_constant("vseparation");
- int hseparation = get_theme_constant("hseparation");
- Color font_color = get_theme_color("font_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- Color font_accelerator_color = get_theme_color("font_accelerator_color");
- Color font_hover_color = get_theme_color("font_hover_color");
- Color font_separator_color = get_theme_color("font_separator_color");
+ int vseparation = get_theme_constant(SNAME("vseparation"));
+ int hseparation = get_theme_constant(SNAME("hseparation"));
+ Color font_color = get_theme_color(SNAME("font_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ Color font_accelerator_color = get_theme_color(SNAME("font_accelerator_color"));
+ Color font_hover_color = get_theme_color(SNAME("font_hover_color"));
+ Color font_separator_color = get_theme_color(SNAME("font_separator_color"));
float scroll_width = scroll_container->get_v_scrollbar()->is_visible_in_tree() ? scroll_container->get_v_scrollbar()->get_size().width : 0;
float display_width = control->get_size().width - scroll_width;
@@ -525,7 +525,7 @@ void PopupMenu::_draw_items() {
float check_ofs = 0.0;
if (has_check) {
- check_ofs = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
+ check_ofs = MAX(get_theme_icon(SNAME("checked"))->get_width(), get_theme_icon(SNAME("radio_checked"))->get_width()) + hseparation;
}
Point2 ofs = Point2();
@@ -606,8 +606,8 @@ void PopupMenu::_draw_items() {
}
// Text
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (items[i].separator) {
if (text != String()) {
int center = (display_width - items[i].text_buf->get_size().width) / 2;
@@ -657,7 +657,7 @@ void PopupMenu::_draw_items() {
}
void PopupMenu::_draw_background() {
- Ref<StyleBox> style = get_theme_stylebox("panel");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("panel"));
RID ci2 = margin_container->get_canvas_item();
style->draw(ci2, Rect2(Point2(), margin_container->get_size()));
}
@@ -691,8 +691,8 @@ void PopupMenu::_shape_item(int p_item) {
if (items.write[p_item].dirty) {
items.write[p_item].text_buf->clear();
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
if (items[p_item].text_direction == Control::TEXT_DIRECTION_INHERITED) {
items.write[p_item].text_buf->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
@@ -791,7 +791,7 @@ void PopupMenu::_notification(int p_what) {
}
// Set margin on the margin container
- Ref<StyleBox> panel_style = get_theme_stylebox("panel");
+ Ref<StyleBox> panel_style = get_theme_stylebox(SNAME("panel"));
margin_container->add_theme_constant_override("margin_top", panel_style->get_margin(Side::SIDE_TOP));
margin_container->add_theme_constant_override("margin_bottom", panel_style->get_margin(Side::SIDE_BOTTOM));
margin_container->add_theme_constant_override("margin_left", panel_style->get_margin(Side::SIDE_LEFT));
@@ -1376,8 +1376,8 @@ void PopupMenu::activate_item(int p_item) {
need_hide = false;
}
- emit_signal("id_pressed", id);
- emit_signal("index_pressed", p_item);
+ emit_signal(SNAME("id_pressed"), id);
+ emit_signal(SNAME("index_pressed"), p_item);
if (need_hide) {
hide();
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 6e8dfd5994..2cfaaa2fde 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -32,10 +32,10 @@
#include "scene/resources/text_line.h"
Size2 ProgressBar::get_minimum_size() const {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
- Ref<StyleBox> fg = get_theme_stylebox("fg");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
+ Ref<StyleBox> fg = get_theme_stylebox(SNAME("fg"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
Size2 minimum_size = bg->get_minimum_size();
minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
@@ -53,11 +53,11 @@ Size2 ProgressBar::get_minimum_size() const {
void ProgressBar::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_theme_stylebox("bg");
- Ref<StyleBox> fg = get_theme_stylebox("fg");
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
- Color font_color = get_theme_color("font_color");
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("bg"));
+ Ref<StyleBox> fg = get_theme_stylebox(SNAME("fg"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
+ Color font_color = get_theme_color(SNAME("font_color"));
draw_style_box(bg, Rect2(Point2(), get_size()));
float r = get_as_ratio();
@@ -75,8 +75,8 @@ void ProgressBar::_notification(int p_what) {
String txt = TS->format_number(itos(int(get_as_ratio() * 100))) + TS->percent_sign();
TextLine tl = TextLine(txt, font, font_size);
Vector2 text_pos = (Point2(get_size().width - tl.get_size().x, get_size().height - tl.get_size().y) / 2).round();
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
tl.draw_outline(get_canvas_item(), text_pos, outline_size, font_outline_color);
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index 4ea1e1eb9f..92d4261d8d 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -42,7 +42,7 @@ TypedArray<String> Range::get_configuration_warnings() const {
void Range::_value_changed_notify() {
_value_changed(shared->val);
- emit_signal("value_changed", shared->val);
+ emit_signal(SNAME("value_changed"), shared->val);
update();
}
@@ -57,7 +57,7 @@ void Range::Shared::emit_value_changed() {
}
void Range::_changed_notify(const char *p_what) {
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
update();
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index f32ad2144a..99395aae30 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -136,7 +136,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) co
}
Rect2 RichTextLabel::_get_text_rect() {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
}
@@ -229,8 +229,8 @@ void RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font>
switch (it->type) {
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
int col_count = table->columns.size();
for (int i = 0; i < col_count; i++) {
@@ -458,8 +458,8 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
} break;
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
int col_count = table->columns.size();
int t_char_count = 0;
// Set minimums to zero.
@@ -672,11 +672,11 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
if (prefix != "") {
Ref<Font> font = _find_font(l.from);
if (font.is_null()) {
- font = get_theme_font("normal_font");
+ font = get_theme_font(SNAME("normal_font"));
}
int font_size = _find_font_size(l.from);
if (font_size == -1) {
- font_size = get_theme_font_size("normal_font_size");
+ font_size = get_theme_font_size(SNAME("normal_font_size"));
}
if (rtl) {
float offx = 0.0f;
@@ -775,10 +775,10 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
} break;
case ITEM_TABLE: {
ItemTable *table = static_cast<ItemTable *>(it);
- Color odd_row_bg = get_theme_color("table_odd_row_bg");
- Color even_row_bg = get_theme_color("table_even_row_bg");
- Color border = get_theme_color("table_border");
- int hseparation = get_theme_constant("table_hseparation");
+ Color odd_row_bg = get_theme_color(SNAME("table_odd_row_bg"));
+ Color even_row_bg = get_theme_color(SNAME("table_even_row_bg"));
+ Color border = get_theme_color(SNAME("table_border"));
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
int col_count = table->columns.size();
int row_count = table->rows.size();
@@ -916,7 +916,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
}
}
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
// Draw glyph outlines.
for (int j = 0; j < glyphs[i].repeat; j++) {
@@ -940,8 +940,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
_draw_fbg_boxes(ci, rid, fbg_line_off, it_from, it_to, chr_range.x, chr_range.y, 0);
// Draw main text.
- Color selection_fg = get_theme_color("font_selected_color");
- Color selection_bg = get_theme_color("selection_color");
+ Color selection_fg = get_theme_color(SNAME("font_selected_color"));
+ Color selection_bg = get_theme_color(SNAME("selection_color"));
int sel_start = -1;
int sel_end = -1;
@@ -1192,8 +1192,8 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
if (rect.has_point(p_click - p_ofs - off)) {
switch (it->type) {
case ITEM_TABLE: {
- int hseparation = get_theme_constant("table_hseparation");
- int vseparation = get_theme_constant("table_vseparation");
+ int hseparation = get_theme_constant(SNAME("table_hseparation"));
+ int vseparation = get_theme_constant(SNAME("table_vseparation"));
ItemTable *table = static_cast<ItemTable *>(it);
@@ -1362,7 +1362,7 @@ void RichTextLabel::_notification(int p_what) {
case NOTIFICATION_MOUSE_EXIT: {
if (meta_hovering) {
meta_hovering = nullptr;
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
current_meta = false;
update();
}
@@ -1395,11 +1395,11 @@ void RichTextLabel::_notification(int p_what) {
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
- draw_style_box(get_theme_stylebox("normal"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("normal")), Rect2(Point2(), size));
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
- draw_style_box(get_theme_stylebox("focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox(SNAME("focus")), Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false);
}
@@ -1419,13 +1419,13 @@ void RichTextLabel::_notification(int p_what) {
if (from_line >= main->lines.size()) {
break; //nothing to draw
}
- Ref<Font> base_font = get_theme_font("normal_font");
- Color base_color = get_theme_color("default_color");
- Color outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- Color font_shadow_color = get_theme_color("font_shadow_color");
- bool use_outline = get_theme_constant("shadow_as_outline");
- Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ Color base_color = get_theme_color(SNAME("default_color"));
+ Color outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ Color font_shadow_color = get_theme_color(SNAME("font_shadow_color"));
+ bool use_outline = get_theme_constant(SNAME("shadow_as_outline"));
+ Point2 shadow_ofs(get_theme_constant(SNAME("shadow_offset_x")), get_theme_constant(SNAME("shadow_offset_y")));
visible_paragraph_count = 0;
visible_line_count = 0;
@@ -1568,7 +1568,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
Variant meta;
if (!outside && _find_meta(c_item, &meta)) {
//meta clicked
- emit_signal("meta_clicked", meta);
+ emit_signal(SNAME("meta_clicked"), meta);
}
}
}
@@ -1611,11 +1611,11 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
handled = true;
}
if (k->is_action("ui_up") && vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() - get_theme_font("normal_font")->get_height(get_theme_font_size("normal_font_size")));
+ vscroll->set_value(vscroll->get_value() - get_theme_font(SNAME("normal_font"))->get_height(get_theme_font_size(SNAME("normal_font_size"))));
handled = true;
}
if (k->is_action("ui_down") && vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() + get_theme_font("normal_font")->get_height(get_theme_font_size("normal_font_size")));
+ vscroll->set_value(vscroll->get_value() + get_theme_font(SNAME("normal_font"))->get_height(get_theme_font_size(SNAME("normal_font_size"))));
handled = true;
}
if (k->is_action("ui_home") && vscroll->is_visible_in_tree()) {
@@ -1693,15 +1693,15 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
if (c_item && !outside && _find_meta(c_item, &meta, &item_meta)) {
if (meta_hovering != item_meta) {
if (meta_hovering) {
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
}
meta_hovering = item_meta;
current_meta = meta;
- emit_signal("meta_hover_started", meta);
+ emit_signal(SNAME("meta_hover_started"), meta);
}
} else if (meta_hovering) {
meta_hovering = nullptr;
- emit_signal("meta_hover_ended", current_meta);
+ emit_signal(SNAME("meta_hover_ended"), current_meta);
current_meta = false;
}
}
@@ -2105,8 +2105,8 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
}
Rect2 text_rect = _get_text_rect();
- Ref<Font> base_font = get_theme_font("normal_font");
- int base_font_size = get_theme_font_size("normal_font_size");
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ int base_font_size = get_theme_font_size(SNAME("normal_font_size"));
for (int i = p_frame->first_resized_line; i < p_frame->lines.size(); i++) {
_resize_line(p_frame, i, base_font, base_font_size, text_rect.get_size().width - scroll_w);
@@ -2140,8 +2140,8 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
}
Rect2 text_rect = _get_text_rect();
- Ref<Font> base_font = get_theme_font("normal_font");
- int base_font_size = get_theme_font_size("normal_font_size");
+ Ref<Font> base_font = get_theme_font(SNAME("normal_font"));
+ int base_font_size = get_theme_font_size(SNAME("normal_font_size"));
int total_chars = (p_frame->first_invalid_line == 0) ? 0 : (p_frame->lines[p_frame->first_invalid_line].char_offset + p_frame->lines[p_frame->first_invalid_line].char_count);
for (int i = p_frame->first_invalid_line; i < p_frame->lines.size(); i++) {
@@ -2406,35 +2406,35 @@ void RichTextLabel::push_font(const Ref<Font> &p_font) {
}
void RichTextLabel::push_normal() {
- Ref<Font> normal_font = get_theme_font("normal_font");
+ Ref<Font> normal_font = get_theme_font(SNAME("normal_font"));
ERR_FAIL_COND(normal_font.is_null());
push_font(normal_font);
}
void RichTextLabel::push_bold() {
- Ref<Font> bold_font = get_theme_font("bold_font");
+ Ref<Font> bold_font = get_theme_font(SNAME("bold_font"));
ERR_FAIL_COND(bold_font.is_null());
push_font(bold_font);
}
void RichTextLabel::push_bold_italics() {
- Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
+ Ref<Font> bold_italics_font = get_theme_font(SNAME("bold_italics_font"));
ERR_FAIL_COND(bold_italics_font.is_null());
push_font(bold_italics_font);
}
void RichTextLabel::push_italics() {
- Ref<Font> italics_font = get_theme_font("italics_font");
+ Ref<Font> italics_font = get_theme_font(SNAME("italics_font"));
ERR_FAIL_COND(italics_font.is_null());
push_font(italics_font);
}
void RichTextLabel::push_mono() {
- Ref<Font> mono_font = get_theme_font("mono_font");
+ Ref<Font> mono_font = get_theme_font(SNAME("mono_font"));
ERR_FAIL_COND(mono_font.is_null());
push_font(mono_font);
@@ -2774,13 +2774,13 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
int pos = 0;
List<String> tag_stack;
- Ref<Font> normal_font = get_theme_font("normal_font");
- Ref<Font> bold_font = get_theme_font("bold_font");
- Ref<Font> italics_font = get_theme_font("italics_font");
- Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
- Ref<Font> mono_font = get_theme_font("mono_font");
+ Ref<Font> normal_font = get_theme_font(SNAME("normal_font"));
+ Ref<Font> bold_font = get_theme_font(SNAME("bold_font"));
+ Ref<Font> italics_font = get_theme_font(SNAME("italics_font"));
+ Ref<Font> bold_italics_font = get_theme_font(SNAME("bold_italics_font"));
+ Ref<Font> mono_font = get_theme_font(SNAME("mono_font"));
- Color base_color = get_theme_color("default_color");
+ Color base_color = get_theme_color(SNAME("default_color"));
int indent_level = 0;
@@ -3140,11 +3140,11 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
tag_stack.push_front("url");
} else if (tag.begins_with("dropcap")) {
Vector<String> subtag = tag.substr(5, tag.length()).split(" ");
- Ref<Font> f = get_theme_font("normal_font");
- int fs = get_theme_font_size("normal_font_size") * 3;
- Color color = get_theme_color("default_color");
- Color outline_color = get_theme_color("outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Ref<Font> f = get_theme_font(SNAME("normal_font"));
+ int fs = get_theme_font_size(SNAME("normal_font_size")) * 3;
+ Color color = get_theme_color(SNAME("default_color"));
+ Color outline_color = get_theme_color(SNAME("outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Rect2 dropcap_margins = Rect2();
for (int i = 0; i < subtag.size(); i++) {
@@ -4168,7 +4168,7 @@ void RichTextLabel::set_fixed_size_to_width(int p_width) {
}
Size2 RichTextLabel::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("normal"));
Size2 size = style->get_minimum_size();
if (fixed_width != -1) {
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 62276e3af0..ce04a0204b 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -46,7 +46,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (!m.is_valid() || drag.active) {
- emit_signal("scrolling");
+ emit_signal(SNAME("scrolling"));
}
Ref<InputEventMouseButton> b = p_event;
@@ -70,8 +70,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed()) {
double ofs = orientation == VERTICAL ? b->get_position().y : b->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -140,7 +140,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (drag.active) {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
ofs -= decr_size;
@@ -150,8 +150,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
set_as_ratio(drag.value_at_click + diff);
} else {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -215,17 +215,17 @@ void ScrollBar::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
- Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_theme_icon("decrement_highlight") : get_theme_icon("decrement");
- Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_theme_icon("increment_highlight") : get_theme_icon("increment");
- Ref<StyleBox> bg = has_focus() ? get_theme_stylebox("scroll_focus") : get_theme_stylebox("scroll");
+ Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_theme_icon(SNAME("decrement_highlight")) : get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_theme_icon(SNAME("increment_highlight")) : get_theme_icon(SNAME("increment"));
+ Ref<StyleBox> bg = has_focus() ? get_theme_stylebox(SNAME("scroll_focus")) : get_theme_stylebox(SNAME("scroll"));
Ref<StyleBox> grabber;
if (drag.active) {
- grabber = get_theme_stylebox("grabber_pressed");
+ grabber = get_theme_stylebox(SNAME("grabber_pressed"));
} else if (highlight == HIGHLIGHT_RANGE) {
- grabber = get_theme_stylebox("grabber_highlight");
+ grabber = get_theme_stylebox(SNAME("grabber_highlight"));
} else {
- grabber = get_theme_stylebox("grabber");
+ grabber = get_theme_stylebox(SNAME("grabber"));
}
Point2 ofs;
@@ -389,7 +389,7 @@ void ScrollBar::_notification(int p_what) {
}
double ScrollBar::get_grabber_min_size() const {
- Ref<StyleBox> grabber = get_theme_stylebox("grabber");
+ Ref<StyleBox> grabber = get_theme_stylebox(SNAME("grabber"));
Size2 gminsize = grabber->get_minimum_size() + grabber->get_center_size();
return (orientation == VERTICAL) ? gminsize.height : gminsize.width;
}
@@ -415,17 +415,17 @@ double ScrollBar::get_area_size() const {
switch (orientation) {
case VERTICAL: {
double area = get_size().height;
- area -= get_theme_stylebox("scroll")->get_minimum_size().height;
- area -= get_theme_icon("increment")->get_height();
- area -= get_theme_icon("decrement")->get_height();
+ area -= get_theme_stylebox(SNAME("scroll"))->get_minimum_size().height;
+ area -= get_theme_icon(SNAME("increment"))->get_height();
+ area -= get_theme_icon(SNAME("decrement"))->get_height();
area -= get_grabber_min_size();
return area;
} break;
case HORIZONTAL: {
double area = get_size().width;
- area -= get_theme_stylebox("scroll")->get_minimum_size().width;
- area -= get_theme_icon("increment")->get_width();
- area -= get_theme_icon("decrement")->get_width();
+ area -= get_theme_stylebox(SNAME("scroll"))->get_minimum_size().width;
+ area -= get_theme_icon(SNAME("increment"))->get_width();
+ area -= get_theme_icon(SNAME("decrement"))->get_width();
area -= get_grabber_min_size();
return area;
} break;
@@ -439,13 +439,13 @@ double ScrollBar::get_area_offset() const {
double ofs = 0.0;
if (orientation == VERTICAL) {
- ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_TOP);
- ofs += get_theme_icon("decrement")->get_height();
+ ofs += get_theme_stylebox(SNAME("hscroll"))->get_margin(SIDE_TOP);
+ ofs += get_theme_icon(SNAME("decrement"))->get_height();
}
if (orientation == HORIZONTAL) {
- ofs += get_theme_stylebox("hscroll")->get_margin(SIDE_LEFT);
- ofs += get_theme_icon("decrement")->get_width();
+ ofs += get_theme_stylebox(SNAME("hscroll"))->get_margin(SIDE_LEFT);
+ ofs += get_theme_icon(SNAME("decrement"))->get_width();
}
return ofs;
@@ -456,9 +456,9 @@ double ScrollBar::get_grabber_offset() const {
}
Size2 ScrollBar::get_minimum_size() const {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<StyleBox> bg = get_theme_stylebox("scroll");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<StyleBox> bg = get_theme_stylebox(SNAME("scroll"));
Size2 minsize;
if (orientation == VERTICAL) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 177f146b6a..eb5fc924da 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -33,7 +33,7 @@
#include "scene/main/window.h"
Size2 ScrollContainer::get_minimum_size() const {
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
Size2 min_size;
for (int i = 0; i < get_child_count(); i++) {
@@ -77,7 +77,7 @@ void ScrollContainer::_cancel_drag() {
drag_from = Vector2();
if (beyond_deadzone) {
- emit_signal("scroll_ended");
+ emit_signal(SNAME("scroll_ended"));
propagate_notification(NOTIFICATION_SCROLL_END);
beyond_deadzone = false;
}
@@ -173,7 +173,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (beyond_deadzone || (scroll_h && Math::abs(drag_accum.x) > deadzone) || (scroll_v && Math::abs(drag_accum.y) > deadzone)) {
if (!beyond_deadzone) {
propagate_notification(NOTIFICATION_SCROLL_BEGIN);
- emit_signal("scroll_started");
+ emit_signal(SNAME("scroll_started"));
beyond_deadzone = true;
// resetting drag_accum here ensures smooth scrolling after reaching deadzone
@@ -260,7 +260,7 @@ void ScrollContainer::_update_dimensions() {
Size2 size = get_size();
Point2 ofs;
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
size -= sb->get_minimum_size();
ofs += sb->get_offset();
bool rtl = is_layout_rtl();
@@ -319,7 +319,7 @@ void ScrollContainer::_update_dimensions() {
void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
_updating_scrollbars = true;
- call_deferred("_update_scrollbar_position");
+ call_deferred(SNAME("_update_scrollbar_position"));
};
if (p_what == NOTIFICATION_READY) {
@@ -332,7 +332,7 @@ void ScrollContainer::_notification(int p_what) {
};
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
draw_style_box(sb, Rect2(Vector2(), get_size()));
update_scrollbars();
@@ -409,7 +409,7 @@ void ScrollContainer::_notification(int p_what) {
void ScrollContainer::update_scrollbars() {
Size2 size = get_size();
- Ref<StyleBox> sb = get_theme_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("bg"));
size -= sb->get_minimum_size();
Size2 hmin;
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index 3cb8ccf135..1f3cb7aa24 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -33,9 +33,9 @@
Size2 Separator::get_minimum_size() const {
Size2 ms(3, 3);
if (orientation == VERTICAL) {
- ms.x = get_theme_constant("separation");
+ ms.x = get_theme_constant(SNAME("separation"));
} else { // HORIZONTAL
- ms.y = get_theme_constant("separation");
+ ms.y = get_theme_constant(SNAME("separation"));
}
return ms;
}
@@ -44,7 +44,7 @@ void Separator::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Size2i size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("separator");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("separator"));
Size2i ssize = style->get_minimum_size() + style->get_center_size();
if (orientation == VERTICAL) {
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 5947f3b99e..61b5325175 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -32,10 +32,10 @@
#include "core/os/keyboard.h"
Size2 Slider::get_minimum_size() const {
- Ref<StyleBox> style = get_theme_stylebox("slider");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("slider"));
Size2i ss = style->get_minimum_size() + style->get_center_size();
- Ref<Texture2D> grabber = get_theme_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon(SNAME("grabber"));
Size2i rs = grabber->get_size();
if (orientation == HORIZONTAL) {
@@ -89,7 +89,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
if (grab.active) {
Size2i size = get_size();
- Ref<Texture2D> grabber = get_theme_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon(SNAME("grabber"));
float motion = (orientation == VERTICAL ? mm->get_position().y : mm->get_position().x) - grab.pos;
if (orientation == VERTICAL) {
motion = -motion;
@@ -161,11 +161,11 @@ void Slider::_notification(int p_what) {
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
Size2i size = get_size();
- Ref<StyleBox> style = get_theme_stylebox("slider");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("slider"));
bool highlighted = mouse_inside || has_focus();
Ref<StyleBox> grabber_area = get_theme_stylebox(highlighted ? "grabber_area_highlight" : "grabber_area");
Ref<Texture2D> grabber = get_theme_icon(editable ? (highlighted ? "grabber_highlight" : "grabber") : "grabber_disabled");
- Ref<Texture2D> tick = get_theme_icon("tick");
+ Ref<Texture2D> tick = get_theme_icon(SNAME("tick"));
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
if (orientation == VERTICAL) {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 5c7b375608..3f0368a4e2 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -188,7 +188,7 @@ inline void SpinBox::_adjust_width_for_icon(const Ref<Texture2D> &icon) {
void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture2D> updown = get_theme_icon("updown");
+ Ref<Texture2D> updown = get_theme_icon(SNAME("updown"));
_adjust_width_for_icon(updown);
@@ -204,15 +204,15 @@ void SpinBox::_notification(int p_what) {
} else if (p_what == NOTIFICATION_FOCUS_EXIT) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
- _adjust_width_for_icon(get_theme_icon("updown"));
+ _adjust_width_for_icon(get_theme_icon(SNAME("updown")));
_value_changed(0);
} else if (p_what == NOTIFICATION_EXIT_TREE) {
_release_mouse();
} else if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
_value_changed(0);
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
- call_deferred("minimum_size_changed");
- get_line_edit()->call_deferred("minimum_size_changed");
+ call_deferred(SNAME("minimum_size_changed"));
+ get_line_edit()->call_deferred(SNAME("minimum_size_changed"));
} else if (p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
update();
}
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 9796b32c6b..3114e5b7c0 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -76,8 +76,8 @@ void SplitContainer::_resort() {
bool second_expanded = (vertical ? second->get_v_size_flags() : second->get_h_size_flags()) & SIZE_EXPAND;
// Determine the separation between items
- Ref<Texture2D> g = get_theme_icon("grabber");
- int sep = get_theme_constant("separation");
+ Ref<Texture2D> g = get_theme_icon(SNAME("grabber"));
+ int sep = get_theme_constant(SNAME("separation"));
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
// Compute the minimum size
@@ -131,8 +131,8 @@ Size2 SplitContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- Ref<Texture2D> g = get_theme_icon("grabber");
- int sep = get_theme_constant("separation");
+ Ref<Texture2D> g = get_theme_icon(SNAME("grabber"));
+ int sep = get_theme_constant(SNAME("separation"));
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
for (int i = 0; i < 2; i++) {
@@ -173,7 +173,7 @@ void SplitContainer::_notification(int p_what) {
} break;
case NOTIFICATION_MOUSE_EXIT: {
mouse_inside = false;
- if (get_theme_constant("autohide")) {
+ if (get_theme_constant(SNAME("autohide"))) {
update();
}
} break;
@@ -182,7 +182,7 @@ void SplitContainer::_notification(int p_what) {
return;
}
- if (collapsed || (!dragging && !mouse_inside && get_theme_constant("autohide"))) {
+ if (collapsed || (!dragging && !mouse_inside && get_theme_constant(SNAME("autohide")))) {
return;
}
@@ -190,8 +190,8 @@ void SplitContainer::_notification(int p_what) {
return;
}
- int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant("separation") : 0;
- Ref<Texture2D> tex = get_theme_icon("grabber");
+ int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant(SNAME("separation")) : 0;
+ Ref<Texture2D> tex = get_theme_icon(SNAME("grabber"));
Size2 size = get_size();
if (vertical) {
@@ -218,7 +218,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid()) {
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (mb->is_pressed()) {
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
if (vertical) {
if (mb->get_position().y > middle_sep && mb->get_position().y < middle_sep + sep) {
@@ -244,14 +244,14 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
bool mouse_inside_state = false;
if (vertical) {
- mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant("separation");
+ mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant(SNAME("separation"));
} else {
- mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant("separation");
+ mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant(SNAME("separation"));
}
if (mouse_inside != mouse_inside_state) {
mouse_inside = mouse_inside_state;
- if (get_theme_constant("autohide")) {
+ if (get_theme_constant(SNAME("autohide"))) {
update();
}
}
@@ -267,7 +267,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
should_clamp_split_offset = true;
queue_sort();
- emit_signal("dragged", get_split_offset());
+ emit_signal(SNAME("dragged"), get_split_offset());
}
}
@@ -277,7 +277,7 @@ Control::CursorShape SplitContainer::get_cursor_shape(const Point2 &p_pos) const
}
if (!collapsed && _getch(0) && _getch(1) && dragger_visibility == DRAGGER_VISIBLE) {
- int sep = get_theme_constant("separation");
+ int sep = get_theme_constant(SNAME("separation"));
if (vertical) {
if (p_pos.y > middle_sep && p_pos.y < middle_sep + sep) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 133966013b..8f84585f9b 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -43,9 +43,9 @@ int TabContainer::_get_top_margin() const {
}
// Respect the minimum tab height.
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int tab_height = MAX(MAX(tab_unselected->get_minimum_size().height, tab_selected->get_minimum_size().height), tab_disabled->get_minimum_size().height);
@@ -88,11 +88,11 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
// Handle menu button.
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
if (is_layout_rtl()) {
if (popup && pos.x < menu->get_width()) {
- emit_signal("pre_popup_pressed");
+ emit_signal(SNAME("pre_popup_pressed"));
Vector2 popup_pos = get_screen_position();
popup_pos.y += menu->get_height();
@@ -103,7 +103,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
}
} else {
if (popup && pos.x > size.width - menu->get_width()) {
- emit_signal("pre_popup_pressed");
+ emit_signal(SNAME("pre_popup_pressed"));
Vector2 popup_pos = get_screen_position();
popup_pos.x += size.width - popup->get_size().width;
@@ -129,8 +129,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < popup_ofs + decrement->get_width()) {
if (last_tab_cache < tabs.size() - 1) {
@@ -203,7 +203,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
if (popup) {
if (is_layout_rtl()) {
if (pos.x <= menu->get_width()) {
@@ -248,8 +248,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x <= popup_ofs + decrement->get_width()) {
@@ -289,10 +289,10 @@ void TabContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_RESIZED: {
Vector<Control *> tabs = _get_tabs();
- int side_margin = get_theme_constant("side_margin");
- Ref<Texture2D> menu = get_theme_icon("menu");
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ int side_margin = get_theme_constant(SNAME("side_margin"));
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
int header_width = get_size().width - side_margin * 2;
// Find the width of the header area.
@@ -332,26 +332,26 @@ void TabContainer::_notification(int p_what) {
bool rtl = is_layout_rtl();
// Draw only the tab area if the header is hidden.
- Ref<StyleBox> panel = get_theme_stylebox("panel");
+ Ref<StyleBox> panel = get_theme_stylebox(SNAME("panel"));
if (!tabs_visible) {
panel->draw(canvas, Rect2(0, 0, size.width, size.height));
return;
}
Vector<Control *> tabs = _get_tabs();
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> increment_hl = get_theme_icon("increment_highlight");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
- Ref<Texture2D> decrement_hl = get_theme_icon("decrement_highlight");
- Ref<Texture2D> menu = get_theme_icon("menu");
- Ref<Texture2D> menu_hl = get_theme_icon("menu_highlight");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color font_unselected_color = get_theme_color("font_unselected_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- int side_margin = get_theme_constant("side_margin");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> increment_hl = get_theme_icon(SNAME("increment_highlight"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> decrement_hl = get_theme_icon(SNAME("decrement_highlight"));
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
+ Ref<Texture2D> menu_hl = get_theme_icon(SNAME("menu_highlight"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color font_unselected_color = get_theme_color(SNAME("font_unselected_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ int side_margin = get_theme_constant(SNAME("side_margin"));
// Find out start and width of the header area.
int header_x = side_margin;
@@ -529,7 +529,7 @@ void TabContainer::_notification(int p_what) {
text_buf.write[i]->clear();
}
_theme_changing = true;
- call_deferred("_on_theme_changed"); // Wait until all changed theme.
+ call_deferred(SNAME("_on_theme_changed")); // Wait until all changed theme.
} break;
}
}
@@ -537,10 +537,10 @@ void TabContainer::_notification(int p_what) {
void TabContainer::_draw_tab(Ref<StyleBox> &p_tab_style, Color &p_font_color, int p_index, float p_x) {
Vector<Control *> tabs = _get_tabs();
RID canvas = get_canvas_item();
- Ref<Font> font = get_theme_font("font");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
- int icon_text_distance = get_theme_constant("icon_separation");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
+ int icon_text_distance = get_theme_constant(SNAME("icon_separation"));
int tab_width = _get_tab_width(p_index);
int header_height = _get_top_margin();
@@ -580,8 +580,8 @@ void TabContainer::_refresh_texts() {
text_buf.clear();
Vector<Control *> tabs = _get_tabs();
bool rtl = is_layout_rtl();
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
for (int i = 0; i < tabs.size(); i++) {
Control *control = Object::cast_to<Control>(tabs[i]);
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(tr(control->get_name()));
@@ -609,7 +609,7 @@ void TabContainer::_on_theme_changed() {
}
void TabContainer::_repaint() {
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
Vector<Control *> tabs = _get_tabs();
for (int i = 0; i < tabs.size(); i++) {
Control *c = tabs[i];
@@ -646,8 +646,8 @@ int TabContainer::_get_tab_width(int p_index) const {
}
// Get the width of the text displayed on the tab.
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(tr(control->get_name()));
int width = font->get_string_size(text, font_size).width;
@@ -657,15 +657,15 @@ int TabContainer::_get_tab_width(int p_index) const {
if (icon.is_valid()) {
width += icon->get_width();
if (text != "") {
- width += get_theme_constant("icon_separation");
+ width += get_theme_constant(SNAME("icon_separation"));
}
}
}
// Respect a minimum size.
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
if (get_tab_disabled(p_index)) {
width += tab_disabled->get_minimum_size().width;
} else if (p_index == current) {
@@ -715,7 +715,7 @@ void TabContainer::add_child_notify(Node *p_child) {
c->hide();
} else {
c->show();
- //call_deferred("set_current_tab",0);
+ //call_deferred(SNAME("set_current_tab"),0);
first = true;
current = 0;
previous = 0;
@@ -724,7 +724,7 @@ void TabContainer::add_child_notify(Node *p_child) {
if (tabs_visible) {
c->set_offset(SIDE_TOP, _get_top_margin());
}
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
c->set_offset(Side(SIDE_TOP), c->get_offset(Side(SIDE_TOP)) + sb->get_margin(Side(SIDE_TOP)));
c->set_offset(Side(SIDE_LEFT), c->get_offset(Side(SIDE_LEFT)) + sb->get_margin(Side(SIDE_LEFT)));
c->set_offset(Side(SIDE_RIGHT), c->get_offset(Side(SIDE_RIGHT)) - sb->get_margin(Side(SIDE_RIGHT)));
@@ -732,13 +732,13 @@ void TabContainer::add_child_notify(Node *p_child) {
update();
p_child->connect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
if (first && is_inside_tree()) {
- emit_signal("tab_changed", current);
+ emit_signal(SNAME("tab_changed"), current);
}
}
void TabContainer::move_child_notify(Node *p_child) {
Container::move_child_notify(p_child);
- call_deferred("_update_current_tab");
+ call_deferred(SNAME("_update_current_tab"));
_refresh_texts();
update();
}
@@ -756,11 +756,11 @@ void TabContainer::set_current_tab(int p_current) {
_repaint();
if (pending_previous == current) {
- emit_signal("tab_selected", current);
+ emit_signal(SNAME("tab_selected"), current);
} else {
previous = pending_previous;
- emit_signal("tab_selected", current);
- emit_signal("tab_changed", current);
+ emit_signal(SNAME("tab_selected"), current);
+ emit_signal(SNAME("tab_changed"), current);
}
update();
@@ -799,7 +799,7 @@ void TabContainer::remove_child_notify(Node *p_child) {
return;
}
- call_deferred("_update_current_tab");
+ call_deferred(SNAME("_update_current_tab"));
p_child->disconnect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
@@ -913,7 +913,7 @@ void TabContainer::drop_data(const Point2 &p_point, const Variant &p_data) {
}
move_child(moving_tabc, hover_now);
set_current_tab(hover_now);
- emit_signal("tab_changed", hover_now);
+ emit_signal(SNAME("tab_changed"), hover_now);
}
}
}
@@ -944,12 +944,12 @@ int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
Popup *popup = get_popup();
if (popup) {
- Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon(SNAME("menu"));
button_ofs += menu->get_width();
}
if (buttons_visible_cache) {
- Ref<Texture2D> increment = get_theme_icon("increment");
- Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decrement = get_theme_icon(SNAME("decrement"));
button_ofs += increment->get_width() + decrement->get_width();
}
if (px > size.width - button_ofs) {
@@ -1136,17 +1136,17 @@ Size2 TabContainer::get_minimum_size() const {
ms.y = MAX(ms.y, cms.y);
}
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<Font> font = get_theme_font("font");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<Font> font = get_theme_font(SNAME("font"));
if (tabs_visible) {
ms.y += MAX(MAX(tab_unselected->get_minimum_size().y, tab_selected->get_minimum_size().y), tab_disabled->get_minimum_size().y);
ms.y += _get_top_margin();
}
- Ref<StyleBox> sb = get_theme_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
ms += sb->get_minimum_size();
return ms;
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 6f1cff9ec8..9e8fe27ffb 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -38,9 +38,9 @@
#include "scene/gui/texture_rect.h"
Size2 Tabs::get_minimum_size() const {
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int y_margin = MAX(MAX(tab_unselected->get_minimum_size().height, tab_selected->get_minimum_size().height), tab_disabled->get_minimum_size().height);
@@ -51,7 +51,7 @@ Size2 Tabs::get_minimum_size() const {
if (tex.is_valid()) {
ms.height = MAX(ms.height, tex->get_size().height);
if (tabs[i].text != "") {
- ms.width += get_theme_constant("hseparation");
+ ms.width += get_theme_constant(SNAME("hseparation"));
}
}
@@ -69,15 +69,15 @@ Size2 Tabs::get_minimum_size() const {
if (tabs[i].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[i].right_button;
Size2 bms = rb->get_size();
- bms.width += get_theme_constant("hseparation");
+ bms.width += get_theme_constant(SNAME("hseparation"));
ms.width += bms.width;
ms.height = MAX(bms.height + tab_unselected->get_minimum_size().height, ms.height);
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
Size2 bms = cb->get_size();
- bms.width += get_theme_constant("hseparation");
+ bms.width += get_theme_constant(SNAME("hseparation"));
ms.width += bms.width;
ms.height = MAX(bms.height + tab_unselected->get_minimum_size().height, ms.height);
}
@@ -100,8 +100,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
highlight_arrow = -1;
if (buttons_visible) {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < decr->get_width()) {
@@ -148,7 +148,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (rb_hover != -1) {
//pressed
- emit_signal("right_button_pressed", rb_hover);
+ emit_signal(SNAME("right_button_pressed"), rb_hover);
}
rb_pressing = false;
@@ -158,7 +158,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
if (cb_hover != -1) {
//pressed
- emit_signal("tab_closed", cb_hover);
+ emit_signal(SNAME("tab_closed"), cb_hover);
}
cb_pressing = false;
@@ -170,8 +170,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
Point2 pos(mb->get_position().x, mb->get_position().y);
if (buttons_visible) {
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
if (is_layout_rtl()) {
if (pos.x < decr->get_width()) {
@@ -229,15 +229,15 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (found != -1) {
set_current_tab(found);
- emit_signal("tab_clicked", found);
+ emit_signal(SNAME("tab_clicked"), found);
}
}
}
}
void Tabs::_shape(int p_tab) {
- Ref<Font> font = get_theme_font("font");
- int font_size = get_theme_font_size("font_size");
+ Ref<Font> font = get_theme_font(SNAME("font"));
+ int font_size = get_theme_font_size(SNAME("font_size"));
tabs.write[p_tab].xl_text = tr(tabs[p_tab].text);
tabs.write[p_tab].text_buf->clear();
@@ -274,15 +274,15 @@ void Tabs::_notification(int p_what) {
_update_cache();
RID ci = get_canvas_item();
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Color font_selected_color = get_theme_color("font_selected_color");
- Color font_unselected_color = get_theme_color("font_unselected_color");
- Color font_disabled_color = get_theme_color("font_disabled_color");
- Ref<Texture2D> close = get_theme_icon("close");
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Color font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ Color font_unselected_color = get_theme_color(SNAME("font_unselected_color"));
+ Color font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
+ Ref<Texture2D> close = get_theme_icon(SNAME("close"));
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Vector2 size = get_size();
bool rtl = is_layout_rtl();
@@ -306,10 +306,10 @@ void Tabs::_notification(int p_what) {
w = 0;
}
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
- Ref<Texture2D> incr_hl = get_theme_icon("increment_highlight");
- Ref<Texture2D> decr_hl = get_theme_icon("decrement_highlight");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
+ Ref<Texture2D> incr_hl = get_theme_icon(SNAME("increment_highlight"));
+ Ref<Texture2D> decr_hl = get_theme_icon(SNAME("decrement_highlight"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
@@ -363,7 +363,7 @@ void Tabs::_notification(int p_what) {
icon->draw(ci, Point2i(w, sb->get_margin(SIDE_TOP) + ((sb_rect.size.y - sb_ms.y) - icon->get_height()) / 2));
}
if (tabs[i].text != "") {
- w += icon->get_width() + get_theme_constant("hseparation");
+ w += icon->get_width() + get_theme_constant(SNAME("hseparation"));
}
}
@@ -384,10 +384,10 @@ void Tabs::_notification(int p_what) {
w += tabs[i].size_text;
if (tabs[i].right_button.is_valid()) {
- Ref<StyleBox> style = get_theme_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("button"));
Ref<Texture2D> rb = tabs[i].right_button;
- w += get_theme_constant("hseparation");
+ w += get_theme_constant(SNAME("hseparation"));
Rect2 rb_rect;
rb_rect.size = style->get_minimum_size() + rb->get_size();
@@ -400,7 +400,7 @@ void Tabs::_notification(int p_what) {
if (rb_hover == i) {
if (rb_pressing) {
- get_theme_stylebox("button_pressed")->draw(ci, rb_rect);
+ get_theme_stylebox(SNAME("button_pressed"))->draw(ci, rb_rect);
} else {
style->draw(ci, rb_rect);
}
@@ -416,10 +416,10 @@ void Tabs::_notification(int p_what) {
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<StyleBox> style = get_theme_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox(SNAME("button"));
Ref<Texture2D> cb = close;
- w += get_theme_constant("hseparation");
+ w += get_theme_constant(SNAME("hseparation"));
Rect2 cb_rect;
cb_rect.size = style->get_minimum_size() + cb->get_size();
@@ -432,7 +432,7 @@ void Tabs::_notification(int p_what) {
if (!tabs[i].disabled && cb_hover == i) {
if (cb_pressing) {
- get_theme_stylebox("button_pressed")->draw(ci, cb_rect);
+ get_theme_stylebox(SNAME("button_pressed"))->draw(ci, cb_rect);
} else {
style->draw(ci, cb_rect);
}
@@ -503,7 +503,7 @@ void Tabs::set_current_tab(int p_current) {
_update_cache();
update();
- emit_signal("tab_changed", p_current);
+ emit_signal(SNAME("tab_changed"), p_current);
}
int Tabs::get_current_tab() const {
@@ -659,7 +659,7 @@ void Tabs::_update_hover() {
}
if (hover != hover_now) {
hover = hover_now;
- emit_signal("tab_hovered", hover);
+ emit_signal(SNAME("tab_hovered"), hover);
}
if (hover_buttons == -1) { // no hover
@@ -669,11 +669,11 @@ void Tabs::_update_hover() {
}
void Tabs::_update_cache() {
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
int w = 0;
@@ -712,12 +712,12 @@ void Tabs::_update_cache() {
slen = m_width - (sb->get_margin(SIDE_LEFT) + sb->get_margin(SIDE_RIGHT));
if (tabs[i].icon.is_valid()) {
slen -= tabs[i].icon->get_width();
- slen -= get_theme_constant("hseparation");
+ slen -= get_theme_constant(SNAME("hseparation"));
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
slen -= cb->get_width();
- slen -= get_theme_constant("hseparation");
+ slen -= get_theme_constant(SNAME("hseparation"));
}
slen = MAX(slen, 1);
lsize = m_width;
@@ -745,7 +745,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture2D> &p_icon) {
t.xl_text = tr(p_str);
t.text_buf.instantiate();
t.text_buf->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
- t.text_buf->add_string(t.xl_text, get_theme_font("font"), get_theme_font_size("font_size"), Dictionary(), TranslationServer::get_singleton()->get_tool_locale());
+ t.text_buf->add_string(t.xl_text, get_theme_font(SNAME("font")), get_theme_font_size(SNAME("font_size")), Dictionary(), TranslationServer::get_singleton()->get_tool_locale());
t.icon = p_icon;
t.disabled = false;
t.ofs_cache = 0;
@@ -753,7 +753,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture2D> &p_icon) {
tabs.push_back(t);
_update_cache();
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
minimum_size_changed();
}
@@ -762,7 +762,7 @@ void Tabs::clear_tabs() {
tabs.clear();
current = 0;
previous = 0;
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
}
@@ -773,7 +773,7 @@ void Tabs::remove_tab(int p_idx) {
current--;
}
_update_cache();
- call_deferred("_update_hover");
+ call_deferred(SNAME("_update_hover"));
update();
minimum_size_changed();
@@ -870,7 +870,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
hover_now = get_tab_count() - 1;
}
move_tab(tab_from_id, hover_now);
- emit_signal("reposition_active_tab_request", hover_now);
+ emit_signal(SNAME("reposition_active_tab_request"), hover_now);
set_current_tab(hover_now);
} else if (get_tabs_rearrange_group() != -1) {
// drag and drop between Tabs
@@ -887,7 +887,7 @@ void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
tabs.insert(hover_now, moving_tab);
from_tabs->remove_tab(tab_from_id);
set_current_tab(hover_now);
- emit_signal("tab_changed", hover_now);
+ emit_signal(SNAME("tab_changed"), hover_now);
_update_cache();
}
}
@@ -949,9 +949,9 @@ void Tabs::move_tab(int from, int to) {
int Tabs::get_tab_width(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, tabs.size(), 0);
- Ref<StyleBox> tab_unselected = get_theme_stylebox("tab_unselected");
- Ref<StyleBox> tab_selected = get_theme_stylebox("tab_selected");
- Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_unselected = get_theme_stylebox(SNAME("tab_unselected"));
+ Ref<StyleBox> tab_selected = get_theme_stylebox(SNAME("tab_selected"));
+ Ref<StyleBox> tab_disabled = get_theme_stylebox(SNAME("tab_disabled"));
int x = 0;
@@ -959,7 +959,7 @@ int Tabs::get_tab_width(int p_idx) const {
if (tex.is_valid()) {
x += tex->get_width();
if (tabs[p_idx].text != "") {
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
}
@@ -976,13 +976,13 @@ int Tabs::get_tab_width(int p_idx) const {
if (tabs[p_idx].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[p_idx].right_button;
x += rb->get_width();
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx == current)) {
- Ref<Texture2D> cb = get_theme_icon("close");
+ Ref<Texture2D> cb = get_theme_icon(SNAME("close"));
x += cb->get_width();
- x += get_theme_constant("hseparation");
+ x += get_theme_constant(SNAME("hseparation"));
}
return x;
@@ -993,8 +993,8 @@ void Tabs::_ensure_no_over_offset() {
return;
}
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
@@ -1034,8 +1034,8 @@ void Tabs::ensure_tab_visible(int p_idx) {
}
int prev_offset = offset;
- Ref<Texture2D> incr = get_theme_icon("increment");
- Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
+ Ref<Texture2D> decr = get_theme_icon(SNAME("decrement"));
int limit = get_size().width;
int limit_minus_buttons = get_size().width - incr->get_width() - decr->get_width();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 9450b39aed..8444cc27f4 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -542,8 +542,8 @@ void TextEdit::_notification(int p_what) {
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
- call_deferred("_update_scrollbars");
- call_deferred("_update_wrap_at");
+ call_deferred(SNAME("_update_scrollbars"));
+ call_deferred(SNAME("_update_wrap_at"));
}
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
@@ -2361,7 +2361,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
if (mpos.x > left_margin && mpos.x <= (left_margin + gutters[i].width) - 3) {
- emit_signal("gutter_clicked", row, i);
+ emit_signal(SNAME("gutter_clicked"), row, i);
return;
}
@@ -2483,7 +2483,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int row, col;
_get_mouse_pos(Point2i(mpos.x, mpos.y), row, col);
- emit_signal("symbol_lookup", highlighted_word, row, col);
+ emit_signal(SNAME("symbol_lookup"), highlighted_word, row, col);
return;
}
@@ -2525,7 +2525,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (!dragging_minimap && !dragging_selection && mm->is_command_pressed() && mm->get_button_mask() == 0) {
String new_word = get_word_at_pos(mpos);
if (new_word != highlighted_word) {
- emit_signal("symbol_validate", new_word);
+ emit_signal(SNAME("symbol_validate"), new_word);
}
} else {
if (highlighted_word != String()) {
@@ -2576,7 +2576,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (select_identifiers_enabled) {
if (k->is_pressed() && !dragging_minimap && !dragging_selection) {
Point2 mp = _get_local_mouse_pos();
- emit_signal("symbol_validate", get_word_at_pos(mp));
+ emit_signal(SNAME("symbol_validate"), get_word_at_pos(mp));
} else {
set_highlighted_word(String());
}
@@ -2992,7 +2992,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
}
text_changed_dirty = true;
}
- emit_signal("lines_edited_from", p_line, r_end_line);
+ emit_signal(SNAME("lines_edited_from"), p_line, r_end_line);
}
String TextEdit::_base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const {
@@ -3043,7 +3043,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
}
text_changed_dirty = true;
}
- emit_signal("lines_edited_from", p_to_line, p_from_line);
+ emit_signal(SNAME("lines_edited_from"), p_to_line, p_from_line);
}
void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) {
@@ -4034,35 +4034,35 @@ void TextEdit::_toggle_draw_caret() {
}
void TextEdit::_update_caches() {
- cache.style_normal = get_theme_stylebox("normal");
- cache.style_focus = get_theme_stylebox("focus");
- cache.style_readonly = get_theme_stylebox("read_only");
- cache.font = get_theme_font("font");
- cache.font_size = get_theme_font_size("font_size");
- cache.outline_color = get_theme_color("font_outline_color");
- cache.outline_size = get_theme_constant("outline_size");
- cache.caret_color = get_theme_color("caret_color");
- cache.caret_background_color = get_theme_color("caret_background_color");
- cache.font_color = get_theme_color("font_color");
- cache.font_selected_color = get_theme_color("font_selected_color");
- cache.font_readonly_color = get_theme_color("font_readonly_color");
- cache.selection_color = get_theme_color("selection_color");
- cache.current_line_color = get_theme_color("current_line_color");
- cache.line_length_guideline_color = get_theme_color("line_length_guideline_color");
- cache.code_folding_color = get_theme_color("code_folding_color", "CodeEdit");
- cache.brace_mismatch_color = get_theme_color("brace_mismatch_color");
- cache.word_highlighted_color = get_theme_color("word_highlighted_color");
- cache.search_result_color = get_theme_color("search_result_color");
- cache.search_result_border_color = get_theme_color("search_result_border_color");
- cache.background_color = get_theme_color("background_color");
+ cache.style_normal = get_theme_stylebox(SNAME("normal"));
+ cache.style_focus = get_theme_stylebox(SNAME("focus"));
+ cache.style_readonly = get_theme_stylebox(SNAME("read_only"));
+ cache.font = get_theme_font(SNAME("font"));
+ cache.font_size = get_theme_font_size(SNAME("font_size"));
+ cache.outline_color = get_theme_color(SNAME("font_outline_color"));
+ cache.outline_size = get_theme_constant(SNAME("outline_size"));
+ cache.caret_color = get_theme_color(SNAME("caret_color"));
+ cache.caret_background_color = get_theme_color(SNAME("caret_background_color"));
+ cache.font_color = get_theme_color(SNAME("font_color"));
+ cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ cache.font_readonly_color = get_theme_color(SNAME("font_readonly_color"));
+ cache.selection_color = get_theme_color(SNAME("selection_color"));
+ cache.current_line_color = get_theme_color(SNAME("current_line_color"));
+ cache.line_length_guideline_color = get_theme_color(SNAME("line_length_guideline_color"));
+ cache.code_folding_color = get_theme_color(SNAME("code_folding_color"), SNAME("CodeEdit"));
+ cache.brace_mismatch_color = get_theme_color(SNAME("brace_mismatch_color"));
+ cache.word_highlighted_color = get_theme_color(SNAME("word_highlighted_color"));
+ cache.search_result_color = get_theme_color(SNAME("search_result_color"));
+ cache.search_result_border_color = get_theme_color(SNAME("search_result_border_color"));
+ cache.background_color = get_theme_color(SNAME("background_color"));
#ifdef TOOLS_ENABLED
- cache.line_spacing = get_theme_constant("line_spacing") * EDSCALE;
+ cache.line_spacing = get_theme_constant(SNAME("line_spacing")) * EDSCALE;
#else
- cache.line_spacing = get_theme_constant("line_spacing");
+ cache.line_spacing = get_theme_constant(SNAME("line_spacing"));
#endif
- cache.tab_icon = get_theme_icon("tab");
- cache.space_icon = get_theme_icon("space");
- cache.folded_eol_icon = get_theme_icon("folded_eol_icon", "CodeEdit");
+ cache.tab_icon = get_theme_icon(SNAME("tab"));
+ cache.space_icon = get_theme_icon(SNAME("space"));
+ cache.folded_eol_icon = get_theme_icon(SNAME("folded_eol_icon"), SNAME("CodeEdit"));
TextServer::Direction dir;
if (text_direction == Control::TEXT_DIRECTION_INHERITED) {
@@ -4119,7 +4119,7 @@ void TextEdit::add_gutter(int p_at) {
for (int i = 0; i < text.size() + 1; i++) {
text.add_gutter(p_at);
}
- emit_signal("gutter_added");
+ emit_signal(SNAME("gutter_added"));
update();
}
@@ -4131,7 +4131,7 @@ void TextEdit::remove_gutter(int p_gutter) {
for (int i = 0; i < text.size() + 1; i++) {
text.remove_gutter(p_gutter);
}
- emit_signal("gutter_removed");
+ emit_signal(SNAME("gutter_removed"));
update();
}
@@ -4755,12 +4755,12 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l
}
void TextEdit::_cursor_changed_emit() {
- emit_signal("cursor_changed");
+ emit_signal(SNAME("cursor_changed"));
cursor_changed_dirty = false;
}
void TextEdit::_text_changed_emit() {
- emit_signal("text_changed");
+ emit_signal(SNAME("text_changed"));
text_changed_dirty = false;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 4d2cb81f23..09db3205d9 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -416,7 +416,7 @@ void TreeItem::set_collapsed(bool p_collapsed) {
if (tree->select_mode == Tree::SELECT_MULTI) {
tree->selected_item = this;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
select(tree->selected_col);
}
@@ -426,7 +426,7 @@ void TreeItem::set_collapsed(bool p_collapsed) {
}
_changed_notify();
- tree->emit_signal("item_collapsed", this);
+ tree->emit_signal(SNAME("item_collapsed"), this);
}
bool TreeItem::is_collapsed() {
@@ -1215,62 +1215,62 @@ TreeItem::~TreeItem() {
/**********************************************/
void Tree::update_cache() {
- cache.font = get_theme_font("font");
- cache.font_size = get_theme_font_size("font_size");
- cache.tb_font = get_theme_font("title_button_font");
- cache.tb_font_size = get_theme_font_size("title_button_font_size");
- cache.bg = get_theme_stylebox("bg");
- cache.selected = get_theme_stylebox("selected");
- cache.selected_focus = get_theme_stylebox("selected_focus");
- cache.cursor = get_theme_stylebox("cursor");
- cache.cursor_unfocus = get_theme_stylebox("cursor_unfocused");
- cache.button_pressed = get_theme_stylebox("button_pressed");
-
- cache.checked = get_theme_icon("checked");
- cache.unchecked = get_theme_icon("unchecked");
+ cache.font = get_theme_font(SNAME("font"));
+ cache.font_size = get_theme_font_size(SNAME("font_size"));
+ cache.tb_font = get_theme_font(SNAME("title_button_font"));
+ cache.tb_font_size = get_theme_font_size(SNAME("title_button_font_size"));
+ cache.bg = get_theme_stylebox(SNAME("bg"));
+ cache.selected = get_theme_stylebox(SNAME("selected"));
+ cache.selected_focus = get_theme_stylebox(SNAME("selected_focus"));
+ cache.cursor = get_theme_stylebox(SNAME("cursor"));
+ cache.cursor_unfocus = get_theme_stylebox(SNAME("cursor_unfocused"));
+ cache.button_pressed = get_theme_stylebox(SNAME("button_pressed"));
+
+ cache.checked = get_theme_icon(SNAME("checked"));
+ cache.unchecked = get_theme_icon(SNAME("unchecked"));
if (is_layout_rtl()) {
- cache.arrow_collapsed = get_theme_icon("arrow_collapsed_mirrored");
+ cache.arrow_collapsed = get_theme_icon(SNAME("arrow_collapsed_mirrored"));
} else {
- cache.arrow_collapsed = get_theme_icon("arrow_collapsed");
- }
- cache.arrow = get_theme_icon("arrow");
- cache.select_arrow = get_theme_icon("select_arrow");
- cache.updown = get_theme_icon("updown");
-
- cache.custom_button = get_theme_stylebox("custom_button");
- cache.custom_button_hover = get_theme_stylebox("custom_button_hover");
- cache.custom_button_pressed = get_theme_stylebox("custom_button_pressed");
- cache.custom_button_font_highlight = get_theme_color("custom_button_font_highlight");
-
- cache.font_color = get_theme_color("font_color");
- cache.font_selected_color = get_theme_color("font_selected_color");
- cache.drop_position_color = get_theme_color("drop_position_color");
- cache.hseparation = get_theme_constant("hseparation");
- cache.vseparation = get_theme_constant("vseparation");
- cache.item_margin = get_theme_constant("item_margin");
- cache.button_margin = get_theme_constant("button_margin");
-
- cache.font_outline_color = get_theme_color("font_outline_color");
- cache.font_outline_size = get_theme_constant("outline_size");
-
- cache.draw_guides = get_theme_constant("draw_guides");
- cache.guide_color = get_theme_color("guide_color");
- cache.draw_relationship_lines = get_theme_constant("draw_relationship_lines");
- cache.relationship_line_width = get_theme_constant("relationship_line_width");
- cache.parent_hl_line_width = get_theme_constant("parent_hl_line_width");
- cache.children_hl_line_width = get_theme_constant("children_hl_line_width");
- cache.parent_hl_line_margin = get_theme_constant("parent_hl_line_margin");
- cache.relationship_line_color = get_theme_color("relationship_line_color");
- cache.parent_hl_line_color = get_theme_color("parent_hl_line_color");
- cache.children_hl_line_color = get_theme_color("children_hl_line_color");
-
- cache.scroll_border = get_theme_constant("scroll_border");
- cache.scroll_speed = get_theme_constant("scroll_speed");
-
- cache.title_button = get_theme_stylebox("title_button_normal");
- cache.title_button_pressed = get_theme_stylebox("title_button_pressed");
- cache.title_button_hover = get_theme_stylebox("title_button_hover");
- cache.title_button_color = get_theme_color("title_button_color");
+ cache.arrow_collapsed = get_theme_icon(SNAME("arrow_collapsed"));
+ }
+ cache.arrow = get_theme_icon(SNAME("arrow"));
+ cache.select_arrow = get_theme_icon(SNAME("select_arrow"));
+ cache.updown = get_theme_icon(SNAME("updown"));
+
+ cache.custom_button = get_theme_stylebox(SNAME("custom_button"));
+ cache.custom_button_hover = get_theme_stylebox(SNAME("custom_button_hover"));
+ cache.custom_button_pressed = get_theme_stylebox(SNAME("custom_button_pressed"));
+ cache.custom_button_font_highlight = get_theme_color(SNAME("custom_button_font_highlight"));
+
+ cache.font_color = get_theme_color(SNAME("font_color"));
+ cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ cache.drop_position_color = get_theme_color(SNAME("drop_position_color"));
+ cache.hseparation = get_theme_constant(SNAME("hseparation"));
+ cache.vseparation = get_theme_constant(SNAME("vseparation"));
+ cache.item_margin = get_theme_constant(SNAME("item_margin"));
+ cache.button_margin = get_theme_constant(SNAME("button_margin"));
+
+ cache.font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ cache.font_outline_size = get_theme_constant(SNAME("outline_size"));
+
+ cache.draw_guides = get_theme_constant(SNAME("draw_guides"));
+ cache.guide_color = get_theme_color(SNAME("guide_color"));
+ cache.draw_relationship_lines = get_theme_constant(SNAME("draw_relationship_lines"));
+ cache.relationship_line_width = get_theme_constant(SNAME("relationship_line_width"));
+ cache.parent_hl_line_width = get_theme_constant(SNAME("parent_hl_line_width"));
+ cache.children_hl_line_width = get_theme_constant(SNAME("children_hl_line_width"));
+ cache.parent_hl_line_margin = get_theme_constant(SNAME("parent_hl_line_margin"));
+ cache.relationship_line_color = get_theme_color(SNAME("relationship_line_color"));
+ cache.parent_hl_line_color = get_theme_color(SNAME("parent_hl_line_color"));
+ cache.children_hl_line_color = get_theme_color(SNAME("children_hl_line_color"));
+
+ cache.scroll_border = get_theme_constant(SNAME("scroll_border"));
+ cache.scroll_speed = get_theme_constant(SNAME("scroll_speed"));
+
+ cache.title_button = get_theme_stylebox(SNAME("title_button_normal"));
+ cache.title_button_pressed = get_theme_stylebox(SNAME("title_button_pressed"));
+ cache.title_button_hover = get_theme_stylebox(SNAME("title_button_hover"));
+ cache.title_button_color = get_theme_color(SNAME("title_button_color"));
v_scroll->set_custom_step(cache.font->get_height(cache.font_size));
}
@@ -2075,7 +2075,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
selected_item = p_selected;
selected_col = 0;
if (!emitted_row) {
- emit_signal("item_selected");
+ emit_signal(SNAME("item_selected"));
emitted_row = true;
}
/*
@@ -2095,28 +2095,28 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
selected_item = p_selected;
selected_col = i;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
if (select_mode == SELECT_MULTI) {
- emit_signal("multi_selected", p_current, i, true);
+ emit_signal(SNAME("multi_selected"), p_current, i, true);
} else if (select_mode == SELECT_SINGLE) {
- emit_signal("item_selected");
+ emit_signal(SNAME("item_selected"));
}
} else if (select_mode == SELECT_MULTI && (selected_item != p_selected || selected_col != i)) {
selected_item = p_selected;
selected_col = i;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
}
} else {
if (r_in_range && *r_in_range && !p_force_deselect) {
if (!c.selected && c.selectable) {
c.selected = true;
- emit_signal("multi_selected", p_current, i, true);
+ emit_signal(SNAME("multi_selected"), p_current, i, true);
}
} else if (!r_in_range || p_force_deselect) {
if (select_mode == SELECT_MULTI && c.selected) {
- emit_signal("multi_selected", p_current, i, false);
+ emit_signal(SNAME("multi_selected"), p_current, i, false);
}
c.selected = false;
}
@@ -2184,7 +2184,7 @@ void Tree::_range_click_timeout() {
}
if (propagate_mouse_activated) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
propagate_mouse_activated = false;
}
@@ -2297,7 +2297,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
cache.click_column = col;
cache.click_pos = get_global_mouse_position() - get_global_position();
update();
- //emit_signal("button_pressed");
+ //emit_signal(SNAME("button_pressed"));
return -1;
}
@@ -2318,15 +2318,15 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
if (select_mode == SELECT_MULTI && p_mod->is_command_pressed() && c.selectable) {
if (!c.selected || p_button == MOUSE_BUTTON_RIGHT) {
p_item->select(col);
- emit_signal("multi_selected", p_item, col, true);
+ emit_signal(SNAME("multi_selected"), p_item, col, true);
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
//p_item->selected_signal.call(col);
} else {
p_item->deselect(col);
- emit_signal("multi_selected", p_item, col, false);
+ emit_signal(SNAME("multi_selected"), p_item, col, false);
//p_item->deselected_signal.call(col);
}
@@ -2337,7 +2337,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
select_single_item(p_item, root, col, selected_item, &inrange);
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
} else {
int icount = _count_selected_items(root);
@@ -2351,14 +2351,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
}
if (p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("item_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("item_rmb_selected"), get_local_mouse_position());
}
}
}
/*
if (!c.selected && select_mode==SELECT_MULTI) {
- emit_signal("multi_selected",p_item,col,true);
+ emit_signal(SNAME("multi_selected"),p_item,col,true);
}
*/
update();
@@ -2472,7 +2472,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
if (on_arrow || !p_item->cells[col].custom_button) {
- emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2))));
+ emit_signal(SNAME("custom_popup_edited"), ((bool)(x >= (col_width - item_h / 2))));
}
if (!p_item->cells[col].custom_button || !on_arrow) {
@@ -2524,7 +2524,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
}
}
if (p_item == root && p_button == MOUSE_BUTTON_RIGHT) {
- emit_signal("empty_rmb", get_local_mouse_position());
+ emit_signal(SNAME("empty_rmb"), get_local_mouse_position());
}
}
@@ -2630,7 +2630,7 @@ void Tree::_go_left() {
} else {
if (select_mode == SELECT_MULTI) {
selected_col--;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
selected_item->select(selected_col - 1);
}
@@ -2651,7 +2651,7 @@ void Tree::_go_right() {
} else {
if (select_mode == SELECT_MULTI) {
selected_col++;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
} else {
selected_item->select(selected_col + 1);
}
@@ -2684,7 +2684,7 @@ void Tree::_go_up() {
return;
}
selected_item = prev;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
int col = selected_col < 0 ? 0 : selected_col;
@@ -2727,7 +2727,7 @@ void Tree::_go_down() {
}
selected_item = next;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
int col = selected_col < 0 ? 0 : selected_col;
@@ -2828,7 +2828,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (select_mode == SELECT_MULTI) {
selected_item = next;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
while (next && !next->cells[selected_col].selectable) {
@@ -2866,7 +2866,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (select_mode == SELECT_MULTI) {
selected_item = prev;
- emit_signal("cell_selected");
+ emit_signal(SNAME("cell_selected"));
update();
} else {
while (prev && !prev->cells[selected_col].selectable) {
@@ -2882,7 +2882,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (selected_item) {
//bring up editor if possible
if (!edit_selected()) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
incr_search.clear();
}
}
@@ -2894,10 +2894,10 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (selected_item->is_selected(selected_col)) {
selected_item->deselect(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, false);
+ emit_signal(SNAME("multi_selected"), selected_item, selected_col, false);
} else if (selected_item->is_selectable(selected_col)) {
selected_item->select(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, true);
+ emit_signal(SNAME("multi_selected"), selected_item, selected_col, true);
}
}
accept_event();
@@ -3081,7 +3081,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
for (int i = 0; i < columns.size(); i++) {
len += get_column_width(i);
if (pos.x < len) {
- emit_signal("column_title_pressed", i);
+ emit_signal(SNAME("column_title_pressed"), i);
break;
}
}
@@ -3108,10 +3108,10 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (rect.has_point(mpos)) {
if (!edit_selected()) {
- emit_signal("item_double_clicked");
+ emit_signal(SNAME("item_double_clicked"));
}
} else {
- emit_signal("item_double_clicked");
+ emit_signal(SNAME("item_double_clicked"));
}
}
pressing_for_editor = false;
@@ -3120,7 +3120,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != nullptr) {
// make sure in case of wrong reference after reconstructing whole TreeItems
cache.click_item = get_item_at_position(cache.click_pos);
- emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);
+ emit_signal(SNAME("button_pressed"), cache.click_item, cache.click_column, cache.click_id);
}
cache.click_type = Cache::CLICK_NONE;
cache.click_index = -1;
@@ -3180,7 +3180,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (!root || (!root->get_first_child() && hide_root)) {
if (b->get_button_index() == MOUSE_BUTTON_RIGHT && allow_rmb_select) {
- emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
+ emit_signal(SNAME("empty_tree_rmb_selected"), get_local_mouse_position());
}
break;
}
@@ -3231,13 +3231,13 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
if (get_item_at_position(b->get_position()) == nullptr && !b->is_shift_pressed() && !b->is_ctrl_pressed() && !b->is_command_pressed()) {
- emit_signal("nothing_selected");
+ emit_signal(SNAME("nothing_selected"));
}
}
}
if (propagate_mouse_activated) {
- emit_signal("item_activated");
+ emit_signal(SNAME("item_activated"));
propagate_mouse_activated = false;
}
@@ -3306,7 +3306,7 @@ bool Tree::edit_selected() {
edited_item = s;
edited_col = col;
custom_popup_rect = Rect2i(get_global_position() + rect.position, rect.size);
- emit_signal("custom_popup_edited", false);
+ emit_signal(SNAME("custom_popup_edited"), false);
item_edited(col, s);
return true;
@@ -3542,8 +3542,8 @@ void Tree::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> bg = cache.bg;
- Color font_outline_color = get_theme_color("font_outline_color");
- int outline_size = get_theme_constant("outline_size");
+ Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
+ int outline_size = get_theme_constant(SNAME("outline_size"));
Point2 draw_ofs;
draw_ofs += bg->get_offset();
@@ -3593,7 +3593,7 @@ void Tree::_notification(int p_what) {
// Otherwise, section heading backgrounds can appear to be in front of the focus outline when scrolling.
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
- const Ref<StyleBox> bg_focus = get_theme_stylebox("bg_focus");
+ const Ref<StyleBox> bg_focus = get_theme_stylebox(SNAME("bg_focus"));
bg_focus->draw(ci, Rect2(Point2(), get_size()));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false);
}
@@ -3694,9 +3694,9 @@ void Tree::item_edited(int p_column, TreeItem *p_item, bool p_lmb) {
edited_item->cells.write[p_column].dirty = true;
}
if (p_lmb) {
- emit_signal("item_edited");
+ emit_signal(SNAME("item_edited"));
} else {
- emit_signal("item_rmb_edited");
+ emit_signal(SNAME("item_rmb_edited"));
}
}
@@ -3714,7 +3714,7 @@ void Tree::item_selected(int p_column, TreeItem *p_item) {
}
p_item->cells.write[p_column].selected = true;
- //emit_signal("multi_selected",p_item,p_column,true); - NO this is for TreeItem::select
+ //emit_signal(SNAME("multi_selected"),p_item,p_column,true); - NO this is for TreeItem::select
selected_col = p_column;
if (!selected_item) {
@@ -4075,7 +4075,7 @@ void Tree::ensure_cursor_is_visible() {
if (cell_h > screen_h) { // Screen size is too small, maybe it was not resized yet.
v_scroll->set_value(y_offset);
} else if (y_offset + cell_h > v_scroll->get_value() + screen_h) {
- v_scroll->call_deferred("set_value", y_offset - screen_h + cell_h);
+ v_scroll->call_deferred(SNAME("set_value"), y_offset - screen_h + cell_h);
} else if (y_offset < v_scroll->get_value()) {
v_scroll->set_value(y_offset);
}
@@ -4093,7 +4093,7 @@ void Tree::ensure_cursor_is_visible() {
if (cell_w > screen_w) {
h_scroll->set_value(x_offset);
} else if (x_offset + cell_w > h_scroll->get_value() + screen_w) {
- h_scroll->call_deferred("set_value", x_offset - screen_w + cell_w);
+ h_scroll->call_deferred(SNAME("set_value"), x_offset - screen_w + cell_w);
} else if (x_offset < h_scroll->get_value()) {
h_scroll->set_value(x_offset);
}
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 775dfa4c46..f649380afa 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -151,7 +151,7 @@ Error HTTPRequest::request_raw(const String &p_url, const Vector<String> &p_cust
client->set_blocking_mode(false);
err = _request();
if (err != OK) {
- call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
return ERR_CANT_CONNECT;
}
@@ -167,7 +167,7 @@ void HTTPRequest::_thread_func(void *p_userdata) {
Error err = hr->_request();
if (err != OK) {
- hr->call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
+ hr->call_deferred(SNAME("_request_done"), RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
} else {
while (!hr->thread_request_quit.is_set()) {
bool exit = hr->_update_connection();
@@ -209,7 +209,7 @@ void HTTPRequest::cancel_request() {
bool HTTPRequest::_handle_response(bool *ret_value) {
if (!client->has_response()) {
- call_deferred("_request_done", RESULT_NO_RESPONSE, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_NO_RESPONSE, 0, PackedStringArray(), PackedByteArray());
*ret_value = true;
return true;
}
@@ -228,7 +228,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
// Handle redirect
if (max_redirects >= 0 && redirections >= max_redirects) {
- call_deferred("_request_done", RESULT_REDIRECT_LIMIT_REACHED, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_REDIRECT_LIMIT_REACHED, response_code, response_headers, PackedByteArray());
*ret_value = true;
return true;
}
@@ -273,7 +273,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) {
bool HTTPRequest::_update_connection() {
switch (client->get_status()) {
case HTTPClient::STATUS_DISCONNECTED: {
- call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
return true; // End it, since it's doing something
} break;
case HTTPClient::STATUS_RESOLVING: {
@@ -282,7 +282,7 @@ bool HTTPRequest::_update_connection() {
return false;
} break;
case HTTPClient::STATUS_CANT_RESOLVE: {
- call_deferred("_request_done", RESULT_CANT_RESOLVE, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CANT_RESOLVE, 0, PackedStringArray(), PackedByteArray());
return true;
} break;
@@ -292,7 +292,7 @@ bool HTTPRequest::_update_connection() {
return false;
} break; // Connecting to IP
case HTTPClient::STATUS_CANT_CONNECT: {
- call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
return true;
} break;
@@ -307,16 +307,16 @@ bool HTTPRequest::_update_connection() {
return ret_value;
}
- call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_SUCCESS, response_code, response_headers, PackedByteArray());
return true;
}
if (body_len < 0) {
// Chunked transfer is done
- call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
+ call_deferred(SNAME("_request_done"), RESULT_SUCCESS, response_code, response_headers, body);
return true;
}
- call_deferred("_request_done", RESULT_CHUNKED_BODY_SIZE_MISMATCH, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CHUNKED_BODY_SIZE_MISMATCH, response_code, response_headers, PackedByteArray());
return true;
// Request might have been done
} else {
@@ -325,7 +325,7 @@ bool HTTPRequest::_update_connection() {
int size = request_data.size();
Error err = client->request(method, request_string, headers, size > 0 ? request_data.ptr() : nullptr, size);
if (err != OK) {
- call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray());
return true;
}
@@ -348,7 +348,7 @@ bool HTTPRequest::_update_connection() {
}
if (!client->is_response_chunked() && client->get_response_body_length() == 0) {
- call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_SUCCESS, response_code, response_headers, PackedByteArray());
return true;
}
@@ -357,14 +357,14 @@ bool HTTPRequest::_update_connection() {
body_len = client->get_response_body_length();
if (body_size_limit >= 0 && body_len > body_size_limit) {
- call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
return true;
}
if (download_to_file != String()) {
file = FileAccess::open(download_to_file, FileAccess::WRITE);
if (!file) {
- call_deferred("_request_done", RESULT_DOWNLOAD_FILE_CANT_OPEN, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_DOWNLOAD_FILE_CANT_OPEN, response_code, response_headers, PackedByteArray());
return true;
}
}
@@ -383,7 +383,7 @@ bool HTTPRequest::_update_connection() {
const uint8_t *r = chunk.ptr();
file->store_buffer(r, chunk.size());
if (file->get_error() != OK) {
- call_deferred("_request_done", RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PackedByteArray());
return true;
}
} else {
@@ -392,18 +392,18 @@ bool HTTPRequest::_update_connection() {
}
if (body_size_limit >= 0 && downloaded.get() > body_size_limit) {
- call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray());
return true;
}
if (body_len >= 0) {
if (downloaded.get() == body_len) {
- call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
+ call_deferred(SNAME("_request_done"), RESULT_SUCCESS, response_code, response_headers, body);
return true;
}
} else if (client->get_status() == HTTPClient::STATUS_DISCONNECTED) {
// We read till EOF, with no errors. Request is done.
- call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
+ call_deferred(SNAME("_request_done"), RESULT_SUCCESS, response_code, response_headers, body);
return true;
}
@@ -411,11 +411,11 @@ bool HTTPRequest::_update_connection() {
} break; // Request resulted in body: break which must be read
case HTTPClient::STATUS_CONNECTION_ERROR: {
- call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray());
return true;
} break;
case HTTPClient::STATUS_SSL_HANDSHAKE_ERROR: {
- call_deferred("_request_done", RESULT_SSL_HANDSHAKE_ERROR, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_SSL_HANDSHAKE_ERROR, 0, PackedStringArray(), PackedByteArray());
return true;
} break;
}
@@ -463,7 +463,7 @@ void HTTPRequest::_request_done(int p_status, int p_code, const PackedStringArra
data = &p_data;
}
- emit_signal("request_completed", p_status, p_code, p_headers, *data);
+ emit_signal(SNAME("request_completed"), p_status, p_code, p_headers, *data);
}
void HTTPRequest::_notification(int p_what) {
@@ -563,7 +563,7 @@ int HTTPRequest::get_timeout() {
void HTTPRequest::_timeout() {
cancel_request();
- call_deferred("_request_done", RESULT_TIMEOUT, 0, PackedStringArray(), PackedByteArray());
+ call_deferred(SNAME("_request_done"), RESULT_TIMEOUT, 0, PackedStringArray(), PackedByteArray());
}
void HTTPRequest::_bind_methods() {
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0935e64678..0d060240de 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -442,7 +442,7 @@ void Node::set_process_mode(ProcessMode p_mode) {
// This is required for the editor to update the visibility of disabled nodes
// It's very expensive during runtime to change, so editor-only
if (Engine::get_singleton()->is_editor_hint()) {
- get_tree()->emit_signal("tree_process_mode_changed");
+ get_tree()->emit_signal(SNAME("tree_process_mode_changed"));
}
#endif
}
@@ -868,7 +868,7 @@ void Node::set_name(const String &p_name) {
propagate_notification(NOTIFICATION_PATH_CHANGED);
if (is_inside_tree()) {
- emit_signal("renamed");
+ emit_signal(SNAME("renamed"));
get_tree()->node_renamed(this);
get_tree()->tree_changed();
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index fefe4c9f0d..2a5be0314d 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -406,7 +406,7 @@ bool SceneTree::physics_process(float p_time) {
MainLoop::physics_process(p_time);
physics_process_time = p_time;
- emit_signal("physics_frame");
+ emit_signal(SNAME("physics_frame"));
_notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_process_picking");
@@ -436,7 +436,7 @@ bool SceneTree::process(float p_time) {
multiplayer->poll();
}
- emit_signal("process_frame");
+ emit_signal(SNAME("process_frame"));
MessageQueue::get_singleton()->flush(); //small little hack
@@ -471,7 +471,7 @@ bool SceneTree::process(float p_time) {
E->get()->set_time_left(time_left);
if (time_left < 0) {
- E->get()->emit_signal("timeout");
+ E->get()->emit_signal(SNAME("timeout"));
timers.erase(E);
}
if (E == L) {
@@ -1097,7 +1097,7 @@ Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) {
ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE);
}
- call_deferred("_change_scene", new_scene);
+ call_deferred(SNAME("_change_scene"), new_scene);
return OK;
}
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index f52237251c..ef8245076f 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -58,7 +58,7 @@ void Timer::_notification(int p_what) {
stop();
}
- emit_signal("timeout");
+ emit_signal(SNAME("timeout"));
}
} break;
@@ -74,7 +74,7 @@ void Timer::_notification(int p_what) {
} else {
stop();
}
- emit_signal("timeout");
+ emit_signal(SNAME("timeout"));
}
} break;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e3934afb23..b366f2d670 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -248,16 +248,16 @@ void Viewport::_sub_window_update(Window *p_window) {
Rect2i r = Rect2i(p_window->get_position(), sw.window->get_size());
if (!p_window->get_flag(Window::FLAG_BORDERLESS)) {
- Ref<StyleBox> panel = p_window->get_theme_stylebox("panel_window");
+ Ref<StyleBox> panel = p_window->get_theme_stylebox(SNAME("panel_window"));
panel->draw(sw.canvas_item, r);
// Draw the title bar text.
- Ref<Font> title_font = p_window->get_theme_font("title_font");
- int font_size = p_window->get_theme_font_size("title_font_size");
- Color title_color = p_window->get_theme_color("title_color");
- int title_height = p_window->get_theme_constant("title_height");
- int close_h_ofs = p_window->get_theme_constant("close_h_ofs");
- int close_v_ofs = p_window->get_theme_constant("close_v_ofs");
+ Ref<Font> title_font = p_window->get_theme_font(SNAME("title_font"));
+ int font_size = p_window->get_theme_font_size(SNAME("title_font_size"));
+ Color title_color = p_window->get_theme_color(SNAME("title_color"));
+ int title_height = p_window->get_theme_constant(SNAME("title_height"));
+ int close_h_ofs = p_window->get_theme_constant(SNAME("close_h_ofs"));
+ int close_v_ofs = p_window->get_theme_constant(SNAME("close_v_ofs"));
TextLine title_text = TextLine(p_window->get_title(), title_font, font_size, Dictionary(), TranslationServer::get_singleton()->get_tool_locale());
title_text.set_width(r.size.width - panel->get_minimum_size().x - close_h_ofs);
@@ -265,8 +265,8 @@ void Viewport::_sub_window_update(Window *p_window) {
int x = (r.size.width - title_text.get_size().x) / 2;
int y = (-title_height - title_text.get_size().y) / 2;
- Color font_outline_color = p_window->get_theme_color("title_outline_modulate");
- int outline_size = p_window->get_theme_constant("title_outline_size");
+ Color font_outline_color = p_window->get_theme_color(SNAME("title_outline_modulate"));
+ int outline_size = p_window->get_theme_constant(SNAME("title_outline_size"));
if (outline_size > 0 && font_outline_color.a > 0) {
title_text.draw_outline(sw.canvas_item, r.position + Point2(x, y), outline_size, font_outline_color);
}
@@ -847,7 +847,7 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override,
update_canvas_items();
- emit_signal("size_changed");
+ emit_signal(SNAME("size_changed"));
}
Size2i Viewport::_get_size() const {
@@ -2214,7 +2214,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Window *sw = embedder->gui.sub_windows[i].window;
Rect2 swrect = Rect2i(sw->get_position(), sw->get_size());
if (!sw->get_flag(Window::FLAG_BORDERLESS)) {
- int title_height = sw->get_theme_constant("title_height");
+ int title_height = sw->get_theme_constant(SNAME("title_height"));
swrect.position.y -= title_height;
swrect.size.y += title_height;
}
@@ -2563,7 +2563,7 @@ void Viewport::_gui_control_grab_focus(Control *p_control) {
}
get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "_viewports", "_gui_remove_focus_for_window", (Node *)get_base_window());
gui.key_focus = p_control;
- emit_signal("gui_focus_changed", p_control);
+ emit_signal(SNAME("gui_focus_changed"), p_control);
p_control->notification(Control::NOTIFICATION_FOCUS_ENTER);
p_control->update();
}
@@ -2673,7 +2673,7 @@ Control *Viewport::_gui_get_focus_owner() {
void Viewport::_gui_grab_click_focus(Control *p_control) {
gui.mouse_click_grabber = p_control;
- call_deferred("_post_gui_grab_click_focus");
+ call_deferred(SNAME("_post_gui_grab_click_focus"));
}
void Viewport::_post_gui_grab_click_focus() {
@@ -2746,7 +2746,7 @@ Viewport::SubWindowResize Viewport::_sub_window_get_resize_margin(Window *p_subw
Rect2i r = Rect2i(p_subwindow->get_position(), p_subwindow->get_size());
- int title_height = p_subwindow->get_theme_constant("title_height");
+ int title_height = p_subwindow->get_theme_constant(SNAME("title_height"));
r.position.y -= title_height;
r.size.y += title_height;
@@ -2758,7 +2758,7 @@ Viewport::SubWindowResize Viewport::_sub_window_get_resize_margin(Window *p_subw
int dist_x = p_point.x < r.position.x ? (p_point.x - r.position.x) : (p_point.x > (r.position.x + r.size.x) ? (p_point.x - (r.position.x + r.size.x)) : 0);
int dist_y = p_point.y < r.position.y ? (p_point.y - r.position.y) : (p_point.y > (r.position.y + r.size.y) ? (p_point.y - (r.position.y + r.size.y)) : 0);
- int limit = p_subwindow->get_theme_constant("resize_margin");
+ int limit = p_subwindow->get_theme_constant(SNAME("resize_margin"));
if (ABS(dist_x) > limit) {
return SUB_WINDOW_RESIZE_DISABLED;
@@ -2840,7 +2840,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
new_rect.position.x = 0;
}
- int title_height = gui.subwindow_focused->get_flag(Window::FLAG_BORDERLESS) ? 0 : gui.subwindow_focused->get_theme_constant("title_height");
+ int title_height = gui.subwindow_focused->get_flag(Window::FLAG_BORDERLESS) ? 0 : gui.subwindow_focused->get_theme_constant(SNAME("title_height"));
if (new_rect.position.y < title_height) {
new_rect.position.y = title_height;
@@ -2944,7 +2944,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
if (!sw.window->get_flag(Window::FLAG_BORDERLESS)) {
//check top bar
- int title_height = sw.window->get_theme_constant("title_height");
+ int title_height = sw.window->get_theme_constant(SNAME("title_height"));
Rect2i title_bar = r;
title_bar.position.y -= title_height;
title_bar.size.y = title_height;
@@ -2952,9 +2952,9 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
if (title_bar.has_point(mb->get_position())) {
click_on_window = true;
- int close_h_ofs = sw.window->get_theme_constant("close_h_ofs");
- int close_v_ofs = sw.window->get_theme_constant("close_v_ofs");
- Ref<Texture2D> close_icon = sw.window->get_theme_icon("close");
+ int close_h_ofs = sw.window->get_theme_constant(SNAME("close_h_ofs"));
+ int close_v_ofs = sw.window->get_theme_constant(SNAME("close_v_ofs"));
+ Ref<Texture2D> close_icon = sw.window->get_theme_icon(SNAME("close"));
Rect2 close_rect;
close_rect.position = Vector2(r.position.x + r.size.x - close_v_ofs, r.position.y - close_h_ofs);
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index c557fd0101..7aa88fa766 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -313,39 +313,39 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
switch (p_event) {
case DisplayServer::WINDOW_EVENT_MOUSE_ENTER: {
_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER);
- emit_signal("mouse_entered");
+ emit_signal(SNAME("mouse_entered"));
DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_ARROW); //restore cursor shape
} break;
case DisplayServer::WINDOW_EVENT_MOUSE_EXIT: {
_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_EXIT);
- emit_signal("mouse_exited");
+ emit_signal(SNAME("mouse_exited"));
} break;
case DisplayServer::WINDOW_EVENT_FOCUS_IN: {
focused = true;
_propagate_window_notification(this, NOTIFICATION_WM_WINDOW_FOCUS_IN);
- emit_signal("focus_entered");
+ emit_signal(SNAME("focus_entered"));
} break;
case DisplayServer::WINDOW_EVENT_FOCUS_OUT: {
focused = false;
_propagate_window_notification(this, NOTIFICATION_WM_WINDOW_FOCUS_OUT);
- emit_signal("focus_exited");
+ emit_signal(SNAME("focus_exited"));
} break;
case DisplayServer::WINDOW_EVENT_CLOSE_REQUEST: {
if (exclusive_child != nullptr) {
break; //has an exclusive child, can't get events until child is closed
}
_propagate_window_notification(this, NOTIFICATION_WM_CLOSE_REQUEST);
- emit_signal("close_requested");
+ emit_signal(SNAME("close_requested"));
} break;
case DisplayServer::WINDOW_EVENT_GO_BACK_REQUEST: {
_propagate_window_notification(this, NOTIFICATION_WM_GO_BACK_REQUEST);
- emit_signal("go_back_requested");
+ emit_signal(SNAME("go_back_requested"));
} break;
case DisplayServer::WINDOW_EVENT_DPI_CHANGE: {
_update_viewport_size();
_propagate_window_notification(this, NOTIFICATION_WM_DPI_CHANGE);
- emit_signal("dpi_changed");
+ emit_signal(SNAME("dpi_changed"));
} break;
}
}
@@ -882,7 +882,7 @@ void Window::child_controls_changed() {
}
updating_child_controls = true;
- call_deferred("_update_child_controls");
+ call_deferred(SNAME("_update_child_controls"));
}
bool Window::_can_consume_input_events() const {
@@ -925,7 +925,7 @@ void Window::_window_input_text(const String &p_text) {
}
void Window::_window_drop_files(const Vector<String> &p_files) {
- emit_signal("files_dropped", p_files, current_screen);
+ emit_signal(SNAME("files_dropped"), p_files, current_screen);
}
Viewport *Window::get_parent_viewport() const {
@@ -1043,7 +1043,7 @@ void Window::popup_centered_ratio(float p_ratio) {
}
void Window::popup(const Rect2i &p_screen_rect) {
- emit_signal("about_to_popup");
+ emit_signal(SNAME("about_to_popup"));
// Update window size to calculate the actual window size based on contents minimum size and minimum size.
_update_window_size();
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 846da39221..53979e16df 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -286,7 +286,7 @@ void Curve::set_min_value(float p_min) {
}
// Note: min and max are indicative values,
// it's still possible that existing points are out of range at this point.
- emit_signal(SIGNAL_RANGE_CHANGED);
+ emit_signal(SNAME(SIGNAL_RANGE_CHANGED));
}
void Curve::set_max_value(float p_max) {
@@ -296,7 +296,7 @@ void Curve::set_max_value(float p_max) {
_minmax_set_once |= 0b01; // second bit is "max set"
_max_value = p_max;
}
- emit_signal(SIGNAL_RANGE_CHANGED);
+ emit_signal(SNAME(SIGNAL_RANGE_CHANGED));
}
real_t Curve::interpolate(real_t offset) const {
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index 9dd00849f4..bf889d7a1c 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -405,7 +405,7 @@ void CodeHighlighter::_clear_highlighting_cache() {
}
void CodeHighlighter::_update_cache() {
- font_color = text_edit->get_theme_color("font_color");
+ font_color = text_edit->get_theme_color(SNAME("font_color"));
}
void CodeHighlighter::add_keyword_color(const String &p_keyword, const Color &p_color) {
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 26c0d432a9..38042d84fd 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1790,7 +1790,7 @@ void GradientTexture::_queue_update() {
}
update_pending = true;
- call_deferred("_update");
+ call_deferred(SNAME("_update"));
}
void GradientTexture::_update() {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index deee22f05f..deb5a50eb2 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -2569,7 +2569,7 @@ void TileSetAtlasSource::create_tile(const Vector2i p_atlas_coords, const Vector
}
}
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileSetAtlasSource::remove_tile(Vector2i p_atlas_coords) {
@@ -2595,7 +2595,7 @@ void TileSetAtlasSource::remove_tile(Vector2i p_atlas_coords) {
tiles_ids.erase(p_atlas_coords);
tiles_ids.sort();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileSetAtlasSource::has_tile(Vector2i p_atlas_coords) const {
@@ -2723,7 +2723,7 @@ void TileSetAtlasSource::move_tile_in_atlas(Vector2i p_atlas_coords, Vector2i p_
}
}
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileSetAtlasSource::has_tiles_outside_texture() {
@@ -2768,7 +2768,7 @@ int TileSetAtlasSource::create_alternative_tile(const Vector2i p_atlas_coords, i
tiles[p_atlas_coords].alternatives_ids.sort();
_compute_next_alternative_id(p_atlas_coords);
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
return new_alternative_id;
}
@@ -2783,7 +2783,7 @@ void TileSetAtlasSource::remove_alternative_tile(const Vector2i p_atlas_coords,
tiles[p_atlas_coords].alternatives_ids.erase(p_alternative_tile);
tiles[p_atlas_coords].alternatives_ids.sort();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileSetAtlasSource::set_alternative_tile_id(const Vector2i p_atlas_coords, int p_alternative_tile, int p_new_id) {
@@ -2800,7 +2800,7 @@ void TileSetAtlasSource::set_alternative_tile_id(const Vector2i p_atlas_coords,
tiles[p_atlas_coords].alternatives_ids.erase(p_alternative_tile);
tiles[p_atlas_coords].alternatives_ids.sort();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileSetAtlasSource::has_alternative_tile(const Vector2i p_atlas_coords, int p_alternative_tile) const {
@@ -2958,7 +2958,7 @@ int TileSetScenesCollectionSource::create_scene_tile(Ref<PackedScene> p_packed_s
set_scene_tile_scene(new_scene_id, p_packed_scene);
_compute_next_alternative_id();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
return new_scene_id;
}
@@ -2978,7 +2978,7 @@ void TileSetScenesCollectionSource::set_scene_tile_id(int p_id, int p_new_id) {
scenes.erase(p_id);
scenes_ids.erase(p_id);
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileSetScenesCollectionSource::set_scene_tile_scene(int p_id, Ref<PackedScene> p_packed_scene) {
@@ -2997,7 +2997,7 @@ void TileSetScenesCollectionSource::set_scene_tile_scene(int p_id, Ref<PackedSce
} else {
scenes[p_id].scene = Ref<PackedScene>();
}
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Ref<PackedScene> TileSetScenesCollectionSource::get_scene_tile_scene(int p_id) const {
@@ -3010,7 +3010,7 @@ void TileSetScenesCollectionSource::set_scene_tile_display_placeholder(int p_id,
scenes[p_id].display_placeholder = p_display_placeholder;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileSetScenesCollectionSource::get_scene_tile_display_placeholder(int p_id) const {
@@ -3023,7 +3023,7 @@ void TileSetScenesCollectionSource::remove_scene_tile(int p_id) {
scenes.erase(p_id);
scenes_ids.erase(p_id);
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileSetScenesCollectionSource::get_next_scene_tile_id() const {
@@ -3144,7 +3144,7 @@ void TileData::notify_tile_data_properties_should_change() {
}
notify_property_list_changed();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileData::reset_state() {
@@ -3166,7 +3166,7 @@ bool TileData::is_allowing_transform() const {
void TileData::set_flip_h(bool p_flip_h) {
ERR_FAIL_COND_MSG(!allow_transform && p_flip_h, "Transform is only allowed for alternative tiles (with its alternative_id != 0)");
flip_h = p_flip_h;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileData::get_flip_h() const {
return flip_h;
@@ -3175,7 +3175,7 @@ bool TileData::get_flip_h() const {
void TileData::set_flip_v(bool p_flip_v) {
ERR_FAIL_COND_MSG(!allow_transform && p_flip_v, "Transform is only allowed for alternative tiles (with its alternative_id != 0)");
flip_v = p_flip_v;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileData::get_flip_v() const {
@@ -3185,7 +3185,7 @@ bool TileData::get_flip_v() const {
void TileData::set_transpose(bool p_transpose) {
ERR_FAIL_COND_MSG(!allow_transform && p_transpose, "Transform is only allowed for alternative tiles (with its alternative_id != 0)");
transpose = p_transpose;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileData::get_transpose() const {
return transpose;
@@ -3193,7 +3193,7 @@ bool TileData::get_transpose() const {
void TileData::set_texture_offset(Vector2i p_texture_offset) {
tex_offset = p_texture_offset;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Vector2i TileData::get_texture_offset() const {
@@ -3202,7 +3202,7 @@ Vector2i TileData::get_texture_offset() const {
void TileData::tile_set_material(Ref<ShaderMaterial> p_material) {
material = p_material;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Ref<ShaderMaterial> TileData::tile_get_material() const {
return material;
@@ -3210,7 +3210,7 @@ Ref<ShaderMaterial> TileData::tile_get_material() const {
void TileData::set_modulate(Color p_modulate) {
modulate = p_modulate;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Color TileData::get_modulate() const {
return modulate;
@@ -3218,7 +3218,7 @@ Color TileData::get_modulate() const {
void TileData::set_z_index(int p_z_index) {
z_index = p_z_index;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileData::get_z_index() const {
return z_index;
@@ -3226,7 +3226,7 @@ int TileData::get_z_index() const {
void TileData::set_y_sort_origin(int p_y_sort_origin) {
y_sort_origin = p_y_sort_origin;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileData::get_y_sort_origin() const {
return y_sort_origin;
@@ -3235,7 +3235,7 @@ int TileData::get_y_sort_origin() const {
void TileData::set_occluder(int p_layer_id, Ref<OccluderPolygon2D> p_occluder_polygon) {
ERR_FAIL_INDEX(p_layer_id, occluders.size());
occluders.write[p_layer_id] = p_occluder_polygon;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Ref<OccluderPolygon2D> TileData::get_occluder(int p_layer_id) const {
@@ -3254,20 +3254,20 @@ void TileData::set_collision_polygons_count(int p_layer_id, int p_polygons_count
ERR_FAIL_COND(p_polygons_count < 0);
physics.write[p_layer_id].polygons.resize(p_polygons_count);
notify_property_list_changed();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileData::add_collision_polygon(int p_layer_id) {
ERR_FAIL_INDEX(p_layer_id, physics.size());
physics.write[p_layer_id].polygons.push_back(PhysicsLayerTileData::PolygonShapeTileData());
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileData::remove_collision_polygon(int p_layer_id, int p_polygon_index) {
ERR_FAIL_INDEX(p_layer_id, physics.size());
ERR_FAIL_INDEX(p_polygon_index, physics[p_layer_id].polygons.size());
physics.write[p_layer_id].polygons.remove(p_polygon_index);
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
void TileData::set_collision_polygon_points(int p_layer_id, int p_polygon_index, Vector<Vector2> p_polygon) {
@@ -3291,7 +3291,7 @@ void TileData::set_collision_polygon_points(int p_layer_id, int p_polygon_index,
}
}
physics.write[p_layer_id].polygons.write[p_polygon_index].polygon = p_polygon;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Vector<Vector2> TileData::get_collision_polygon_points(int p_layer_id, int p_polygon_index) const {
@@ -3304,7 +3304,7 @@ void TileData::set_collision_polygon_one_way(int p_layer_id, int p_polygon_index
ERR_FAIL_INDEX(p_layer_id, physics.size());
ERR_FAIL_INDEX(p_polygon_index, physics[p_layer_id].polygons.size());
physics.write[p_layer_id].polygons.write[p_polygon_index].one_way = p_one_way;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
bool TileData::is_collision_polygon_one_way(int p_layer_id, int p_polygon_index) const {
@@ -3317,7 +3317,7 @@ void TileData::set_collision_polygon_one_way_margin(int p_layer_id, int p_polygo
ERR_FAIL_INDEX(p_layer_id, physics.size());
ERR_FAIL_INDEX(p_polygon_index, physics[p_layer_id].polygons.size());
physics.write[p_layer_id].polygons.write[p_polygon_index].one_way_margin = p_one_way_margin;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
float TileData::get_collision_polygon_one_way_margin(int p_layer_id, int p_polygon_index) const {
@@ -3353,7 +3353,7 @@ void TileData::set_terrain_set(int p_terrain_set) {
}
terrain_set = p_terrain_set;
notify_property_list_changed();
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileData::get_terrain_set() const {
@@ -3368,7 +3368,7 @@ void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int
ERR_FAIL_COND(!is_valid_peering_bit_terrain(p_peering_bit));
}
terrain_peering_bits[p_peering_bit] = p_terrain_index;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
int TileData::get_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit) const {
@@ -3386,7 +3386,7 @@ bool TileData::is_valid_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit)
void TileData::set_navigation_polygon(int p_layer_id, Ref<NavigationPolygon> p_navigation_polygon) {
ERR_FAIL_INDEX(p_layer_id, navigation.size());
navigation.write[p_layer_id] = p_navigation_polygon;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Ref<NavigationPolygon> TileData::get_navigation_polygon(int p_layer_id) const {
@@ -3398,7 +3398,7 @@ Ref<NavigationPolygon> TileData::get_navigation_polygon(int p_layer_id) const {
void TileData::set_probability(float p_probability) {
ERR_FAIL_COND(p_probability < 0.0);
probability = p_probability;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
float TileData::get_probability() const {
return probability;
@@ -3422,7 +3422,7 @@ Variant TileData::get_custom_data(String p_layer_name) const {
void TileData::set_custom_data_by_layer_id(int p_layer_id, Variant p_value) {
ERR_FAIL_INDEX(p_layer_id, custom_data.size());
custom_data.write[p_layer_id] = p_value;
- emit_signal("changed");
+ emit_signal(SNAME("changed"));
}
Variant TileData::get_custom_data_by_layer_id(int p_layer_id) const {
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index b4a95f2592..ae09872171 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1943,7 +1943,7 @@ void VisualShader::_update_shader() const {
const_cast<VisualShader *>(this)->set_default_texture_param(default_tex_params[i].name, default_tex_params[i].param);
}
if (previous_code != final_code) {
- const_cast<VisualShader *>(this)->emit_signal("changed");
+ const_cast<VisualShader *>(this)->emit_signal(SNAME("changed"));
}
previous_code = final_code;
}
@@ -1954,7 +1954,7 @@ void VisualShader::_queue_update() {
}
dirty.set();
- call_deferred("_update_shader");
+ call_deferred(SNAME("_update_shader"));
}
void VisualShader::_input_type_changed(Type p_type, int p_id) {
@@ -2436,7 +2436,7 @@ void VisualShaderNodeInput::set_input_name(String p_name) {
input_name = p_name;
emit_changed();
if (get_input_type_by_name(input_name) != prev_type) {
- emit_signal("input_type_changed");
+ emit_signal(SNAME("input_type_changed"));
}
}
@@ -2977,7 +2977,7 @@ VisualShaderNodeOutput::VisualShaderNodeOutput() {
void VisualShaderNodeUniform::set_uniform_name(const String &p_name) {
uniform_name = p_name;
- emit_signal("name_changed");
+ emit_signal(SNAME("name_changed"));
emit_changed();
}
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index 79ea9d72df..c090ce78ee 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -707,7 +707,7 @@ void VisualShaderNodeTexture::set_source(Source p_source) {
break;
}
emit_changed();
- emit_signal("editor_refresh_request");
+ emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeTexture::Source VisualShaderNodeTexture::get_source() const {
@@ -1076,7 +1076,7 @@ String VisualShaderNodeSample3D::generate_code(Shader::Mode p_mode, VisualShader
void VisualShaderNodeSample3D::set_source(Source p_source) {
source = p_source;
emit_changed();
- emit_signal("editor_refresh_request");
+ emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeSample3D::Source VisualShaderNodeSample3D::get_source() const {
@@ -1366,7 +1366,7 @@ String VisualShaderNodeCubemap::get_input_port_default_hint(int p_port) const {
void VisualShaderNodeCubemap::set_source(Source p_source) {
source = p_source;
emit_changed();
- emit_signal("editor_refresh_request");
+ emit_signal(SNAME("editor_refresh_request"));
}
VisualShaderNodeCubemap::Source VisualShaderNodeCubemap::get_source() const {