mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 15:11:19 +00:00
Reworked signal connection system, added support for Callable and Signal objects and made them default.
This commit is contained in:
parent
1a4be2cd8f
commit
69c95f4b4c
275 changed files with 3831 additions and 2948 deletions
|
|
@ -1761,30 +1761,30 @@ void TileMapEditor::edit(Node *p_tile_map) {
|
|||
}
|
||||
|
||||
if (node)
|
||||
node->disconnect("settings_changed", this, "_tileset_settings_changed");
|
||||
node->disconnect_compat("settings_changed", this, "_tileset_settings_changed");
|
||||
if (p_tile_map) {
|
||||
|
||||
node = Object::cast_to<TileMap>(p_tile_map);
|
||||
if (!canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter"))
|
||||
canvas_item_editor_viewport->connect("mouse_entered", this, "_canvas_mouse_enter");
|
||||
if (!canvas_item_editor_viewport->is_connected("mouse_exited", this, "_canvas_mouse_exit"))
|
||||
canvas_item_editor_viewport->connect("mouse_exited", this, "_canvas_mouse_exit");
|
||||
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");
|
||||
|
||||
_update_palette();
|
||||
|
||||
} else {
|
||||
node = NULL;
|
||||
|
||||
if (canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter"))
|
||||
canvas_item_editor_viewport->disconnect("mouse_entered", this, "_canvas_mouse_enter");
|
||||
if (canvas_item_editor_viewport->is_connected("mouse_exited", this, "_canvas_mouse_exit"))
|
||||
canvas_item_editor_viewport->disconnect("mouse_exited", this, "_canvas_mouse_exit");
|
||||
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");
|
||||
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
if (node)
|
||||
node->connect("settings_changed", this, "_tileset_settings_changed");
|
||||
node->connect_compat("settings_changed", this, "_tileset_settings_changed");
|
||||
|
||||
_clear_bucket_cache();
|
||||
}
|
||||
|
|
@ -1939,20 +1939,20 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
|||
|
||||
manual_button = memnew(CheckBox);
|
||||
manual_button->set_text(TTR("Disable Autotile"));
|
||||
manual_button->connect("toggled", this, "_manual_toggled");
|
||||
manual_button->connect_compat("toggled", this, "_manual_toggled");
|
||||
add_child(manual_button);
|
||||
|
||||
priority_button = memnew(CheckBox);
|
||||
priority_button->set_text(TTR("Enable Priority"));
|
||||
priority_button->connect("toggled", this, "_priority_toggled");
|
||||
priority_button->connect_compat("toggled", this, "_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("text_entered", this, "_text_entered");
|
||||
search_box->connect("text_changed", this, "_text_changed");
|
||||
search_box->connect("gui_input", this, "_sbox_input");
|
||||
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");
|
||||
add_child(search_box);
|
||||
|
||||
size_slider = memnew(HSlider);
|
||||
|
|
@ -1961,7 +1961,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("value_changed", this, "_icon_size_changed");
|
||||
size_slider->connect_compat("value_changed", this, "_icon_size_changed");
|
||||
add_child(size_slider);
|
||||
|
||||
int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80);
|
||||
|
|
@ -1980,8 +1980,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("item_selected", this, "_palette_selected");
|
||||
palette->connect("multi_selected", this, "_palette_multi_selected");
|
||||
palette->connect_compat("item_selected", this, "_palette_selected");
|
||||
palette->connect_compat("multi_selected", this, "_palette_multi_selected");
|
||||
palette_container->add_child(palette);
|
||||
|
||||
// Add message for when no texture is selected.
|
||||
|
|
@ -2015,25 +2015,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("pressed", this, "_button_tool_select", make_binds(TOOL_NONE));
|
||||
paint_button->connect_compat("pressed", this, "_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("pressed", this, "_button_tool_select", make_binds(TOOL_BUCKET));
|
||||
bucket_fill_button->connect_compat("pressed", this, "_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("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING));
|
||||
picker_button->connect_compat("pressed", this, "_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("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING));
|
||||
select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING));
|
||||
select_button->set_toggle_mode(true);
|
||||
toolbar->add_child(select_button);
|
||||
|
||||
|
|
@ -2068,40 +2068,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("id_pressed", this, "_menu_option");
|
||||
p->connect_compat("id_pressed", this, "_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("pressed", this, "_rotate", varray(-1));
|
||||
rotate_left_button->connect_compat("pressed", this, "_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("pressed", this, "_rotate", varray(1));
|
||||
rotate_right_button->connect_compat("pressed", this, "_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("pressed", this, "_flip_horizontal");
|
||||
flip_horizontal_button->connect_compat("pressed", this, "_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("pressed", this, "_flip_vertical");
|
||||
flip_vertical_button->connect_compat("pressed", this, "_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("pressed", this, "_clear_transform");
|
||||
clear_transform_button->connect_compat("pressed", this, "_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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue