Merge branch 'tetxure_remove' into 'noggit-shadowlands'
New button to remove texture from ADT See merge request prophecy-rp/noggit-red!15
This commit is contained in:
@@ -1259,6 +1259,17 @@ void MapChunk::eraseTextures()
|
||||
texture_set->eraseTextures();
|
||||
}
|
||||
|
||||
void MapChunk::eraseTexture(scoped_blp_texture_reference const& tex)
|
||||
{
|
||||
|
||||
int textureindex = texture_set->get_texture_index_or_add(tex, 0);
|
||||
|
||||
if (textureindex != -1)
|
||||
{
|
||||
texture_set->eraseTexture(textureindex);
|
||||
}
|
||||
}
|
||||
|
||||
void MapChunk::change_texture_flag(scoped_blp_texture_reference const& tex, std::size_t flag, bool add)
|
||||
{
|
||||
texture_set->change_texture_flag(tex, flag, add);
|
||||
|
||||
@@ -162,6 +162,7 @@ public:
|
||||
int addTexture(scoped_blp_texture_reference texture);
|
||||
void switchTexture(scoped_blp_texture_reference const& oldTexture, scoped_blp_texture_reference newTexture);
|
||||
void eraseTextures();
|
||||
void eraseTexture(scoped_blp_texture_reference const& tex);
|
||||
void change_texture_flag(scoped_blp_texture_reference const& tex, std::size_t flag, bool add);
|
||||
|
||||
void clear_shadows();
|
||||
|
||||
@@ -2031,6 +2031,21 @@ void World::swapTexture(glm::vec3 const& pos, scoped_blp_texture_reference tex)
|
||||
}
|
||||
}
|
||||
|
||||
void World::removeTexture(glm::vec3 const& pos, scoped_blp_texture_reference tex)
|
||||
{
|
||||
ZoneScoped;
|
||||
if (!!Noggit::Ui::selected_texture::get())
|
||||
{
|
||||
for_all_chunks_on_tile(pos, [&](MapChunk* chunk)
|
||||
{
|
||||
NOGGIT_CUR_ACTION->registerChunkTextureChange(chunk);
|
||||
// chunk->switchTexture(tex, *Noggit::Ui::selected_texture::get());
|
||||
chunk->eraseTexture(tex);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void World::removeTexDuplicateOnADT(glm::vec3 const& pos)
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
@@ -216,6 +216,7 @@ public:
|
||||
void clear_shadows(glm::vec3 const& pos);
|
||||
void clearTextures(glm::vec3 const& pos);
|
||||
void swapTexture(glm::vec3 const& pos, scoped_blp_texture_reference tex);
|
||||
void removeTexture(glm::vec3 const& pos, scoped_blp_texture_reference tex);
|
||||
void removeTexDuplicateOnADT(glm::vec3 const& pos);
|
||||
void change_texture_flag(glm::vec3 const& pos, scoped_blp_texture_reference const& tex, std::size_t flag, bool add);
|
||||
|
||||
|
||||
@@ -36,11 +36,13 @@ namespace Noggit
|
||||
|
||||
QPushButton* select = new QPushButton("Select", this);
|
||||
QPushButton* swap_adt = new QPushButton("Swap ADT", this);
|
||||
QPushButton* remove_text_adt = new QPushButton(tr("Remove this texture from ADT"), this);
|
||||
|
||||
layout->addRow(new QLabel("Texture to swap"));
|
||||
layout->addRow(_texture_to_swap_display);
|
||||
layout->addRow(select);
|
||||
layout->addRow(swap_adt);
|
||||
layout->addRow(remove_text_adt);
|
||||
|
||||
_brush_mode_group = new QGroupBox("Brush mode", this);
|
||||
_brush_mode_group->setCheckable(true);
|
||||
@@ -87,6 +89,15 @@ namespace Noggit
|
||||
}
|
||||
});
|
||||
|
||||
connect(remove_text_adt, &QPushButton::clicked, [this, camera_pos, map_view]() {
|
||||
if (_texture_to_swap)
|
||||
{
|
||||
ActionManager::instance()->beginAction(map_view, ActionFlags::eCHUNKS_TEXTURE);
|
||||
_world->removeTexture(*camera_pos, _texture_to_swap.value());
|
||||
ActionManager::instance()->endAction();
|
||||
}
|
||||
});
|
||||
|
||||
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&](double v)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user