You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
[Scene] Add SceneStringNames::pressed
This commit is contained in:
@@ -616,7 +616,7 @@ bool TileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEven
|
||||
b->set_pressed(b->get_button_group().is_valid() || !b->is_pressed());
|
||||
} else {
|
||||
// Can't press a button without toggle mode, so just emit the signal directly.
|
||||
b->emit_signal(SNAME("pressed"));
|
||||
b->emit_signal(SceneStringName(pressed));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -2209,7 +2209,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
select_tool_button->set_toggle_mode(true);
|
||||
select_tool_button->set_button_group(tool_buttons_group);
|
||||
select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", TTR("Selection"), Key::S));
|
||||
select_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
select_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(select_tool_button);
|
||||
viewport_shortcut_buttons.push_back(select_tool_button);
|
||||
|
||||
@@ -2219,7 +2219,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
paint_tool_button->set_button_group(tool_buttons_group);
|
||||
paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", TTR("Paint"), Key::D));
|
||||
paint_tool_button->set_tooltip_text(TTR("Shift: Draw line.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Shift: Draw rectangle."));
|
||||
paint_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(paint_tool_button);
|
||||
viewport_shortcut_buttons.push_back(paint_tool_button);
|
||||
|
||||
@@ -2229,7 +2229,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
line_tool_button->set_button_group(tool_buttons_group);
|
||||
// TRANSLATORS: This refers to the line tool in the tilemap editor.
|
||||
line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", TTR("Line", "Tool"), Key::L));
|
||||
line_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(line_tool_button);
|
||||
viewport_shortcut_buttons.push_back(line_tool_button);
|
||||
|
||||
@@ -2238,7 +2238,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
rect_tool_button->set_toggle_mode(true);
|
||||
rect_tool_button->set_button_group(tool_buttons_group);
|
||||
rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), Key::R));
|
||||
rect_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(rect_tool_button);
|
||||
viewport_shortcut_buttons.push_back(rect_tool_button);
|
||||
|
||||
@@ -2247,7 +2247,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
bucket_tool_button->set_toggle_mode(true);
|
||||
bucket_tool_button->set_button_group(tool_buttons_group);
|
||||
bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), Key::B));
|
||||
bucket_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
|
||||
toolbar->add_child(tilemap_tiles_tools_buttons);
|
||||
viewport_shortcut_buttons.push_back(bucket_tool_button);
|
||||
@@ -2266,7 +2266,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P));
|
||||
Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL;
|
||||
picker_button->set_tooltip_text(vformat(TTR("Alternatively hold %s with other tools to pick tile."), find_keycode_name(key)));
|
||||
picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
tools_settings->add_child(picker_button);
|
||||
viewport_shortcut_buttons.push_back(picker_button);
|
||||
|
||||
@@ -2276,7 +2276,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
erase_button->set_toggle_mode(true);
|
||||
erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E));
|
||||
erase_button->set_tooltip_text(TTR("Alternatively use RMB to erase tiles."));
|
||||
erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
tools_settings->add_child(erase_button);
|
||||
viewport_shortcut_buttons.push_back(erase_button);
|
||||
|
||||
@@ -2289,28 +2289,28 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||
transform_button_rotate_left->set_theme_type_variation("FlatButton");
|
||||
transform_button_rotate_left->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_left", TTR("Rotate Tile Left"), Key::Z));
|
||||
transform_toolbar->add_child(transform_button_rotate_left);
|
||||
transform_button_rotate_left->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_LEFT));
|
||||
transform_button_rotate_left->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_LEFT));
|
||||
viewport_shortcut_buttons.push_back(transform_button_rotate_left);
|
||||
|
||||
transform_button_rotate_right = memnew(Button);
|
||||
transform_button_rotate_right->set_theme_type_variation("FlatButton");
|
||||
transform_button_rotate_right->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_right", TTR("Rotate Tile Right"), Key::X));
|
||||
transform_toolbar->add_child(transform_button_rotate_right);
|
||||
transform_button_rotate_right->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_RIGHT));
|
||||
transform_button_rotate_right->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_RIGHT));
|
||||
viewport_shortcut_buttons.push_back(transform_button_rotate_right);
|
||||
|
||||
transform_button_flip_h = memnew(Button);
|
||||
transform_button_flip_h->set_theme_type_variation("FlatButton");
|
||||
transform_button_flip_h->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_horizontal", TTR("Flip Tile Horizontally"), Key::C));
|
||||
transform_toolbar->add_child(transform_button_flip_h);
|
||||
transform_button_flip_h->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_H));
|
||||
transform_button_flip_h->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_H));
|
||||
viewport_shortcut_buttons.push_back(transform_button_flip_h);
|
||||
|
||||
transform_button_flip_v = memnew(Button);
|
||||
transform_button_flip_v->set_theme_type_variation("FlatButton");
|
||||
transform_button_flip_v->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_vertical", TTR("Flip Tile Vertically"), Key::V));
|
||||
transform_toolbar->add_child(transform_button_flip_v);
|
||||
transform_button_flip_v->connect("pressed", callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_V));
|
||||
transform_button_flip_v->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_V));
|
||||
viewport_shortcut_buttons.push_back(transform_button_flip_v);
|
||||
|
||||
// Separator 2.
|
||||
@@ -3553,7 +3553,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
paint_tool_button->set_button_group(tool_buttons_group);
|
||||
paint_tool_button->set_pressed(true);
|
||||
paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", TTR("Paint"), Key::D));
|
||||
paint_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(paint_tool_button);
|
||||
viewport_shortcut_buttons.push_back(paint_tool_button);
|
||||
|
||||
@@ -3562,7 +3562,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
line_tool_button->set_toggle_mode(true);
|
||||
line_tool_button->set_button_group(tool_buttons_group);
|
||||
line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", TTR("Line"), Key::L));
|
||||
line_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(line_tool_button);
|
||||
viewport_shortcut_buttons.push_back(line_tool_button);
|
||||
|
||||
@@ -3571,7 +3571,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
rect_tool_button->set_toggle_mode(true);
|
||||
rect_tool_button->set_button_group(tool_buttons_group);
|
||||
rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", TTR("Rect"), Key::R));
|
||||
rect_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(rect_tool_button);
|
||||
viewport_shortcut_buttons.push_back(rect_tool_button);
|
||||
|
||||
@@ -3580,7 +3580,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
bucket_tool_button->set_toggle_mode(true);
|
||||
bucket_tool_button->set_button_group(tool_buttons_group);
|
||||
bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", TTR("Bucket"), Key::B));
|
||||
bucket_tool_button->connect("pressed", callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
|
||||
viewport_shortcut_buttons.push_back(bucket_tool_button);
|
||||
|
||||
@@ -3598,7 +3598,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
picker_button->set_theme_type_variation("FlatButton");
|
||||
picker_button->set_toggle_mode(true);
|
||||
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P));
|
||||
picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
tools_settings->add_child(picker_button);
|
||||
viewport_shortcut_buttons.push_back(picker_button);
|
||||
|
||||
@@ -3607,7 +3607,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
||||
erase_button->set_theme_type_variation("FlatButton");
|
||||
erase_button->set_toggle_mode(true);
|
||||
erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E));
|
||||
erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
tools_settings->add_child(erase_button);
|
||||
viewport_shortcut_buttons.push_back(erase_button);
|
||||
|
||||
@@ -4457,19 +4457,19 @@ TileMapLayerEditor::TileMapLayerEditor() {
|
||||
select_previous_layer = memnew(Button);
|
||||
select_previous_layer->set_theme_type_variation("FlatButton");
|
||||
select_previous_layer->set_tooltip_text(TTR("Select previous layer"));
|
||||
select_previous_layer->connect("pressed", callable_mp(this, &TileMapLayerEditor::_select_previous_layer_pressed));
|
||||
select_previous_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_previous_layer_pressed));
|
||||
layer_selection_hbox->add_child(select_previous_layer);
|
||||
|
||||
select_next_layer = memnew(Button);
|
||||
select_next_layer->set_theme_type_variation("FlatButton");
|
||||
select_next_layer->set_tooltip_text(TTR("Select next layer"));
|
||||
select_next_layer->connect("pressed", callable_mp(this, &TileMapLayerEditor::_select_next_layer_pressed));
|
||||
select_next_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_next_layer_pressed));
|
||||
layer_selection_hbox->add_child(select_next_layer);
|
||||
|
||||
select_all_layers = memnew(Button);
|
||||
select_all_layers->set_theme_type_variation("FlatButton");
|
||||
select_all_layers->set_text(TTR("Select all layers"));
|
||||
select_all_layers->connect("pressed", callable_mp(this, &TileMapLayerEditor::_select_all_layers_pressed));
|
||||
select_all_layers->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_all_layers_pressed));
|
||||
select_all_layers->set_tooltip_text(TTR("Select all TileMapLayers in scene"));
|
||||
layer_selection_hbox->add_child(select_all_layers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user