disable drag selection slider, default to 3000 depth

This commit is contained in:
T1ti
2023-07-05 03:55:10 +02:00
parent 17c68600e5
commit 25f659d3ca
3 changed files with 17 additions and 41 deletions

View File

@@ -5292,7 +5292,8 @@ void MapView::mouseReleaseEvent (QMouseEvent* event)
glm::vec2(std::min(_drag_start_pos.x(), drag_end_pos.x()), std::min(_drag_start_pos.y(), drag_end_pos.y())),
glm::vec2(std::max(_drag_start_pos.x(), drag_end_pos.x()), std::max(_drag_start_pos.y(), drag_end_pos.y()))
};
_world->select_objects_in_area(selection_box, !_mod_shift_down, model_view(), projection(), width(), height(), objectEditor->drag_selection_depth(), _camera.position);
// _world->select_objects_in_area(selection_box, !_mod_shift_down, model_view(), projection(), width(), height(), objectEditor->drag_selection_depth(), _camera.position);
_world->select_objects_in_area(selection_box, !_mod_shift_down, model_view(), projection(), width(), height(), 3000.0f, _camera.position);
}
else // Do normal selection when we just clicked
{

View File

@@ -2659,48 +2659,20 @@ void World::update_models_by_filename()
void World::range_add_to_selection(glm::vec3 const& pos, float radius, bool remove)
{
ZoneScoped;
for_tile_at(pos, [this, pos, radius, remove](MapTile* tile)
auto objects_in_range = getObjectsInRange(pos, radius);
for (auto obj : objects_in_range)
{
std::vector<uint32_t>* uids = tile->get_uids();
if (remove)
{
for (uint32_t uid : *uids)
if (remove)
{
auto instance = _model_instance_storage.get_instance(uid);
if (instance && instance.value().index() == eEntry_Object)
{
auto obj = std::get<selected_object_type>(instance.value());
if (glm::distance(obj->pos, pos) <= radius && is_selected(obj))
{
remove_from_selection(obj);
}
}
remove_from_selection(obj);
}
}
else
{
for (uint32_t uid : *uids)
else
{
auto instance = _model_instance_storage.get_instance(uid);
if (instance && instance.value().index() == eEntry_Object)
{
auto obj = std::get<selected_object_type>(instance.value());
if (glm::distance(obj->pos, pos) <= radius && !is_selected(obj))
{
add_to_selection(obj);
}
}
add_to_selection(obj);
}
}
});
}
}
float World::getMaxTileHeight(const TileIndex& tile)

View File

@@ -65,7 +65,7 @@ namespace Noggit
auto layout = new QVBoxLayout (this);
layout->setAlignment(Qt::AlignTop);
QGroupBox* radius_group = new QGroupBox("Radius");
QGroupBox* radius_group = new QGroupBox("Selection Brush Radius");
auto radius_layout = new QFormLayout(radius_group);
_radius_spin = new QDoubleSpinBox (this);
@@ -81,6 +81,7 @@ namespace Noggit
radius_layout->addRow(_radius_spin);
layout->addWidget(radius_group);
/*
QGroupBox* drag_selection_depth_group = new QGroupBox("Drag Selection Depth");
auto drag_selection_depth_layout = new QFormLayout(drag_selection_depth_group);
@@ -92,10 +93,11 @@ namespace Noggit
_drag_selection_depth_slider = new QSlider(Qt::Orientation::Horizontal, this);
_drag_selection_depth_slider->setRange(1.0f, 3000.0f);
_drag_selection_depth_slider->setSliderPosition(_drag_selection_depth);
drag_selection_depth_layout->addRow(_drag_selection_depth_slider);
drag_selection_depth_layout->addRow(_drag_selection_depth_spin);
layout->addWidget(drag_selection_depth_group);
layout->addWidget(drag_selection_depth_group);*/
QPushButton* asset_browser_btn = new QPushButton("Asset browser", this);
layout->addWidget(asset_browser_btn);
@@ -384,6 +386,7 @@ namespace Noggit
}
);
/*
connect(_drag_selection_depth_spin, qOverload<double>(&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
@@ -399,7 +402,7 @@ namespace Noggit
QSignalBlocker const blocker(_drag_selection_depth_spin);
_drag_selection_depth_spin->setValue(v);
}
);
);*/
connect ( rotRangeStart, qOverload<double> (&QDoubleSpinBox::valueChanged)
, [=] (double v)