SLA gizmo now forces objects to use their normal color (not SELECTED_COLOR)

This commit is contained in:
Lukas Matena 2019-03-20 14:04:20 +01:00
parent 2728e45646
commit df01af975a
3 changed files with 19 additions and 10 deletions

View file

@ -249,6 +249,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, is_wipe_tower(false)
, is_extrusion_path(false)
, force_transparent(false)
, force_native_color(false)
, tverts_range(0, size_t(-1))
, qverts_range(0, size_t(-1))
{
@ -280,16 +281,20 @@ void GLVolume::set_render_color(const float* rgba, unsigned int size)
void GLVolume::set_render_color()
{
if (selected)
set_render_color(is_outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR, 4);
else if (hover)
set_render_color(HOVER_COLOR, 4);
else if (disabled)
set_render_color(DISABLED_COLOR, 4);
else if (is_outside && shader_outside_printer_detection_enabled)
set_render_color(OUTSIDE_COLOR, 4);
else
if (force_native_color)
set_render_color(color, 4);
else {
if (selected)
set_render_color(is_outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR, 4);
else if (hover)
set_render_color(HOVER_COLOR, 4);
else if (disabled)
set_render_color(DISABLED_COLOR, 4);
else if (is_outside && shader_outside_printer_detection_enabled)
set_render_color(OUTSIDE_COLOR, 4);
else
set_render_color(color, 4);
}
if (force_transparent)
render_color[3] = color[3];

View file

@ -302,6 +302,8 @@ public:
bool is_extrusion_path;
// Wheter or not to always render this volume using its own alpha
bool force_transparent;
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
bool force_native_color;
// Interleaved triangles & normals with indexed triangles & quads.
GLIndexedVertexArray indexed_vertex_array;

View file

@ -2231,8 +2231,10 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject
{
for (GLVolume* vol : m_volumes.volumes) {
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx))
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)) {
vol->is_active = visible;
vol->force_native_color = (instance_idx != -1);
}
}
if (visible && !mo)
toggle_sla_auxiliaries_visibility(true);