Removed obsolete member variable GLCanvas3D::m_color_by

This commit is contained in:
enricoturri1966 2022-02-11 11:47:29 +01:00
parent 0c74081f7d
commit 5089d1460d
5 changed files with 5 additions and 21 deletions

View File

@ -684,13 +684,12 @@ std::vector<int> GLVolumeCollection::load_object(
const ModelObject *model_object, const ModelObject *model_object,
int obj_idx, int obj_idx,
const std::vector<int> &instance_idxs, const std::vector<int> &instance_idxs,
const std::string &color_by,
bool opengl_initialized) bool opengl_initialized)
{ {
std::vector<int> volumes_idx; std::vector<int> volumes_idx;
for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++volume_idx) for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++volume_idx)
for (int instance_idx : instance_idxs) for (int instance_idx : instance_idxs)
volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx, color_by, opengl_initialized)); volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx, opengl_initialized));
return volumes_idx; return volumes_idx;
} }
@ -699,16 +698,13 @@ int GLVolumeCollection::load_object_volume(
int obj_idx, int obj_idx,
int volume_idx, int volume_idx,
int instance_idx, int instance_idx,
const std::string &color_by,
bool opengl_initialized) bool opengl_initialized)
{ {
const ModelVolume *model_volume = model_object->volumes[volume_idx]; const ModelVolume *model_volume = model_object->volumes[volume_idx];
const int extruder_id = model_volume->extruder_id(); const int extruder_id = model_volume->extruder_id();
const ModelInstance *instance = model_object->instances[instance_idx]; const ModelInstance *instance = model_object->instances[instance_idx];
const TriangleMesh &mesh = model_volume->mesh(); const TriangleMesh &mesh = model_volume->mesh();
ColorRGBA color = GLVolume::MODEL_COLOR[((color_by == "volume") ? volume_idx : obj_idx) % 4]; this->volumes.emplace_back(new GLVolume());
color.a(model_volume->is_model_part() ? 1.0f : 0.5f);
this->volumes.emplace_back(new GLVolume(color));
GLVolume& v = *this->volumes.back(); GLVolume& v = *this->volumes.back();
v.set_color(color_from_model_volume(*model_volume)); v.set_color(color_from_model_volume(*model_volume));
#if ENABLE_SMOOTH_NORMALS #if ENABLE_SMOOTH_NORMALS

View File

@ -593,7 +593,6 @@ public:
const ModelObject *model_object, const ModelObject *model_object,
int obj_idx, int obj_idx,
const std::vector<int> &instance_idxs, const std::vector<int> &instance_idxs,
const std::string &color_by,
bool opengl_initialized); bool opengl_initialized);
int load_object_volume( int load_object_volume(
@ -601,7 +600,6 @@ public:
int obj_idx, int obj_idx,
int volume_idx, int volume_idx,
int instance_idx, int instance_idx,
const std::string &color_by,
bool opengl_initialized); bool opengl_initialized);
// Load SLA auxiliary GLVolumes (for support trees or pad). // Load SLA auxiliary GLVolumes (for support trees or pad).

View File

@ -2306,7 +2306,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
} }
size_t current_volumes_count = m_shells.volumes.volumes.size(); size_t current_volumes_count = m_shells.volumes.volumes.size();
m_shells.volumes.load_object(model_obj, object_id, instance_ids, "object", initialized); m_shells.volumes.load_object(model_obj, object_id, instance_ids, initialized);
// adjust shells' z if raft is present // adjust shells' z if raft is present
const SlicingParameters& slicing_parameters = obj->slicing_parameters(); const SlicingParameters& slicing_parameters = obj->slicing_parameters();

View File

@ -1106,7 +1106,6 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D &bed)
, m_moving(false) , m_moving(false)
, m_tab_down(false) , m_tab_down(false)
, m_cursor_type(Standard) , m_cursor_type(Standard)
, m_color_by("volume")
, m_reload_delayed(false) , m_reload_delayed(false)
#if ENABLE_RENDER_PICKING_PASS #if ENABLE_RENDER_PICKING_PASS
, m_show_picking_texture(false) , m_show_picking_texture(false)
@ -1358,11 +1357,6 @@ void GLCanvas3D::bed_shape_changed()
m_dirty = true; m_dirty = true;
} }
void GLCanvas3D::set_color_by(const std::string& value)
{
m_color_by = value;
}
void GLCanvas3D::refresh_camera_scene_box() void GLCanvas3D::refresh_camera_scene_box()
{ {
wxGetApp().plater()->get_camera().set_scene_box(scene_bounding_box()); wxGetApp().plater()->get_camera().set_scene_box(scene_bounding_box());
@ -1807,7 +1801,7 @@ std::vector<int> GLCanvas3D::load_object(const ModelObject& model_object, int ob
instance_idxs.emplace_back(i); instance_idxs.emplace_back(i);
} }
} }
return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_color_by, m_initialized); return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_initialized);
} }
std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx) std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx)
@ -2032,7 +2026,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// Note the index of the loaded volume, so that we can reload the main model GLVolume with the hollowed mesh // Note the index of the loaded volume, so that we can reload the main model GLVolume with the hollowed mesh
// later in this function. // later in this function.
it->volume_idx = m_volumes.volumes.size(); it->volume_idx = m_volumes.volumes.size();
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_color_by, m_initialized); m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_initialized);
m_volumes.volumes.back()->geometry_id = key.geometry_id; m_volumes.volumes.back()->geometry_id = key.geometry_id;
update_object_list = true; update_object_list = true;
} else { } else {

View File

@ -522,8 +522,6 @@ private:
// I just don't want to do it now before a release (Lukas Matena 24.3.2019) // I just don't want to do it now before a release (Lukas Matena 24.3.2019)
bool m_render_sla_auxiliaries; bool m_render_sla_auxiliaries;
std::string m_color_by;
bool m_reload_delayed; bool m_reload_delayed;
#if ENABLE_RENDER_PICKING_PASS #if ENABLE_RENDER_PICKING_PASS
@ -692,8 +690,6 @@ public:
bool get_use_clipping_planes() const { return m_use_clipping_planes; } bool get_use_clipping_planes() const { return m_use_clipping_planes; }
const std::array<ClippingPlane, 2> &get_clipping_planes() const { return m_clipping_planes; }; const std::array<ClippingPlane, 2> &get_clipping_planes() const { return m_clipping_planes; };
void set_color_by(const std::string& value);
void refresh_camera_scene_box(); void refresh_camera_scene_box();
BoundingBoxf3 volumes_bounding_box() const; BoundingBoxf3 volumes_bounding_box() const;