Skip to content

Commit

Permalink
Merge pull request #92016 from KoBeWi/pick_layers_like_a_boss
Browse files Browse the repository at this point in the history
Allow selecting TileMapLayers by clicking them
  • Loading branch information
akien-mga committed Jun 28, 2024
2 parents 4777685 + b758222 commit d71c85c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scene/2d/tile_map_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,12 @@ void TileMapLayer::_update_self_texture_repeat(RS::CanvasItemTextureRepeat p_tex
emit_signal(CoreStringName(changed));
}

#ifdef TOOLS_ENABLED
bool TileMapLayer::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
return get_cell_source_id(local_to_map(p_point)) != TileSet::INVALID_SOURCE;
}
#endif

void TileMapLayer::set_as_tile_map_internal_node(int p_index) {
// Compatibility with TileMap.
ERR_FAIL_NULL(get_parent());
Expand Down
4 changes: 4 additions & 0 deletions scene/2d/tile_map_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ class TileMapLayer : public Node2D {
virtual void _update_self_texture_repeat(RS::CanvasItemTextureRepeat p_texture_repeat) override;

public:
#ifdef TOOLS_ENABLED
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
#endif

// TileMap node.
void set_as_tile_map_internal_node(int p_index);
int get_index_in_tile_map() const {
Expand Down

0 comments on commit d71c85c

Please sign in to comment.