Render non printable instances with a darker color
This commit is contained in:
parent
b1a1ed6394
commit
03820a38cf
6 changed files with 67 additions and 7 deletions
|
@ -200,6 +200,9 @@ const float GLVolume::HOVER_DESELECT_COLOR[4] = { 1.0f, 0.75f, 0.75f, 1.0f };
|
||||||
const float GLVolume::OUTSIDE_COLOR[4] = { 0.0f, 0.38f, 0.8f, 1.0f };
|
const float GLVolume::OUTSIDE_COLOR[4] = { 0.0f, 0.38f, 0.8f, 1.0f };
|
||||||
const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 0.19f, 0.58f, 1.0f, 1.0f };
|
const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 0.19f, 0.58f, 1.0f, 1.0f };
|
||||||
const float GLVolume::DISABLED_COLOR[4] = { 0.25f, 0.25f, 0.25f, 1.0f };
|
const float GLVolume::DISABLED_COLOR[4] = { 0.25f, 0.25f, 0.25f, 1.0f };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
const float GLVolume::NON_PRINTABLE_COLOR[4] = { 0.5f, 0.5f, 0.5f, 1.0f };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
const float GLVolume::MODEL_COLOR[4][4] = {
|
const float GLVolume::MODEL_COLOR[4][4] = {
|
||||||
{ 1.0f, 1.0f, 0.0f, 1.f },
|
{ 1.0f, 1.0f, 0.0f, 1.f },
|
||||||
{ 1.0f, 0.5f, 0.5f, 1.f },
|
{ 1.0f, 0.5f, 0.5f, 1.f },
|
||||||
|
@ -218,6 +221,9 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
||||||
, extruder_id(0)
|
, extruder_id(0)
|
||||||
, selected(false)
|
, selected(false)
|
||||||
, disabled(false)
|
, disabled(false)
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
, printable(true)
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
, is_active(true)
|
, is_active(true)
|
||||||
, zoom_to_volumes(true)
|
, zoom_to_volumes(true)
|
||||||
, shader_outside_printer_detection_enabled(false)
|
, shader_outside_printer_detection_enabled(false)
|
||||||
|
@ -271,10 +277,23 @@ void GLVolume::set_render_color()
|
||||||
set_render_color(DISABLED_COLOR, 4);
|
set_render_color(DISABLED_COLOR, 4);
|
||||||
else if (is_outside && shader_outside_printer_detection_enabled)
|
else if (is_outside && shader_outside_printer_detection_enabled)
|
||||||
set_render_color(OUTSIDE_COLOR, 4);
|
set_render_color(OUTSIDE_COLOR, 4);
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
// else if (!printable)
|
||||||
|
// set_render_color(NON_PRINTABLE_COLOR, 4);
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
else
|
else
|
||||||
set_render_color(color, 4);
|
set_render_color(color, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
if (!printable)
|
||||||
|
{
|
||||||
|
render_color[0] /= 4;
|
||||||
|
render_color[1] /= 4;
|
||||||
|
render_color[2] /= 4;
|
||||||
|
}
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
if (force_transparent)
|
if (force_transparent)
|
||||||
render_color[3] = color[3];
|
render_color[3] = color[3];
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,6 +231,9 @@ public:
|
||||||
static const float OUTSIDE_COLOR[4];
|
static const float OUTSIDE_COLOR[4];
|
||||||
static const float SELECTED_OUTSIDE_COLOR[4];
|
static const float SELECTED_OUTSIDE_COLOR[4];
|
||||||
static const float DISABLED_COLOR[4];
|
static const float DISABLED_COLOR[4];
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
static const float NON_PRINTABLE_COLOR[4];
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
static const float MODEL_COLOR[4][4];
|
static const float MODEL_COLOR[4][4];
|
||||||
static const float SLA_SUPPORT_COLOR[4];
|
static const float SLA_SUPPORT_COLOR[4];
|
||||||
static const float SLA_PAD_COLOR[4];
|
static const float SLA_PAD_COLOR[4];
|
||||||
|
@ -294,6 +297,10 @@ public:
|
||||||
bool selected;
|
bool selected;
|
||||||
// Is this object disabled from selection?
|
// Is this object disabled from selection?
|
||||||
bool disabled;
|
bool disabled;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
// Is this object printable?
|
||||||
|
bool printable;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
// Whether or not this volume is active for rendering
|
// Whether or not this volume is active for rendering
|
||||||
bool is_active;
|
bool is_active;
|
||||||
// Whether or not to use this volume when applying zoom_to_volumes()
|
// Whether or not to use this volume when applying zoom_to_volumes()
|
||||||
|
|
|
@ -1382,13 +1382,14 @@ wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu, wxWind
|
||||||
wxMenuItem* ObjectList::append_menu_item_printable(wxMenu* menu, wxWindow* parent)
|
wxMenuItem* ObjectList::append_menu_item_printable(wxMenu* menu, wxWindow* parent)
|
||||||
{
|
{
|
||||||
return append_menu_check_item(menu, wxID_ANY, _(L("Printable")), "", [this](wxCommandEvent&) {
|
return append_menu_check_item(menu, wxID_ANY, _(L("Printable")), "", [this](wxCommandEvent&) {
|
||||||
int instance_idx = wxGetApp().plater()->canvas3D()->get_selection().get_instance_idx();
|
wxGetApp().plater()->canvas3D()->get_selection().toggle_instance_printable_state();
|
||||||
if (instance_idx != -1)
|
// int instance_idx = wxGetApp().plater()->canvas3D()->get_selection().get_instance_idx();
|
||||||
{
|
// if (instance_idx != -1)
|
||||||
int obj_idx = wxGetApp().plater()->get_selected_object_idx();
|
// {
|
||||||
(*m_objects)[obj_idx]->instances[instance_idx]->printable = !(*m_objects)[obj_idx]->instances[instance_idx]->printable;
|
// int obj_idx = wxGetApp().plater()->get_selected_object_idx();
|
||||||
|
// (*m_objects)[obj_idx]->instances[instance_idx]->printable = !(*m_objects)[obj_idx]->instances[instance_idx]->printable;
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
}, menu);
|
}, menu);
|
||||||
}
|
}
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
|
@ -3509,7 +3509,10 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
|
||||||
int instance_idx = selection.get_instance_idx();
|
int instance_idx = selection.get_instance_idx();
|
||||||
evt.Enable(instance_idx != -1);
|
evt.Enable(instance_idx != -1);
|
||||||
if (instance_idx != -1)
|
if (instance_idx != -1)
|
||||||
|
{
|
||||||
evt.Check(model.objects[selection.get_object_idx()]->instances[instance_idx]->printable);
|
evt.Check(model.objects[selection.get_object_idx()]->instances[instance_idx]->printable);
|
||||||
|
view3D->set_as_dirty();
|
||||||
|
}
|
||||||
}, menu_item_printable->GetId());
|
}, menu_item_printable->GetId());
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
}
|
}
|
||||||
|
|
|
@ -1459,6 +1459,32 @@ std::vector<unsigned int> Selection::get_unselected_volume_idxs_from(const std::
|
||||||
return idxs;
|
return idxs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
void Selection::toggle_instance_printable_state()
|
||||||
|
{
|
||||||
|
int instance_idx = get_instance_idx();
|
||||||
|
if (instance_idx == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int obj_idx = get_object_idx();
|
||||||
|
if ((0 <= obj_idx) && (obj_idx < (int)m_model->objects.size()))
|
||||||
|
{
|
||||||
|
ModelObject* model_object = m_model->objects[obj_idx];
|
||||||
|
if ((0 <= instance_idx) && (instance_idx < (int)model_object->instances.size()))
|
||||||
|
{
|
||||||
|
ModelInstance* instance = model_object->instances[instance_idx];
|
||||||
|
instance->printable = !instance->printable;
|
||||||
|
|
||||||
|
for (GLVolume* volume : *m_volumes)
|
||||||
|
{
|
||||||
|
if ((volume->object_idx() == obj_idx) && (volume->instance_idx() == instance_idx))
|
||||||
|
volume->printable = instance->printable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
void Selection::update_valid()
|
void Selection::update_valid()
|
||||||
{
|
{
|
||||||
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
||||||
|
|
|
@ -336,6 +336,10 @@ public:
|
||||||
// returns the list of idxs of the volumes contained in the given list but not in the selection
|
// returns the list of idxs of the volumes contained in the given list but not in the selection
|
||||||
std::vector<unsigned int> get_unselected_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const;
|
std::vector<unsigned int> get_unselected_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const;
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
void toggle_instance_printable_state();
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_valid();
|
void update_valid();
|
||||||
void update_type();
|
void update_type();
|
||||||
|
|
Loading…
Reference in a new issue