Merge pull request #90817 from KoBeWi/there_is_one_pattern
Reuse single erase pattern in tile editor
This commit is contained in:
commit
149023335d
|
@ -1079,9 +1079,6 @@ HashMap<Vector2i, TileMapCell> TileMapLayerEditorTilesPlugin::_draw_line(Vector2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get or create the pattern.
|
// Get or create the pattern.
|
||||||
Ref<TileMapPattern> erase_pattern;
|
|
||||||
erase_pattern.instantiate();
|
|
||||||
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
|
||||||
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
||||||
|
|
||||||
HashMap<Vector2i, TileMapCell> output;
|
HashMap<Vector2i, TileMapCell> output;
|
||||||
|
@ -1132,9 +1129,6 @@ HashMap<Vector2i, TileMapCell> TileMapLayerEditorTilesPlugin::_draw_rect(Vector2
|
||||||
rect.size += Vector2i(1, 1);
|
rect.size += Vector2i(1, 1);
|
||||||
|
|
||||||
// Get or create the pattern.
|
// Get or create the pattern.
|
||||||
Ref<TileMapPattern> erase_pattern;
|
|
||||||
erase_pattern.instantiate();
|
|
||||||
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
|
||||||
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
||||||
|
|
||||||
HashMap<Vector2i, TileMapCell> err_output;
|
HashMap<Vector2i, TileMapCell> err_output;
|
||||||
|
@ -1189,9 +1183,6 @@ HashMap<Vector2i, TileMapCell> TileMapLayerEditorTilesPlugin::_draw_bucket_fill(
|
||||||
HashMap<Vector2i, TileMapCell> output;
|
HashMap<Vector2i, TileMapCell> output;
|
||||||
|
|
||||||
// Get or create the pattern.
|
// Get or create the pattern.
|
||||||
Ref<TileMapPattern> erase_pattern;
|
|
||||||
erase_pattern.instantiate();
|
|
||||||
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
|
||||||
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
Ref<TileMapPattern> pattern = p_erase ? erase_pattern : selection_pattern;
|
||||||
|
|
||||||
if (!pattern->is_empty()) {
|
if (!pattern->is_empty()) {
|
||||||
|
@ -2200,6 +2191,9 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() {
|
||||||
tile_map_clipboard.instantiate();
|
tile_map_clipboard.instantiate();
|
||||||
selection_pattern.instantiate();
|
selection_pattern.instantiate();
|
||||||
|
|
||||||
|
erase_pattern.instantiate();
|
||||||
|
erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE);
|
||||||
|
|
||||||
// --- Toolbar ---
|
// --- Toolbar ---
|
||||||
toolbar = memnew(HBoxContainer);
|
toolbar = memnew(HBoxContainer);
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ private:
|
||||||
RBSet<Vector2i> tile_map_selection;
|
RBSet<Vector2i> tile_map_selection;
|
||||||
Ref<TileMapPattern> tile_map_clipboard;
|
Ref<TileMapPattern> tile_map_clipboard;
|
||||||
Ref<TileMapPattern> selection_pattern;
|
Ref<TileMapPattern> selection_pattern;
|
||||||
|
Ref<TileMapPattern> erase_pattern;
|
||||||
void _set_tile_map_selection(const TypedArray<Vector2i> &p_selection);
|
void _set_tile_map_selection(const TypedArray<Vector2i> &p_selection);
|
||||||
TypedArray<Vector2i> _get_tile_map_selection() const;
|
TypedArray<Vector2i> _get_tile_map_selection() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue