diff --git a/tile_editor/atlas_merging_dialog.cpp b/tile_editor/atlas_merging_dialog.cpp index ce684c9..9eabb32 100644 --- a/tile_editor/atlas_merging_dialog.cpp +++ b/tile_editor/atlas_merging_dialog.cpp @@ -40,12 +40,12 @@ void RAtlasMergingDialog::_property_changed(const StringName &p_property, const } void RAtlasMergingDialog::_generate_merged(Vector> p_atlas_sources, int p_max_columns) { - merged.instantiate(); + merged.instance(); merged_mapping.clear(); if (p_atlas_sources.size() >= 2) { Ref output_image; - output_image.instantiate(); + output_image.instance(); output_image->create(1, 1, false, Image::FORMAT_RGBA8); // Compute the new texture region size. @@ -81,7 +81,7 @@ void RAtlasMergingDialog::_generate_merged(Vector> p_at } // Copy the properties. - TileData *original_tile_data = Object::cast_to(atlas_source->get_tile_data(tile_id, alternative_id)); + RTileData *original_tile_data = Object::cast_to(atlas_source->get_tile_data(tile_id, alternative_id)); List properties; original_tile_data->get_property_list(&properties); for (List::Element *E = properties.front(); E; E = E->next()) { @@ -115,7 +115,7 @@ void RAtlasMergingDialog::_generate_merged(Vector> p_at } Ref output_image_texture; - output_image_texture.instantiate(); + output_image_texture.instance(); output_image_texture->create_from_image(output_image); merged->set_name(p_atlas_sources[0]->get_name()); @@ -152,7 +152,7 @@ void RAtlasMergingDialog::_merge_confirmed(String p_path) { ERR_FAIL_COND(!merged.is_valid()); Ref output_image_texture = merged->get_texture(); - output_image_texture->get_image()->save_png(p_path); + output_image_texture->get_data()->save_png(p_path); Ref new_texture_resource = ResourceLoader::load(p_path, "Texture"); merged->set_texture(new_texture_resource); @@ -271,7 +271,7 @@ RAtlasMergingDialog::RAtlasMergingDialog() { atlas_merging_atlases_list->set_fixed_icon_size(Size2i(60, 60) * EDSCALE); atlas_merging_atlases_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); atlas_merging_atlases_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); - atlas_merging_atlases_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + //atlas_merging_atlases_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); atlas_merging_atlases_list->set_custom_minimum_size(Size2(100, 200)); atlas_merging_atlases_list->set_select_mode(ItemList::SELECT_MULTI); atlas_merging_atlases_list->connect("multi_selected", callable_mp(this, &RAtlasMergingDialog::_update_texture).unbind(2)); diff --git a/tile_editor/tile_atlas_view.cpp b/tile_editor/tile_atlas_view.cpp index 1ad0e60..51857fe 100644 --- a/tile_editor/tile_atlas_view.cpp +++ b/tile_editor/tile_atlas_view.cpp @@ -109,7 +109,7 @@ Size2i RTileAtlasView::_compute_alternative_tiles_control_size() { Size2i texture_region_size = tile_set_atlas_source->get_tile_texture_region(tile_id).size; for (int j = 1; j < alternatives_count; j++) { int alternative_id = tile_set_atlas_source->get_alternative_tile_id(tile_id, j); - bool transposed = Object::cast_to(tile_set_atlas_source->get_tile_data(tile_id, alternative_id))->get_transpose(); + bool transposed = Object::cast_to(tile_set_atlas_source->get_tile_data(tile_id, alternative_id))->get_transpose(); line_size.x += transposed ? texture_region_size.y : texture_region_size.x; line_size.y = MAX(line_size.y, transposed ? texture_region_size.x : texture_region_size.y); } @@ -266,7 +266,7 @@ void RTileAtlasView::_draw_base_tiles() { Vector2i offset_pos = base_frame_rect.get_center() + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, 0); // Draw the tile. - TileMap::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0, frame); + RTileMap::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0, frame); // Draw, the texture in the separation areas if (separation.x > 0) { @@ -371,7 +371,7 @@ void RTileAtlasView::_draw_alternatives() { int alternatives_count = tile_set_atlas_source->get_alternative_tiles_count(atlas_coords); for (int j = 1; j < alternatives_count; j++) { int alternative_id = tile_set_atlas_source->get_alternative_tile_id(atlas_coords, j); - TileData *tile_data = Object::cast_to(tile_set_atlas_source->get_tile_data(atlas_coords, alternative_id)); + RTileData *tile_data = Object::cast_to(tile_set_atlas_source->get_tile_data(atlas_coords, alternative_id)); bool transposed = tile_data->get_transpose(); // Update the y to max value. @@ -385,7 +385,7 @@ void RTileAtlasView::_draw_alternatives() { } // Draw the tile. - TileMap::draw_tile(alternatives_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, alternative_id); + RTileMap::draw_tile(alternatives_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, alternative_id); // Increment the x position. current_pos.x += transposed ? texture_region_size.y : texture_region_size.x; @@ -398,13 +398,13 @@ void RTileAtlasView::_draw_alternatives() { } void RTileAtlasView::_draw_background_left() { - Ref texture = get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons")); + Ref texture = get_theme_icon(("Checkerboard"), ("EditorIcons")); background_left->set_size(base_tiles_root_control->get_custom_minimum_size()); background_left->draw_texture_rect(texture, Rect2(Vector2(), background_left->get_size()), true); } void RTileAtlasView::_draw_background_right() { - Ref texture = get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons")); + Ref texture = get_theme_icon(("Checkerboard"), ("EditorIcons")); background_right->set_size(alternative_tiles_root_control->get_custom_minimum_size()); background_right->draw_texture_rect(texture, Rect2(Vector2(), background_right->get_size()), true); } @@ -499,7 +499,7 @@ void RTileAtlasView::_update_alternative_tiles_rect_cache() { int line_height = 0; for (int j = 1; j < alternatives_count; j++) { int alternative_id = tile_set_atlas_source->get_alternative_tile_id(tile_id, j); - TileData *tile_data = Object::cast_to(tile_set_atlas_source->get_tile_data(tile_id, alternative_id)); + RTileData *tile_data = Object::cast_to(tile_set_atlas_source->get_tile_data(tile_id, alternative_id)); bool transposed = tile_data->get_transpose(); current.size = transposed ? Vector2i(texture_region_size.y, texture_region_size.x) : texture_region_size; @@ -549,7 +549,7 @@ void RTileAtlasView::update() { void RTileAtlasView::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: - button_center_view->set_icon(get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons"))); + button_center_view->set_icon(get_theme_icon(("CenterView"), ("EditorIcons"))); break; } } @@ -559,7 +559,7 @@ void RTileAtlasView::_bind_methods() { } RTileAtlasView::RTileAtlasView() { - set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + //set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); Panel *panel = memnew(Panel); panel->set_clip_contents(true); @@ -576,7 +576,7 @@ RTileAtlasView::RTileAtlasView() { zoom_widget->connect("zoom_changed", callable_mp(this, &RTileAtlasView::_zoom_widget_changed).unbind(1)); button_center_view = memnew(Button); - button_center_view->set_icon(get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons"))); + button_center_view->set_icon(get_theme_icon(("CenterView"), ("EditorIcons"))); button_center_view->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT, Control::PRESET_MODE_MINSIZE, 5); button_center_view->connect("pressed", callable_mp(this, &RTileAtlasView::_center_view)); button_center_view->set_flat(true); diff --git a/tile_editor/tile_atlas_view.h b/tile_editor/tile_atlas_view.h index 14f0e71..7fab418 100644 --- a/tile_editor/tile_atlas_view.h +++ b/tile_editor/tile_atlas_view.h @@ -41,6 +41,8 @@ #include "scene/gui/texture_rect.h" #include "../rtile_set.h" +#include "../vector3i.h" + class RTileAtlasView : public Control { GDCLASS(RTileAtlasView, Control); diff --git a/tile_editor/tile_data_editors.cpp b/tile_editor/tile_data_editors.cpp index 3085b9c..49a29e6 100644 --- a/tile_editor/tile_data_editors.cpp +++ b/tile_editor/tile_data_editors.cpp @@ -123,9 +123,9 @@ void RGenericTilePolygonEditor::_base_control_draw() { real_t grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius"); Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); - const Ref handle = get_theme_icon(SNAME("EditorPathSharpHandle"), SNAME("EditorIcons")); - const Ref add_handle = get_theme_icon(SNAME("EditorHandleAdd"), SNAME("EditorIcons")); - const Ref focus_stylebox = get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles")); + const Ref handle = get_theme_icon(("EditorPathSharpHandle"), ("EditorIcons")); + const Ref add_handle = get_theme_icon(("EditorHandleAdd"), ("EditorIcons")); + const Ref focus_stylebox = get_theme_stylebox(("Focus"), ("EditorStyles")); // Draw the focus rectangle. if (base_control->has_focus()) { @@ -214,8 +214,8 @@ void RGenericTilePolygonEditor::_base_control_draw() { // Draw the text on top of the selected point. if (tinted_polygon_index >= 0) { - Ref font = get_theme_font(SNAME("font"), SNAME("Label")); - int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); + Ref font = get_theme_font(("font"), ("Label")); + int font_size = get_theme_font_size(("font_size"), ("Label")); String text = multiple_polygon_mode ? vformat("%d:%d", tinted_polygon_index, tinted_point_index) : vformat("%d", tinted_point_index); Size2 text_size = font->get_string_size(text, font_size); base_control->draw_string(font, xform.xform(polygons[tinted_polygon_index][tinted_point_index]) - text_size * 0.5, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5)); @@ -482,7 +482,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) undo_redo->add_undo_method(this, "remove_polygon", added); undo_redo->add_undo_method(base_control, "update"); undo_redo->commit_action(false); - emit_signal(SNAME("polygons_changed")); + emit_signal(("polygons_changed")); } else { // Create a new point. drag_type = DRAG_TYPE_CREATE_POINT; @@ -515,7 +515,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) int closest_point; _grab_polygon_point(mb->get_position(), xform, closest_polygon, closest_point); if (closest_polygon >= 0) { - PackedVector2Array old_polygon = polygons[closest_polygon]; + PoolVector2Array old_polygon = polygons[closest_polygon]; polygons[closest_polygon].remove_at(closest_point); undo_redo->create_action(TTR("Edit Polygons")); if (polygons[closest_polygon].size() < 3) { @@ -529,7 +529,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) undo_redo->add_do_method(base_control, "update"); undo_redo->add_undo_method(base_control, "update"); undo_redo->commit_action(false); - emit_signal(SNAME("polygons_changed")); + emit_signal(("polygons_changed")); } } } else { @@ -540,7 +540,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) undo_redo->add_undo_method(this, "set_polygon", drag_polygon_index, drag_old_polygon); undo_redo->add_undo_method(base_control, "update"); undo_redo->commit_action(false); - emit_signal(SNAME("polygons_changed")); + emit_signal(("polygons_changed")); } else if (drag_type == DRAG_TYPE_CREATE_POINT) { Point2 point = xform.affine_inverse().xform(mb->get_position()); float distance = grab_threshold * 2; @@ -562,7 +562,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) int closest_point; _grab_polygon_point(mb->get_position(), xform, closest_polygon, closest_point); if (closest_polygon >= 0) { - PackedVector2Array old_polygon = polygons[closest_polygon]; + PoolVector2Array old_polygon = polygons[closest_polygon]; polygons[closest_polygon].remove_at(closest_point); undo_redo->create_action(TTR("Edit Polygons")); if (polygons[closest_polygon].size() < 3) { @@ -576,7 +576,7 @@ void RGenericTilePolygonEditor::_base_control_gui_input(Ref p_event) undo_redo->add_do_method(base_control, "update"); undo_redo->add_undo_method(base_control, "update"); undo_redo->commit_action(false); - emit_signal(SNAME("polygons_changed")); + emit_signal(("polygons_changed")); } else { drag_type = DRAG_TYPE_PAN; drag_last_pos = mb->get_position(); @@ -609,7 +609,7 @@ void RGenericTilePolygonEditor::set_use_undo_redo(bool p_use_undo_redo) { use_undo_redo = p_use_undo_redo; } -void RGenericTilePolygonEditor::set_tile_set(Ref p_tile_set) { +void RGenericTilePolygonEditor::set_tile_set(Ref p_tile_set) { ERR_FAIL_COND(!p_tile_set.is_valid()); if (tile_set == p_tile_set) { return; @@ -714,18 +714,18 @@ void RGenericTilePolygonEditor::set_multiple_polygon_mode(bool p_multiple_polygo void RGenericTilePolygonEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: - button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons"))); - button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons"))); - button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons"))); - button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons"))); - button_pixel_snap->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); - button_advanced_menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); + button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("CurveCreate"), ("EditorIcons"))); + button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("CurveEdit"), ("EditorIcons"))); + button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("CurveDelete"), ("EditorIcons"))); + button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("CenterView"), ("EditorIcons"))); + button_pixel_snap->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("Snap"), ("EditorIcons"))); + button_advanced_menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("GuiTabMenuHl"), ("EditorIcons"))); PopupMenu *p = button_advanced_menu->get_popup(); - p->set_item_icon(p->get_item_index(ROTATE_RIGHT), get_theme_icon(SNAME("RotateRight"), SNAME("EditorIcons"))); - p->set_item_icon(p->get_item_index(ROTATE_LEFT), get_theme_icon(SNAME("RotateLeft"), SNAME("EditorIcons"))); - p->set_item_icon(p->get_item_index(FLIP_HORIZONTALLY), get_theme_icon(SNAME("MirrorX"), SNAME("EditorIcons"))); - p->set_item_icon(p->get_item_index(FLIP_VERTICALLY), get_theme_icon(SNAME("MirrorY"), SNAME("EditorIcons"))); + p->set_item_icon(p->get_item_index(ROTATE_RIGHT), get_theme_icon(("RotateRight"), ("EditorIcons"))); + p->set_item_icon(p->get_item_index(ROTATE_LEFT), get_theme_icon(("RotateLeft"), ("EditorIcons"))); + p->set_item_icon(p->get_item_index(FLIP_HORIZONTALLY), get_theme_icon(("MirrorX"), ("EditorIcons"))); + p->set_item_icon(p->get_item_index(FLIP_VERTICALLY), get_theme_icon(("MirrorY"), ("EditorIcons"))); break; } } @@ -745,7 +745,7 @@ RGenericTilePolygonEditor::RGenericTilePolygonEditor() { toolbar = memnew(HBoxContainer); add_child(toolbar); - tools_button_group.instantiate(); + tools_button_group.instance(); button_create = memnew(Button); button_create->set_flat(true); @@ -775,10 +775,10 @@ RGenericTilePolygonEditor::RGenericTilePolygonEditor() { button_advanced_menu->get_popup()->add_item(TTR("Reset to default tile shape"), RESET_TO_DEFAULT_TILE); button_advanced_menu->get_popup()->add_item(TTR("Clear"), CLEAR_TILE); button_advanced_menu->get_popup()->add_separator(); - button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(SNAME("RotateRight"), SNAME("EditorIcons")), TTR("Rotate Right"), ROTATE_RIGHT); - button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(SNAME("RotateLeft"), SNAME("EditorIcons")), TTR("Rotate Left"), ROTATE_LEFT); - button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(SNAME("MirrorX"), SNAME("EditorIcons")), TTR("Flip Horizontally"), FLIP_HORIZONTALLY); - button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(SNAME("MirrorY"), SNAME("EditorIcons")), TTR("Flip Vertically"), FLIP_VERTICALLY); + button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(("RotateRight"), ("EditorIcons")), TTR("Rotate Right"), ROTATE_RIGHT); + button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(("RotateLeft"), ("EditorIcons")), TTR("Rotate Left"), ROTATE_LEFT); + button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(("MirrorX"), ("EditorIcons")), TTR("Flip Horizontally"), FLIP_HORIZONTALLY); + button_advanced_menu->get_popup()->add_icon_item(get_theme_icon(("MirrorY"), ("EditorIcons")), TTR("Flip Vertically"), FLIP_VERTICALLY); button_advanced_menu->get_popup()->connect("id_pressed", callable_mp(this, &RGenericTilePolygonEditor::_advanced_menu_item_pressed)); button_advanced_menu->set_focus_mode(FOCUS_ALL); toolbar->add_child(button_advanced_menu); @@ -804,7 +804,7 @@ RGenericTilePolygonEditor::RGenericTilePolygonEditor() { root->add_child(panel); base_control = memnew(Control); - base_control->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); + //base_control->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); base_control->set_anchors_and_offsets_preset(Control::PRESET_WIDE); base_control->connect("draw", callable_mp(this, &RGenericTilePolygonEditor::_base_control_draw)); base_control->connect("gui_input", callable_mp(this, &RGenericTilePolygonEditor::_base_control_gui_input)); @@ -818,7 +818,7 @@ RGenericTilePolygonEditor::RGenericTilePolygonEditor() { root->add_child(editor_zoom_widget); button_center_view = memnew(Button); - button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons"))); + button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(("CenterView"), ("EditorIcons"))); button_center_view->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT, Control::PRESET_MODE_MINSIZE, 5); button_center_view->connect("pressed", callable_mp(this, &RGenericTilePolygonEditor::_center_view)); button_center_view->set_flat(true); @@ -836,8 +836,8 @@ Variant RTileDataDefaultEditor::_get_painted_value() { return dummy_object->get(property); } -void RTileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +void RTileDataDefaultEditor::_set_painted_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND(!tile_data); Variant value = tile_data->get(property); dummy_object->set(property, value); @@ -846,27 +846,27 @@ void RTileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_a } } -void RTileDataDefaultEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +void RTileDataDefaultEditor::_set_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND(!tile_data); tile_data->set(property, p_value); } -Variant RTileDataDefaultEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +Variant RTileDataDefaultEditor::_get_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND_V(!tile_data, Variant()); return tile_data->get(property); } -void RTileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { - for (const KeyValue &E : p_previous_values) { +void RTileDataDefaultEditor::_setup_undo_redo_action(RTileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/%s", coords.x, coords.y, E.key.alternative_tile, property), E.value); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/%s", coords.x, coords.y, E.key.alternative_tile, property), p_new_value); } } -void RTileDataDefaultEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { +void RTileDataDefaultEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { if (drag_type == DRAG_TYPE_PAINT_RECT) { Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color"); Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); @@ -878,13 +878,13 @@ void RTileDataDefaultEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atla rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()))); rect = rect.abs(); - Set edited; + Set edited; for (int x = rect.get_position().x; x <= rect.get_end().x; x++) { for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -893,7 +893,7 @@ void RTileDataDefaultEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atla } } - for (Set::Element *E = edited.front(); E; E = E->next()) { + for (Set::Element *E = edited.front(); E; E = E->next()) { Vector2i coords = E->get().get_atlas_coords(); p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false); } @@ -901,19 +901,19 @@ void RTileDataDefaultEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atla } }; -void RTileDataDefaultEditor::forward_draw_over_alternatives(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){ +void RTileDataDefaultEditor::forward_draw_over_alternatives(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){ }; -void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT) { Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position())); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -934,7 +934,7 @@ void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_ if (picker_button->is_pressed()) { Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { _set_painted_value(p_tile_set_atlas_source, coords, 0); picker_button->set_pressed(false); } @@ -949,8 +949,8 @@ void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_ drag_painted_value = _get_painted_value(); Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -971,8 +971,8 @@ void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_ for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; @@ -995,7 +995,7 @@ void RTileDataDefaultEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_ } } -void RTileDataDefaultEditor::forward_painting_alternatives_gui_input(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void RTileDataDefaultEditor::forward_painting_alternatives_gui_input(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT) { @@ -1003,8 +1003,8 @@ void RTileDataDefaultEditor::forward_painting_alternatives_gui_input(RTileAtlasV Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -1039,8 +1039,8 @@ void RTileDataDefaultEditor::forward_painting_alternatives_gui_input(RTileAtlasV Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileMapCell cell; + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; @@ -1059,8 +1059,8 @@ void RTileDataDefaultEditor::forward_painting_alternatives_gui_input(RTileAtlasV } } -void RTileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { - TileData *tile_data = _get_tile_data(p_cell); +void RTileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, RTileMapCell p_cell, bool p_selected) { + RTileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_COND(!tile_data); bool valid; @@ -1079,18 +1079,18 @@ void RTileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2), Vector2(size, size))); p_canvas_item->draw_rect(rect, value); } else { - Ref font = RTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts")); - int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")); + Ref font = RTileSetEditor::get_singleton()->get_theme_font(("bold"), ("EditorFonts")); + int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(("bold_size"), ("EditorFonts")); String text; switch (value.get_type()) { case Variant::INT: text = vformat("%d", value); break; - case Variant::FLOAT: + case Variant::REAL: text = vformat("%.2f", value); break; case Variant::STRING: - case Variant::STRING_NAME: + //case Variant::STRING_NAME: text = value; break; default: @@ -1106,7 +1106,7 @@ void RTileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform color = selection_color; } else if (is_visible_in_tree()) { Variant painted_value = _get_painted_value(); - bool equal = (painted_value.get_type() == Variant::FLOAT && value.get_type() == Variant::FLOAT) ? Math::is_equal_approx(float(painted_value), float(value)) : painted_value == value; + bool equal = (painted_value.get_type() == Variant::REAL && value.get_type() == Variant::REAL) ? Math::is_equal_approx(float(painted_value), float(value)) : painted_value == value; if (equal) { color = Color(0.7, 0.7, 0.7); } @@ -1156,9 +1156,9 @@ void RTileDataDefaultEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - picker_button->set_icon(get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); - tile_bool_checked = get_theme_icon(SNAME("TileChecked"), SNAME("EditorIcons")); - tile_bool_unchecked = get_theme_icon(SNAME("TileUnchecked"), SNAME("EditorIcons")); + picker_button->set_icon(get_theme_icon(("ColorPick"), ("EditorIcons"))); + tile_bool_checked = get_theme_icon(("TileChecked"), ("EditorIcons")); + tile_bool_unchecked = get_theme_icon(("TileUnchecked"), ("EditorIcons")); break; default: break; @@ -1184,8 +1184,8 @@ RTileDataDefaultEditor::~RTileDataDefaultEditor() { memdelete(dummy_object); } -void RTileDataTextureOffsetEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { - TileData *tile_data = _get_tile_data(p_cell); +void RTileDataTextureOffsetEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, RTileMapCell p_cell, bool p_selected) { + RTileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_COND(!tile_data); Vector2i tile_set_tile_size = tile_set->get_tile_size(); @@ -1217,7 +1217,7 @@ void RRTileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfo Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } - Ref position_icon = RTileSetEditor::get_singleton()->get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons")); + Ref position_icon = RTileSetEditor::get_singleton()->get_theme_icon(("EditorPosition"), ("EditorIcons")); p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(value)) - position_icon->get_size() / 2, color); } @@ -1231,7 +1231,7 @@ void RTileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0); color = selection_color; } - Ref position_icon = RTileSetEditor::get_singleton()->get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons")); + Ref position_icon = RTileSetEditor::get_singleton()->get_theme_icon(("EditorPosition"), ("EditorIcons")); p_canvas_item->draw_texture(position_icon, p_transform.xform(Vector2(0, tile_data->get_y_sort_origin())) - position_icon->get_size() / 2, color); } @@ -1260,15 +1260,15 @@ void RTileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Tr Variant RTileDataOcclusionShapeEditor::_get_painted_value() { Ref occluder_polygon; - occluder_polygon.instantiate(); + occluder_polygon.instance(); if (polygon_editor->get_polygon_count() >= 1) { occluder_polygon->set_polygon(polygon_editor->get_polygon(0)); } return occluder_polygon; } -void RTileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +void RTileDataOcclusionShapeEditor::_set_painted_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND(!tile_data); Ref occluder_polygon = tile_data->get_occluder(occlusion_layer); @@ -1279,8 +1279,8 @@ void RTileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_til polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -void RTileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +void RTileDataOcclusionShapeEditor::_set_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND(!tile_data); Ref occluder_polygon = p_value; tile_data->set_occluder(occlusion_layer, occluder_polygon); @@ -1288,14 +1288,14 @@ void RTileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_at polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -Variant RTileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); +Variant RTileDataOcclusionShapeEditor::_get_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND_V(!tile_data, Variant()); return tile_data->get_occluder(occlusion_layer); } -void RTileDataOcclusionShapeEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { - for (const KeyValue &E : p_previous_values) { +void RTileDataOcclusionShapeEditor::_setup_undo_redo_action(RTileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { + for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/occlusion_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, occlusion_layer), E.value); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/occlusion_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, occlusion_layer), p_new_value); @@ -1610,7 +1610,7 @@ void RTileDataTerrainsEditor::_property_value_changed(StringName p_property, Var } _update_terrain_selector(); } - emit_signal(SNAME("needs_redraw")); + emit_signal(("needs_redraw")); } void RTileDataTerrainsEditor::_tile_set_changed() { @@ -1655,7 +1655,7 @@ void RTileDataTerrainsEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atl color.push_back(Color(1.0, 1.0, 1.0, 0.5)); for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(xform.affine_inverse().xform(mouse_pos), polygon)) { @@ -1675,8 +1675,8 @@ void RTileDataTerrainsEditor::forward_draw_over_atlas(RTileAtlasView *p_tile_atl } // Dim terrains with wrong terrain set. - Ref font = RTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts")); - int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")); + Ref font = RTileSetEditor::get_singleton()->get_theme_font(("bold"), ("EditorFonts")); + int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(("bold_size"), ("EditorFonts")); for (int i = 0; i < p_tile_set_atlas_source->get_tiles_count(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_id(i); if (coords != hovered_coords) { @@ -1849,8 +1849,8 @@ void RTileDataTerrainsEditor::forward_draw_over_alternatives(RTileAtlasView *p_t } // Dim terrains with wrong terrain set. - Ref font = RTileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), SNAME("EditorFonts")); - int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")); + Ref font = RTileSetEditor::get_singleton()->get_theme_font(("bold"), ("EditorFonts")); + int font_size = RTileSetEditor::get_singleton()->get_theme_font_size(("bold_size"), ("EditorFonts")); for (int i = 0; i < p_tile_set_atlas_source->get_tiles_count(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_id(i); for (int j = 1; j < p_tile_set_atlas_source->get_alternative_tiles_count(coords); j++) { @@ -1885,14 +1885,14 @@ void RTileDataTerrainsEditor::forward_draw_over_alternatives(RTileAtlasView *p_t p_canvas_item->draw_set_transform_matrix(Transform2D()); } -void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position())); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { int terrain_set = drag_painted_value; TileMapCell cell; cell.source_id = 0; @@ -1900,13 +1900,13 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p cell.alternative_tile = 0; // Save the old terrain_set and terrains bits. - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); if (!drag_modified.has(cell)) { Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < RTileSet::CELL_NEIGHBOR_MAX; j++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -1924,13 +1924,13 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Vector line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position())); for (int i = 0; i < line.size(); i++) { Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = 0; - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); if (tile_data->get_terrain_set() == terrain_set) { // Save the old terrain_set and terrains bits. if (!drag_modified.has(cell)) { @@ -1949,7 +1949,7 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0); for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(j); if (tile_data->is_valid_peering_bit_terrain(bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(tile_data->get_terrain_set(), bit); if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) { @@ -1971,15 +1971,15 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p if (picker_button->is_pressed()) { Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0); dummy_object->set("terrain_set", terrain_set); dummy_object->set("terrain", -1); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -1995,8 +1995,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); TileData *tile_data = nullptr; - if (coords != TileSetAtlasSource::INVALID_ATLAS_COORDS) { - tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + if (coords != RTileSetAtlasSource::INVALID_ATLAS_COORDS) { + tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); } int terrain_set = int(dummy_object->get("terrain_set")); int terrain = int(dummy_object->get("terrain")); @@ -2023,8 +2023,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2054,7 +2054,7 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p painted_dict["terrain"] = terrain; drag_painted_value = painted_dict; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); @@ -2064,8 +2064,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2075,8 +2075,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2101,7 +2101,7 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); @@ -2111,13 +2111,13 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p } } undo_redo->create_action(TTR("Painting Terrain Set")); - for (Set::Element *E = edited.front(); E; E = E->next()) { + for (Set::Element *E = edited.front(); E; E = E->next()) { Vector2i coords = E->get().get_atlas_coords(); - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E->get().alternative_tile), tile_data->get_terrain_set()); undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E->get().alternative_tile), drag_painted_value); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_data->is_valid_peering_bit_terrain(bit)) { undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), tile_data->get_peering_bit_terrain(bit)); } @@ -2134,9 +2134,9 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), dict["terrain_set"]); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2152,12 +2152,12 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p Vector2i coords = E.key.get_atlas_coords(); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); } if (tile_set->is_valid_peering_bit_terrain(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2178,8 +2178,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p for (int y = rect.get_position().y; y <= rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); coords = p_tile_set_atlas_source->get_tile_at_coords(coords); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); if (tile_data->get_terrain_set() == terrain_set) { TileMapCell cell; cell.source_id = 0; @@ -2198,12 +2198,12 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y)); undo_redo->create_action(TTR("Painting Terrain")); - for (Set::Element *E = edited.front(); E; E = E->next()) { + for (Set::Element *E = edited.front(); E; E = E->next()) { Vector2i coords = E->get().get_atlas_coords(); - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); + TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, 0)); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Rect2i texture_region = p_tile_set_atlas_source->get_tile_texture_region(coords); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, 0); @@ -2214,8 +2214,8 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p } if (!Geometry2D::intersect_polygons(polygon, mouse_pos_rect_polygon).is_empty()) { // Draw bit. - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), terrain); - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), tile_data->get_peering_bit_terrain(bit)); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), terrain); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E->get().alternative_tile), tile_data->get_peering_bit_terrain(bit)); } } } @@ -2228,7 +2228,7 @@ void RTileDataTerrainsEditor::forward_painting_atlas_gui_input(RTileAtlasView *p } } -void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { +void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlasView *p_tile_atlas_view, RTileSetAtlasSource *p_tile_set_atlas_source, const Ref &p_event) { Ref mm = p_event; if (mm.is_valid()) { if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) { @@ -2236,18 +2236,18 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); if (!drag_modified.has(cell)) { Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < RTileSet::CELL_NEIGHBOR_MAX; j++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2266,21 +2266,21 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); cell.alternative_tile = alternative_tile; // Save the old terrain_set and terrains bits. - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); if (tile_data->get_terrain_set() == terrain_set) { if (!drag_modified.has(cell)) { Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < RTileSet::CELL_NEIGHBOR_MAX; j++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(j); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2290,8 +2290,8 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas // Set the terrains bits. Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile); - for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(j); + for (int j = 0; j < RTileSet::CELL_NEIGHBOR_MAX; j++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(j); if (tile_data->is_valid_peering_bit_terrain(bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(tile_data->get_terrain_set(), bit); if (Geometry2D::is_segment_intersecting_polygon(mm->get_position() - position, drag_last_pos - position, polygon)) { @@ -2314,15 +2314,15 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { + RTileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); int terrain_set = tile_data->get_terrain_set(); Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile); dummy_object->set("terrain_set", terrain_set); dummy_object->set("terrain", -1); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2342,13 +2342,13 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Vector2i coords = Vector2i(tile.x, tile.y); int alternative_tile = tile.z; - TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); + TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(coords, alternative_tile)); if (terrain_set == -1 || !tile_data || tile_data->get_terrain_set() != terrain_set) { drag_type = DRAG_TYPE_PAINT_TERRAIN_SET; drag_modified.clear(); drag_painted_value = int(dummy_object->get("terrain_set")); - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); @@ -2356,8 +2356,8 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2374,7 +2374,7 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas painted_dict["terrain"] = terrain; drag_painted_value = painted_dict; - if (coords != TileSetSource::INVALID_ATLAS_COORDS) { + if (coords != RTileSetSource::INVALID_ATLAS_COORDS) { TileMapCell cell; cell.source_id = 0; cell.set_atlas_coords(coords); @@ -2384,8 +2384,8 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Dictionary dict; dict["terrain_set"] = tile_data->get_terrain_set(); Array array; - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); array.push_back(tile_data->is_valid_peering_bit_terrain(bit) ? tile_data->get_peering_bit_terrain(bit) : -1); } dict["terrain_peering_bits"] = array; @@ -2394,8 +2394,8 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas // Set the terrain bit. Rect2i texture_region = p_tile_atlas_view->get_alternative_tile_rect(coords, alternative_tile); Vector2i position = texture_region.get_center() + p_tile_set_atlas_source->get_tile_effective_texture_offset(coords, alternative_tile); - for (int i = 0; i < TileSet::CELL_NEIGHBOR_MAX; i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + for (int i = 0; i < RTileSet::CELL_NEIGHBOR_MAX; i++) { + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { Vector polygon = tile_set->get_terrain_bit_polygon(terrain_set, bit); if (Geometry2D::is_point_in_polygon(mb->get_position() - position, polygon)) { @@ -2417,7 +2417,7 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrain_set", coords.x, coords.y, E.key.alternative_tile), drag_painted_value); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } undo_redo->commit_action(false); @@ -2432,12 +2432,12 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas Vector2i coords = E.key.get_atlas_coords(); Array array = dict["terrain_peering_bits"]; for (int i = 0; i < array.size(); i++) { - TileSet::CellNeighbor bit = TileSet::CellNeighbor(i); + RTileSet::CellNeighbor bit = RTileSet::CellNeighbor(i); if (tile_set->is_valid_peering_bit_terrain(terrain_set, bit)) { - undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); + undo_redo->add_do_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), terrain); } if (tile_set->is_valid_peering_bit_terrain(dict["terrain_set"], bit)) { - undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(TileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); + undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/terrains_peering_bit/" + String(RTileSet::CELL_NEIGHBOR_ENUM_TO_TEXT[i]), coords.x, coords.y, E.key.alternative_tile), array[i]); } } } @@ -2449,7 +2449,7 @@ void RTileDataTerrainsEditor::forward_painting_alternatives_gui_input(RTileAtlas } } -void RTileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void RTileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, RTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_COND(!tile_data); @@ -2460,7 +2460,7 @@ void RTileDataTerrainsEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - picker_button->set_icon(get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); + picker_button->set_icon(get_theme_icon(("ColorPick"), ("EditorIcons"))); break; default: break; @@ -2508,7 +2508,7 @@ RTileDataTerrainsEditor::~RTileDataTerrainsEditor() { Variant RTileDataNavigationEditor::_get_painted_value() { Ref navigation_polygon; - navigation_polygon.instantiate(); + navigation_polygon.instance(); for (int i = 0; i < polygon_editor->get_polygon_count(); i++) { Vector polygon = polygon_editor->get_polygon(i); @@ -2533,7 +2533,7 @@ void RTileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_se polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -void RTileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { +void RTileDataNavigationEditor::_set_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, Variant p_value) { TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND(!tile_data); Ref navigation_polygon = p_value; @@ -2542,13 +2542,13 @@ void RTileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_ polygon_editor->set_background(p_tile_set_atlas_source->get_texture(), p_tile_set_atlas_source->get_tile_texture_region(p_coords), p_tile_set_atlas_source->get_tile_effective_texture_offset(p_coords, p_alternative_tile), tile_data->get_flip_h(), tile_data->get_flip_v(), tile_data->get_transpose(), tile_data->get_modulate()); } -Variant RTileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { +Variant RTileDataNavigationEditor::_get_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { TileData *tile_data = Object::cast_to(p_tile_set_atlas_source->get_tile_data(p_coords, p_alternative_tile)); ERR_FAIL_COND_V(!tile_data, Variant()); return tile_data->get_navigation_polygon(navigation_layer); } -void RTileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { +void RTileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map p_previous_values, Variant p_new_value) { for (const KeyValue &E : p_previous_values) { Vector2i coords = E.key.get_atlas_coords(); undo_redo->add_undo_property(p_tile_set_atlas_source, vformat("%d:%d/%d/navigation_layer_%d/polygon", coords.x, coords.y, E.key.alternative_tile, navigation_layer), E.value); @@ -2576,7 +2576,7 @@ RTileDataNavigationEditor::RTileDataNavigationEditor() { add_child(polygon_editor); } -void RTileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { +void RTileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, RTileMapCell p_cell, bool p_selected) { TileData *tile_data = _get_tile_data(p_cell); ERR_FAIL_COND(!tile_data); diff --git a/tile_editor/tile_data_editors.h b/tile_editor/tile_data_editors.h index d61fb01..bb1540a 100644 --- a/tile_editor/tile_data_editors.h +++ b/tile_editor/tile_data_editors.h @@ -113,7 +113,7 @@ private: int drag_polygon_index; int drag_point_index; Vector2 drag_last_pos; - PackedVector2Array drag_old_polygon; + PoolVector2Array drag_old_polygon; HBoxContainer *toolbar; Ref tools_button_group; @@ -272,7 +272,7 @@ private: // UI RGenericTilePolygonEditor *polygon_editor; - void _polygon_changed(PackedVector2Array p_polygon); + void _polygon_changed(PoolVector2Array p_polygon); virtual Variant _get_painted_value() override; virtual void _set_painted_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; @@ -386,12 +386,12 @@ class RTileDataNavigationEditor : public RTileDataDefaultEditor { private: int navigation_layer = -1; - PackedVector2Array navigation_polygon; + PoolVector2Array navigation_polygon; // UI RGenericTilePolygonEditor *polygon_editor; - void _polygon_changed(PackedVector2Array p_polygon); + void _polygon_changed(PoolVector2Array p_polygon); virtual Variant _get_painted_value() override; virtual void _set_painted_value(RTileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) override; diff --git a/tile_editor/tile_map_editor.cpp b/tile_editor/tile_map_editor.cpp index 62b7e7b..7d74d26 100644 --- a/tile_editor/tile_map_editor.cpp +++ b/tile_editor/tile_map_editor.cpp @@ -165,7 +165,7 @@ void RTileMapEditorTilesPlugin::_update_tile_set_sources_list() { // Scene collection source. RTileSetScenesCollectionSource *scene_collection_source = Object::cast_to(source); if (scene_collection_source) { - texture = tiles_bottom_panel->get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")); + texture = tiles_bottom_panel->get_theme_icon(("PackedScene"), ("EditorIcons")); if (item_text.is_empty()) { item_text = vformat(TTR("Scene Collection Source (ID: %d)"), source_id); } @@ -190,7 +190,7 @@ void RTileMapEditorTilesPlugin::_update_tile_set_sources_list() { } else { sources_list->set_current(0); } - sources_list->emit_signal(SNAME("item_selected"), sources_list->get_current()); + sources_list->emit_signal(("item_selected"), sources_list->get_current()); } // Synchronize @@ -371,7 +371,7 @@ void RTileMapEditorTilesPlugin::_update_scenes_collection_view() { Variant udata = i; EditorResourcePreview::get_singleton()->queue_edited_resource_preview(scene, this, "_scene_thumbnail_done", udata); } else { - item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), tiles_bottom_panel->get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons"))); + item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), tiles_bottom_panel->get_theme_icon(("PackedScene"), ("EditorIcons"))); } scene_tiles_list->set_item_metadata(item_index, scene_id); @@ -434,21 +434,21 @@ void RTileMapEditorTilesPlugin::_scenes_list_nothing_selected() { scene_tiles_list->deselect_all(); tile_set_selection.clear(); tile_map_selection.clear(); - selection_pattern.instantiate(); + selection_pattern.instance(); _update_selection_pattern_from_tileset_tiles_selection(); } void RTileMapEditorTilesPlugin::_update_theme() { - select_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons"))); - paint_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); - line_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons"))); - rect_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Rectangle"), SNAME("EditorIcons"))); - bucket_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Bucket"), SNAME("EditorIcons"))); + select_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(("ToolSelect"), ("EditorIcons"))); + paint_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(("Edit"), ("EditorIcons"))); + line_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(("CurveLinear"), ("EditorIcons"))); + rect_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(("Rectangle"), ("EditorIcons"))); + bucket_tool_button->set_icon(tiles_bottom_panel->get_theme_icon(("Bucket"), ("EditorIcons"))); - picker_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); - erase_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Eraser"), SNAME("EditorIcons"))); + picker_button->set_icon(tiles_bottom_panel->get_theme_icon(("ColorPick"), ("EditorIcons"))); + erase_button->set_icon(tiles_bottom_panel->get_theme_icon(("Eraser"), ("EditorIcons"))); - missing_atlas_texture_icon = tiles_bottom_panel->get_theme_icon(SNAME("RTileSet"), SNAME("EditorIcons")); + missing_atlas_texture_icon = tiles_bottom_panel->get_theme_icon(("RTileSet"), ("EditorIcons")); } bool RTileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref &p_event) { @@ -480,7 +480,7 @@ bool RTileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref & if (ED_IS_SHORTCUT("tiles_editor/cut", p_event) || ED_IS_SHORTCUT("tiles_editor/copy", p_event)) { // Fill in the clipboard. if (!tile_map_selection.is_empty()) { - tile_map_clipboard.instantiate(); + tile_map_clipboard.instance(); TypedArray coords_array; for (Set::Element *E = tile_map_selection.front(); E; E = E->next()) { coords_array.push_back(E->get()); @@ -980,7 +980,7 @@ Map RTileMapEditorTilesPlugin::_draw_line(Vector2 p_start // Get or create the pattern. Ref erase_pattern; - erase_pattern.instantiate(); + erase_pattern.instance(); erase_pattern->set_cell(Vector2i(0, 0), RTileSet::INVALID_SOURCE, RTileSetSource::INVALID_ATLAS_COORDS, RTileSetSource::INVALID_TILE_ALTERNATIVE); Ref pattern = p_erase ? erase_pattern : selection_pattern; @@ -1033,7 +1033,7 @@ Map RTileMapEditorTilesPlugin::_draw_rect(Vector2i p_star // Get or create the pattern. Ref erase_pattern; - erase_pattern.instantiate(); + erase_pattern.instance(); erase_pattern->set_cell(Vector2i(0, 0), RTileSet::INVALID_SOURCE, RTileSetSource::INVALID_ATLAS_COORDS, RTileSetSource::INVALID_TILE_ALTERNATIVE); Ref pattern = p_erase ? erase_pattern : selection_pattern; @@ -1094,7 +1094,7 @@ Map RTileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i // Get or create the pattern. Ref erase_pattern; - erase_pattern.instantiate(); + erase_pattern.instance(); erase_pattern->set_cell(Vector2i(0, 0), RTileSet::INVALID_SOURCE, RTileSetSource::INVALID_ATLAS_COORDS, RTileSetSource::INVALID_TILE_ALTERNATIVE); Ref pattern = p_erase ? erase_pattern : selection_pattern; @@ -1396,7 +1396,7 @@ void RTileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { tile_set_selection.clear(); patterns_item_list->deselect_all(); tile_map_selection.clear(); - selection_pattern.instantiate(); + selection_pattern.instance(); return; } @@ -1408,7 +1408,7 @@ void RTileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { tile_set_selection.clear(); patterns_item_list->deselect_all(); tile_map_selection.clear(); - selection_pattern.instantiate(); + selection_pattern.instance(); return; } @@ -1420,7 +1420,7 @@ void RTileMapEditorTilesPlugin::_update_fix_selected_and_hovered() { tile_set_selection.clear(); patterns_item_list->deselect_all(); tile_map_selection.clear(); - selection_pattern.instantiate(); + selection_pattern.instance(); return; } @@ -1487,7 +1487,7 @@ void RTileMapEditorTilesPlugin::_update_selection_pattern_from_tilemap_selection ERR_FAIL_INDEX(tile_map_layer, tile_map->get_layers_count()); - selection_pattern.instantiate(); + selection_pattern.instance(); TypedArray coords_array; for (Set::Element *E = tile_map_selection.front(); E; E = E->next()) { @@ -1511,7 +1511,7 @@ void RTileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles_sel tile_map_selection.clear(); // Clear the selected pattern. - selection_pattern.instantiate(); + selection_pattern.instance(); // Group per source. Map> per_source; @@ -1584,7 +1584,7 @@ void RTileMapEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_s tile_map_selection.clear(); // Clear the selected pattern. - selection_pattern.instantiate(); + selection_pattern.instance(); if (patterns_item_list->get_selected_items().size() >= 1) { selection_pattern = patterns_item_list->get_item_metadata(patterns_item_list->get_selected_items()[0]); @@ -1944,7 +1944,7 @@ void RTileMapEditorTilesPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_laye tile_set_selection.clear(); patterns_item_list->deselect_all(); tile_map_selection.clear(); - selection_pattern.instantiate(); + selection_pattern.instance(); } tile_map_layer = p_tile_map_layer; @@ -1967,8 +1967,8 @@ RTileMapEditorTilesPlugin::RTileMapEditorTilesPlugin() { ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), Key::KEY_DELETE); // --- Initialize references --- - tile_map_clipboard.instantiate(); - selection_pattern.instantiate(); + tile_map_clipboard.instance(); + selection_pattern.instance(); // --- Toolbar --- toolbar = memnew(HBoxContainer); @@ -1976,7 +1976,7 @@ RTileMapEditorTilesPlugin::RTileMapEditorTilesPlugin() { HBoxContainer *tilemap_tiles_tools_buttons = memnew(HBoxContainer); - tool_buttons_group.instantiate(); + tool_buttons_group.instance(); select_tool_button = memnew(Button); select_tool_button->set_flat(true); @@ -3059,13 +3059,13 @@ void RTileMapEditorTerrainsPlugin::_update_terrains_tree() { TreeItem *terrain_set_tree_item = terrains_tree->create_item(); String matches; if (tile_set->get_terrain_set_mode(terrain_set_index) == RTileSet::TERRAIN_MODE_MATCH_CORNERS_AND_SIDES) { - terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(SNAME("TerrainMatchCornersAndSides"), SNAME("EditorIcons"))); + terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(("TerrainMatchCornersAndSides"), ("EditorIcons"))); matches = String(TTR("Matches Corners and Sides")); } else if (tile_set->get_terrain_set_mode(terrain_set_index) == RTileSet::TERRAIN_MODE_MATCH_CORNERS) { - terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(SNAME("TerrainMatchCorners"), SNAME("EditorIcons"))); + terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(("TerrainMatchCorners"), ("EditorIcons"))); matches = String(TTR("Matches Corners Only")); } else { - terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(SNAME("TerrainMatchSides"), SNAME("EditorIcons"))); + terrain_set_tree_item->set_icon(0, main_vbox_container->get_theme_icon(("TerrainMatchSides"), ("EditorIcons"))); matches = String(TTR("Matches Sides Only")); } terrain_set_tree_item->set_text(0, vformat("Terrain Set %d (%s)", terrain_set_index, matches)); @@ -3173,13 +3173,13 @@ void RTileMapEditorTerrainsPlugin::_update_tiles_list() { } void RTileMapEditorTerrainsPlugin::_update_theme() { - paint_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); - line_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons"))); - rect_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Rectangle"), SNAME("EditorIcons"))); - bucket_tool_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Bucket"), SNAME("EditorIcons"))); + paint_tool_button->set_icon(main_vbox_container->get_theme_icon(("Edit"), ("EditorIcons"))); + line_tool_button->set_icon(main_vbox_container->get_theme_icon(("CurveLinear"), ("EditorIcons"))); + rect_tool_button->set_icon(main_vbox_container->get_theme_icon(("Rectangle"), ("EditorIcons"))); + bucket_tool_button->set_icon(main_vbox_container->get_theme_icon(("Bucket"), ("EditorIcons"))); - picker_button->set_icon(main_vbox_container->get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); - erase_button->set_icon(main_vbox_container->get_theme_icon(SNAME("Eraser"), SNAME("EditorIcons"))); + picker_button->set_icon(main_vbox_container->get_theme_icon(("ColorPick"), ("EditorIcons"))); + erase_button->set_icon(main_vbox_container->get_theme_icon(("Eraser"), ("EditorIcons"))); } void RTileMapEditorTerrainsPlugin::edit(ObjectID p_tile_map_id, int p_tile_map_layer) { @@ -3226,7 +3226,7 @@ RTileMapEditorTerrainsPlugin::RTileMapEditorTerrainsPlugin() { HBoxContainer *tilemap_tiles_tools_buttons = memnew(HBoxContainer); - tool_buttons_group.instantiate(); + tool_buttons_group.instance(); paint_tool_button = memnew(Button); paint_tool_button->set_flat(true); @@ -3305,12 +3305,12 @@ void RTileMapEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - missing_tile_texture = get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")); - warning_pattern_texture = get_theme_icon(SNAME("WarningPattern"), SNAME("EditorIcons")); - advanced_menu_button->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons"))); - toggle_grid_button->set_icon(get_theme_icon(SNAME("Grid"), SNAME("EditorIcons"))); + missing_tile_texture = get_theme_icon(("StatusWarning"), ("EditorIcons")); + warning_pattern_texture = get_theme_icon(("WarningPattern"), ("EditorIcons")); + advanced_menu_button->set_icon(get_theme_icon(("Tools"), ("EditorIcons"))); + toggle_grid_button->set_icon(get_theme_icon(("Grid"), ("EditorIcons"))); toggle_grid_button->set_pressed(EditorSettings::get_singleton()->get("editors/tiles_editor/display_grid")); - toogle_highlight_selected_layer_button->set_icon(get_theme_icon(SNAME("TileMapHighlightSelected"), SNAME("EditorIcons"))); + toogle_highlight_selected_layer_button->set_icon(get_theme_icon(("TileMapHighlightSelected"), ("EditorIcons"))); break; case NOTIFICATION_INTERNAL_PROCESS: if (is_visible_in_tree() && tileset_changed_needs_update) { @@ -3342,30 +3342,30 @@ void RTileMapEditor::_on_grid_toggled(bool p_pressed) { } void RTileMapEditor::_layers_selection_button_draw() { - if (!has_theme_icon(SNAME("arrow"), SNAME("OptionButton"))) { + if (!has_theme_icon(("arrow"), ("OptionButton"))) { return; } RID ci = layers_selection_button->get_canvas_item(); - Ref arrow = Control::get_theme_icon(SNAME("arrow"), SNAME("OptionButton")); + Ref arrow = Control::get_theme_icon(("arrow"), ("OptionButton")); Color clr = Color(1, 1, 1); - if (get_theme_constant(SNAME("modulate_arrow"))) { + if (get_theme_constant(("modulate_arrow"))) { switch (layers_selection_button->get_draw_mode()) { case BaseButton::DRAW_PRESSED: - clr = get_theme_color(SNAME("font_pressed_color")); + clr = get_theme_color(("font_pressed_color")); break; case BaseButton::DRAW_HOVER: - clr = get_theme_color(SNAME("font_hover_color")); + clr = get_theme_color(("font_hover_color")); break; case BaseButton::DRAW_DISABLED: - clr = get_theme_color(SNAME("font_disabled_color")); + clr = get_theme_color(("font_disabled_color")); break; default: if (layers_selection_button->has_focus()) { - clr = get_theme_color(SNAME("font_focus_color")); + clr = get_theme_color(("font_focus_color")); } else { - clr = get_theme_color(SNAME("font_color")); + clr = get_theme_color(("font_color")); } } } @@ -3374,9 +3374,9 @@ void RTileMapEditor::_layers_selection_button_draw() { Point2 ofs; if (is_layout_rtl()) { - ofs = Point2(get_theme_constant(SNAME("arrow_margin"), SNAME("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); + ofs = Point2(get_theme_constant(("arrow_margin"), ("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); } else { - ofs = Point2(size.width - arrow->get_width() - get_theme_constant(SNAME("arrow_margin"), SNAME("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); + ofs = Point2(size.width - arrow->get_width() - get_theme_constant(("arrow_margin"), ("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); } Rect2 dst_rect = Rect2(ofs, arrow->get_size()); if (!layers_selection_button->is_pressed()) { @@ -3629,8 +3629,8 @@ void RTileMapEditor::_update_layers_selection() { // Set button minimum width. Size2 min_button_size = Size2(layers_selection_popup->get_contents_minimum_size().x, 0); - if (has_theme_icon(SNAME("arrow"), SNAME("OptionButton"))) { - Ref arrow = Control::get_theme_icon(SNAME("arrow"), SNAME("OptionButton")); + if (has_theme_icon(("arrow"), ("OptionButton"))) { + Ref arrow = Control::get_theme_icon(("arrow"), ("OptionButton")); min_button_size.x += arrow->get_size().x; } layers_selection_button->set_custom_minimum_size(min_button_size); @@ -3849,7 +3849,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } // Draw the IDs for debug. - /*Ref font = get_theme_font(SNAME("font"), SNAME("Label")); + /*Ref font = get_theme_font(("font"), ("Label")); for (int x = displayed_rect.position.x; x < (displayed_rect.position.x + displayed_rect.size.x); x++) { for (int y = displayed_rect.position.y; y < (displayed_rect.position.y + displayed_rect.size.y); y++) { p_overlay->draw_string(font, xform.xform(tile_map->map_to_world(Vector2(x, y))) + Vector2i(-tile_shape_size.x / 2, 0), vformat("%s", Vector2(x, y))); @@ -3999,7 +3999,7 @@ RTileMapEditor::RTileMapEditor() { _tab_changed(0); // Registers UndoRedo inspector callback. - EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(SNAME("TileMap"), callable_mp(this, &RTileMapEditor::_move_tile_map_array_element)); + EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(("TileMap"), callable_mp(this, &RTileMapEditor::_move_tile_map_array_element)); } RTileMapEditor::~RTileMapEditor() { diff --git a/tile_editor/tile_set_atlas_source_editor.cpp b/tile_editor/tile_set_atlas_source_editor.cpp index 37c9703..d587abe 100644 --- a/tile_editor/tile_set_atlas_source_editor.cpp +++ b/tile_editor/tile_set_atlas_source_editor.cpp @@ -58,7 +58,7 @@ void RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::set_id(int p_id) int previous_source = source_id; source_id = p_id; // source_id must be updated before, because it's used by the source list update. tile_set->set_source_id(previous_source, p_id); - emit_signal(SNAME("changed"), "id"); + emit_signal(("changed"), "id"); } int RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::get_id() { @@ -74,7 +74,7 @@ bool RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::_set(const Strin bool valid = false; tile_set_atlas_source->set(name, p_value, &valid); if (valid) { - emit_signal(SNAME("changed"), String(name).utf8().get_data()); + emit_signal(("changed"), String(name).utf8().get_data()); } return valid; } @@ -168,14 +168,14 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n tile_set_atlas_source->move_tile_in_atlas(coords, as_vector2i); tiles.clear(); tiles.insert({ as_vector2i, 0 }); - emit_signal(SNAME("changed"), "atlas_coords"); + emit_signal(("changed"), "atlas_coords"); return true; } else if (p_name == "size_in_atlas") { Vector2i as_vector2i = Vector2i(p_value); bool has_room_for_tile = tile_set_atlas_source->has_room_for_tile(coords, as_vector2i, tile_set_atlas_source->get_tile_animation_columns(coords), tile_set_atlas_source->get_tile_animation_separation(coords), tile_set_atlas_source->get_tile_animation_frames_count(coords), coords); ERR_FAIL_COND_V_EDMSG(!has_room_for_tile, false, "Invalid size or not enough room in the atlas for the tile."); tile_set_atlas_source->move_tile_in_atlas(coords, RTileSetSource::INVALID_ATLAS_COORDS, as_vector2i); - emit_signal(SNAME("changed"), "size_in_atlas"); + emit_signal(("changed"), "size_in_atlas"); return true; } } else if (alternative > 0) { @@ -194,7 +194,7 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n tiles.insert({ coords, as_int }); // tiles must be updated before. tile_set_atlas_source->set_alternative_tile_id(coords, previous_alternative_tile, as_int); - emit_signal(SNAME("changed"), "alternative_id"); + emit_signal(("changed"), "alternative_id"); return true; } } @@ -221,7 +221,7 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n tile_set_atlas_source->set_tile_animation_columns(tile.tile, p_value); } } - emit_signal(SNAME("changed"), "animation_columns"); + emit_signal(("changed"), "animation_columns"); return true; } else if (p_name == "animation_separation") { for (TileSelection tile : tiles) { @@ -232,13 +232,13 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n tile_set_atlas_source->set_tile_animation_separation(tile.tile, p_value); } } - emit_signal(SNAME("changed"), "animation_separation"); + emit_signal(("changed"), "animation_separation"); return true; } else if (p_name == "animation_speed") { for (TileSelection tile : tiles) { tile_set_atlas_source->set_tile_animation_speed(tile.tile, p_value); } - emit_signal(SNAME("changed"), "animation_speed"); + emit_signal(("changed"), "animation_speed"); return true; } else if (p_name == "animation_frames_count") { for (TileSelection tile : tiles) { @@ -250,7 +250,7 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n } } notify_property_list_changed(); - emit_signal(SNAME("changed"), "animation_separation"); + emit_signal(("changed"), "animation_separation"); return true; } else if (components.size() == 2 && components[0].begins_with("animation_frame_") && components[0].trim_prefix("animation_frame_").is_valid_int()) { for (TileSelection tile : tiles) { @@ -282,7 +282,7 @@ bool RTileSetAtlasSourceEditor::AtlasTileProxyObject::_set(const StringName &p_n } if (any_valid) { - emit_signal(SNAME("changed"), String(p_name).utf8().get_data()); + emit_signal(("changed"), String(p_name).utf8().get_data()); } return any_valid; @@ -612,7 +612,7 @@ void RTileSetAtlasSourceEditor::_update_tile_data_editors() { tile_data_editors_tree->add_theme_constant_override("vseparation", 1); tile_data_editors_tree->add_theme_constant_override("hseparation", 3); - Color group_color = get_theme_color(SNAME("prop_category"), SNAME("Editor")); + Color group_color = get_theme_color(("prop_category"), ("Editor")); // List of editors. // --- Rendering --- @@ -823,29 +823,29 @@ void RTileSetAtlasSourceEditor::_update_current_tile_data_editor() { } void RTileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_draw() { - if (!has_theme_icon(SNAME("arrow"), SNAME("OptionButton"))) { + if (!has_theme_icon(("arrow"), ("OptionButton"))) { return; } RID ci = tile_data_editor_dropdown_button->get_canvas_item(); - Ref arrow = Control::get_theme_icon(SNAME("arrow"), SNAME("OptionButton")); + Ref arrow = Control::get_theme_icon(("arrow"), ("OptionButton")); Color clr = Color(1, 1, 1); - if (get_theme_constant(SNAME("modulate_arrow"))) { + if (get_theme_constant(("modulate_arrow"))) { switch (tile_data_editor_dropdown_button->get_draw_mode()) { case BaseButton::DRAW_PRESSED: - clr = get_theme_color(SNAME("font_pressed_color")); + clr = get_theme_color(("font_pressed_color")); break; case BaseButton::DRAW_HOVER: - clr = get_theme_color(SNAME("font_hover_color")); + clr = get_theme_color(("font_hover_color")); break; case BaseButton::DRAW_DISABLED: - clr = get_theme_color(SNAME("font_disabled_color")); + clr = get_theme_color(("font_disabled_color")); break; default: if (tile_data_editor_dropdown_button->has_focus()) { - clr = get_theme_color(SNAME("font_focus_color")); + clr = get_theme_color(("font_focus_color")); } else { - clr = get_theme_color(SNAME("font_color")); + clr = get_theme_color(("font_color")); } } } @@ -854,9 +854,9 @@ void RTileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_draw() { Point2 ofs; if (is_layout_rtl()) { - ofs = Point2(get_theme_constant(SNAME("arrow_margin"), SNAME("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); + ofs = Point2(get_theme_constant(("arrow_margin"), ("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); } else { - ofs = Point2(size.width - arrow->get_width() - get_theme_constant(SNAME("arrow_margin"), SNAME("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); + ofs = Point2(size.width - arrow->get_width() - get_theme_constant(("arrow_margin"), ("OptionButton")), int(Math::abs((size.height - arrow->get_height()) / 2))); } arrow->draw(ci, ofs, clr); } @@ -869,7 +869,7 @@ void RTileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_pressed() { } void RTileSetAtlasSourceEditor::_tile_data_editors_tree_selected() { - tile_data_editors_popup->call_deferred(SNAME("hide")); + tile_data_editors_popup->call_deferred(("hide")); _update_current_tile_data_editor(); tile_atlas_control->update(); tile_atlas_control_unscaled->update(); @@ -907,7 +907,7 @@ void RTileSetAtlasSourceEditor::_update_atlas_view() { Button *button = memnew(Button); alternative_tiles_control->add_child(button); button->set_flat(true); - button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); + button->set_icon(get_theme_icon(("Add"), ("EditorIcons"))); button->add_theme_style_override("normal", memnew(StyleBoxEmpty)); button->add_theme_style_override("hover", memnew(StyleBoxEmpty)); button->add_theme_style_override("focus", memnew(StyleBoxEmpty)); @@ -2043,7 +2043,7 @@ void RTileSetAtlasSourceEditor::_atlas_source_proxy_object_changed(String p_what if (p_what == "texture" && !atlas_source_proxy_object->get("texture").is_null()) { confirm_auto_create_tiles->popup_centered(); } else if (p_what == "id") { - emit_signal(SNAME("source_id_changed"), atlas_source_proxy_object->get_id()); + emit_signal(("source_id_changed"), atlas_source_proxy_object->get_id()); } } @@ -2084,7 +2084,7 @@ void RTileSetAtlasSourceEditor::_undo_redo_inspector_callback(Object *p_undo_red RTileSetAtlasSource *atlas_source = atlas_source_proxy->get_edited(); ERR_FAIL_COND(!atlas_source); - PackedVector2Array arr; + PoolVector2Array arr; if (p_property == "texture") { arr = atlas_source->get_tiles_to_be_removed_on_change(p_new_value, atlas_source->get_margins(), atlas_source->get_separation(), atlas_source->get_texture_region_size()); } else if (p_property == "margins") { @@ -2270,16 +2270,16 @@ void RTileSetAtlasSourceEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - tool_setup_atlas_source_button->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons"))); - tool_select_button->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons"))); - tool_paint_button->set_icon(get_theme_icon(SNAME("CanvasItem"), SNAME("EditorIcons"))); + tool_setup_atlas_source_button->set_icon(get_theme_icon(("Tools"), ("EditorIcons"))); + tool_select_button->set_icon(get_theme_icon(("ToolSelect"), ("EditorIcons"))); + tool_paint_button->set_icon(get_theme_icon(("CanvasItem"), ("EditorIcons"))); - tools_settings_erase_button->set_icon(get_theme_icon(SNAME("Eraser"), SNAME("EditorIcons"))); + tools_settings_erase_button->set_icon(get_theme_icon(("Eraser"), ("EditorIcons"))); - tool_advanced_menu_buttom->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); + tool_advanced_menu_buttom->set_icon(get_theme_icon(("GuiTabMenuHl"), ("EditorIcons"))); - resize_handle = get_theme_icon(SNAME("EditorHandle"), SNAME("EditorIcons")); - resize_handle_disabled = get_theme_icon(SNAME("EditorHandleDisabled"), SNAME("EditorIcons")); + resize_handle = get_theme_icon(("EditorHandle"), ("EditorIcons")); + resize_handle_disabled = get_theme_icon(("EditorHandleDisabled"), ("EditorIcons")); break; case NOTIFICATION_INTERNAL_PROCESS: if (tile_set_changed_needs_update) { @@ -2405,7 +2405,7 @@ RTileSetAtlasSourceEditor::RTileSetAtlasSourceEditor() { add_child(confirm_auto_create_tiles); // -- Toolbox -- - tools_button_group.instantiate(); + tools_button_group.instance(); tools_button_group->connect("pressed", callable_mp(this, &RTileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles).unbind(1)); tools_button_group->connect("pressed", callable_mp(this, &RTileSetAtlasSourceEditor::_update_tile_id_label).unbind(1)); tools_button_group->connect("pressed", callable_mp(this, &RTileSetAtlasSourceEditor::_update_atlas_source_inspector).unbind(1)); @@ -2538,7 +2538,7 @@ RTileSetAtlasSourceEditor::RTileSetAtlasSourceEditor() { // Inspector plugin. Ref tile_data_inspector_plugin; - tile_data_inspector_plugin.instantiate(); + tile_data_inspector_plugin.instance(); EditorInspector::add_inspector_plugin(tile_data_inspector_plugin); } @@ -2565,14 +2565,14 @@ void REditorPropertyTilePolygon::_polygons_changed() { // Single OccluderPolygon2D. Ref occluder; if (generic_tile_polygon_editor->get_polygon_count() >= 1) { - occluder.instantiate(); + occluder.instance(); occluder->set_polygon(generic_tile_polygon_editor->get_polygon(0)); } emit_changed(get_edited_property(), occluder); } else if (base_type == "NavigationPolygon") { Ref navigation_polygon; if (generic_tile_polygon_editor->get_polygon_count() >= 1) { - navigation_polygon.instantiate(); + navigation_polygon.instance(); for (int i = 0; i < generic_tile_polygon_editor->get_polygon_count(); i++) { Vector polygon = generic_tile_polygon_editor->get_polygon(i); navigation_polygon->add_outline(polygon); diff --git a/tile_editor/tile_set_editor.cpp b/tile_editor/tile_set_editor.cpp index bed0e8a..cc4301e 100644 --- a/tile_editor/tile_set_editor.cpp +++ b/tile_editor/tile_set_editor.cpp @@ -166,7 +166,7 @@ void RTileSetEditor::_update_sources_list(int force_selected_id) { // Scene collection source. TileSetScenesCollectionSource *scene_collection_source = Object::cast_to(source); if (scene_collection_source) { - texture = get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")); + texture = get_theme_icon(("PackedScene"), ("EditorIcons")); if (item_text.is_empty()) { item_text = vformat(TTR("Scene Collection Source (ID:%d)"), source_id); } @@ -190,7 +190,7 @@ void RTileSetEditor::_update_sources_list(int force_selected_id) { if ((int)sources_list->get_item_metadata(i) == to_select) { sources_list->set_current(i); if (old_selected != to_select) { - sources_list->emit_signal(SNAME("item_selected"), sources_list->get_current()); + sources_list->emit_signal(("item_selected"), sources_list->get_current()); } break; } @@ -201,7 +201,7 @@ void RTileSetEditor::_update_sources_list(int force_selected_id) { if (sources_list->get_current() < 0 && sources_list->get_item_count() > 0) { sources_list->set_current(0); if (old_selected != int(sources_list->get_item_metadata(0))) { - sources_list->emit_signal(SNAME("item_selected"), sources_list->get_current()); + sources_list->emit_signal(("item_selected"), sources_list->get_current()); } } @@ -316,10 +316,10 @@ void RTileSetEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - sources_delete_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); - sources_add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); - sources_advanced_menu_button->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); - missing_texture_texture = get_theme_icon(SNAME("TileSet"), SNAME("EditorIcons")); + sources_delete_button->set_icon(get_theme_icon(("Remove"), ("EditorIcons"))); + sources_add_button->set_icon(get_theme_icon(("Add"), ("EditorIcons"))); + sources_advanced_menu_button->set_icon(get_theme_icon(("GuiTabMenuHl"), ("EditorIcons"))); + missing_texture_texture = get_theme_icon(("TileSet"), ("EditorIcons")); break; case NOTIFICATION_INTERNAL_PROCESS: if (tile_set_changed_needs_update) { @@ -761,7 +761,7 @@ RTileSetEditor::RTileSetEditor() { patterns_item_list->add_child(patterns_help_label); // Registers UndoRedo inspector callback. - EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(SNAME("TileSet"), callable_mp(this, &RTileSetEditor::_move_tile_set_array_element)); + EditorNode::get_singleton()->get_editor_data().add_move_array_element_function(("TileSet"), callable_mp(this, &RTileSetEditor::_move_tile_set_array_element)); EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &RTileSetEditor::_undo_redo_inspector_callback)); } diff --git a/tile_editor/tile_set_scenes_collection_source_editor.cpp b/tile_editor/tile_set_scenes_collection_source_editor.cpp index 0a04cd0..b494c32 100644 --- a/tile_editor/tile_set_scenes_collection_source_editor.cpp +++ b/tile_editor/tile_set_scenes_collection_source_editor.cpp @@ -48,7 +48,7 @@ void RTileSetScenesCollectionSourceEditor::RTileSetScenesCollectionProxyObject:: int previous_source = source_id; source_id = p_id; // source_id must be updated before, because it's used by the source list update. tile_set->set_source_id(previous_source, p_id); - emit_signal(SNAME("changed"), "id"); + emit_signal(("changed"), "id"); } int RTileSetScenesCollectionSourceEditor::RTileSetScenesCollectionProxyObject::get_id() { @@ -64,7 +64,7 @@ bool RTileSetScenesCollectionSourceEditor::RTileSetScenesCollectionProxyObject:: bool valid = false; tile_set_scenes_collection_source->set(name, p_value, &valid); if (valid) { - emit_signal(SNAME("changed"), String(name).utf8().get_data()); + emit_signal(("changed"), String(name).utf8().get_data()); } return valid; } @@ -138,7 +138,7 @@ bool RTileSetScenesCollectionSourceEditor::SceneTileProxyObject::_set(const Stri ERR_FAIL_COND_V(tile_set_scenes_collection_source->has_scene_tile_id(as_int), false); tile_set_scenes_collection_source->set_scene_tile_id(scene_id, as_int); scene_id = as_int; - emit_signal(SNAME("changed"), "id"); + emit_signal(("changed"), "id"); for (int i = 0; i < tile_set_scenes_collection_source_editor->scene_tiles_list->get_item_count(); i++) { if (int(tile_set_scenes_collection_source_editor->scene_tiles_list->get_item_metadata(i)) == scene_id) { tile_set_scenes_collection_source_editor->scene_tiles_list->select(i); @@ -148,11 +148,11 @@ bool RTileSetScenesCollectionSourceEditor::SceneTileProxyObject::_set(const Stri return true; } else if (p_name == "scene") { tile_set_scenes_collection_source->set_scene_tile_scene(scene_id, p_value); - emit_signal(SNAME("changed"), "scene"); + emit_signal(("changed"), "scene"); return true; } else if (p_name == "display_placeholder") { tile_set_scenes_collection_source->set_scene_tile_display_placeholder(scene_id, p_value); - emit_signal(SNAME("changed"), "display_placeholder"); + emit_signal(("changed"), "display_placeholder"); return true; } @@ -208,7 +208,7 @@ void RTileSetScenesCollectionSourceEditor::SceneTileProxyObject::_bind_methods() void RTileSetScenesCollectionSourceEditor::_scenes_collection_source_proxy_object_changed(String p_what) { if (p_what == "id") { - emit_signal(SNAME("source_id_changed"), scenes_collection_source_proxy_object->get_id()); + emit_signal(("source_id_changed"), scenes_collection_source_proxy_object->get_id()); } } @@ -306,7 +306,7 @@ void RTileSetScenesCollectionSourceEditor::_update_scenes_list() { Variant udata = i; EditorResourcePreview::get_singleton()->queue_edited_resource_preview(scene, this, "_scene_thumbnail_done", udata); } else { - item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons"))); + item_index = scene_tiles_list->add_item(TTR("Tile with Invalid Scene"), get_theme_icon(("PackedScene"), ("EditorIcons"))); } scene_tiles_list->set_item_metadata(item_index, scene_id); @@ -329,8 +329,8 @@ void RTileSetScenesCollectionSourceEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: - scene_tile_add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); - scene_tile_delete_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); + scene_tile_add_button->set_icon(get_theme_icon(("Add"), ("EditorIcons"))); + scene_tile_delete_button->set_icon(get_theme_icon(("Remove"), ("EditorIcons"))); _update_scenes_list(); break; case NOTIFICATION_INTERNAL_PROCESS: diff --git a/tile_editor/tiles_editor_plugin.cpp b/tile_editor/tiles_editor_plugin.cpp index 167000d..330d5a3 100644 --- a/tile_editor/tiles_editor_plugin.cpp +++ b/tile_editor/tiles_editor_plugin.cpp @@ -116,13 +116,13 @@ void RTilesEditorPlugin::_thread() { // Add the viewport at the lasst moment to avoid rendering too early. EditorNode::get_singleton()->add_child(viewport); - RS::get_singleton()->connect(SNAME("frame_pre_draw"), callable_mp(const_cast(this), &RTilesEditorPlugin::_preview_frame_started), Vector(), Object::CONNECT_ONESHOT); + RS::get_singleton()->connect(("frame_pre_draw"), callable_mp(const_cast(this), &RTilesEditorPlugin::_preview_frame_started), Vector(), Object::CONNECT_ONESHOT); pattern_preview_done.wait(); Ref image = viewport->get_texture()->get_image(); Ref image_texture; - image_texture.instantiate(); + image_texture.instance(); image_texture->create_from_image(image); // Find the index for the given pattern. TODO: optimize. @@ -216,7 +216,7 @@ void RTilesEditorPlugin::synchronize_sources_list(Object *p_current) { item_list->deselect_all(); } else { item_list->set_current(atlas_sources_lists_current); - item_list->emit_signal(SNAME("item_selected"), atlas_sources_lists_current); + item_list->emit_signal(("item_selected"), atlas_sources_lists_current); } } }