New selection set as default

This commit is contained in:
Enrico Turri 2018-11-01 10:06:55 +01:00
parent 0d282896d0
commit a15bf7cc25
16 changed files with 20 additions and 2149 deletions

View file

@ -209,10 +209,6 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, m_transformed_convex_hull_bounding_box_dirty(true)
, m_convex_hull(nullptr)
, composite_id(-1)
#if !ENABLE_EXTENDED_SELECTION
, select_group_id(-1)
, drag_group_id(-1)
#endif // !ENABLE_EXTENDED_SELECTION
, extruder_id(0)
, selected(false)
, is_active(true)
@ -270,14 +266,11 @@ const Vec3d& GLVolume::get_rotation() const
void GLVolume::set_rotation(const Vec3d& rotation)
{
#if ENABLE_EXTENDED_SELECTION
static const double TWO_PI = 2.0 * (double)PI;
#endif // ENABLE_EXTENDED_SELECTION
if (m_rotation != rotation)
{
m_rotation = rotation;
#if ENABLE_EXTENDED_SELECTION
for (int i = 0; i < 3; ++i)
{
while (m_rotation(i) < 0.0)
@ -289,7 +282,6 @@ void GLVolume::set_rotation(const Vec3d& rotation)
m_rotation(i) -= TWO_PI;
}
}
#endif // ENABLE_EXTENDED_SELECTION
m_world_matrix_dirty = true;
m_transformed_bounding_box_dirty = true;
m_transformed_convex_hull_bounding_box_dirty = true;
@ -312,12 +304,10 @@ void GLVolume::set_offset(const Vec3d& offset)
}
}
#if ENABLE_EXTENDED_SELECTION
const Vec3d& GLVolume::get_scaling_factor() const
{
return m_scaling_factor;
}
#endif // ENABLE_EXTENDED_SELECTION
void GLVolume::set_scaling_factor(const Vec3d& scaling_factor)
{
@ -368,26 +358,6 @@ void GLVolume::set_convex_hull(const TriangleMesh& convex_hull)
m_convex_hull = &convex_hull;
}
#if !ENABLE_EXTENDED_SELECTION
void GLVolume::set_select_group_id(const std::string& select_by)
{
if (select_by == "object")
select_group_id = object_idx() * 1000000;
else if (select_by == "volume")
select_group_id = object_idx() * 1000000 + volume_idx() * 1000;
else if (select_by == "instance")
select_group_id = composite_id;
}
void GLVolume::set_drag_group_id(const std::string& drag_by)
{
if (drag_by == "object")
drag_group_id = object_idx() * 1000;
else if (drag_by == "instance")
drag_group_id = object_idx() * 1000 + instance_idx();
}
#endif // !ENABLE_EXTENDED_SELECTION
#if !ENABLE_MODELVOLUME_TRANSFORM
const Transform3f& GLVolume::world_matrix() const
{
@ -722,23 +692,12 @@ void GLVolume::generate_layer_height_texture(const PrintObject *print_object, bo
#define LAYER_HEIGHT_TEXTURE_WIDTH 1024
#define LAYER_HEIGHT_TEXTURE_HEIGHT 1024
#if ENABLE_EXTENDED_SELECTION
std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
bool use_VBOs)
#else
std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object,
int obj_idx,
const std::vector<int> &instance_idxs,
const std::string &color_by,
const std::string &select_by,
const std::string &drag_by,
bool use_VBOs)
#endif // ENABLE_EXTENDED_SELECTION
{
static float colors[4][4] = {
{ 1.0f, 1.0f, 0.0f, 1.f },
@ -789,10 +748,6 @@ std::vector<int> GLVolumeCollection::load_object(
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
v.composite_id = obj_idx * 1000000 + volume_idx * 1000 + instance_idx;
#if !ENABLE_EXTENDED_SELECTION
v.set_select_group_id(select_by);
v.set_drag_group_id(drag_by);
#endif // !ENABLE_EXTENDED_SELECTION
if (model_volume->is_model_part())
{
v.set_convex_hull(model_volume->get_convex_hull());
@ -884,10 +839,6 @@ int GLVolumeCollection::load_wipe_tower_preview(
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
v.composite_id = obj_idx * 1000000;
#if !ENABLE_EXTENDED_SELECTION
v.select_group_id = obj_idx * 1000000;
v.drag_group_id = obj_idx * 1000;
#endif // !ENABLE_EXTENDED_SELECTION
v.is_wipe_tower = true;
v.shader_outside_printer_detection_enabled = ! size_unknown;
return int(this->volumes.size() - 1);
@ -1083,26 +1034,6 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con
}
}
#if !ENABLE_EXTENDED_SELECTION
void GLVolumeCollection::set_select_by(const std::string& select_by)
{
for (GLVolume *vol : this->volumes)
{
if (vol != nullptr)
vol->set_select_group_id(select_by);
}
}
void GLVolumeCollection::set_drag_by(const std::string& drag_by)
{
for (GLVolume *vol : this->volumes)
{
if (vol != nullptr)
vol->set_drag_group_id(drag_by);
}
}
#endif // !ENABLE_EXTENDED_SELECTION
std::vector<double> GLVolumeCollection::get_current_print_zs(bool active_only) const
{
// Collect layer top positions of all volumes.
@ -1874,23 +1805,6 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas)
s_canvas_mgr.reset_volumes(canvas);
}
#if !ENABLE_EXTENDED_SELECTION
void _3DScene::deselect_volumes(wxGLCanvas* canvas)
{
s_canvas_mgr.deselect_volumes(canvas);
}
void _3DScene::select_volume(wxGLCanvas* canvas, unsigned int id)
{
s_canvas_mgr.select_volume(canvas, id);
}
void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections)
{
s_canvas_mgr.update_volumes_selection(canvas, selections);
}
#endif // !ENABLE_EXTENDED_SELECTION
int _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config)
{
return s_canvas_mgr.check_volumes_outside_state(canvas, config);
@ -1906,17 +1820,10 @@ bool _3DScene::move_volume_down(wxGLCanvas* canvas, unsigned int id)
return s_canvas_mgr.move_volume_down(canvas, id);
}
#if ENABLE_EXTENDED_SELECTION
GUI::GLCanvas3D* _3DScene::get_canvas(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_canvas(canvas);
}
#else
void _3DScene::set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections)
{
s_canvas_mgr.set_objects_selections(canvas, selections);
}
#endif // ENABLE_EXTENDED_SELECTION
void _3DScene::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config)
{
@ -1963,23 +1870,6 @@ void _3DScene::set_color_by(wxGLCanvas* canvas, const std::string& value)
s_canvas_mgr.set_color_by(canvas, value);
}
#if !ENABLE_EXTENDED_SELECTION
void _3DScene::set_select_by(wxGLCanvas* canvas, const std::string& value)
{
s_canvas_mgr.set_select_by(canvas, value);
}
void _3DScene::set_drag_by(wxGLCanvas* canvas, const std::string& value)
{
s_canvas_mgr.set_drag_by(canvas, value);
}
std::string _3DScene::get_select_by(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_select_by(canvas);
}
#endif // !ENABLE_EXTENDED_SELECTION
bool _3DScene::is_layers_editing_enabled(wxGLCanvas* canvas)
{
return s_canvas_mgr.is_layers_editing_enabled(canvas);
@ -2157,12 +2047,10 @@ int _3DScene::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx)
return s_canvas_mgr.get_in_object_volume_id(canvas, scene_vol_idx);
}
#if ENABLE_EXTENDED_SELECTION
void _3DScene::mirror_selection(wxGLCanvas* canvas, Axis axis)
{
s_canvas_mgr.mirror_selection(canvas, axis);
}
#endif // ENABLE_EXTENDED_SELECTION
void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
{