summaryrefslogtreecommitdiff
path: root/editor/plugins/tile_map_editor_plugin.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-28 17:19:08 +0100
committerGitHub <noreply@github.com>2020-02-28 17:19:08 +0100
commit324e5a60dd068cbbff9c433802f8ecb78cff3364 (patch)
tree41edf077bcafa3c959a417aa4700318d483ff680 /editor/plugins/tile_map_editor_plugin.cpp
parenta439131c2b06b3d452e5be13530b6d2caa72c1aa (diff)
parent32ccf306f9a820e2ac5811de7c12e99a736fdf05 (diff)
Merge pull request #36426 from akien-mga/calling-all-stations
Signals: Port connect calls to use callable_mp
Diffstat (limited to 'editor/plugins/tile_map_editor_plugin.cpp')
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp75
1 files changed, 28 insertions, 47 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 10d00b2a1d..82f04aaac4 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -1761,30 +1761,30 @@ void TileMapEditor::edit(Node *p_tile_map) {
}
if (node)
- node->disconnect_compat("settings_changed", this, "_tileset_settings_changed");
+ node->disconnect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed));
if (p_tile_map) {
node = Object::cast_to<TileMap>(p_tile_map);
- if (!canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter"))
- canvas_item_editor_viewport->connect_compat("mouse_entered", this, "_canvas_mouse_enter");
- if (!canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit"))
- canvas_item_editor_viewport->connect_compat("mouse_exited", this, "_canvas_mouse_exit");
+ if (!canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)))
+ canvas_item_editor_viewport->connect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter));
+ if (!canvas_item_editor_viewport->is_connected("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit)))
+ canvas_item_editor_viewport->connect("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit));
_update_palette();
} else {
node = NULL;
- if (canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter"))
- canvas_item_editor_viewport->disconnect_compat("mouse_entered", this, "_canvas_mouse_enter");
- if (canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit"))
- canvas_item_editor_viewport->disconnect_compat("mouse_exited", this, "_canvas_mouse_exit");
+ if (canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)))
+ canvas_item_editor_viewport->disconnect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter));
+ if (canvas_item_editor_viewport->is_connected("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit)))
+ canvas_item_editor_viewport->disconnect("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit));
_update_palette();
}
if (node)
- node->connect_compat("settings_changed", this, "_tileset_settings_changed");
+ node->connect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed));
_clear_bucket_cache();
}
@@ -1805,27 +1805,8 @@ void TileMapEditor::_icon_size_changed(float p_value) {
void TileMapEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled);
- ClassDB::bind_method(D_METHOD("_priority_toggled"), &TileMapEditor::_priority_toggled);
- ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered);
- ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed);
- ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input);
- ClassDB::bind_method(D_METHOD("_button_tool_select"), &TileMapEditor::_button_tool_select);
- ClassDB::bind_method(D_METHOD("_menu_option"), &TileMapEditor::_menu_option);
- ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &TileMapEditor::_canvas_mouse_enter);
- ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &TileMapEditor::_canvas_mouse_exit);
- ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &TileMapEditor::_tileset_settings_changed);
- ClassDB::bind_method(D_METHOD("_rotate"), &TileMapEditor::_rotate);
- ClassDB::bind_method(D_METHOD("_flip_horizontal"), &TileMapEditor::_flip_horizontal);
- ClassDB::bind_method(D_METHOD("_flip_vertical"), &TileMapEditor::_flip_vertical);
- ClassDB::bind_method(D_METHOD("_clear_transform"), &TileMapEditor::_clear_transform);
- ClassDB::bind_method(D_METHOD("_palette_selected"), &TileMapEditor::_palette_selected);
- ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &TileMapEditor::_palette_multi_selected);
-
ClassDB::bind_method(D_METHOD("_fill_points"), &TileMapEditor::_fill_points);
ClassDB::bind_method(D_METHOD("_erase_points"), &TileMapEditor::_erase_points);
-
- ClassDB::bind_method(D_METHOD("_icon_size_changed"), &TileMapEditor::_icon_size_changed);
}
TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i &p_pos) {
@@ -1939,20 +1920,20 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
manual_button = memnew(CheckBox);
manual_button->set_text(TTR("Disable Autotile"));
- manual_button->connect_compat("toggled", this, "_manual_toggled");
+ manual_button->connect("toggled", callable_mp(this, &TileMapEditor::_manual_toggled));
add_child(manual_button);
priority_button = memnew(CheckBox);
priority_button->set_text(TTR("Enable Priority"));
- priority_button->connect_compat("toggled", this, "_priority_toggled");
+ priority_button->connect("toggled", callable_mp(this, &TileMapEditor::_priority_toggled));
add_child(priority_button);
search_box = memnew(LineEdit);
search_box->set_placeholder(TTR("Filter tiles"));
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
- search_box->connect_compat("text_entered", this, "_text_entered");
- search_box->connect_compat("text_changed", this, "_text_changed");
- search_box->connect_compat("gui_input", this, "_sbox_input");
+ search_box->connect("text_entered", callable_mp(this, &TileMapEditor::_text_entered));
+ search_box->connect("text_changed", callable_mp(this, &TileMapEditor::_text_changed));
+ search_box->connect("gui_input", callable_mp(this, &TileMapEditor::_sbox_input));
add_child(search_box);
size_slider = memnew(HSlider);
@@ -1961,7 +1942,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
size_slider->set_max(4.0f);
size_slider->set_step(0.1f);
size_slider->set_value(1.0f);
- size_slider->connect_compat("value_changed", this, "_icon_size_changed");
+ size_slider->connect("value_changed", callable_mp(this, &TileMapEditor::_icon_size_changed));
add_child(size_slider);
int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80);
@@ -1980,8 +1961,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
palette->set_max_text_lines(2);
palette->set_select_mode(ItemList::SELECT_MULTI);
palette->add_constant_override("vseparation", 8 * EDSCALE);
- palette->connect_compat("item_selected", this, "_palette_selected");
- palette->connect_compat("multi_selected", this, "_palette_multi_selected");
+ palette->connect("item_selected", callable_mp(this, &TileMapEditor::_palette_selected));
+ palette->connect("multi_selected", callable_mp(this, &TileMapEditor::_palette_multi_selected));
palette_container->add_child(palette);
// Add message for when no texture is selected.
@@ -2015,25 +1996,25 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
paint_button = memnew(ToolButton);
paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P));
paint_button->set_tooltip(TTR("Shift+LMB: Line Draw\nShift+Ctrl+LMB: Rectangle Paint"));
- paint_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_NONE));
+ paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE));
paint_button->set_toggle_mode(true);
toolbar->add_child(paint_button);
bucket_fill_button = memnew(ToolButton);
bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_G));
- bucket_fill_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_BUCKET));
+ bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET));
bucket_fill_button->set_toggle_mode(true);
toolbar->add_child(bucket_fill_button);
picker_button = memnew(ToolButton);
picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I));
- picker_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING));
+ picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING));
picker_button->set_toggle_mode(true);
toolbar->add_child(picker_button);
select_button = memnew(ToolButton);
select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M));
- select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING));
+ select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING));
select_button->set_toggle_mode(true);
toolbar->add_child(select_button);
@@ -2068,40 +2049,40 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION);
p->add_separator();
p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID);
- p->connect_compat("id_pressed", this, "_menu_option");
+ p->connect("id_pressed", callable_mp(this, &TileMapEditor::_menu_option));
rotate_left_button = memnew(ToolButton);
rotate_left_button->set_tooltip(TTR("Rotate Left"));
rotate_left_button->set_focus_mode(FOCUS_NONE);
- rotate_left_button->connect_compat("pressed", this, "_rotate", varray(-1));
+ rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1));
rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A));
tool_hb->add_child(rotate_left_button);
rotate_right_button = memnew(ToolButton);
rotate_right_button->set_tooltip(TTR("Rotate Right"));
rotate_right_button->set_focus_mode(FOCUS_NONE);
- rotate_right_button->connect_compat("pressed", this, "_rotate", varray(1));
+ rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1));
rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S));
tool_hb->add_child(rotate_right_button);
flip_horizontal_button = memnew(ToolButton);
flip_horizontal_button->set_tooltip(TTR("Flip Horizontally"));
flip_horizontal_button->set_focus_mode(FOCUS_NONE);
- flip_horizontal_button->connect_compat("pressed", this, "_flip_horizontal");
+ flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal));
flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X));
tool_hb->add_child(flip_horizontal_button);
flip_vertical_button = memnew(ToolButton);
flip_vertical_button->set_tooltip(TTR("Flip Vertically"));
flip_vertical_button->set_focus_mode(FOCUS_NONE);
- flip_vertical_button->connect_compat("pressed", this, "_flip_vertical");
+ flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical));
flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z));
tool_hb->add_child(flip_vertical_button);
clear_transform_button = memnew(ToolButton);
clear_transform_button->set_tooltip(TTR("Clear Transform"));
clear_transform_button->set_focus_mode(FOCUS_NONE);
- clear_transform_button->connect_compat("pressed", this, "_clear_transform");
+ clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform));
clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W));
tool_hb->add_child(clear_transform_button);