fix pickers not updating correctly

This commit is contained in:
T1ti
2024-05-25 06:22:06 +02:00
parent 041013efef
commit 2961033f24

View File

@@ -4004,10 +4004,11 @@ void MapView::tick (float dt)
} }
else if (_mod_ctrl_down && !ui_hidden) else if (_mod_ctrl_down && !ui_hidden)
{ {
_texture_picker_need_update = true;
// Pick texture // Pick texture
_texture_picker_dock->setVisible(true); // _texture_picker_dock->setVisible(true);
TexturePicker->setMainTexture(texturingTool->_current_texture); // TexturePicker->setMainTexture(texturingTool->_current_texture);
TexturePicker->getTextures(selection); // TexturePicker->getTextures(selection);
} }
else if (_mod_shift_down && !!Noggit::Ui::selected_texture::get()) else if (_mod_shift_down && !!Noggit::Ui::selected_texture::get())
{ {
@@ -4068,10 +4069,11 @@ void MapView::tick (float dt)
else if (_mod_ctrl_down) else if (_mod_ctrl_down)
{ {
// pick areaID from chunk // pick areaID from chunk
MapChunk* chnk(std::get<selected_chunk_type>(selection).chunk); _area_picker_need_update = true;
int newID = chnk->getAreaID(); // MapChunk* chnk(std::get<selected_chunk_type>(selection).chunk);
_selected_area_id = newID; // int newID = chnk->getAreaID();
ZoneIDBrowser->setZoneID(newID); // _selected_area_id = newID;
// ZoneIDBrowser->setZoneID(newID);
} }
} }
break; break;
@@ -4311,7 +4313,7 @@ void MapView::tick (float dt)
_status_position->setText (status); _status_position->setText (status);
if (currentSelection.size() > 0) if (currentSelection.size() > 0) // currently disabled, change to == to enable status bar selection
{ {
_status_selection->setText (""); _status_selection->setText ("");
} }
@@ -4356,6 +4358,27 @@ void MapView::tick (float dt)
if (_world->selection_updated) if (_world->selection_updated)
{ {
updateDetailInfos(true); updateDetailInfos(true);
// update areaid and texture picker
if (_texture_picker_need_update)
{
_texture_picker_dock->setVisible(true);
TexturePicker->setMainTexture(texturingTool->_current_texture);
TexturePicker->getTextures(*currentSelection.begin());
_texture_picker_need_update = false;
}
if (_area_picker_need_update)
{
MapChunk* chnk(std::get<selected_chunk_type>(*currentSelection.begin()).chunk);
int newID = chnk->getAreaID();
_selected_area_id = newID;
ZoneIDBrowser->setZoneID(newID);
_area_picker_need_update = false;
}
_world->selection_updated = false; _world->selection_updated = false;
} }
else else