mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-03-28 06:46:21 +01:00
Backported from godot4: Fixes "no cached rect" errors in TileMapLayer editor
- groud
c928273c6c
This commit is contained in:
parent
4cad999f60
commit
cb55fa2292
@ -1915,7 +1915,8 @@ void LayeredTileMapLayerEditorTilesPlugin::_tile_atlas_control_draw() {
|
|||||||
Color grid_color = EDITOR_GET("editors/layered_tiles_editor/grid_color");
|
Color grid_color = EDITOR_GET("editors/layered_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);
|
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);
|
||||||
for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
|
for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
|
||||||
if (E->get().source_id == source_id && E->get().alternative_tile == 0) {
|
int16_t untransformed_alternative_id = E->get().alternative_tile & LayeredTileSetAtlasSource::UNTRANSFORM_MASK;
|
||||||
|
if (E->get().source_id == source_id && untransformed_alternative_id == 0) {
|
||||||
for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E->get().get_atlas_coords()); frame++) {
|
for (int frame = 0; frame < atlas->get_tile_animation_frames_count(E->get().get_atlas_coords()); frame++) {
|
||||||
Color color = selection_color;
|
Color color = selection_color;
|
||||||
if (frame > 0) {
|
if (frame > 0) {
|
||||||
@ -2099,8 +2100,9 @@ void LayeredTileMapLayerEditorTilesPlugin::_tile_alternatives_control_draw() {
|
|||||||
|
|
||||||
// Draw the selection.
|
// Draw the selection.
|
||||||
for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
|
for (const RBSet<LayeredTileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
|
||||||
if (E->get().source_id == source_id && E->get().get_atlas_coords() != LayeredTileSetSource::INVALID_ATLAS_COORDS && E->get().alternative_tile > 0) {
|
int16_t untransformed_alternative_id = E->get().alternative_tile & LayeredTileSetAtlasSource::UNTRANSFORM_MASK;
|
||||||
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().get_atlas_coords(), E->get().alternative_tile);
|
if (E->get().source_id == source_id && E->get().get_atlas_coords() != LayeredTileSetSource::INVALID_ATLAS_COORDS && untransformed_alternative_id > 0) {
|
||||||
|
Rect2i rect = tile_atlas_view->get_alternative_tile_rect(E->get().get_atlas_coords(), untransformed_alternative_id);
|
||||||
if (rect != Rect2i()) {
|
if (rect != Rect2i()) {
|
||||||
LayeredTilesEditorUtils::draw_selection_rect(alternative_tiles_control, rect);
|
LayeredTilesEditorUtils::draw_selection_rect(alternative_tiles_control, rect);
|
||||||
}
|
}
|
||||||
|
@ -618,6 +618,8 @@ public:
|
|||||||
TRANSFORM_FLIP_V = 1 << 13,
|
TRANSFORM_FLIP_V = 1 << 13,
|
||||||
TRANSFORM_TRANSPOSE = 1 << 14,
|
TRANSFORM_TRANSPOSE = 1 << 14,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const int16_t UNTRANSFORM_MASK = ~(LayeredTileSetAtlasSource::TRANSFORM_FLIP_H + LayeredTileSetAtlasSource::TRANSFORM_FLIP_V + LayeredTileSetAtlasSource::TRANSFORM_TRANSPOSE);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TileAlternativesData {
|
struct TileAlternativesData {
|
||||||
|
Loading…
Reference in New Issue
Block a user