Merge branch 'dev' into fs_simplify_multipart_object

This commit is contained in:
Filip Sykala 2022-01-17 10:00:21 +01:00
commit cb72f40d9a
5 changed files with 7 additions and 24 deletions

View File

@ -377,7 +377,6 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, is_modifier(false)
, is_wipe_tower(false)
, is_extrusion_path(false)
, force_transparent(false)
, force_native_color(false)
, force_neutral_color(false)
, force_sinking_contours(false)
@ -388,7 +387,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
set_render_color(color);
}
void GLVolume::set_render_color()
void GLVolume::set_render_color(bool force_transparent)
{
bool outside = is_outside || is_below_printbed();
@ -812,11 +811,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
glsafe(::glDisable(GL_CULL_FACE));
for (GLVolumeWithIdAndZ& volume : to_render) {
if (type == ERenderType::Transparent)
volume.first->force_transparent = true;
volume.first->set_render_color();
if (type == ERenderType::Transparent)
volume.first->force_transparent = false;
volume.first->set_render_color(true);
// render sinking contours of non-hovered volumes
if (m_show_sinking_contours)

View File

@ -358,9 +358,7 @@ public:
bool is_wipe_tower : 1;
// Wheter or not this volume has been generated from an extrusion path
bool is_extrusion_path : 1;
// Wheter or not to always render this volume using its own alpha
bool force_transparent : 1;
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
bool force_native_color : 1;
// Whether or not render this volume in neutral
bool force_neutral_color : 1;
@ -397,7 +395,7 @@ public:
void set_color(const ColorRGBA& rgba) { color = rgba; }
void set_render_color(const ColorRGBA& rgba) { render_color = rgba; }
// Sets render color in dependence of current state
void set_render_color();
void set_render_color(bool force_transparent);
// set color according to model volume
void set_color_from_model_volume(const ModelVolume& model_volume);

View File

@ -2155,7 +2155,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
volume->zoom_to_volumes = false;
volume->color.a(0.25f);
volume->force_native_color = true;
volume->set_render_color();
volume->set_render_color(true);
}
}

View File

@ -1845,12 +1845,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
volume->is_modifier = !mvs->model_volume->is_model_part();
volume->set_color(color_from_model_volume(*mvs->model_volume));
// force update of render_color alpha channel
bool transparent = volume->color.is_transparent();
if (transparent)
volume->force_transparent = true;
volume->set_render_color();
if (transparent)
volume->force_transparent = false;
volume->set_render_color(volume->color.is_transparent());
// updates volumes transformations
volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation());

View File

@ -452,12 +452,7 @@ void Selection::clear()
for (unsigned int i : m_list) {
GLVolume& volume = *(*m_volumes)[i];
volume.selected = false;
bool is_transparent = volume.color.is_transparent();
if (is_transparent)
volume.force_transparent = true;
volume.set_render_color();
if (is_transparent)
volume.force_transparent = false;
volume.set_render_color(volume.color.is_transparent());
}
m_list.clear();