diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index c41f2e3bd..ac9755e1c 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -280,6 +280,26 @@ void GLVolume::set_render_color() set_render_color(color, 4); } +void GLVolume::set_color_from_model_volume(const ModelVolume *model_volume) +{ + if (model_volume->is_modifier()) { + color[0] = 0.2f; + color[1] = 1.0f; + color[2] = 0.2f; + } + else if (model_volume->is_support_blocker()) { + color[0] = 1.0f; + color[1] = 0.2f; + color[2] = 0.2f; + } + else if (model_volume->is_support_enforcer()) { + color[0] = 0.2f; + color[1] = 0.2f; + color[2] = 1.0f; + } + color[3] = model_volume->is_model_part() ? 1.f : 0.5f; +} + #if !ENABLE_MODELVOLUME_TRANSFORM const Vec3d& GLVolume::get_rotation() const { @@ -767,7 +787,7 @@ int GLVolumeCollection::load_object_volume( #endif // ENABLE_MODELVOLUME_TRANSFORM float color[4]; memcpy(color, colors[((color_by == "volume") ? volume_idx : obj_idx) % 4], sizeof(float) * 3); - if (model_volume->is_support_blocker()) { +/* if (model_volume->is_support_blocker()) { color[0] = 1.0f; color[1] = 0.2f; color[2] = 0.2f; @@ -776,9 +796,10 @@ int GLVolumeCollection::load_object_volume( color[1] = 0.2f; color[2] = 1.0f; } - color[3] = model_volume->is_model_part() ? 1.f : 0.5f; + color[3] = model_volume->is_model_part() ? 1.f : 0.5f; */ this->volumes.emplace_back(new GLVolume(color)); GLVolume &v = *this->volumes.back(); + v.set_color_from_model_volume(model_volume); if (use_VBOs) v.indexed_vertex_array.load_mesh_full_shading(mesh); else diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 4c3cafcc2..604859e62 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -358,6 +358,8 @@ public: void set_render_color(const float* rgba, unsigned int size); // Sets render color in dependence of current state void set_render_color(); + // set color according to model volume + void set_color_from_model_volume(const ModelVolume *model_volume); #if ENABLE_MODELVOLUME_TRANSFORM const Geometry::Transformation& get_instance_transformation() const { return m_instance_transformation; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2701fcea5..dcf115b93 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4102,6 +4102,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re if (extruder_id != -1) volume->extruder_id = extruder_id; + volume->is_modifier = !mvs->model_volume->is_model_part(); + volume->set_color_from_model_volume(mvs->model_volume); + // updates volumes transformations volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation()); volume->set_volume_transformation(mvs->model_volume->get_transformation());