Removed obsolete class GLCanvas3D::WarningTexture
This commit is contained in:
parent
a6bd2d7664
commit
125fcd0623
3 changed files with 163 additions and 88 deletions
|
@ -116,6 +116,7 @@
|
|||
#define ENABLE_SPLITTED_VERTEX_BUFFER (1 && ENABLE_2_3_1_ALPHA1)
|
||||
#define ENABLE_RELOAD_FROM_DISK_FOR_3MF (1 && ENABLE_2_3_1_ALPHA1)
|
||||
#define ENABLE_REDUCED_TOOLPATHS_SEGMENT_CAPS (1 && ENABLE_SPLITTED_VERTEX_BUFFER)
|
||||
#define ENABLE_WARNING_TEXTURE_REMOVAL (1 && ENABLE_2_3_1_ALPHA1)
|
||||
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
|
|
@ -611,6 +611,7 @@ GLCanvas3D::Mouse::Mouse()
|
|||
{
|
||||
}
|
||||
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
const unsigned char GLCanvas3D::WarningTexture::Background_Color[3] = { 120, 120, 120 };//{ 9, 91, 134 };
|
||||
const unsigned char GLCanvas3D::WarningTexture::Opacity = 255;
|
||||
|
||||
|
@ -879,6 +880,7 @@ void GLCanvas3D::WarningTexture::msw_rescale(const GLCanvas3D& canvas)
|
|||
|
||||
generate(m_msg_text, canvas, true, m_is_colored_red);
|
||||
}
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_instances) const
|
||||
{
|
||||
|
@ -1302,7 +1304,11 @@ void GLCanvas3D::reset_volumes()
|
|||
m_volumes.clear();
|
||||
m_dirty = true;
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification(EWarning::ObjectOutside, false);
|
||||
#else
|
||||
_set_warning_texture(WarningTexture::ObjectOutside, false);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
|
||||
int GLCanvas3D::check_volumes_outside_state() const
|
||||
|
@ -1356,11 +1362,19 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject
|
|||
if (visible && !mo)
|
||||
toggle_sla_auxiliaries_visibility(true, mo, instance_idx);
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
if (!mo && !visible && !m_model->objects.empty() && (m_model->objects.size() > 1 || m_model->objects.front()->instances.size() > 1))
|
||||
_set_warning_notification(EWarning::SomethingNotShown, true);
|
||||
|
||||
if (!mo && visible)
|
||||
_set_warning_notification(EWarning::SomethingNotShown, false);
|
||||
#else
|
||||
if (!mo && !visible && !m_model->objects.empty() && (m_model->objects.size() > 1 || m_model->objects.front()->instances.size() > 1))
|
||||
_set_warning_texture(WarningTexture::SomethingNotShown, true);
|
||||
|
||||
if (!mo && visible)
|
||||
_set_warning_texture(WarningTexture::SomethingNotShown, false);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_instance_printable_state_for_object(const size_t obj_idx)
|
||||
|
@ -2236,18 +2250,31 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
|
||||
const bool contained_min_one = m_volumes.check_outside_state(m_config, &state);
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification(EWarning::ObjectClashed, state == ModelInstancePVS_Partly_Outside);
|
||||
_set_warning_notification(EWarning::ObjectOutside, state == ModelInstancePVS_Fully_Outside);
|
||||
if (printer_technology != ptSLA || state == ModelInstancePVS_Inside)
|
||||
_set_warning_notification(EWarning::SlaSupportsOutside, false);
|
||||
#else
|
||||
_set_warning_texture(WarningTexture::ObjectClashed, state == ModelInstancePVS_Partly_Outside);
|
||||
_set_warning_texture(WarningTexture::ObjectOutside, state == ModelInstancePVS_Fully_Outside);
|
||||
if(printer_technology != ptSLA || state == ModelInstancePVS_Inside)
|
||||
_set_warning_texture(WarningTexture::SlaSupportsOutside, false);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
||||
contained_min_one && !m_model->objects.empty() && state != ModelInstancePVS_Partly_Outside));
|
||||
}
|
||||
else {
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification(EWarning::ObjectOutside, false);
|
||||
_set_warning_notification(EWarning::ObjectClashed, false);
|
||||
_set_warning_notification(EWarning::SlaSupportsOutside, false);
|
||||
#else
|
||||
_set_warning_texture(WarningTexture::ObjectOutside, false);
|
||||
_set_warning_texture(WarningTexture::ObjectClashed, false);
|
||||
_set_warning_texture(WarningTexture::SlaSupportsOutside, false);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
|
||||
}
|
||||
|
||||
|
@ -2290,7 +2317,11 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result)
|
|||
|
||||
if (wxGetApp().is_editor()) {
|
||||
m_gcode_viewer.update_shells_color_by_extruder(m_config);
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification_if_needed(EWarning::ToolpathOutside);
|
||||
#else
|
||||
_show_warning_texture_if_needed(WarningTexture::ToolpathOutside);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2319,7 +2350,11 @@ void GLCanvas3D::load_sla_preview()
|
|||
this->reset_volumes();
|
||||
_load_sla_shells();
|
||||
_update_sla_shells_outside_state();
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification_if_needed(EWarning::SlaSupportsOutside);
|
||||
#else
|
||||
_show_warning_texture_if_needed(WarningTexture::SlaSupportsOutside);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2340,7 +2375,11 @@ void GLCanvas3D::load_preview(const std::vector<std::string>& str_tool_colors, c
|
|||
_load_print_object_toolpaths(*object, str_tool_colors, color_print_values);
|
||||
|
||||
_update_toolpath_volumes_outside_state();
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_set_warning_notification_if_needed(EWarning::ToolpathOutside);
|
||||
#else
|
||||
_show_warning_texture_if_needed(WarningTexture::ToolpathOutside);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
|
||||
void GLCanvas3D::bind_event_handlers()
|
||||
|
@ -3850,7 +3889,9 @@ void GLCanvas3D::set_cursor(ECursorType type)
|
|||
|
||||
void GLCanvas3D::msw_rescale()
|
||||
{
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
m_warning_texture.msw_rescale(*this);
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()
|
||||
|
@ -5190,7 +5231,9 @@ void GLCanvas3D::_render_overlays() const
|
|||
_check_and_update_toolbar_icon_scale();
|
||||
|
||||
_render_gizmos_overlay();
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
_render_warning_texture();
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
// main toolbar and undoredo toolbar need to be both updated before rendering because both their sizes are needed
|
||||
// to correctly place them
|
||||
|
@ -5211,7 +5254,7 @@ void GLCanvas3D::_render_overlays() const
|
|||
_render_collapse_toolbar();
|
||||
_render_view_toolbar();
|
||||
|
||||
if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f))
|
||||
if (m_layers_editing.last_object_id >= 0 && m_layers_editing.object_max_z() > 0.0f)
|
||||
m_layers_editing.render_overlay(*this);
|
||||
|
||||
const ConfigOptionBool* opt = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects"));
|
||||
|
@ -5228,10 +5271,12 @@ void GLCanvas3D::_render_overlays() const
|
|||
glsafe(::glPopMatrix());
|
||||
}
|
||||
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void GLCanvas3D::_render_warning_texture() const
|
||||
{
|
||||
m_warning_texture.render(*this);
|
||||
}
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
void GLCanvas3D::_render_volumes_for_picking() const
|
||||
{
|
||||
|
@ -5401,8 +5446,7 @@ void GLCanvas3D::_render_sla_slices() const
|
|||
|
||||
double clip_min_z = -m_clipping_planes[0].get_data()[3];
|
||||
double clip_max_z = m_clipping_planes[1].get_data()[3];
|
||||
for (unsigned int i = 0; i < (unsigned int)print_objects.size(); ++i)
|
||||
{
|
||||
for (unsigned int i = 0; i < (unsigned int)print_objects.size(); ++i) {
|
||||
const SLAPrintObject* obj = print_objects[i];
|
||||
|
||||
if (!obj->is_step_done(slaposSliceSupports))
|
||||
|
@ -5473,10 +5517,8 @@ void GLCanvas3D::_render_sla_slices() const
|
|||
}
|
||||
}
|
||||
|
||||
if (!bottom_obj_triangles.empty() || !top_obj_triangles.empty() || !bottom_sup_triangles.empty() || !top_sup_triangles.empty())
|
||||
{
|
||||
for (const SLAPrintObject::Instance& inst : obj->instances())
|
||||
{
|
||||
if (!bottom_obj_triangles.empty() || !top_obj_triangles.empty() || !bottom_sup_triangles.empty() || !top_sup_triangles.empty()) {
|
||||
for (const SLAPrintObject::Instance& inst : obj->instances()) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(unscale<double>(inst.shift.x()), unscale<double>(inst.shift.y()), 0));
|
||||
glsafe(::glRotatef(Geometry::rad2deg(inst.rotation), 0.0, 0.0, 1.0));
|
||||
|
@ -5516,8 +5558,7 @@ void GLCanvas3D::_render_selection_sidebar_hints() const
|
|||
|
||||
void GLCanvas3D::_update_volumes_hover_state() const
|
||||
{
|
||||
for (GLVolume* v : m_volumes.volumes)
|
||||
{
|
||||
for (GLVolume* v : m_volumes.volumes) {
|
||||
v->hover = GLVolume::HS_None;
|
||||
}
|
||||
|
||||
|
@ -5528,8 +5569,7 @@ void GLCanvas3D::_update_volumes_hover_state() const
|
|||
bool shift_pressed = wxGetKeyState(WXK_SHIFT); // select by rectangle
|
||||
bool alt_pressed = wxGetKeyState(WXK_ALT); // deselect by rectangle
|
||||
|
||||
if (alt_pressed && (shift_pressed || ctrl_pressed))
|
||||
{
|
||||
if (alt_pressed && (shift_pressed || ctrl_pressed)) {
|
||||
// illegal combinations of keys
|
||||
m_hover_volume_idxs.clear();
|
||||
return;
|
||||
|
@ -5538,33 +5578,28 @@ void GLCanvas3D::_update_volumes_hover_state() const
|
|||
bool selection_modifiers_only = m_selection.is_empty() || m_selection.is_any_modifier();
|
||||
|
||||
bool hover_modifiers_only = true;
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
if (!m_volumes.volumes[i]->is_modifier)
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
if (!m_volumes.volumes[i]->is_modifier) {
|
||||
hover_modifiers_only = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::pair<int, int>> hover_instances;
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
const GLVolume& v = *m_volumes.volumes[i];
|
||||
hover_instances.insert(std::make_pair(v.object_idx(), v.instance_idx()));
|
||||
}
|
||||
|
||||
bool hover_from_single_instance = hover_instances.size() == 1;
|
||||
|
||||
if (hover_modifiers_only && !hover_from_single_instance)
|
||||
{
|
||||
if (hover_modifiers_only && !hover_from_single_instance) {
|
||||
// do not allow to select volumes from different instances
|
||||
m_hover_volume_idxs.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
GLVolume& volume = *m_volumes.volumes[i];
|
||||
if (volume.hover != GLVolume::HS_None)
|
||||
continue;
|
||||
|
@ -5573,8 +5608,7 @@ void GLCanvas3D::_update_volumes_hover_state() const
|
|||
// (volume->is_modifier && !selection_modifiers_only && !is_ctrl_pressed) -> allows hovering on selected modifiers belonging to selection of type Instance
|
||||
bool select = (!volume.selected || (volume.is_modifier && !selection_modifiers_only && !ctrl_pressed)) && !alt_pressed;
|
||||
|
||||
if (select || deselect)
|
||||
{
|
||||
if (select || deselect) {
|
||||
bool as_volume =
|
||||
volume.is_modifier && hover_from_single_instance && !ctrl_pressed &&
|
||||
(
|
||||
|
@ -5582,22 +5616,18 @@ void GLCanvas3D::_update_volumes_hover_state() const
|
|||
(deselect && !m_selection.is_single_full_instance() && (volume.object_idx() == m_selection.get_object_idx()) && (volume.instance_idx() == m_selection.get_instance_idx()))
|
||||
);
|
||||
|
||||
if (as_volume)
|
||||
{
|
||||
if (as_volume) {
|
||||
if (deselect)
|
||||
volume.hover = GLVolume::HS_Deselect;
|
||||
else
|
||||
volume.hover = GLVolume::HS_Select;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
int object_idx = volume.object_idx();
|
||||
int instance_idx = volume.instance_idx();
|
||||
|
||||
for (GLVolume* v : m_volumes.volumes)
|
||||
{
|
||||
if ((v->object_idx() == object_idx) && (v->instance_idx() == instance_idx))
|
||||
{
|
||||
for (GLVolume* v : m_volumes.volumes) {
|
||||
if (v->object_idx() == object_idx && v->instance_idx() == instance_idx) {
|
||||
if (deselect)
|
||||
v->hover = GLVolume::HS_Deselect;
|
||||
else
|
||||
|
@ -5616,8 +5646,7 @@ void GLCanvas3D::_perform_layer_editing_action(wxMouseEvent* evt)
|
|||
return;
|
||||
|
||||
// A volume is selected. Test, whether hovering over a layer thickness bar.
|
||||
if (evt != nullptr)
|
||||
{
|
||||
if (evt != nullptr) {
|
||||
const Rect& rect = LayersEditing::get_bar_rect_screen(*this);
|
||||
float b = rect.get_bottom();
|
||||
m_layers_editing.last_z = m_layers_editing.object_max_z() * (b - evt->GetY() - 1.0f) / (b - rect.get_top());
|
||||
|
@ -5686,8 +5715,7 @@ void GLCanvas3D::_load_print_toolpaths()
|
|||
|
||||
// number of skirt layers
|
||||
size_t total_layer_count = 0;
|
||||
for (const PrintObject* print_object : print->objects())
|
||||
{
|
||||
for (const PrintObject* print_object : print->objects()) {
|
||||
total_layer_count = std::max(total_layer_count, print_object->total_layer_count());
|
||||
}
|
||||
size_t skirt_height = print->has_infinite_skirt() ? total_layer_count : std::min<size_t>(print->config().skirt_height.value, total_layer_count);
|
||||
|
@ -5768,8 +5796,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
auto it = std::find_if(color_print_values->begin(), color_print_values->end(),
|
||||
[print_z](const CustomGCode::Item& code)
|
||||
{ return fabs(code.print_z - print_z) < EPSILON; });
|
||||
if (it != color_print_values->end())
|
||||
{
|
||||
if (it != color_print_values->end()) {
|
||||
CustomGCode::Type type = it->type;
|
||||
// pause print or custom Gcode
|
||||
if (type == CustomGCode::PausePrint ||
|
||||
|
@ -5789,8 +5816,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
|
||||
const CustomGCode::Item value{print_z + EPSILON, CustomGCode::Custom, 0, ""};
|
||||
it = std::lower_bound(color_print_values->begin(), color_print_values->end(), value);
|
||||
while (it != color_print_values->begin())
|
||||
{
|
||||
while (it != color_print_values->begin()) {
|
||||
--it;
|
||||
// change color for current extruder
|
||||
if (it->type == CustomGCode::ColorChange) {
|
||||
|
@ -6252,6 +6278,24 @@ void GLCanvas3D::_update_sla_shells_outside_state()
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning)
|
||||
{
|
||||
_set_current();
|
||||
bool show = false;
|
||||
if (!m_volumes.empty())
|
||||
show = _is_any_volume_outside();
|
||||
else {
|
||||
if (wxGetApp().is_editor()) {
|
||||
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
|
||||
const BoundingBoxf3& paths_volume = m_gcode_viewer.get_paths_bounding_box();
|
||||
if (test_volume.radius() > 0.0 && paths_volume.radius() > 0.0)
|
||||
show = !test_volume.contains(paths_volume);
|
||||
}
|
||||
}
|
||||
_set_warning_notification(warning, show);
|
||||
}
|
||||
#else
|
||||
void GLCanvas3D::_show_warning_texture_if_needed(WarningTexture::Warning warning)
|
||||
{
|
||||
_set_current();
|
||||
|
@ -6268,23 +6312,21 @@ void GLCanvas3D::_show_warning_texture_if_needed(WarningTexture::Warning warning
|
|||
}
|
||||
_set_warning_texture(warning, show);
|
||||
}
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& colors)
|
||||
{
|
||||
static const float INV_255 = 1.0f / 255.0f;
|
||||
|
||||
std::vector<float> output(colors.size() * 4, 1.0f);
|
||||
for (size_t i = 0; i < colors.size(); ++i)
|
||||
{
|
||||
for (size_t i = 0; i < colors.size(); ++i) {
|
||||
const std::string& color = colors[i];
|
||||
const char* c = color.data() + 1;
|
||||
if ((color.size() == 7) && (color.front() == '#'))
|
||||
{
|
||||
for (size_t j = 0; j < 3; ++j)
|
||||
{
|
||||
if (color.size() == 7 && color.front() == '#') {
|
||||
for (size_t j = 0; j < 3; ++j) {
|
||||
int digit1 = hex_digit_to_int(*c++);
|
||||
int digit2 = hex_digit_to_int(*c++);
|
||||
if ((digit1 == -1) || (digit2 == -1))
|
||||
if (digit1 == -1 || digit2 == -1)
|
||||
break;
|
||||
|
||||
output[i * 4 + j] = float(digit1 * 16 + digit2) * INV_255;
|
||||
|
@ -6294,10 +6336,42 @@ std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& col
|
|||
return output;
|
||||
}
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
||||
{
|
||||
std::string text;
|
||||
bool error = false;
|
||||
switch (warning) {
|
||||
case EWarning::ObjectOutside: text = _u8L("An object outside the print area was detected."); break;
|
||||
case EWarning::ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = true; break;
|
||||
case EWarning::SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = true; break;
|
||||
case EWarning::SomethingNotShown: text = _u8L("Some objects are not visible."); break;
|
||||
case EWarning::ObjectClashed:
|
||||
text = _u8L("An object outside the print area was detected.\n"
|
||||
"Resolve the current problem to continue slicing.");
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
auto& notification_manager = *wxGetApp().plater()->get_notification_manager();
|
||||
if (state) {
|
||||
if (error)
|
||||
notification_manager.push_plater_error_notification(text);
|
||||
else
|
||||
notification_manager.push_plater_warning_notification(text);
|
||||
}
|
||||
else {
|
||||
if (error)
|
||||
notification_manager.close_plater_error_notification(text);
|
||||
else
|
||||
notification_manager.close_plater_warning_notification(text);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void GLCanvas3D::_set_warning_texture(WarningTexture::Warning warning, bool state)
|
||||
{
|
||||
m_warning_texture.activate(warning, state, *this);
|
||||
}
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
bool GLCanvas3D::_is_any_volume_outside() const
|
||||
{
|
||||
|
@ -6313,8 +6387,7 @@ void GLCanvas3D::_update_selection_from_hover()
|
|||
{
|
||||
bool ctrl_pressed = wxGetKeyState(WXK_CONTROL);
|
||||
|
||||
if (m_hover_volume_idxs.empty())
|
||||
{
|
||||
if (m_hover_volume_idxs.empty()) {
|
||||
if (!ctrl_pressed && (m_rectangle_selection.get_state() == GLSelectionRectangle::Select))
|
||||
m_selection.remove_all();
|
||||
|
||||
|
@ -6324,50 +6397,40 @@ void GLCanvas3D::_update_selection_from_hover()
|
|||
GLSelectionRectangle::EState state = m_rectangle_selection.get_state();
|
||||
|
||||
bool hover_modifiers_only = true;
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
if (!m_volumes.volumes[i]->is_modifier)
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
if (!m_volumes.volumes[i]->is_modifier) {
|
||||
hover_modifiers_only = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool selection_changed = false;
|
||||
if (state == GLSelectionRectangle::Select)
|
||||
{
|
||||
if (state == GLSelectionRectangle::Select) {
|
||||
bool contains_all = true;
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
if (!m_selection.contains_volume((unsigned int)i))
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
if (!m_selection.contains_volume((unsigned int)i)) {
|
||||
contains_all = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the selection is going to be modified (Add)
|
||||
if (!contains_all)
|
||||
{
|
||||
if (!contains_all) {
|
||||
wxGetApp().plater()->take_snapshot(_(L("Selection-Add from rectangle")));
|
||||
selection_changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
bool contains_any = false;
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
if (m_selection.contains_volume((unsigned int)i))
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
if (m_selection.contains_volume((unsigned int)i)) {
|
||||
contains_any = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the selection is going to be modified (Remove)
|
||||
if (contains_any)
|
||||
{
|
||||
if (contains_any) {
|
||||
wxGetApp().plater()->take_snapshot(_(L("Selection-Remove from rectangle")));
|
||||
selection_changed = true;
|
||||
}
|
||||
|
@ -6381,12 +6444,9 @@ void GLCanvas3D::_update_selection_from_hover()
|
|||
if ((state == GLSelectionRectangle::Select) && !ctrl_pressed)
|
||||
m_selection.clear();
|
||||
|
||||
for (int i : m_hover_volume_idxs)
|
||||
{
|
||||
if (state == GLSelectionRectangle::Select)
|
||||
{
|
||||
if (hover_modifiers_only)
|
||||
{
|
||||
for (int i : m_hover_volume_idxs) {
|
||||
if (state == GLSelectionRectangle::Select) {
|
||||
if (hover_modifiers_only) {
|
||||
const GLVolume& v = *m_volumes.volumes[i];
|
||||
m_selection.add_volume(v.object_idx(), v.volume_idx(), v.instance_idx(), false);
|
||||
}
|
||||
|
@ -6409,13 +6469,11 @@ void GLCanvas3D::_update_selection_from_hover()
|
|||
|
||||
bool GLCanvas3D::_deactivate_undo_redo_toolbar_items()
|
||||
{
|
||||
if (m_undoredo_toolbar.is_item_pressed("undo"))
|
||||
{
|
||||
if (m_undoredo_toolbar.is_item_pressed("undo")) {
|
||||
m_undoredo_toolbar.force_right_action(m_undoredo_toolbar.get_item_id("undo"), *this);
|
||||
return true;
|
||||
}
|
||||
else if (m_undoredo_toolbar.is_item_pressed("redo"))
|
||||
{
|
||||
else if (m_undoredo_toolbar.is_item_pressed("redo")) {
|
||||
m_undoredo_toolbar.force_right_action(m_undoredo_toolbar.get_item_id("redo"), *this);
|
||||
return true;
|
||||
}
|
||||
|
@ -6440,8 +6498,7 @@ bool GLCanvas3D::_deactivate_arrange_menu()
|
|||
|
||||
bool GLCanvas3D::_deactivate_search_toolbar_item()
|
||||
{
|
||||
if (is_search_pressed())
|
||||
{
|
||||
if (is_search_pressed()) {
|
||||
m_main_toolbar.force_left_action(m_main_toolbar.get_item_id("search"), *this);
|
||||
return true;
|
||||
}
|
||||
|
@ -6451,8 +6508,7 @@ bool GLCanvas3D::_deactivate_search_toolbar_item()
|
|||
|
||||
bool GLCanvas3D::_activate_search_toolbar_item()
|
||||
{
|
||||
if (!m_main_toolbar.is_item_pressed("search"))
|
||||
{
|
||||
if (!m_main_toolbar.is_item_pressed("search")) {
|
||||
m_main_toolbar.force_left_action(m_main_toolbar.get_item_id("search"), *this);
|
||||
return true;
|
||||
}
|
||||
|
@ -6463,8 +6519,7 @@ bool GLCanvas3D::_activate_search_toolbar_item()
|
|||
bool GLCanvas3D::_deactivate_collapse_toolbar_items()
|
||||
{
|
||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||
if (collapse_toolbar.is_item_pressed("print"))
|
||||
{
|
||||
if (collapse_toolbar.is_item_pressed("print")) {
|
||||
collapse_toolbar.force_left_action(collapse_toolbar.get_item_id("print"), *this);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -302,6 +302,15 @@ class GLCanvas3D
|
|||
bool matches(double z) const { return this->z == z; }
|
||||
};
|
||||
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
enum class EWarning {
|
||||
ObjectOutside,
|
||||
ToolpathOutside,
|
||||
SlaSupportsOutside,
|
||||
SomethingNotShown,
|
||||
ObjectClashed
|
||||
};
|
||||
#else
|
||||
class WarningTexture : public GUI::GLTexture
|
||||
{
|
||||
public:
|
||||
|
@ -340,6 +349,7 @@ class GLCanvas3D
|
|||
// Generates the texture with given text.
|
||||
bool generate(const std::string& msg, const GLCanvas3D& canvas, bool compress, bool red_colored = false);
|
||||
};
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
#if ENABLE_RENDER_STATISTICS
|
||||
class RenderStats
|
||||
|
@ -437,7 +447,9 @@ private:
|
|||
std::unique_ptr<RetinaHelper> m_retina_helper;
|
||||
#endif
|
||||
bool m_in_render;
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
WarningTexture m_warning_texture;
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
wxTimer m_timer;
|
||||
LayersEditing m_layers_editing;
|
||||
Mouse m_mouse;
|
||||
|
@ -578,10 +590,8 @@ public:
|
|||
|
||||
void bed_shape_changed();
|
||||
|
||||
void set_clipping_plane(unsigned int id, const ClippingPlane& plane)
|
||||
{
|
||||
if (id < 2)
|
||||
{
|
||||
void set_clipping_plane(unsigned int id, const ClippingPlane& plane) {
|
||||
if (id < 2) {
|
||||
m_clipping_planes[id] = plane;
|
||||
m_sla_caps[id].reset();
|
||||
}
|
||||
|
@ -812,7 +822,9 @@ private:
|
|||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
void _check_and_update_toolbar_icon_scale() const;
|
||||
void _render_overlays() const;
|
||||
#if !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void _render_warning_texture() const;
|
||||
#endif // !ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void _render_volumes_for_picking() const;
|
||||
void _render_current_gizmo() const;
|
||||
void _render_gizmos_overlay() const;
|
||||
|
@ -865,10 +877,17 @@ private:
|
|||
void _load_sla_shells();
|
||||
void _update_toolpath_volumes_outside_state();
|
||||
void _update_sla_shells_outside_state();
|
||||
#if ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
void _set_warning_notification_if_needed(EWarning warning);
|
||||
|
||||
// generates a warning notification containing the given message
|
||||
void _set_warning_notification(EWarning warning, bool state);
|
||||
#else
|
||||
void _show_warning_texture_if_needed(WarningTexture::Warning warning);
|
||||
|
||||
// generates a warning texture containing the given message
|
||||
void _set_warning_texture(WarningTexture::Warning warning, bool state);
|
||||
#endif // ENABLE_WARNING_TEXTURE_REMOVAL
|
||||
|
||||
bool _is_any_volume_outside() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue