[Scene] Add SceneStringName::toggled

This commit is contained in:
Yuri Rubinsky 2024-06-01 13:15:13 +03:00 committed by Chaosus
parent f648de1a83
commit 52889ab7ee
44 changed files with 74 additions and 72 deletions

View File

@ -584,7 +584,7 @@ ActionMapEditor::ActionMapEditor() {
show_builtin_actions_checkbutton = memnew(CheckButton);
show_builtin_actions_checkbutton->set_text(TTR("Show Built-in Actions"));
show_builtin_actions_checkbutton->connect("toggled", callable_mp(this, &ActionMapEditor::set_show_builtin_actions));
show_builtin_actions_checkbutton->connect(SceneStringName(toggled), callable_mp(this, &ActionMapEditor::set_show_builtin_actions));
add_hbox->add_child(show_builtin_actions_checkbutton);
show_builtin_actions = EditorSettings::get_singleton()->get_project_metadata("project_settings", "show_builtin_actions", false);

View File

@ -755,13 +755,13 @@ FindReplaceBar::FindReplaceBar() {
hbc_option_search->add_child(case_sensitive);
case_sensitive->set_text(TTR("Match Case"));
case_sensitive->set_focus_mode(FOCUS_NONE);
case_sensitive->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
case_sensitive->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
whole_words = memnew(CheckBox);
hbc_option_search->add_child(whole_words);
whole_words->set_text(TTR("Whole Words"));
whole_words->set_focus_mode(FOCUS_NONE);
whole_words->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
whole_words->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
// Replace toolbar
replace_text = memnew(LineEdit);
@ -786,7 +786,7 @@ FindReplaceBar::FindReplaceBar() {
hbc_option_replace->add_child(selection_only);
selection_only->set_text(TTR("Selection Only"));
selection_only->set_focus_mode(FOCUS_NONE);
selection_only->connect("toggled", callable_mp(this, &FindReplaceBar::_search_options_changed));
selection_only->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
hide_button = memnew(TextureButton);
add_child(hide_button);

View File

@ -685,7 +685,7 @@ EditorAssetInstaller::EditorAssetInstaller() {
show_source_files_button->set_toggle_mode(true);
show_source_files_button->set_tooltip_text(TTR("Open the list of the asset contents and select which files to install."));
remapping_tools->add_child(show_source_files_button);
show_source_files_button->connect("toggled", callable_mp(this, &EditorAssetInstaller::_toggle_source_tree).bind(false));
show_source_files_button->connect(SceneStringName(toggled), callable_mp(this, &EditorAssetInstaller::_toggle_source_tree).bind(false));
Button *target_dir_button = memnew(Button);
target_dir_button->set_text(TTR("Change Install Folder"));
@ -698,7 +698,7 @@ EditorAssetInstaller::EditorAssetInstaller() {
skip_toplevel_check = memnew(CheckBox);
skip_toplevel_check->set_text(TTR("Ignore asset root"));
skip_toplevel_check->set_tooltip_text(TTR("Ignore the root directory when extracting files."));
skip_toplevel_check->connect("toggled", callable_mp(this, &EditorAssetInstaller::_set_skip_toplevel));
skip_toplevel_check->connect(SceneStringName(toggled), callable_mp(this, &EditorAssetInstaller::_set_skip_toplevel));
remapping_tools->add_child(skip_toplevel_check);
remapping_tools->add_spacer();

View File

@ -408,7 +408,7 @@ EditorLocaleDialog::EditorLocaleDialog() {
edit_filters->set_text(TTR("Edit Filters"));
edit_filters->set_toggle_mode(true);
edit_filters->set_pressed(false);
edit_filters->connect("toggled", callable_mp(this, &EditorLocaleDialog::_edit_filters));
edit_filters->connect(SceneStringName(toggled), callable_mp(this, &EditorLocaleDialog::_edit_filters));
hb_filter->add_child(edit_filters);
}
{
@ -416,7 +416,7 @@ EditorLocaleDialog::EditorLocaleDialog() {
advanced->set_text(TTR("Advanced"));
advanced->set_toggle_mode(true);
advanced->set_pressed(false);
advanced->connect("toggled", callable_mp(this, &EditorLocaleDialog::_toggle_advanced));
advanced->connect(SceneStringName(toggled), callable_mp(this, &EditorLocaleDialog::_toggle_advanced));
hb_filter->add_child(advanced);
}
vb->add_child(hb_filter);

View File

@ -510,7 +510,7 @@ EditorLog::EditorLog() {
collapse_button->set_tooltip_text(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences."));
collapse_button->set_toggle_mode(true);
collapse_button->set_pressed(false);
collapse_button->connect("toggled", callable_mp(this, &EditorLog::_set_collapse));
collapse_button->connect(SceneStringName(toggled), callable_mp(this, &EditorLog::_set_collapse));
hb_tools2->add_child(collapse_button);
// Show Search.
@ -521,7 +521,7 @@ EditorLog::EditorLog() {
show_search_button->set_pressed(true);
show_search_button->set_shortcut(ED_SHORTCUT("editor/open_search", TTR("Focus Search/Filter Bar"), KeyModifierMask::CMD_OR_CTRL | Key::F));
show_search_button->set_shortcut_context(this);
show_search_button->connect("toggled", callable_mp(this, &EditorLog::_set_search_visible));
show_search_button->connect(SceneStringName(toggled), callable_mp(this, &EditorLog::_set_search_visible));
hb_tools2->add_child(show_search_button);
// Message Type Filters.

View File

@ -102,7 +102,7 @@ private:
toggle_button->add_theme_color_override("icon_color_pressed", Color(1, 1, 1, 1));
toggle_button->set_focus_mode(FOCUS_NONE);
// When toggled call the callback and pass the MessageType this button is for.
toggle_button->connect("toggled", p_toggled_callback.bind(type));
toggle_button->connect(SceneStringName(toggled), p_toggled_callback.bind(type));
}
int get_message_count() {

View File

@ -236,7 +236,7 @@ EditorPropertyVectorN::EditorPropertyVectorN(Variant::Type p_type, bool p_force_
linked->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED);
linked->set_tooltip_text(TTR("Lock/Unlock Component Ratio"));
linked->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyVectorN::_update_ratio));
linked->connect(SNAME("toggled"), callable_mp(this, &EditorPropertyVectorN::_store_link));
linked->connect(SceneStringName(toggled), callable_mp(this, &EditorPropertyVectorN::_store_link));
hb->add_child(linked);
add_child(hb);

View File

@ -1410,12 +1410,12 @@ ProjectExportDialog::ProjectExportDialog() {
sec_scroll_container->add_child(sec_vb);
enc_pck = memnew(CheckButton);
enc_pck->connect("toggled", callable_mp(this, &ProjectExportDialog::_enc_pck_changed));
enc_pck->connect(SceneStringName(toggled), callable_mp(this, &ProjectExportDialog::_enc_pck_changed));
enc_pck->set_text(TTR("Encrypt Exported PCK"));
sec_vb->add_child(enc_pck);
enc_directory = memnew(CheckButton);
enc_directory->connect("toggled", callable_mp(this, &ProjectExportDialog::_enc_directory_changed));
enc_directory->connect(SceneStringName(toggled), callable_mp(this, &ProjectExportDialog::_enc_directory_changed));
enc_directory->set_text(TTR("Encrypt Index (File Names and Info)"));
sec_vb->add_child(enc_directory);

View File

@ -648,7 +648,7 @@ void GroupsEditor::_show_add_group_dialog() {
add_group_description->set_editable(false);
gc->add_child(add_group_description);
global_group_button->connect("toggled", callable_mp(add_group_description, &LineEdit::set_editable));
global_group_button->connect(SceneStringName(toggled), callable_mp(add_group_description, &LineEdit::set_editable));
add_group_dialog->register_text_enter(add_group_name);
add_group_dialog->register_text_enter(add_group_description);

View File

@ -158,7 +158,7 @@ void EditorBottomPanel::load_layout_from_config(Ref<ConfigFile> p_config_file, c
Button *EditorBottomPanel::add_item(String p_text, Control *p_item, const Ref<Shortcut> &p_shortcut, bool p_at_front) {
Button *tb = memnew(Button);
tb->set_theme_type_variation("BottomPanelButton");
tb->connect("toggled", callable_mp(this, &EditorBottomPanel::_switch_by_control).bind(p_item));
tb->connect(SceneStringName(toggled), callable_mp(this, &EditorBottomPanel::_switch_by_control).bind(p_item));
tb->set_drag_forwarding(Callable(), callable_mp(this, &EditorBottomPanel::_button_drag_hover).bind(tb, p_item), Callable());
tb->set_text(p_text);
tb->set_shortcut(p_shortcut);
@ -295,5 +295,5 @@ EditorBottomPanel::EditorBottomPanel() {
expand_button->set_theme_type_variation("FlatMenuButton");
expand_button->set_toggle_mode(true);
expand_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KeyModifierMask::SHIFT | Key::F12));
expand_button->connect("toggled", callable_mp(this, &EditorBottomPanel::_expand_button_toggled));
expand_button->connect(SceneStringName(toggled), callable_mp(this, &EditorBottomPanel::_expand_button_toggled));
}

View File

@ -1779,7 +1779,7 @@ void EditorFileDialog::_update_option_controls() {
CheckBox *cb = memnew(CheckBox);
cb->set_pressed(opt.default_idx);
grid_options->add_child(cb);
cb->connect("toggled", callable_mp(this, &EditorFileDialog::_option_changed_checkbox_toggled).bind(opt.name));
cb->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::_option_changed_checkbox_toggled).bind(opt.name));
selected_options[opt.name] = (bool)opt.default_idx;
} else {
OptionButton *ob = memnew(OptionButton);
@ -2146,7 +2146,7 @@ EditorFileDialog::EditorFileDialog() {
show_hidden->set_toggle_mode(true);
show_hidden->set_pressed(is_showing_hidden_files());
show_hidden->set_tooltip_text(TTR("Toggle the visibility of hidden files."));
show_hidden->connect("toggled", callable_mp(this, &EditorFileDialog::set_show_hidden_files));
show_hidden->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::set_show_hidden_files));
pathhb->add_child(show_hidden);
pathhb->add_child(memnew(VSeparator));

View File

@ -445,7 +445,7 @@ EditorRunBar::EditorRunBar() {
write_movie_button->set_pressed(false);
write_movie_button->set_focus_mode(Control::FOCUS_NONE);
write_movie_button->set_tooltip_text(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file."));
write_movie_button->connect("toggled", callable_mp(this, &EditorRunBar::_write_movie_toggled));
write_movie_button->connect(SceneStringName(toggled), callable_mp(this, &EditorRunBar::_write_movie_toggled));
quick_run = memnew(EditorQuickOpen);
add_child(quick_run);

View File

@ -1769,7 +1769,7 @@ SceneTreeDialog::SceneTreeDialog() {
// Add 'Show All' button to HBoxContainer next to the filter, visible only when valid_types is defined.
show_all_nodes = memnew(CheckButton);
show_all_nodes->set_text(TTR("Show All"));
show_all_nodes->connect("toggled", callable_mp(this, &SceneTreeDialog::_show_all_nodes_changed));
show_all_nodes->connect(SceneStringName(toggled), callable_mp(this, &SceneTreeDialog::_show_all_nodes_changed));
show_all_nodes->set_h_size_flags(Control::SIZE_SHRINK_BEGIN);
show_all_nodes->hide();
filter_hbc->add_child(show_all_nodes);

View File

@ -245,8 +245,8 @@ HistoryDock::HistoryDock() {
current_scene_checkbox->set_text(TTR("Scene"));
current_scene_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
current_scene_checkbox->set_clip_text(true);
current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::save_options).unbind(1));
current_scene_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::refresh_history).unbind(1));
current_scene_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::save_options).unbind(1));
global_history_checkbox = memnew(CheckBox);
mode_hb->add_child(global_history_checkbox);
@ -255,8 +255,8 @@ HistoryDock::HistoryDock() {
global_history_checkbox->set_text(TTR("Global"));
global_history_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
global_history_checkbox->set_clip_text(true);
global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::save_options).unbind(1));
global_history_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::refresh_history).unbind(1));
global_history_checkbox->connect(SceneStringName(toggled), callable_mp(this, &HistoryDock::save_options).unbind(1));
action_list = memnew(ItemList);
action_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);

View File

@ -537,7 +537,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() {
loop = memnew(CheckBox);
loop->set_text(TTR("Enable"));
loop->set_tooltip_text(TTR("Enable looping."));
loop->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
loop->connect(SceneStringName(toggled), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
loop_hb->add_child(loop);
loop_hb->add_spacer();
loop_hb->add_child(memnew(Label(TTR("Offset:"))));
@ -554,7 +554,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() {
interactive_hb->add_theme_constant_override("separation", 4 * EDSCALE);
bpm_enabled = memnew(CheckBox);
bpm_enabled->set_text((TTR("BPM:")));
bpm_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
bpm_enabled->connect(SceneStringName(toggled), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(bpm_enabled);
bpm_edit = memnew(SpinBox);
bpm_edit->set_max(400);
@ -565,7 +565,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() {
interactive_hb->add_spacer();
beats_enabled = memnew(CheckBox);
beats_enabled->set_text(TTR("Beat Count:"));
beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
beats_enabled->connect(SceneStringName(toggled), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(beats_enabled);
beats_edit = memnew(SpinBox);
beats_edit->set_tooltip_text(TTR("Configure the amount of Beats used for music-aware looping. If zero, it will be autodetected from the length.\nIt is recommended to set this value (either manually or by clicking on a beat number in the preview) to ensure looping works properly."));

View File

@ -720,7 +720,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
for (int i = 0; i < MOD_MAX; i++) {
String name = mods[i];
mod_checkboxes[i] = memnew(CheckBox);
mod_checkboxes[i]->connect("toggled", callable_mp(this, &InputEventConfigurationDialog::_mod_toggled).bind(i));
mod_checkboxes[i]->connect(SceneStringName(toggled), callable_mp(this, &InputEventConfigurationDialog::_mod_toggled).bind(i));
mod_checkboxes[i]->set_text(name);
mod_checkboxes[i]->set_tooltip_text(TTR(mods_tip[i]));
mod_container->add_child(mod_checkboxes[i]);
@ -729,7 +729,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
mod_container->add_child(memnew(VSeparator));
autoremap_command_or_control_checkbox = memnew(CheckBox);
autoremap_command_or_control_checkbox->connect("toggled", callable_mp(this, &InputEventConfigurationDialog::_autoremap_command_or_control_toggled));
autoremap_command_or_control_checkbox->connect(SceneStringName(toggled), callable_mp(this, &InputEventConfigurationDialog::_autoremap_command_or_control_toggled));
autoremap_command_or_control_checkbox->set_pressed(false);
autoremap_command_or_control_checkbox->set_text(TTR("Command / Control (auto)"));
autoremap_command_or_control_checkbox->set_tooltip_text(TTR("Automatically remaps between 'Meta' ('Command') and 'Control' depending on current platform."));

View File

@ -713,7 +713,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
top_hb->add_child(memnew(Label(TTR("Sync:"))));
sync = memnew(CheckBox);
top_hb->add_child(sync);
sync->connect("toggled", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed));
sync->connect(SceneStringName(toggled), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed));
top_hb->add_child(memnew(VSeparator));

View File

@ -961,7 +961,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
top_hb->add_child(memnew(Label(TTR("Sync:"))));
sync = memnew(CheckBox);
top_hb->add_child(sync);
sync->connect("toggled", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed));
sync->connect(SceneStringName(toggled), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed));
top_hb->add_child(memnew(VSeparator));

View File

@ -5409,7 +5409,7 @@ CanvasItemEditor::CanvasItemEditor() {
smart_snap_button->set_theme_type_variation("FlatButton");
main_menu_hbox->add_child(smart_snap_button);
smart_snap_button->set_toggle_mode(true);
smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap));
smart_snap_button->connect(SceneStringName(toggled), callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap));
smart_snap_button->set_tooltip_text(TTR("Toggle smart snapping."));
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KeyModifierMask::SHIFT | Key::S));
smart_snap_button->set_shortcut_context(this);
@ -5418,7 +5418,7 @@ CanvasItemEditor::CanvasItemEditor() {
grid_snap_button->set_theme_type_variation("FlatButton");
main_menu_hbox->add_child(grid_snap_button);
grid_snap_button->set_toggle_mode(true);
grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap));
grid_snap_button->connect(SceneStringName(toggled), callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap));
grid_snap_button->set_tooltip_text(TTR("Toggle grid snapping."));
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KeyModifierMask::SHIFT | Key::G));
grid_snap_button->set_shortcut_context(this);
@ -5511,7 +5511,7 @@ CanvasItemEditor::CanvasItemEditor() {
override_camera_button = memnew(Button);
override_camera_button->set_theme_type_variation("FlatButton");
main_menu_hbox->add_child(override_camera_button);
override_camera_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_override_camera));
override_camera_button->connect(SceneStringName(toggled), callable_mp(this, &CanvasItemEditor::_button_override_camera));
override_camera_button->set_toggle_mode(true);
override_camera_button->set_disabled(true);
_update_override_camera_button(false);

View File

@ -1084,7 +1084,7 @@ ControlEditorToolbar::ControlEditorToolbar() {
anchor_mode_button->set_toggle_mode(true);
anchor_mode_button->set_tooltip_text(TTR("When active, moving Control nodes changes their anchors instead of their offsets."));
add_child(anchor_mode_button);
anchor_mode_button->connect("toggled", callable_mp(this, &ControlEditorToolbar::_anchor_mode_toggled));
anchor_mode_button->connect(SceneStringName(toggled), callable_mp(this, &ControlEditorToolbar::_anchor_mode_toggled));
// Container tools.
containers_button = memnew(ControlEditorPopupButton);

View File

@ -1003,7 +1003,7 @@ CurveEditor::CurveEditor() {
snap_button->set_tooltip_text(TTR("Toggle Grid Snap"));
snap_button->set_toggle_mode(true);
toolbar->add_child(snap_button);
snap_button->connect("toggled", callable_mp(this, &CurveEditor::_set_snap_enabled));
snap_button->connect(SceneStringName(toggled), callable_mp(this, &CurveEditor::_set_snap_enabled));
toolbar->add_child(memnew(VSeparator));

View File

@ -632,7 +632,7 @@ GradientEditor::GradientEditor() {
snap_button->set_tooltip_text(TTR("Toggle Grid Snap"));
snap_button->set_toggle_mode(true);
toolbar->add_child(snap_button);
snap_button->connect("toggled", callable_mp(this, &GradientEditor::_set_snap_enabled));
snap_button->connect(SceneStringName(toggled), callable_mp(this, &GradientEditor::_set_snap_enabled));
snap_count_edit = memnew(EditorSpinSlider);
snap_count_edit->set_min(2);

View File

@ -290,7 +290,7 @@ GradientTexture2DEditor::GradientTexture2DEditor() {
snap_button->set_tooltip_text(TTR("Toggle Grid Snap"));
snap_button->set_toggle_mode(true);
toolbar->add_child(snap_button);
snap_button->connect("toggled", callable_mp(this, &GradientTexture2DEditor::_set_snap_enabled));
snap_button->connect(SceneStringName(toggled), callable_mp(this, &GradientTexture2DEditor::_set_snap_enabled));
snap_count_edit = memnew(EditorSpinSlider);
snap_count_edit->set_min(2);

View File

@ -3729,10 +3729,10 @@ void Node3DEditorViewport::_set_auto_orthogonal() {
}
void Node3DEditorViewport::_preview_exited_scene() {
preview_camera->disconnect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
preview_camera->disconnect(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
preview_camera->set_pressed(false);
_toggle_camera_preview(false);
preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
preview_camera->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
view_menu->show();
}
@ -4104,8 +4104,8 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, previewing_cinema);
}
if (preview_camera->is_connected("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview))) {
preview_camera->disconnect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
if (preview_camera->is_connected(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview))) {
preview_camera->disconnect(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
}
if (p_state.has("previewing")) {
Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]);
@ -4118,7 +4118,7 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
preview_camera->show();
}
}
preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
preview_camera->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
}
Dictionary Node3DEditorViewport::get_state() const {
@ -5466,7 +5466,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
vbox->add_child(preview_camera);
preview_camera->set_h_size_flags(0);
preview_camera->hide();
preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
preview_camera->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
previewing = nullptr;
gizmo_scale = 1.0;
@ -8681,7 +8681,7 @@ Node3DEditor::Node3DEditor() {
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true);
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_theme_type_variation("FlatButton");
tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_LOCAL_COORDS));
tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_LOCAL_COORDS));
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), Key::T));
tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this);
@ -8689,7 +8689,7 @@ Node3DEditor::Node3DEditor() {
main_menu_hbox->add_child(tool_option_button[TOOL_OPT_USE_SNAP]);
tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true);
tool_option_button[TOOL_OPT_USE_SNAP]->set_theme_type_variation("FlatButton");
tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_SNAP));
tool_option_button[TOOL_OPT_USE_SNAP]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_SNAP));
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), Key::Y));
tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);
@ -8700,7 +8700,7 @@ Node3DEditor::Node3DEditor() {
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_toggle_mode(true);
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_theme_type_variation("FlatButton");
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true);
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_OVERRIDE_CAMERA));
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_OVERRIDE_CAMERA));
_update_camera_override_button(false);
main_menu_hbox->add_child(memnew(VSeparator));

View File

@ -438,7 +438,7 @@ ParticleProcessMaterialMinMaxPropertyEditor::ParticleProcessMaterialMinMaxProper
toggle_mode_button->set_toggle_mode(true);
toggle_mode_button->set_tooltip_text(TTR("Toggle between minimum/maximum and base value/spread modes."));
hb->add_child(toggle_mode_button);
toggle_mode_button->connect(SNAME("toggled"), callable_mp(this, &ParticleProcessMaterialMinMaxPropertyEditor::_toggle_mode));
toggle_mode_button->connect(SceneStringName(toggled), callable_mp(this, &ParticleProcessMaterialMinMaxPropertyEditor::_toggle_mode));
set_bottom_editor(content_vb);
}

View File

@ -62,7 +62,7 @@ PhysicalBone3DEditor::PhysicalBone3DEditor() {
// when the editor theme updates.
button_transform_joint->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("PhysicalBone3D"), EditorStringName(EditorIcons)));
button_transform_joint->set_toggle_mode(true);
button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBone3DEditor::_on_toggle_button_transform_joint));
button_transform_joint->connect(SceneStringName(toggled), callable_mp(this, &PhysicalBone3DEditor::_on_toggle_button_transform_joint));
hide();
}

View File

@ -1468,7 +1468,7 @@ Polygon2DEditor::Polygon2DEditor() {
b_snap_enable->set_toggle_mode(true);
b_snap_enable->set_pressed(use_snap);
b_snap_enable->set_tooltip_text(TTR("Enable Snap"));
b_snap_enable->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_use_snap));
b_snap_enable->connect(SceneStringName(toggled), callable_mp(this, &Polygon2DEditor::_set_use_snap));
b_snap_grid = memnew(Button);
b_snap_grid->set_theme_type_variation("FlatButton");
@ -1478,7 +1478,7 @@ Polygon2DEditor::Polygon2DEditor() {
b_snap_grid->set_toggle_mode(true);
b_snap_grid->set_pressed(snap_show_grid);
b_snap_grid->set_tooltip_text(TTR("Show Grid"));
b_snap_grid->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_show_grid));
b_snap_grid->connect(SceneStringName(toggled), callable_mp(this, &Polygon2DEditor::_set_show_grid));
grid_settings = memnew(AcceptDialog);
grid_settings->set_title(TTR("Configure Grid:"));

View File

@ -4063,7 +4063,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
members_overview_alphabeta_sort_button->set_tooltip_text(TTR("Toggle alphabetical sorting of the method list."));
members_overview_alphabeta_sort_button->set_toggle_mode(true);
members_overview_alphabeta_sort_button->set_pressed(EDITOR_GET("text_editor/script_list/sort_members_outline_alphabetically"));
members_overview_alphabeta_sort_button->connect("toggled", callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort));
members_overview_alphabeta_sort_button->connect(SceneStringName(toggled), callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort));
buttons_hbox->add_child(members_overview_alphabeta_sort_button);

View File

@ -747,7 +747,7 @@ void Skeleton3DEditor::create_editors() {
edit_mode_button->set_toggle_mode(true);
edit_mode_button->set_focus_mode(FOCUS_NONE);
edit_mode_button->set_tooltip_text(TTR("Edit Mode\nShow buttons on joints."));
edit_mode_button->connect("toggled", callable_mp(this, &Skeleton3DEditor::edit_mode_toggled));
edit_mode_button->connect(SceneStringName(toggled), callable_mp(this, &Skeleton3DEditor::edit_mode_toggled));
edit_mode = false;

View File

@ -113,7 +113,7 @@ StyleBoxPreview::StyleBoxPreview() {
// This theme variation works better than the normal theme because there's no focus highlight.
grid_preview->set_theme_type_variation("PreviewLightButton");
grid_preview->set_toggle_mode(true);
grid_preview->connect("toggled", callable_mp(this, &StyleBoxPreview::_grid_preview_toggled));
grid_preview->connect(SceneStringName(toggled), callable_mp(this, &StyleBoxPreview::_grid_preview_toggled));
grid_preview->set_pressed(grid_preview_enabled);
add_child(grid_preview);
}

View File

@ -917,7 +917,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
button_expand->set_toggle_mode(true);
button_expand->set_pressed(false);
button_expand->set_tooltip_text(TTR("Expand editor"));
button_expand->connect("toggled", callable_mp(this, &GenericTilePolygonEditor::_toggle_expand));
button_expand->connect(SceneStringName(toggled), callable_mp(this, &GenericTilePolygonEditor::_toggle_expand));
toolbar->add_child(button_expand);
toolbar->add_child(memnew(VSeparator));

View File

@ -2330,7 +2330,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
random_tile_toggle->set_theme_type_variation("FlatButton");
random_tile_toggle->set_toggle_mode(true);
random_tile_toggle->set_tooltip_text(TTR("Place Random Tile"));
random_tile_toggle->connect("toggled", callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled));
random_tile_toggle->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled));
tools_settings->add_child(random_tile_toggle);
// Random tile scattering.
@ -4486,7 +4486,7 @@ TileMapLayerEditor::TileMapLayerEditor() {
toggle_highlight_selected_layer_button->set_theme_type_variation("FlatButton");
toggle_highlight_selected_layer_button->set_toggle_mode(true);
toggle_highlight_selected_layer_button->set_pressed(true);
toggle_highlight_selected_layer_button->connect("toggled", callable_mp(this, &TileMapLayerEditor::_highlight_selected_layer_button_toggled));
toggle_highlight_selected_layer_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_highlight_selected_layer_button_toggled));
toggle_highlight_selected_layer_button->set_tooltip_text(TTR("Highlight Selected TileMap Layer"));
tile_map_toolbar->add_child(toggle_highlight_selected_layer_button);
@ -4497,7 +4497,7 @@ TileMapLayerEditor::TileMapLayerEditor() {
toggle_grid_button->set_theme_type_variation("FlatButton");
toggle_grid_button->set_toggle_mode(true);
toggle_grid_button->set_tooltip_text(TTR("Toggle grid visibility."));
toggle_grid_button->connect("toggled", callable_mp(this, &TileMapLayerEditor::_on_grid_toggled));
toggle_grid_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_on_grid_toggled));
tile_map_toolbar->add_child(toggle_grid_button);
// Advanced settings menu button.

View File

@ -1006,7 +1006,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
toggle_vcs_choice = memnew(CheckButton);
toggle_vcs_choice->set_h_size_flags(Control::SIZE_EXPAND_FILL);
toggle_vcs_choice->set_pressed_no_signal(false);
toggle_vcs_choice->connect(SNAME("toggled"), callable_mp(this, &VersionControlEditorPlugin::_toggle_vcs_integration));
toggle_vcs_choice->connect(SceneStringName(toggled), callable_mp(this, &VersionControlEditorPlugin::_toggle_vcs_integration));
toggle_vcs_hbc->add_child(toggle_vcs_choice);
set_up_vbc->add_child(memnew(HSeparator));

View File

@ -6382,7 +6382,7 @@ VisualShaderEditor::VisualShaderEditor() {
custom_mode_box->set_text(TTR("Custom"));
custom_mode_box->set_pressed(false);
custom_mode_box->set_visible(false);
custom_mode_box->connect("toggled", callable_mp(this, &VisualShaderEditor::_custom_mode_toggled));
custom_mode_box->connect(SceneStringName(toggled), callable_mp(this, &VisualShaderEditor::_custom_mode_toggled));
edit_type_standard = memnew(OptionButton);
edit_type_standard->add_item(TTR("Vertex"));

View File

@ -857,7 +857,7 @@ ProjectDialog::ProjectDialog() {
create_dir->set_text(TTR("Create Folder"));
create_dir->set_pressed(true);
pphb_label->add_child(create_dir);
create_dir->connect("toggled", callable_mp(this, &ProjectDialog::_create_dir_toggled));
create_dir->connect(SceneStringName(toggled), callable_mp(this, &ProjectDialog::_create_dir_toggled));
HBoxContainer *pphb = memnew(HBoxContainer);
project_path_container->add_child(pphb);

View File

@ -652,7 +652,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced = memnew(CheckButton);
advanced->set_text(TTR("Advanced Settings"));
advanced->connect("toggled", callable_mp(this, &ProjectSettingsEditor::_advanced_toggled));
advanced->connect(SceneStringName(toggled), callable_mp(this, &ProjectSettingsEditor::_advanced_toggled));
search_bar->add_child(advanced);
custom_properties = memnew(HBoxContainer);

View File

@ -304,7 +304,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
// ---- Connections
cbut_collapse_features->connect("toggled", callable_mp(this, &RenameDialog::_features_toggled));
cbut_collapse_features->connect(SceneStringName(toggled), callable_mp(this, &RenameDialog::_features_toggled));
// Substitute Buttons

View File

@ -304,7 +304,7 @@ RunInstancesDialog::RunInstancesDialog() {
args_gc->add_child(instance_count);
instance_count->connect(SceneStringName(value_changed), callable_mp(this, &RunInstancesDialog::_start_instance_timer).unbind(1));
instance_count->connect(SceneStringName(value_changed), callable_mp(this, &RunInstancesDialog::_refresh_argument_count).unbind(1));
enable_multiple_instances_checkbox->connect("toggled", callable_mp(instance_count, &SpinBox::set_editable));
enable_multiple_instances_checkbox->connect(SceneStringName(toggled), callable_mp(instance_count, &SpinBox::set_editable));
instance_count->set_editable(enable_multiple_instances_checkbox->is_pressed());
main_args_edit = memnew(LineEdit);

View File

@ -629,7 +629,7 @@ ShaderCreateDialog::ShaderCreateDialog() {
internal = memnew(CheckBox);
internal->set_text(TTR("On"));
internal->connect("toggled", callable_mp(this, &ShaderCreateDialog::_built_in_toggled));
internal->connect(SceneStringName(toggled), callable_mp(this, &ShaderCreateDialog::_built_in_toggled));
gc->add_child(memnew(Label(TTR("Built-in Shader:"))));
gc->add_child(internal);

View File

@ -140,7 +140,7 @@ void BaseButton::_pressed() {
void BaseButton::_toggled(bool p_pressed) {
GDVIRTUAL_CALL(_toggled, p_pressed);
toggled(p_pressed);
emit_signal(SNAME("toggled"), p_pressed);
emit_signal(SceneStringName(toggled), p_pressed);
}
void BaseButton::on_action_event(Ref<InputEvent> p_event) {

View File

@ -783,7 +783,7 @@ void ColorPicker::_add_recent_preset_button(int p_size, const Color &p_color) {
recent_preset_hbc->add_child(btn_preset_new);
recent_preset_hbc->move_child(btn_preset_new, 0);
btn_preset_new->set_pressed(true);
btn_preset_new->connect("toggled", callable_mp(this, &ColorPicker::_recent_preset_pressed).bind(btn_preset_new));
btn_preset_new->connect(SceneStringName(toggled), callable_mp(this, &ColorPicker::_recent_preset_pressed).bind(btn_preset_new));
}
void ColorPicker::_show_hide_preset(const bool &p_is_btn_pressed, Button *p_btn_preset, Container *p_preset_container) {
@ -2003,7 +2003,7 @@ ColorPicker::ColorPicker() {
btn_preset->set_toggle_mode(true);
btn_preset->set_focus_mode(FOCUS_NONE);
btn_preset->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
btn_preset->connect("toggled", callable_mp(this, &ColorPicker::_show_hide_preset).bind(btn_preset, preset_container));
btn_preset->connect(SceneStringName(toggled), callable_mp(this, &ColorPicker::_show_hide_preset).bind(btn_preset, preset_container));
real_vbox->add_child(btn_preset);
real_vbox->add_child(preset_container);
@ -2020,7 +2020,7 @@ ColorPicker::ColorPicker() {
btn_recent_preset->set_toggle_mode(true);
btn_recent_preset->set_focus_mode(FOCUS_NONE);
btn_recent_preset->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
btn_recent_preset->connect("toggled", callable_mp(this, &ColorPicker::_show_hide_preset).bind(btn_recent_preset, recent_preset_hbc));
btn_recent_preset->connect(SceneStringName(toggled), callable_mp(this, &ColorPicker::_show_hide_preset).bind(btn_recent_preset, recent_preset_hbc));
real_vbox->add_child(btn_recent_preset);
real_vbox->add_child(recent_preset_hbc);

View File

@ -1143,7 +1143,7 @@ void FileDialog::_update_option_controls() {
CheckBox *cb = memnew(CheckBox);
cb->set_pressed(opt.default_idx);
grid_options->add_child(cb);
cb->connect("toggled", callable_mp(this, &FileDialog::_option_changed_checkbox_toggled).bind(opt.name));
cb->connect(SceneStringName(toggled), callable_mp(this, &FileDialog::_option_changed_checkbox_toggled).bind(opt.name));
selected_options[opt.name] = (bool)opt.default_idx;
} else {
OptionButton *ob = memnew(OptionButton);
@ -1441,7 +1441,7 @@ FileDialog::FileDialog() {
show_hidden->set_toggle_mode(true);
show_hidden->set_pressed(is_showing_hidden_files());
show_hidden->set_tooltip_text(ETR("Toggle the visibility of hidden files."));
show_hidden->connect("toggled", callable_mp(this, &FileDialog::set_show_hidden_files));
show_hidden->connect(SceneStringName(toggled), callable_mp(this, &FileDialog::set_show_hidden_files));
hbc->add_child(show_hidden);
shortcuts_container = memnew(HBoxContainer);

View File

@ -132,6 +132,7 @@ SceneStringNames::SceneStringNames() {
pressed = StaticCString::create("pressed");
id_pressed = StaticCString::create("id_pressed");
toggled = StaticCString::create("toggled");
panel = StaticCString::create("panel");

View File

@ -145,6 +145,7 @@ public:
StringName pressed;
StringName id_pressed;
StringName toggled;
StringName panel;