feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef ATLAS_MERGING_DIALOG_H
|
||||
#define ATLAS_MERGING_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "editor/editor_properties.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
|
@ -83,5 +82,3 @@ public:
|
|||
|
||||
AtlasMergingDialog();
|
||||
};
|
||||
|
||||
#endif // ATLAS_MERGING_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -650,6 +650,7 @@ TileAtlasView::TileAtlasView() {
|
|||
button_center_view->set_flat(true);
|
||||
button_center_view->set_disabled(true);
|
||||
button_center_view->set_tooltip_text(TTR("Center View"));
|
||||
button_center_view->set_accessibility_name(TTRC("Center View"));
|
||||
add_child(button_center_view);
|
||||
|
||||
panner.instantiate();
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_ATLAS_VIEW_H
|
||||
#define TILE_ATLAS_VIEW_H
|
||||
#pragma once
|
||||
|
||||
#include "editor/gui/editor_zoom_widget.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
|
|
@ -170,5 +169,3 @@ public:
|
|||
TileAtlasView();
|
||||
~TileAtlasView();
|
||||
};
|
||||
|
||||
#endif // TILE_ATLAS_VIEW_H
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "tile_set_editor.h"
|
||||
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "core/math/random_pcg.h"
|
||||
#include "core/os/keyboard.h"
|
||||
|
||||
#include "editor/editor_node.h"
|
||||
|
|
@ -219,8 +220,7 @@ void GenericTilePolygonEditor::_base_control_draw() {
|
|||
color = color.darkened(0.3);
|
||||
}
|
||||
color.a = 0.5;
|
||||
Vector<Color> v_color;
|
||||
v_color.push_back(color);
|
||||
Vector<Color> v_color = { color };
|
||||
base_control->draw_polygon(polygon, v_color);
|
||||
|
||||
color.a = 0.7;
|
||||
|
|
@ -438,8 +438,9 @@ void GenericTilePolygonEditor::_grab_polygon_segment_point(Vector2 p_pos, const
|
|||
for (unsigned int i = 0; i < polygons.size(); i++) {
|
||||
const Vector<Vector2> &polygon = polygons[i];
|
||||
for (int j = 0; j < polygon.size(); j++) {
|
||||
Vector2 segment[2] = { polygon[j], polygon[(j + 1) % polygon.size()] };
|
||||
Vector2 closest_point = Geometry2D::get_closest_point_to_segment(point, segment);
|
||||
const Vector2 segment_a = polygon[j];
|
||||
const Vector2 segment_b = polygon[(j + 1) % polygon.size()];
|
||||
Vector2 closest_point = Geometry2D::get_closest_point_to_segment(point, segment_a, segment_b);
|
||||
float distance = closest_point.distance_to(point);
|
||||
if (distance < grab_threshold / editor_zoom_widget->get_zoom() && distance < closest_distance) {
|
||||
r_polygon_index = i;
|
||||
|
|
@ -474,8 +475,9 @@ void GenericTilePolygonEditor::_snap_to_tile_shape(Point2 &r_point, float &r_cur
|
|||
// Snap to edges if we did not snap to vertices.
|
||||
if (!snapped) {
|
||||
for (int i = 0; i < polygon.size(); i++) {
|
||||
Point2 segment[2] = { polygon[i], polygon[(i + 1) % polygon.size()] };
|
||||
Point2 point = Geometry2D::get_closest_point_to_segment(r_point, segment);
|
||||
const Vector2 segment_a = polygon[i];
|
||||
const Vector2 segment_b = polygon[(i + 1) % polygon.size()];
|
||||
Point2 point = Geometry2D::get_closest_point_to_segment(r_point, segment_a, segment_b);
|
||||
float distance = r_point.distance_to(point);
|
||||
if (distance < p_snap_dist && distance < r_current_snapped_dist) {
|
||||
snapped_point = point;
|
||||
|
|
@ -834,7 +836,7 @@ void GenericTilePolygonEditor::remove_polygon(int p_index) {
|
|||
ERR_FAIL_INDEX(p_index, (int)polygons.size());
|
||||
polygons.remove_at(p_index);
|
||||
|
||||
if (polygons.size() == 0) {
|
||||
if (polygons.is_empty()) {
|
||||
button_create->set_pressed(true);
|
||||
}
|
||||
base_control->queue_redraw();
|
||||
|
|
@ -922,6 +924,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_expand->set_toggle_mode(true);
|
||||
button_expand->set_pressed(false);
|
||||
button_expand->set_tooltip_text(TTR("Expand editor"));
|
||||
button_expand->set_accessibility_name(TTRC("Expand editor"));
|
||||
button_expand->connect(SceneStringName(toggled), callable_mp(this, &GenericTilePolygonEditor::_toggle_expand));
|
||||
toolbar->add_child(button_expand);
|
||||
|
||||
|
|
@ -933,6 +936,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_create->set_button_group(tools_button_group);
|
||||
button_create->set_pressed(true);
|
||||
button_create->set_tooltip_text(TTR("Add polygon tool"));
|
||||
button_create->set_accessibility_name(TTRC("Add Points"));
|
||||
toolbar->add_child(button_create);
|
||||
|
||||
button_edit = memnew(Button);
|
||||
|
|
@ -940,6 +944,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_edit->set_toggle_mode(true);
|
||||
button_edit->set_button_group(tools_button_group);
|
||||
button_edit->set_tooltip_text(TTR("Edit points tool"));
|
||||
button_edit->set_accessibility_name(TTRC("Edit Points"));
|
||||
toolbar->add_child(button_edit);
|
||||
|
||||
button_delete = memnew(Button);
|
||||
|
|
@ -947,10 +952,12 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_delete->set_toggle_mode(true);
|
||||
button_delete->set_button_group(tools_button_group);
|
||||
button_delete->set_tooltip_text(TTR("Delete points tool"));
|
||||
button_delete->set_accessibility_name(TTRC("Delete Points"));
|
||||
toolbar->add_child(button_delete);
|
||||
|
||||
button_advanced_menu = memnew(MenuButton);
|
||||
button_advanced_menu->set_flat(false);
|
||||
button_advanced_menu->set_accessibility_name(TTRC("Advanced"));
|
||||
button_advanced_menu->set_theme_type_variation("FlatMenuButton");
|
||||
button_advanced_menu->set_toggle_mode(true);
|
||||
button_advanced_menu->get_popup()->add_item(TTR("Reset to default tile shape"), RESET_TO_DEFAULT_TILE, Key::F);
|
||||
|
|
@ -969,6 +976,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_pixel_snap = memnew(MenuButton);
|
||||
toolbar->add_child(button_pixel_snap);
|
||||
button_pixel_snap->set_flat(false);
|
||||
button_pixel_snap->set_accessibility_name(TTRC("Snap"));
|
||||
button_pixel_snap->set_theme_type_variation("FlatMenuButton");
|
||||
button_pixel_snap->set_tooltip_text(TTR("Toggle Grid Snap"));
|
||||
button_pixel_snap->get_popup()->add_item(TTR("Disable Snap"), SNAP_NONE);
|
||||
|
|
@ -978,6 +986,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
|
||||
snap_subdivision = memnew(SpinBox);
|
||||
toolbar->add_child(snap_subdivision);
|
||||
snap_subdivision->set_accessibility_name(TTRC("Subdivision"));
|
||||
snap_subdivision->get_line_edit()->add_theme_constant_override("minimum_character_width", 2);
|
||||
snap_subdivision->set_min(1);
|
||||
snap_subdivision->set_max(99);
|
||||
|
|
@ -1017,6 +1026,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() {
|
|||
button_center_view->connect(SceneStringName(pressed), callable_mp(this, &GenericTilePolygonEditor::_center_view));
|
||||
button_center_view->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
button_center_view->set_tooltip_text(TTR("Center View"));
|
||||
button_center_view->set_accessibility_name(TTRC("Center View"));
|
||||
button_center_view->set_disabled(true);
|
||||
root->add_child(button_center_view);
|
||||
|
||||
|
|
@ -1482,8 +1492,7 @@ void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Tra
|
|||
}
|
||||
color.a *= 0.5;
|
||||
|
||||
Vector<Color> debug_occlusion_color;
|
||||
debug_occlusion_color.push_back(color);
|
||||
Vector<Color> debug_occlusion_color = { color };
|
||||
|
||||
RenderingServer::get_singleton()->canvas_item_add_set_transform(p_canvas_item->get_canvas_item(), p_transform);
|
||||
for (int i = 0; i < tile_data->get_occluder_polygons_count(occlusion_layer); i++) {
|
||||
|
|
@ -2064,14 +2073,12 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
|
|||
}
|
||||
|
||||
Vector2 end = p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position());
|
||||
Vector<Point2> mouse_pos_rect_polygon;
|
||||
mouse_pos_rect_polygon.push_back(drag_start_pos);
|
||||
mouse_pos_rect_polygon.push_back(Vector2(end.x, drag_start_pos.y));
|
||||
mouse_pos_rect_polygon.push_back(end);
|
||||
mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, end.y));
|
||||
Vector<Point2> mouse_pos_rect_polygon = {
|
||||
drag_start_pos, Vector2(end.x, drag_start_pos.y),
|
||||
end, Vector2(drag_start_pos.x, end.y)
|
||||
};
|
||||
|
||||
Vector<Color> color;
|
||||
color.push_back(Color(1.0, 1.0, 1.0, 0.5));
|
||||
Vector<Color> color = { Color(1.0, 1.0, 1.0, 0.5) };
|
||||
|
||||
p_canvas_item->draw_set_transform_matrix(p_transform);
|
||||
|
||||
|
|
@ -2131,8 +2138,7 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til
|
|||
Transform2D xform;
|
||||
xform.set_origin(position);
|
||||
|
||||
Vector<Color> color;
|
||||
color.push_back(Color(1.0, 1.0, 1.0, 0.5));
|
||||
Vector<Color> color = { Color(1.0, 1.0, 1.0, 0.5) };
|
||||
|
||||
Vector<Vector2> polygon = tile_set->get_terrain_polygon(terrain_set);
|
||||
if (Geometry2D::is_point_in_polygon(xform.affine_inverse().xform(mouse_pos), polygon)) {
|
||||
|
|
@ -2547,11 +2553,10 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
|
|||
}
|
||||
}
|
||||
|
||||
Vector<Point2> mouse_pos_rect_polygon;
|
||||
mouse_pos_rect_polygon.push_back(drag_start_pos);
|
||||
mouse_pos_rect_polygon.push_back(Vector2(mb->get_position().x, drag_start_pos.y));
|
||||
mouse_pos_rect_polygon.push_back(mb->get_position());
|
||||
mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y));
|
||||
Vector<Point2> mouse_pos_rect_polygon = {
|
||||
drag_start_pos, Vector2(mb->get_position().x, drag_start_pos.y),
|
||||
mb->get_position(), Vector2(drag_start_pos.x, mb->get_position().y)
|
||||
};
|
||||
|
||||
undo_redo->create_action(TTR("Painting Terrain"));
|
||||
for (const TileMapCell &E : edited) {
|
||||
|
|
@ -2883,6 +2888,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() {
|
|||
picker_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
picker_button->set_toggle_mode(true);
|
||||
picker_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/picker"));
|
||||
picker_button->set_accessibility_name(TTRC("Pick"));
|
||||
toolbar->add_child(picker_button);
|
||||
|
||||
// Setup
|
||||
|
|
@ -3030,8 +3036,7 @@ void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfo
|
|||
Color random_variation_color;
|
||||
random_variation_color.set_hsv(color.get_h() + rand.random(-1.0, 1.0) * 0.05, color.get_s(), color.get_v() + rand.random(-1.0, 1.0) * 0.1);
|
||||
random_variation_color.a = color.a;
|
||||
Vector<Color> colors;
|
||||
colors.push_back(random_variation_color);
|
||||
Vector<Color> colors = { random_variation_color };
|
||||
|
||||
RenderingServer::get_singleton()->canvas_item_add_polygon(p_canvas_item->get_canvas_item(), vertices, colors);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_DATA_EDITORS_H
|
||||
#define TILE_DATA_EDITORS_H
|
||||
#pragma once
|
||||
|
||||
#include "tile_atlas_view.h"
|
||||
|
||||
|
|
@ -415,5 +414,3 @@ public:
|
|||
|
||||
TileDataNavigationEditor();
|
||||
};
|
||||
|
||||
#endif // TILE_DATA_EDITORS_H
|
||||
|
|
|
|||
|
|
@ -44,10 +44,28 @@
|
|||
|
||||
#include "core/input/input.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "core/math/random_pcg.h"
|
||||
#include "core/os/keyboard.h"
|
||||
|
||||
TileMapLayer *TileMapLayerSubEditorPlugin::_get_edited_layer() const {
|
||||
return Object::cast_to<TileMapLayer>(ObjectDB::get_instance(edited_tile_map_layer_id));
|
||||
return ObjectDB::get_instance<TileMapLayer>(edited_tile_map_layer_id);
|
||||
}
|
||||
|
||||
void TileMapLayerSubEditorPlugin::draw_tile_coords_over_viewport(Control *p_overlay, const TileMapLayer *p_edited_layer, Ref<TileSet> p_tile_set, bool p_show_rectangle_size, const Vector2i &p_rectangle_origin) {
|
||||
Point2 msgpos = Point2(20 * EDSCALE, p_overlay->get_size().y - 20 * EDSCALE);
|
||||
String text = p_tile_set->local_to_map(p_edited_layer->get_local_mouse_position());
|
||||
|
||||
if (p_show_rectangle_size) {
|
||||
Vector2i rect_size = p_tile_set->local_to_map(p_edited_layer->get_local_mouse_position()) - p_tile_set->local_to_map(p_rectangle_origin);
|
||||
text += vformat(" %s (%dx%d)", TTR("Drawing Rect:"), Math::abs(rect_size.x) + 1, Math::abs(rect_size.y) + 1);
|
||||
}
|
||||
|
||||
Ref<Font> font = p_overlay->get_theme_font(SceneStringName(font), SNAME("Label"));
|
||||
int font_size = p_overlay->get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
||||
|
||||
p_overlay->draw_string(font, msgpos + Point2(1, 1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
|
||||
p_overlay->draw_string(font, msgpos + Point2(-1, -1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
|
||||
p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1));
|
||||
}
|
||||
|
||||
void TileMapLayerEditorTilesPlugin::tile_set_changed() {
|
||||
|
|
@ -66,7 +84,7 @@ void TileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed(double p_valu
|
|||
}
|
||||
|
||||
void TileMapLayerEditorTilesPlugin::_update_toolbar() {
|
||||
// Stop draggig if needed.
|
||||
// Stop dragging if needed.
|
||||
_stop_dragging();
|
||||
|
||||
// Hide all settings.
|
||||
|
|
@ -783,7 +801,7 @@ bool TileMapLayerEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEven
|
|||
}
|
||||
|
||||
void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
TileMapLayer *edited_layer = _get_edited_layer();
|
||||
const TileMapLayer *edited_layer = _get_edited_layer();
|
||||
if (!edited_layer) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1000,19 +1018,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p
|
|||
}
|
||||
}
|
||||
|
||||
Ref<Font> font = p_overlay->get_theme_font(SceneStringName(font), SNAME("Label"));
|
||||
int font_size = p_overlay->get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
|
||||
Point2 msgpos = Point2(20 * EDSCALE, p_overlay->get_size().y - 20 * EDSCALE);
|
||||
|
||||
String text = tile_set->local_to_map(edited_layer->get_local_mouse_position());
|
||||
if (drawing_rect) {
|
||||
Vector2i size = tile_set->local_to_map(edited_layer->get_local_mouse_position()) - tile_set->local_to_map(drag_start_mouse_pos);
|
||||
text += vformat(" %s (%dx%d)", TTR("Drawing Rect:"), ABS(size.x) + 1, ABS(size.y) + 1);
|
||||
}
|
||||
|
||||
p_overlay->draw_string(font, msgpos + Point2(1, 1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
|
||||
p_overlay->draw_string(font, msgpos + Point2(-1, -1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
|
||||
p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1));
|
||||
draw_tile_coords_over_viewport(p_overlay, edited_layer, tile_set, drawing_rect, drag_start_mouse_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2171,7 +2177,7 @@ void TileMapLayerEditorTilesPlugin::edit(ObjectID p_tile_map_layer_id) {
|
|||
}
|
||||
}
|
||||
|
||||
TileMapLayer *new_tile_map_layer = Object::cast_to<TileMapLayer>(ObjectDB::get_instance(edited_tile_map_layer_id));
|
||||
TileMapLayer *new_tile_map_layer = ObjectDB::get_instance<TileMapLayer>(edited_tile_map_layer_id);
|
||||
Ref<TileSet> new_tile_set;
|
||||
if (new_tile_map_layer) {
|
||||
new_tile_set = new_tile_map_layer->get_tile_set();
|
||||
|
|
@ -2213,6 +2219,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
select_tool_button->set_button_group(tool_buttons_group);
|
||||
select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", TTRC("Selection Tool"), Key::S));
|
||||
select_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
select_tool_button->set_accessibility_name(TTRC("Selection Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(select_tool_button);
|
||||
viewport_shortcut_buttons.push_back(select_tool_button);
|
||||
|
||||
|
|
@ -2223,6 +2230,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
paint_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/paint_tool"));
|
||||
paint_tool_button->set_tooltip_text(TTR("Shift: Draw line.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Shift: Draw rectangle."));
|
||||
paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
paint_tool_button->set_accessibility_name(TTRC("Paint Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(paint_tool_button);
|
||||
viewport_shortcut_buttons.push_back(paint_tool_button);
|
||||
|
||||
|
|
@ -2233,6 +2241,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
// TRANSLATORS: This refers to the line tool in the tilemap editor.
|
||||
line_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/line_tool"));
|
||||
line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
line_tool_button->set_accessibility_name(TTRC("Line Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(line_tool_button);
|
||||
viewport_shortcut_buttons.push_back(line_tool_button);
|
||||
|
||||
|
|
@ -2242,6 +2251,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
rect_tool_button->set_button_group(tool_buttons_group);
|
||||
rect_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/rect_tool"));
|
||||
rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
rect_tool_button->set_accessibility_name(TTRC("Rect Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(rect_tool_button);
|
||||
viewport_shortcut_buttons.push_back(rect_tool_button);
|
||||
|
||||
|
|
@ -2251,6 +2261,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
bucket_tool_button->set_button_group(tool_buttons_group);
|
||||
bucket_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/bucket_tool"));
|
||||
bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar));
|
||||
bucket_tool_button->set_accessibility_name(TTRC("Bucket Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
|
||||
toolbar->add_child(tilemap_tiles_tools_buttons);
|
||||
viewport_shortcut_buttons.push_back(bucket_tool_button);
|
||||
|
|
@ -2270,6 +2281,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL;
|
||||
picker_button->set_tooltip_text(vformat(TTR("Alternatively hold %s with other tools to pick tile."), find_keycode_name(key)));
|
||||
picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
picker_button->set_accessibility_name(TTRC("Pick"));
|
||||
tools_settings->add_child(picker_button);
|
||||
viewport_shortcut_buttons.push_back(picker_button);
|
||||
|
||||
|
|
@ -2280,6 +2292,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
erase_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/eraser"));
|
||||
erase_button->set_tooltip_text(TTRC("Alternatively use RMB to erase tiles."));
|
||||
erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
erase_button->set_accessibility_name(TTRC("Erase"));
|
||||
tools_settings->add_child(erase_button);
|
||||
viewport_shortcut_buttons.push_back(erase_button);
|
||||
|
||||
|
|
@ -2293,6 +2306,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
transform_button_rotate_left->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_left", TTRC("Rotate Tile Left"), Key::Z));
|
||||
transform_toolbar->add_child(transform_button_rotate_left);
|
||||
transform_button_rotate_left->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_LEFT));
|
||||
transform_button_rotate_left->set_accessibility_name(TTRC("Rotate Tile Left"));
|
||||
viewport_shortcut_buttons.push_back(transform_button_rotate_left);
|
||||
|
||||
transform_button_rotate_right = memnew(Button);
|
||||
|
|
@ -2300,6 +2314,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
transform_button_rotate_right->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_right", TTRC("Rotate Tile Right"), Key::X));
|
||||
transform_toolbar->add_child(transform_button_rotate_right);
|
||||
transform_button_rotate_right->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_RIGHT));
|
||||
transform_button_rotate_right->set_accessibility_name(TTRC("Rotate Tile Right"));
|
||||
viewport_shortcut_buttons.push_back(transform_button_rotate_right);
|
||||
|
||||
transform_button_flip_h = memnew(Button);
|
||||
|
|
@ -2307,6 +2322,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
transform_button_flip_h->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_horizontal", TTRC("Flip Tile Horizontally"), Key::C));
|
||||
transform_toolbar->add_child(transform_button_flip_h);
|
||||
transform_button_flip_h->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_H));
|
||||
transform_button_flip_h->set_accessibility_name(TTRC("Flip Tile Horizontally"));
|
||||
viewport_shortcut_buttons.push_back(transform_button_flip_h);
|
||||
|
||||
transform_button_flip_v = memnew(Button);
|
||||
|
|
@ -2314,6 +2330,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
transform_button_flip_v->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_vertical", TTRC("Flip Tile Vertically"), Key::V));
|
||||
transform_toolbar->add_child(transform_button_flip_v);
|
||||
transform_button_flip_v->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_V));
|
||||
transform_button_flip_v->set_accessibility_name(TTRC("Flip Tile Vertically"));
|
||||
viewport_shortcut_buttons.push_back(transform_button_flip_v);
|
||||
|
||||
// Separator 2.
|
||||
|
|
@ -2333,6 +2350,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
random_tile_toggle->set_toggle_mode(true);
|
||||
random_tile_toggle->set_tooltip_text(TTR("Place Random Tile"));
|
||||
random_tile_toggle->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled));
|
||||
random_tile_toggle->set_accessibility_name(TTRC("Place Random Tile"));
|
||||
tools_settings->add_child(random_tile_toggle);
|
||||
|
||||
// Random tile scattering.
|
||||
|
|
@ -2350,6 +2368,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
scatter_spinbox->set_tooltip_text(TTR("Modifies the chance of painting nothing instead of a randomly selected tile."));
|
||||
scatter_spinbox->get_line_edit()->add_theme_constant_override("minimum_character_width", 4);
|
||||
scatter_spinbox->connect(SceneStringName(value_changed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed));
|
||||
scatter_spinbox->set_accessibility_name(TTRC("Scattering"));
|
||||
scatter_controls_container->add_child(scatter_spinbox);
|
||||
tools_settings->add_child(scatter_controls_container);
|
||||
|
||||
|
|
@ -2371,6 +2390,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
|
||||
missing_source_label = memnew(Label);
|
||||
missing_source_label->set_text(TTR("This TileMap's TileSet has no Tile Source configured. Go to the TileSet bottom panel to add one."));
|
||||
missing_source_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
missing_source_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
missing_source_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
missing_source_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
|
|
@ -2397,6 +2417,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
source_sort_button->set_flat(false);
|
||||
source_sort_button->set_theme_type_variation("FlatMenuButton");
|
||||
source_sort_button->set_tooltip_text(TTR("Sort sources"));
|
||||
source_sort_button->set_accessibility_name(TTRC("Sort sources"));
|
||||
|
||||
PopupMenu *p = source_sort_button->get_popup();
|
||||
p->connect(SceneStringName(id_pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_set_source_sort));
|
||||
|
|
@ -2489,17 +2510,15 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
|||
|
||||
patterns_help_label = memnew(Label);
|
||||
patterns_help_label->set_text(TTR("Drag and drop or paste a TileMap selection here to store a pattern."));
|
||||
patterns_help_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
patterns_help_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
patterns_help_label->set_anchors_and_offsets_preset(Control::PRESET_CENTER);
|
||||
patterns_help_label->set_anchors_and_offsets_preset(Control::PRESET_HCENTER_WIDE);
|
||||
patterns_item_list->add_child(patterns_help_label);
|
||||
|
||||
// Update.
|
||||
_update_source_display();
|
||||
}
|
||||
|
||||
TileMapLayerEditorTilesPlugin::~TileMapLayerEditorTilesPlugin() {
|
||||
}
|
||||
|
||||
void TileMapLayerEditorTerrainsPlugin::tile_set_changed() {
|
||||
_update_terrains_cache();
|
||||
_update_terrains_tree();
|
||||
|
|
@ -3169,6 +3188,7 @@ void TileMapLayerEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control
|
|||
Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * edited_layer->get_global_transform_with_canvas();
|
||||
Vector2 mpos = edited_layer->get_local_mouse_position();
|
||||
Vector2i tile_shape_size = tile_set->get_tile_size();
|
||||
bool drawing_rect = false;
|
||||
|
||||
// Handle the preview of the tiles to be placed.
|
||||
if (main_vbox_container->is_visible_in_tree() && has_mouse) { // Only if the tilemap editor is opened and the viewport is hovered.
|
||||
|
|
@ -3215,6 +3235,8 @@ void TileMapLayerEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control
|
|||
preview.insert(Vector2i(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
drawing_rect = !preview.is_empty();
|
||||
expand_grid = true;
|
||||
} else if (tool_buttons_group->get_pressed_button() == bucket_tool_button && drag_type == DRAG_TYPE_NONE) {
|
||||
// Preview for a fill.
|
||||
|
|
@ -3273,6 +3295,8 @@ void TileMapLayerEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
draw_tile_coords_over_viewport(p_overlay, edited_layer, tile_set, drawing_rect, drag_start_mouse_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3561,6 +3585,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
paint_tool_button->set_pressed(true);
|
||||
paint_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/paint_tool"));
|
||||
paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
paint_tool_button->set_accessibility_name(TTRC("Paint Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(paint_tool_button);
|
||||
viewport_shortcut_buttons.push_back(paint_tool_button);
|
||||
|
||||
|
|
@ -3570,6 +3595,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
line_tool_button->set_button_group(tool_buttons_group);
|
||||
line_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/line_tool"));
|
||||
line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
line_tool_button->set_accessibility_name(TTRC("Line Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(line_tool_button);
|
||||
viewport_shortcut_buttons.push_back(line_tool_button);
|
||||
|
||||
|
|
@ -3579,6 +3605,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
rect_tool_button->set_button_group(tool_buttons_group);
|
||||
rect_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/rect_tool"));
|
||||
rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
rect_tool_button->set_accessibility_name(TTRC("Rect Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(rect_tool_button);
|
||||
viewport_shortcut_buttons.push_back(rect_tool_button);
|
||||
|
||||
|
|
@ -3588,6 +3615,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
bucket_tool_button->set_button_group(tool_buttons_group);
|
||||
bucket_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/bucket_tool"));
|
||||
bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar));
|
||||
bucket_tool_button->set_accessibility_name(TTRC("Bucket Tool"));
|
||||
tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
|
||||
viewport_shortcut_buttons.push_back(bucket_tool_button);
|
||||
|
||||
|
|
@ -3606,6 +3634,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
picker_button->set_toggle_mode(true);
|
||||
picker_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/picker"));
|
||||
picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
picker_button->set_accessibility_name(TTRC("Pick"));
|
||||
tools_settings->add_child(picker_button);
|
||||
viewport_shortcut_buttons.push_back(picker_button);
|
||||
|
||||
|
|
@ -3615,6 +3644,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
erase_button->set_toggle_mode(true);
|
||||
erase_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/eraser"));
|
||||
erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
|
||||
erase_button->set_accessibility_name(TTRC("Erase"));
|
||||
tools_settings->add_child(erase_button);
|
||||
viewport_shortcut_buttons.push_back(erase_button);
|
||||
|
||||
|
|
@ -3630,11 +3660,8 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() {
|
|||
tools_settings->add_child(bucket_contiguous_checkbox);
|
||||
}
|
||||
|
||||
TileMapLayerEditorTerrainsPlugin::~TileMapLayerEditorTerrainsPlugin() {
|
||||
}
|
||||
|
||||
TileMapLayer *TileMapLayerEditor::_get_edited_layer() const {
|
||||
return Object::cast_to<TileMapLayer>(ObjectDB::get_instance(edited_tile_map_layer_id));
|
||||
return ObjectDB::get_instance<TileMapLayer>(edited_tile_map_layer_id);
|
||||
}
|
||||
|
||||
void TileMapLayerEditor::_find_tile_map_layers_in_scene(Node *p_current, const Node *p_owner, Vector<TileMapLayer *> &r_list) const {
|
||||
|
|
@ -4033,18 +4060,18 @@ Vector<Vector2i> TileMapLayerEditor::get_line(const TileMapLayer *p_tile_map_lay
|
|||
}
|
||||
|
||||
Vector2i delta = p_to_cell - p_from_cell;
|
||||
delta = Vector2i(2 * delta.x + ABS(p_to_cell.y % 2) - ABS(p_from_cell.y % 2), delta.y);
|
||||
delta = Vector2i(2 * delta.x + Math::abs(p_to_cell.y % 2) - Math::abs(p_from_cell.y % 2), delta.y);
|
||||
Vector2i sign = delta.sign();
|
||||
|
||||
Vector2i current = p_from_cell;
|
||||
points.push_back(TileSet::transform_coords_layout(transposed ? Vector2i(current.y, current.x) : current, tile_set->get_tile_offset_axis(), TileSet::TILE_LAYOUT_STACKED, tile_set->get_tile_layout()));
|
||||
|
||||
int err = 0;
|
||||
if (ABS(delta.y) < ABS(delta.x)) {
|
||||
if (Math::abs(delta.y) < Math::abs(delta.x)) {
|
||||
Vector2i err_step = 3 * delta.abs();
|
||||
while (current != p_to_cell) {
|
||||
err += err_step.y;
|
||||
if (err > ABS(delta.x)) {
|
||||
if (err > Math::abs(delta.x)) {
|
||||
if (sign.x == 0) {
|
||||
current += Vector2(sign.y, 0);
|
||||
} else {
|
||||
|
|
@ -4113,6 +4140,7 @@ void TileMapLayerEditor::_tab_changed(int p_tab_id) {
|
|||
// Graphical update.
|
||||
tabs_data[tabs_bar->get_current_tab()].panel->queue_redraw();
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
_update_bottom_panel();
|
||||
}
|
||||
|
||||
void TileMapLayerEditor::_layers_select_next_or_previous(bool p_next) {
|
||||
|
|
@ -4277,10 +4305,7 @@ void TileMapLayerEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
|||
|
||||
if (!source || !source->has_tile(tile_atlas_coords) || !source->has_alternative_tile(tile_atlas_coords, tile_alternative_tile)) {
|
||||
// Generate a random color from the hashed identifier of the tiles.
|
||||
Array to_hash;
|
||||
to_hash.push_back(tile_source_id);
|
||||
to_hash.push_back(tile_atlas_coords);
|
||||
to_hash.push_back(tile_alternative_tile);
|
||||
Array to_hash = { tile_source_id, tile_atlas_coords, tile_alternative_tile };
|
||||
uint32_t hash = RandomPCG(to_hash.hash()).rand();
|
||||
|
||||
Color color;
|
||||
|
|
@ -4471,18 +4496,21 @@ TileMapLayerEditor::TileMapLayerEditor() {
|
|||
layers_selection_button->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
|
||||
layers_selection_button->set_tooltip_text(TTR("TileMap Layers"));
|
||||
layers_selection_button->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditor::_layers_selection_item_selected));
|
||||
layers_selection_button->set_accessibility_name(TTRC("TileMap Layers"));
|
||||
layer_selection_hbox->add_child(layers_selection_button);
|
||||
|
||||
select_previous_layer = memnew(Button);
|
||||
select_previous_layer->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
select_previous_layer->set_tooltip_text(TTR("Select previous layer"));
|
||||
select_previous_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_previous_layer_pressed));
|
||||
select_previous_layer->set_accessibility_name(TTRC("Previous"));
|
||||
layer_selection_hbox->add_child(select_previous_layer);
|
||||
|
||||
select_next_layer = memnew(Button);
|
||||
select_next_layer->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
select_next_layer->set_tooltip_text(TTR("Select next layer"));
|
||||
select_next_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_next_layer_pressed));
|
||||
select_next_layer->set_accessibility_name(TTRC("Next"));
|
||||
layer_selection_hbox->add_child(select_next_layer);
|
||||
|
||||
select_all_layers = memnew(Button);
|
||||
|
|
@ -4498,6 +4526,7 @@ TileMapLayerEditor::TileMapLayerEditor() {
|
|||
toggle_highlight_selected_layer_button->set_toggle_mode(true);
|
||||
toggle_highlight_selected_layer_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_highlight_selected_layer_button_toggled));
|
||||
toggle_highlight_selected_layer_button->set_tooltip_text(TTR("Highlight Selected TileMap Layer"));
|
||||
toggle_highlight_selected_layer_button->set_accessibility_name(TTRC("Highlight Selected TileMap Layer"));
|
||||
tile_map_toolbar->add_child(toggle_highlight_selected_layer_button);
|
||||
|
||||
tile_map_toolbar->add_child(memnew(VSeparator));
|
||||
|
|
@ -4508,11 +4537,13 @@ TileMapLayerEditor::TileMapLayerEditor() {
|
|||
toggle_grid_button->set_toggle_mode(true);
|
||||
toggle_grid_button->set_tooltip_text(TTR("Toggle grid visibility."));
|
||||
toggle_grid_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_on_grid_toggled));
|
||||
toggle_grid_button->set_accessibility_name(TTRC("Grid"));
|
||||
tile_map_toolbar->add_child(toggle_grid_button);
|
||||
|
||||
// Advanced settings menu button.
|
||||
advanced_menu_button = memnew(MenuButton);
|
||||
advanced_menu_button->set_flat(false);
|
||||
advanced_menu_button->set_accessibility_name(TTRC("Advanced"));
|
||||
advanced_menu_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
advanced_menu_button->get_popup()->add_item(TTR("Automatically Replace Tiles with Proxies"), ADVANCED_MENU_REPLACE_WITH_PROXIES);
|
||||
advanced_menu_button->get_popup()->add_item(TTR("Extract TileMap layers as individual TileMapLayer nodes"), ADVANCED_MENU_EXTRACT_TILE_MAP_LAYERS);
|
||||
|
|
@ -4521,6 +4552,8 @@ TileMapLayerEditor::TileMapLayerEditor() {
|
|||
|
||||
// A label for editing errors.
|
||||
cant_edit_label = memnew(Label);
|
||||
cant_edit_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
cant_edit_label->set_anchors_and_offsets_preset(Control::PRESET_HCENTER_WIDE);
|
||||
cant_edit_label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
cant_edit_label->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
cant_edit_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_MAP_LAYER_EDITOR_H
|
||||
#define TILE_MAP_LAYER_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "tile_atlas_view.h"
|
||||
|
||||
|
|
@ -68,6 +67,7 @@ public:
|
|||
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) {}
|
||||
virtual void tile_set_changed() {}
|
||||
virtual void edit(ObjectID p_tile_map_layer_id) {}
|
||||
virtual void draw_tile_coords_over_viewport(Control *p_overlay, const TileMapLayer *p_edited_layer, Ref<TileSet> p_tile_set, bool p_show_rectangle_size, const Vector2i &p_rectangle_origin);
|
||||
};
|
||||
|
||||
class TileMapLayerEditorTilesPlugin : public TileMapLayerSubEditorPlugin {
|
||||
|
|
@ -240,7 +240,6 @@ public:
|
|||
virtual void edit(ObjectID p_tile_map_layer_id) override;
|
||||
|
||||
TileMapLayerEditorTilesPlugin();
|
||||
~TileMapLayerEditorTilesPlugin();
|
||||
};
|
||||
|
||||
class TileMapLayerEditorTerrainsPlugin : public TileMapLayerSubEditorPlugin {
|
||||
|
|
@ -332,7 +331,6 @@ public:
|
|||
virtual void edit(ObjectID p_tile_map_layer_id) override;
|
||||
|
||||
TileMapLayerEditorTerrainsPlugin();
|
||||
~TileMapLayerEditorTerrainsPlugin();
|
||||
};
|
||||
|
||||
class TileMapLayerEditor : public VBoxContainer {
|
||||
|
|
@ -422,5 +420,3 @@ public:
|
|||
// Static functions.
|
||||
static Vector<Vector2i> get_line(const TileMapLayer *p_tile_map_layer, Vector2i p_from_cell, Vector2i p_to_cell);
|
||||
};
|
||||
|
||||
#endif // TILE_MAP_LAYER_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_PROXIES_MANAGER_DIALOG_H
|
||||
#define TILE_PROXIES_MANAGER_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "editor/editor_properties.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
|
@ -85,5 +84,3 @@ public:
|
|||
|
||||
TileProxiesManagerDialog();
|
||||
};
|
||||
|
||||
#endif // TILE_PROXIES_MANAGER_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -463,13 +463,13 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
|
|||
tile_data->get_property_list(&list);
|
||||
|
||||
HashMap<String, int> counts; // Counts the number of time a property appears (useful for groups that may appear more than once)
|
||||
for (List<PropertyInfo>::Element *E_property = list.front(); E_property; E_property = E_property->next()) {
|
||||
for (const PropertyInfo &property : list) {
|
||||
// Don't show category for TileData.
|
||||
if (E_property->get().usage & PROPERTY_USAGE_CATEGORY) {
|
||||
if (property.usage & PROPERTY_USAGE_CATEGORY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const String &property_string = E_property->get().name;
|
||||
const String &property_string = property.name;
|
||||
if (!tile_data->is_allowing_transform() && (property_string == "flip_h" || property_string == "flip_v" || property_string == "transpose")) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -480,7 +480,7 @@ void TileSetAtlasSourceEditor::AtlasTileProxyObject::_get_property_list(List<Pro
|
|||
counts[property_string] += 1;
|
||||
}
|
||||
|
||||
PropertyInfo stored_property_info = E_property->get();
|
||||
PropertyInfo stored_property_info = property;
|
||||
stored_property_info.usage |= PROPERTY_USAGE_STORAGE; // Ignore the storage flag in comparing properties.
|
||||
|
||||
PropertyId id = { counts[property_string], property_string };
|
||||
|
|
@ -968,7 +968,15 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
|
|||
if (tile_set.is_null()) {
|
||||
return;
|
||||
} else {
|
||||
tile_create_help->set_visible(tools_button_group->get_pressed_button() == tool_setup_atlas_source_button);
|
||||
if (tools_button_group->get_pressed_button() == tool_setup_atlas_source_button) {
|
||||
help_label->set_visible(true);
|
||||
help_label->set_text(TTR("Hold Ctrl to create multiple tiles.") + "\n" + TTR("Hold Shift to create big tiles."));
|
||||
} else if (tools_button_group->get_pressed_button() == tool_select_button) {
|
||||
help_label->set_visible(true);
|
||||
help_label->set_text(TTRC("Hold Shift to select multiple regions."));
|
||||
} else {
|
||||
help_label->set_visible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (tools_button_group->get_pressed_button() != tool_paint_button) {
|
||||
|
|
@ -1465,9 +1473,7 @@ void TileSetAtlasSourceEditor::_end_dragging() {
|
|||
undo_redo->add_do_method(tile_set_atlas_source, "move_tile_in_atlas", drag_start_tile_shape.position, drag_current_tile, tile_set_atlas_source->get_tile_size_in_atlas(drag_current_tile));
|
||||
undo_redo->add_do_method(this, "_set_selection_from_array", _get_selection_as_array());
|
||||
undo_redo->add_undo_method(tile_set_atlas_source, "move_tile_in_atlas", drag_current_tile, drag_start_tile_shape.position, drag_start_tile_shape.size);
|
||||
Array array;
|
||||
array.push_back(drag_start_tile_shape.position);
|
||||
array.push_back(0);
|
||||
Array array = { drag_start_tile_shape.position, 0 };
|
||||
undo_redo->add_undo_method(this, "_set_selection_from_array", array);
|
||||
undo_redo->commit_action(false);
|
||||
}
|
||||
|
|
@ -1565,9 +1571,7 @@ void TileSetAtlasSourceEditor::_end_dragging() {
|
|||
undo_redo->add_do_method(tile_set_atlas_source, "move_tile_in_atlas", drag_start_tile_shape.position, drag_current_tile, tile_set_atlas_source->get_tile_size_in_atlas(drag_current_tile));
|
||||
undo_redo->add_do_method(this, "_set_selection_from_array", _get_selection_as_array());
|
||||
undo_redo->add_undo_method(tile_set_atlas_source, "move_tile_in_atlas", drag_current_tile, drag_start_tile_shape.position, drag_start_tile_shape.size);
|
||||
Array array;
|
||||
array.push_back(drag_start_tile_shape.position);
|
||||
array.push_back(0);
|
||||
Array array = { drag_start_tile_shape.position, 0 };
|
||||
undo_redo->add_undo_method(this, "_set_selection_from_array", array);
|
||||
undo_redo->commit_action(false);
|
||||
}
|
||||
|
|
@ -1656,9 +1660,7 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
|
|||
case TILE_CREATE: {
|
||||
undo_redo->create_action(TTR("Create a tile"));
|
||||
undo_redo->add_do_method(tile_set_atlas_source, "create_tile", menu_option_coords);
|
||||
Array array;
|
||||
array.push_back(menu_option_coords);
|
||||
array.push_back(0);
|
||||
Array array = { menu_option_coords, 0 };
|
||||
undo_redo->add_do_method(this, "_set_selection_from_array", array);
|
||||
undo_redo->add_undo_method(tile_set_atlas_source, "remove_tile", menu_option_coords);
|
||||
undo_redo->add_undo_method(this, "_set_selection_from_array", _get_selection_as_array());
|
||||
|
|
@ -2685,18 +2687,12 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
|
|||
tile_atlas_view->connect("transform_changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_atlas_view_transform_changed).unbind(2));
|
||||
right_panel->add_child(tile_atlas_view);
|
||||
|
||||
tile_create_help = memnew(VBoxContainer);
|
||||
tile_atlas_view->add_child(tile_create_help);
|
||||
tile_create_help->set_mouse_filter(MOUSE_FILTER_IGNORE);
|
||||
|
||||
Label *help_label = memnew(Label(TTR("Hold Ctrl to create multiple tiles.")));
|
||||
tile_create_help->add_child(help_label);
|
||||
|
||||
help_label = memnew(Label(TTR("Hold Shift to create big tiles.")));
|
||||
tile_create_help->add_child(help_label);
|
||||
|
||||
tile_create_help->set_anchors_and_offsets_preset(Control::PRESET_BOTTOM_LEFT, Control::PRESET_MODE_MINSIZE, 8);
|
||||
tile_create_help->set_grow_direction_preset(Control::PRESET_BOTTOM_LEFT);
|
||||
help_label = memnew(Label);
|
||||
help_label->set_mouse_filter(MOUSE_FILTER_IGNORE);
|
||||
help_label->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
|
||||
help_label->set_vertical_alignment(VERTICAL_ALIGNMENT_BOTTOM);
|
||||
help_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
tile_atlas_view->add_child(help_label);
|
||||
|
||||
base_tile_popup_menu = memnew(PopupMenu);
|
||||
base_tile_popup_menu->add_shortcut(ED_GET_SHORTCUT("tiles_editor/delete"), TILE_DELETE);
|
||||
|
|
@ -2768,7 +2764,7 @@ TileSetAtlasSourceEditor::~TileSetAtlasSourceEditor() {
|
|||
|
||||
void EditorPropertyTilePolygon::_add_focusable_children(Node *p_node) {
|
||||
Control *control = Object::cast_to<Control>(p_node);
|
||||
if (control && control->get_focus_mode() != Control::FOCUS_NONE) {
|
||||
if (control && control->get_focus_mode_with_recursive() != Control::FOCUS_NONE) {
|
||||
add_focusable(control);
|
||||
}
|
||||
for (int i = 0; i < p_node->get_child_count(); i++) {
|
||||
|
|
@ -2801,11 +2797,9 @@ void EditorPropertyTilePolygon::_polygons_changed() {
|
|||
}
|
||||
} else {
|
||||
// Multiple array of vertices or OccluderPolygon2D.
|
||||
Vector<String> changed_properties;
|
||||
Array values;
|
||||
Vector<String> changed_properties = { count_property };
|
||||
int count = generic_tile_polygon_editor->get_polygon_count();
|
||||
changed_properties.push_back(count_property);
|
||||
values.push_back(count);
|
||||
Array values = { count };
|
||||
for (int i = 0; i < count; i++) {
|
||||
changed_properties.push_back(vformat(element_pattern, i));
|
||||
if (base_type.is_empty()) {
|
||||
|
|
@ -2939,8 +2933,7 @@ bool EditorInspectorPluginTileData::parse_property(Object *p_object, const Varia
|
|||
if (components[1] == "polygons_count") {
|
||||
EditorPropertyTilePolygon *ep = memnew(EditorPropertyTilePolygon);
|
||||
ep->setup_multiple_mode(vformat("physics_layer_%d/polygons", layer_index), vformat("physics_layer_%d/polygons_count", layer_index), vformat("physics_layer_%d/polygon_%%d/points", layer_index), "");
|
||||
Vector<String> properties;
|
||||
properties.push_back(p_path);
|
||||
Vector<String> properties = { p_path };
|
||||
int count = p_object->get(vformat("physics_layer_%d/polygons_count", layer_index));
|
||||
for (int i = 0; i < count; i++) {
|
||||
properties.push_back(vformat(vformat("physics_layer_%d/polygon_%d/points", layer_index, i)));
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_SET_ATLAS_SOURCE_EDITOR_H
|
||||
#define TILE_SET_ATLAS_SOURCE_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "tile_atlas_view.h"
|
||||
#include "tile_data_editors.h"
|
||||
|
|
@ -160,7 +159,7 @@ private:
|
|||
|
||||
// -- Atlas view --
|
||||
TileAtlasView *tile_atlas_view = nullptr;
|
||||
VBoxContainer *tile_create_help = nullptr;
|
||||
Label *help_label = nullptr;
|
||||
|
||||
// Dragging
|
||||
enum DragType {
|
||||
|
|
@ -334,5 +333,3 @@ public:
|
|||
virtual bool can_handle(Object *p_object) override;
|
||||
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
|
||||
};
|
||||
|
||||
#endif // TILE_SET_ATLAS_SOURCE_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ void TileSetEditor::remove_expanded_editor() {
|
|||
return;
|
||||
}
|
||||
|
||||
Node *original_parent = Object::cast_to<Node>(ObjectDB::get_instance(expanded_editor_parent));
|
||||
Node *original_parent = ObjectDB::get_instance<Node>(expanded_editor_parent);
|
||||
if (original_parent) {
|
||||
expanded_editor->remove_meta("reparented");
|
||||
expanded_editor->reparent(original_parent);
|
||||
|
|
@ -846,6 +846,7 @@ TileSetEditor::TileSetEditor() {
|
|||
source_sort_button->set_flat(false);
|
||||
source_sort_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
source_sort_button->set_tooltip_text(TTR("Sort Sources"));
|
||||
source_sort_button->set_accessibility_name(TTRC("Sort Sources"));
|
||||
|
||||
PopupMenu *p = source_sort_button->get_popup();
|
||||
p->connect(SceneStringName(id_pressed), callable_mp(this, &TileSetEditor::_set_source_sort));
|
||||
|
|
@ -896,6 +897,7 @@ TileSetEditor::TileSetEditor() {
|
|||
sources_advanced_menu_button->get_popup()->add_item(TTR("Open Atlas Merging Tool"));
|
||||
sources_advanced_menu_button->get_popup()->add_item(TTR("Manage Tile Proxies"));
|
||||
sources_advanced_menu_button->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &TileSetEditor::_sources_advanced_menu_id_pressed));
|
||||
sources_advanced_menu_button->set_accessibility_name(TTRC("Advanced"));
|
||||
sources_bottom_actions->add_child(sources_advanced_menu_button);
|
||||
sources_bottom_actions->add_child(source_sort_button);
|
||||
|
||||
|
|
@ -914,6 +916,8 @@ TileSetEditor::TileSetEditor() {
|
|||
// No source selected.
|
||||
no_source_selected_label = memnew(Label);
|
||||
no_source_selected_label->set_text(TTR("No TileSet source selected. Select or create a TileSet source.\nYou can create a new source by using the Add button on the left or by dropping a tileset texture onto the source list."));
|
||||
no_source_selected_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
no_source_selected_label->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
|
||||
no_source_selected_label->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
no_source_selected_label->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
no_source_selected_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
|
|
@ -953,8 +957,9 @@ TileSetEditor::TileSetEditor() {
|
|||
|
||||
patterns_help_label = memnew(Label);
|
||||
patterns_help_label->set_text(TTR("Add new patterns in the TileMap editing mode."));
|
||||
patterns_help_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
|
||||
patterns_help_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
patterns_help_label->set_anchors_and_offsets_preset(Control::PRESET_CENTER);
|
||||
patterns_help_label->set_anchors_and_offsets_preset(Control::PRESET_HCENTER_WIDE);
|
||||
patterns_item_list->add_child(patterns_help_label);
|
||||
|
||||
// Expanded editor
|
||||
|
|
@ -978,6 +983,8 @@ void TileSourceInspectorPlugin::_show_id_edit_dialog(Object *p_for_source) {
|
|||
|
||||
Label *label = memnew(Label(TTR("Warning: Modifying a source ID will result in all TileMaps using that source to reference an invalid source instead. This may result in unexpected data loss. Change this ID carefully.")));
|
||||
label->set_autowrap_mode(TextServer::AUTOWRAP_WORD);
|
||||
// Workaround too tall popup window due to text autowrapping. See GH-83546.
|
||||
label->set_custom_minimum_size(Vector2i(400, 0));
|
||||
vbox->add_child(label);
|
||||
|
||||
id_input = memnew(SpinBox);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_SET_EDITOR_H
|
||||
#define TILE_SET_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "atlas_merging_dialog.h"
|
||||
#include "scene/gui/tab_bar.h"
|
||||
|
|
@ -45,8 +44,8 @@ class SplitContainer;
|
|||
class EditorFileDialog;
|
||||
class EditorInspectorPlugin;
|
||||
|
||||
class TileSetEditor : public Control {
|
||||
GDCLASS(TileSetEditor, Control);
|
||||
class TileSetEditor : public MarginContainer {
|
||||
GDCLASS(TileSetEditor, MarginContainer);
|
||||
|
||||
static TileSetEditor *singleton;
|
||||
|
||||
|
|
@ -141,5 +140,3 @@ public:
|
|||
virtual bool can_handle(Object *p_object) override;
|
||||
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
|
||||
};
|
||||
|
||||
#endif // TILE_SET_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ void TileSetScenesCollectionSourceEditor::_scene_thumbnail_done(const String &p_
|
|||
void TileSetScenesCollectionSourceEditor::_scenes_list_item_activated(int p_index) {
|
||||
Ref<PackedScene> packed_scene = tile_set_scenes_collection_source->get_scene_tile_scene(scene_tiles_list->get_item_metadata(p_index));
|
||||
if (packed_scene.is_valid()) {
|
||||
EditorNode::get_singleton()->open_request(packed_scene->get_path());
|
||||
EditorNode::get_singleton()->load_scene(packed_scene->get_path());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ void TileSetScenesCollectionSourceEditor::_update_tile_inspector() {
|
|||
|
||||
void TileSetScenesCollectionSourceEditor::_update_action_buttons() {
|
||||
Vector<int> selected_indices = scene_tiles_list->get_selected_items();
|
||||
scene_tile_delete_button->set_disabled(selected_indices.size() <= 0 || read_only);
|
||||
scene_tile_delete_button->set_disabled(selected_indices.is_empty() || read_only);
|
||||
}
|
||||
|
||||
void TileSetScenesCollectionSourceEditor::_update_scenes_list() {
|
||||
|
|
@ -483,7 +483,7 @@ bool TileSetScenesCollectionSourceEditor::_can_drop_data_fw(const Point2 &p_poin
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -573,12 +573,14 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() {
|
|||
scene_tile_add_button = memnew(Button);
|
||||
scene_tile_add_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
scene_tile_add_button->connect(SceneStringName(pressed), callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_add_pressed));
|
||||
scene_tile_add_button->set_accessibility_name(TTRC("Add"));
|
||||
scenes_bottom_actions->add_child(scene_tile_add_button);
|
||||
|
||||
scene_tile_delete_button = memnew(Button);
|
||||
scene_tile_delete_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
scene_tile_delete_button->set_disabled(true);
|
||||
scene_tile_delete_button->connect(SceneStringName(pressed), callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_delete_pressed));
|
||||
scene_tile_delete_button->set_accessibility_name(TTRC("Delete"));
|
||||
scenes_bottom_actions->add_child(scene_tile_delete_button);
|
||||
|
||||
EditorInspector::add_inspector_plugin(memnew(TileSourceInspectorPlugin));
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
|
||||
#define TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "editor/editor_inspector.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
|
|
@ -144,5 +143,3 @@ public:
|
|||
TileSetScenesCollectionSourceEditor();
|
||||
~TileSetScenesCollectionSourceEditor();
|
||||
};
|
||||
|
||||
#endif // TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void TilesEditorUtils::_thread() {
|
|||
pattern_preview_sem.wait();
|
||||
|
||||
pattern_preview_mutex.lock();
|
||||
if (pattern_preview_queue.size() == 0) {
|
||||
if (pattern_preview_queue.is_empty()) {
|
||||
pattern_preview_mutex.unlock();
|
||||
} else {
|
||||
QueueItem item = pattern_preview_queue.front()->get();
|
||||
|
|
@ -339,14 +339,14 @@ void TileMapEditorPlugin::_tile_map_layer_changed() {
|
|||
|
||||
void TileMapEditorPlugin::_tile_map_layer_removed() {
|
||||
// Workaround for TileMap, making sure the editor stays open when you delete the currently edited layer.
|
||||
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_group_id));
|
||||
TileMap *tile_map = ObjectDB::get_instance<TileMap>(tile_map_group_id);
|
||||
if (tile_map) {
|
||||
edit(tile_map);
|
||||
}
|
||||
}
|
||||
|
||||
void TileMapEditorPlugin::_update_tile_map() {
|
||||
TileMapLayer *edited_layer = Object::cast_to<TileMapLayer>(ObjectDB::get_instance(tile_map_layer_id));
|
||||
TileMapLayer *edited_layer = ObjectDB::get_instance<TileMapLayer>(tile_map_layer_id);
|
||||
if (edited_layer) {
|
||||
Ref<TileSet> tile_set = edited_layer->get_tile_set();
|
||||
if (tile_set.is_valid() && tile_set_id != tile_set->get_instance_id()) {
|
||||
|
|
@ -363,7 +363,7 @@ void TileMapEditorPlugin::_update_tile_map() {
|
|||
}
|
||||
|
||||
void TileMapEditorPlugin::_select_layer(const StringName &p_name) {
|
||||
TileMapLayer *edited_layer = Object::cast_to<TileMapLayer>(ObjectDB::get_instance(tile_map_layer_id));
|
||||
TileMapLayer *edited_layer = ObjectDB::get_instance<TileMapLayer>(tile_map_layer_id);
|
||||
ERR_FAIL_NULL(edited_layer);
|
||||
|
||||
Node *parent = edited_layer->get_parent();
|
||||
|
|
@ -415,7 +415,7 @@ void TileMapEditorPlugin::_notification(int p_notification) {
|
|||
}
|
||||
|
||||
void TileMapEditorPlugin::edit(Object *p_object) {
|
||||
TileMapLayer *edited_layer = Object::cast_to<TileMapLayer>(ObjectDB::get_instance(tile_map_layer_id));
|
||||
TileMapLayer *edited_layer = ObjectDB::get_instance<TileMapLayer>(tile_map_layer_id);
|
||||
if (edited_layer) {
|
||||
edited_layer->disconnect(CoreStringName(changed), callable_mp(this, &TileMapEditorPlugin::_tile_map_layer_changed));
|
||||
edited_layer->disconnect(SceneStringName(tree_exited), callable_mp(this, &TileMapEditorPlugin::_tile_map_layer_removed));
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TILES_EDITOR_PLUGIN_H
|
||||
#define TILES_EDITOR_PLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include "editor/plugins/editor_plugin.h"
|
||||
|
||||
|
|
@ -163,5 +162,3 @@ public:
|
|||
TileSetEditorPlugin();
|
||||
~TileSetEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // TILES_EDITOR_PLUGIN_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue