Merge branch 'main' into dev/bbl-network-upd

This commit is contained in:
Noisyfox
2025-05-14 19:46:08 +08:00
committed by GitHub
35 changed files with 707 additions and 361 deletions

View File

@@ -57,7 +57,6 @@ if (SLIC3R_GUI)
include(${wxWidgets_USE_FILE})
find_package(JPEG QUIET)
find_package(TIFF QUIET)
string(REGEX MATCH "wxpng" WX_PNG_BUILTIN ${wxWidgets_LIBRARIES})
if (PNG_FOUND AND NOT WX_PNG_BUILTIN)
@@ -65,12 +64,6 @@ if (SLIC3R_GUI)
list(APPEND wxWidgets_LIBRARIES ${PNG_LIBRARIES})
endif ()
string(REGEX MATCH "wxtiff" WX_TIFF_BUILTIN ${wxWidgets_LIBRARIES})
if (TIFF_FOUND AND NOT WX_TIFF_BUILTIN)
list(FILTER wxWidgets_LIBRARIES EXCLUDE REGEX tiff)
list(APPEND wxWidgets_LIBRARIES ${TIFF_LIBRARIES})
endif ()
string(REGEX MATCH "wxjpeg" WX_JPEG_BUILTIN ${wxWidgets_LIBRARIES})
if (JPEG_FOUND AND NOT WX_JPEG_BUILTIN)
list(FILTER wxWidgets_LIBRARIES EXCLUDE REGEX jpeg)

View File

@@ -212,8 +212,8 @@ void Bed3D::Axes::render()
const Transform3d& view_matrix = camera.get_view_matrix();
shader->set_uniform("view_model_matrix", view_matrix * transform);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * transform.matrix().block(0, 0, 3, 3).inverse().transpose();
shader->set_uniform("view_normal_matrix", view_normal_matrix);
//const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * transform.matrix().block(0, 0, 3, 3).inverse().transpose();
//shader->set_uniform("view_normal_matrix", view_normal_matrix);
m_arrow.render();
};
@@ -228,7 +228,7 @@ void Bed3D::Axes::render()
glsafe(::glEnable(GL_DEPTH_TEST));
shader->start_using();
shader->set_uniform("emission_factor", 0.0f);
//shader->set_uniform("emission_factor", 0.0f);
// x axis
m_arrow.set_color(AXIS_X_COLOR);

View File

@@ -628,8 +628,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
// non-organic tree support use max_bridge_length instead of bridge_no_support
toggle_line("max_bridge_length", support_is_normal_tree);
toggle_line("bridge_no_support", !support_is_normal_tree);
// This is only supported for auto normal tree
toggle_line("support_critical_regions_only", is_auto(support_type) && support_is_tree);
for (auto el : { "support_interface_spacing", "support_interface_filament",

View File

@@ -667,7 +667,7 @@ void GLCanvas3D::LayersEditing::update_slicing_parameters()
m_slicing_parameters = new SlicingParameters();
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z, m_shrinkage_compensation);
}
}
float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D & canvas)
@@ -1050,14 +1050,14 @@ void GLCanvas3D::load_arrange_settings()
std::string en_rot_sla_str =
wxGetApp().app_config->get("arrange", "enable_rotation_sla");
std::string en_allow_multiple_materials_str =
wxGetApp().app_config->get("arrange", "allow_multi_materials_on_same_plate");
std::string en_avoid_region_str =
wxGetApp().app_config->get("arrange", "avoid_extrusion_cali_region");
if (!dist_fff_str.empty())
m_arrange_settings_fff.distance = std::stof(dist_fff_str);
@@ -1070,14 +1070,14 @@ void GLCanvas3D::load_arrange_settings()
if (!en_rot_fff_str.empty())
m_arrange_settings_fff.enable_rotation = (en_rot_fff_str == "1" || en_rot_fff_str == "true");
if (!en_allow_multiple_materials_str.empty())
m_arrange_settings_fff.allow_multi_materials_on_same_plate = (en_allow_multiple_materials_str == "1" || en_allow_multiple_materials_str == "true");
if (!en_rot_fff_seqp_str.empty())
m_arrange_settings_fff_seq_print.enable_rotation = (en_rot_fff_seqp_str == "1" || en_rot_fff_seqp_str == "true");
if(!en_avoid_region_str.empty())
m_arrange_settings_fff.avoid_extrusion_cali_region = (en_avoid_region_str == "1" || en_avoid_region_str == "true");
@@ -1500,7 +1500,7 @@ void GLCanvas3D::set_config(const DynamicPrintConfig* config)
{
m_config = config;
m_layers_editing.set_config(config);
// Orca: Filament shrinkage compensation
const Print *print = fff_print();
if (print != nullptr)
@@ -1837,7 +1837,7 @@ void GLCanvas3D::render(bool only_init)
if (!is_initialized() && !init())
return;
if (m_canvas_type == ECanvasType::CanvasView3D && m_gizmos.get_current_type() == GLGizmosManager::Undefined) {
if (m_canvas_type == ECanvasType::CanvasView3D && m_gizmos.get_current_type() == GLGizmosManager::Undefined) {
enable_return_toolbar(false);
}
if (!m_main_toolbar.is_enabled())
@@ -2302,7 +2302,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
if (!m_initialized)
return;
_set_current();
m_hover_volume_idxs.clear();
@@ -3259,7 +3259,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case WXK_F5: {
if (wxGetApp().mainframe->is_printer_view())
wxGetApp().mainframe->load_printer_url();
//if ((wxGetApp().is_editor() && !wxGetApp().plater()->model().objects.empty()) ||
// (wxGetApp().is_gcode_viewer() && !wxGetApp().plater()->get_last_loaded_gcode().empty()))
// post_event(SimpleEvent(EVT_GLCANVAS_RELOAD_FROM_DISK));
@@ -3278,7 +3278,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case '3':
case '4':
case '5':
case '6':
case '6':
case '7':
case '8':
case '9': {
@@ -3315,15 +3315,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE));
break;
}
case 'r':
case 'R':
{
if ((evt.GetModifiers() & shiftMask) != 0)
post_event(SimpleEvent(EVT_GLCANVAS_ORIENT_PARTPLATE));
else
post_event(SimpleEvent(EVT_GLCANVAS_ORIENT));
break;
}
//case 'B':
//case 'b': { zoom_to_bed(); break; }
case 'C':
@@ -3351,6 +3342,15 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
//}
case 'O':
case 'o': { _update_camera_zoom(-1.0); break; }
case 'q':
case 'Q':
{
if ((evt.GetModifiers() & shiftMask) != 0)
post_event(SimpleEvent(EVT_GLCANVAS_ORIENT_PARTPLATE));
else
post_event(SimpleEvent(EVT_GLCANVAS_ORIENT));
break;
}
//case 'Z':
//case 'z': {
// if (!m_selection.is_empty())
@@ -4316,7 +4316,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
}
// do not process the dragging if the left mouse was set down in another canvas
else if (is_camera_rotate(evt)) {
// Orca: Sphere rotation for painting view
// Orca: Sphere rotation for painting view
// if dragging over blank area with left button, rotate
if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
Camera& camera = wxGetApp().plater()->get_camera();
@@ -4536,14 +4536,14 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
// Detection of doubleclick on text to open emboss edit window
auto type = m_gizmos.get_current_type();
if (evt.LeftDClick() && !m_hover_volume_idxs.empty() &&
if (evt.LeftDClick() && !m_hover_volume_idxs.empty() &&
(type == GLGizmosManager::EType::Undefined ||
type == GLGizmosManager::EType::Move ||
type == GLGizmosManager::EType::Rotate ||
type == GLGizmosManager::EType::Scale ||
type == GLGizmosManager::EType::Emboss ||
type == GLGizmosManager::EType::Svg) ) {
for (int hover_volume_id : m_hover_volume_idxs) {
for (int hover_volume_id : m_hover_volume_idxs) {
const GLVolume &hover_gl_volume = *m_volumes.volumes[hover_volume_id];
int object_idx = hover_gl_volume.object_idx();
if (object_idx < 0 || static_cast<size_t>(object_idx) >= m_model->objects.size()) continue;
@@ -4555,7 +4555,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
if (hover_volume->text_configuration.has_value()) {
m_selection.add_volumes(Selection::EMode::Volume, {(unsigned) hover_volume_id});
if (type != GLGizmosManager::EType::Emboss)
m_gizmos.open_gizmo(GLGizmosManager::EType::Emboss);
m_gizmos.open_gizmo(GLGizmosManager::EType::Emboss);
wxGetApp().obj_list()->update_selections();
return;
} else if (hover_volume->emboss_shape.has_value()) {
@@ -5484,7 +5484,7 @@ bool GLCanvas3D::is_object_sinking(int object_idx) const
return false;
}
void GLCanvas3D::apply_retina_scale(Vec2d &screen_coordinate) const
void GLCanvas3D::apply_retina_scale(Vec2d &screen_coordinate) const
{
#if ENABLE_RETINA_GL
double scale = static_cast<double>(m_retina_helper->get_scale_factor());
@@ -5776,7 +5776,7 @@ void GLCanvas3D::_render_3d_navigator()
strcpy(style.FaceLabels[ImGuizmo::FACES::FACE_BOTTOM], _utf8("Bottom").c_str());
strcpy(style.FaceLabels[ImGuizmo::FACES::FACE_LEFT], _utf8("Left").c_str());
strcpy(style.FaceLabels[ImGuizmo::FACES::FACE_RIGHT], _utf8("Right").c_str());
float sc = get_scale();
#ifdef WIN32
const int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
@@ -6062,7 +6062,7 @@ void GLCanvas3D::render_thumbnail_internal(ThumbnailData& thumbnail_data, const
shader->set_uniform("view_model_matrix", view_matrix * model_matrix);
shader->set_uniform("projection_matrix", projection_matrix);
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader->set_uniform("view_normal_matrix", view_normal_matrix);
shader->set_uniform("view_normal_matrix", view_normal_matrix);
vol->simple_render(shader, model_objects, extruder_colors, ban_light);
vol->is_active = is_active;
}
@@ -6458,7 +6458,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "orient";
item.icon_filename = m_is_dark ? "toolbar_orient_dark.svg" : "toolbar_orient.svg";
item.tooltip = _utf8(L("Auto orient"));
item.tooltip = _utf8(L("Auto orient all/selected objects")) + " [Q]\n" + _utf8(L("Auto orient all objects on current plate")) + " [Shift+Q]";
item.sprite_id++;
item.left.render_callback = nullptr;
item.enabling_callback = []()->bool { return wxGetApp().plater()->can_arrange(); };
@@ -7914,7 +7914,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
#if ENABLE_RETINA_GL
float f_scale = m_retina_helper->get_scale_factor();
#else
float f_scale = wxGetApp().em_unit() / 10; // ORCA add scaling support
float f_scale = wxGetApp().em_unit() / 10; // ORCA add scaling support
#endif
Size cnv_size = get_canvas_size();
auto canvas_w = float(cnv_size.get_width());
@@ -7953,7 +7953,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
float window_width = button_width + (margin_size + button_margin + ImGui::GetStyle().WindowPadding.x) * 2 + (show_scroll ? scrollbar_size : 0);
ImVec4 window_bg = m_is_dark ? ImVec4(.13f, .13f, .15f, .5f) : ImVec4(1.f, 1.f, 1.f, .7f);
ImVec4 button_active = ImGuiWrapper::COL_ORCA; // ORCA: Use orca color for selected sliced plate border
ImVec4 button_active = ImGuiWrapper::COL_ORCA; // ORCA: Use orca color for selected sliced plate border
ImVec4 button_hover = ImVec4(0.67f, 0.67f, 0.67, m_is_dark ? .6f : 1.0f);
ImVec4 scroll_col = ImVec4(0.77f, 0.77f, 0.77f, m_is_dark ? .6f : 1.0f);
ImU32 plate_bg = m_is_dark ? IM_COL32(255, 255, 255, 10) : IM_COL32(0, 0, 0, 10);
@@ -7963,7 +7963,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
//use white text as the background switch to black
ImGui::PushStyleColor(ImGuiCol_Text, m_is_dark ? ImVec4(.9f, .9f, .9f, 1) : ImVec4(.3f, .3f, .3f, 1)); // ORCA Plate number text > Add support for dark mode
ImGui::PushStyleColor(ImGuiCol_WindowBg, window_bg);
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA using background color with opacity creates a second color. This prevents secondary color
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImVec4(0.f, 0.f, 0.f, 0.f)); // ORCA using background color with opacity creates a second color. This prevents secondary color
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, scroll_col);
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, scroll_col);
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, scroll_col);

View File

@@ -41,6 +41,12 @@ std::string GLGizmoAssembly::on_get_name() const
}
}
bool GLGizmoAssembly::on_init()
{
m_shortcut_key = WXK_CONTROL_Y;
return true;
}
bool GLGizmoAssembly::on_is_activable() const
{
const Selection& selection = m_parent.get_selection();

View File

@@ -24,7 +24,7 @@ public:
std::string get_gizmo_entering_text() const override { return _u8L("Entering Assembly gizmo"); }
std::string get_gizmo_leaving_text() const override { return _u8L("Leaving Assembly gizmo"); }
protected:
//bool on_init() override;
bool on_init() override;
std::string on_get_name() const override;
bool on_is_activable() const override;
//void on_render() override;

View File

@@ -42,8 +42,8 @@ bool GLGizmoBrimEars::on_init()
{
m_new_point_head_diameter = get_brim_default_radius();
m_shortcut_key = WXK_CONTROL_L;
m_shortcut_key = WXK_CONTROL_E;
m_desc["head_diameter"] = _L("Head diameter");
m_desc["max_angle"] = _L("Max angle");
@@ -110,10 +110,12 @@ void GLGizmoBrimEars::render_points(const Selection &selection)
if (!has_points) return;
GLShaderProgram *shader = wxGetApp().get_shader("gouraud_light");
if (shader != nullptr) shader->start_using();
const auto shader = wxGetApp().get_shader("gouraud_light");
if (shader == nullptr)
return;
shader->start_using();
ScopeGuard guard([shader]() {
if (shader != nullptr) shader->stop_using();
shader->stop_using();
});
const Camera& camera = wxGetApp().plater()->get_camera();
@@ -122,6 +124,8 @@ void GLGizmoBrimEars::render_points(const Selection &selection)
const Transform3d &instance_scaling_matrix_inverse = vol->get_instance_transformation().get_scaling_factor_matrix().inverse();
const Transform3d &instance_matrix = vol->get_instance_transformation().get_matrix();
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
ColorRGBA render_color;
for (size_t i = 0; i < cache_size; ++i) {
const BrimPoint &brim_point = editing_cache[i].brim_point;
@@ -151,7 +155,7 @@ void GLGizmoBrimEars::render_points(const Selection &selection)
}
m_cylinder.model.set_color(render_color);
if (shader) shader->set_uniform("emission_factor", 0.5f);
shader->set_uniform("emission_factor", 0.5f);
if (vol->is_left_handed()) glFrontFace(GL_CW);
@@ -164,10 +168,10 @@ void GLGizmoBrimEars::render_points(const Selection &selection)
double radius = (double) brim_point.head_front_radius * RenderPointScale;
const Transform3d center_matrix =
instance_matrix
* Geometry::translation_transform(brim_point.pos.cast<double>())
instance_matrix
* Geometry::translation_transform(brim_point.pos.cast<double>())
// Inverse matrix of the instance scaling is applied so that the mark does not scale with the object.
* instance_scaling_matrix_inverse
* instance_scaling_matrix_inverse
* q
* Geometry::scale_transform(Vec3d{radius, radius, .2});
if (i < m_grabbers.size()) {
@@ -274,7 +278,7 @@ bool GLGizmoBrimEars::on_mouse(const wxMouseEvent& mouse_event)
if (mouse_event.Moving()) {
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false);
}
// when control is down we allow scene pan and rotation even when clicking
// over some object
bool control_down = mouse_event.CmdDown();
@@ -283,14 +287,14 @@ bool GLGizmoBrimEars::on_mouse(const wxMouseEvent& mouse_event)
const Selection &selection = m_parent.get_selection();
int selected_object_idx = selection.get_object_idx();
if (mouse_event.LeftDown()) {
if ((!control_down || grabber_contains_mouse) &&
if ((!control_down || grabber_contains_mouse) &&
gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false))
// the gizmo got the event and took some action, there is no need
// to do anything more
return true;
} else if (mouse_event.RightDown()){
if (!control_down && selected_object_idx != -1 &&
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false))
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false))
// event was taken care of
return true;
} else if (mouse_event.Dragging()) {

View File

@@ -201,7 +201,7 @@ void KBShortcutsDialog::fill_shortcuts()
#else
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
#endif // __APPLE
// Switch table page
{ ctrl + "Tab", L("Switch table page")},
//DEL
@@ -222,8 +222,8 @@ void KBShortcutsDialog::fill_shortcuts()
{ "A", L("Arrange all objects") },
{ L("Shift+A"), L("Arrange objects on selected plates") },
//{ "R", L("Auto orientates selected objects or all objects.If there are selected objects, it just orientates the selected ones.Otherwise, it will orientates all objects in the project.") },
{L("Shift+R"), L("Auto orientates selected objects or all objects.If there are selected objects, it just orientates the selected ones.Otherwise, it will orientates all objects in the current disk.")},
{ "Q", L("Auto orients selected objects or all objects. If there are selected objects, it just orients the selected ones. Otherwise, it will orient all objects in the current project.") },
{L("Shift+Q"), L("Auto orients all objects on the active plate.")},
{L("Shift+Tab"), L("Collapse/Expand the sidebar")},
#ifdef __APPLE__
@@ -257,15 +257,19 @@ void KBShortcutsDialog::fill_shortcuts()
{ctrl + "Z", L("Undo")},
{ctrl + "Y", L("Redo")},
{ "M", L("Gizmo move") },
{ "S", L("Gizmo scale") },
{ "R", L("Gizmo rotate") },
{ "S", L("Gizmo scale") },
{ "F", L("Gizmo place face on bed") },
{ "C", L("Gizmo cut") },
{ "F", L("Gizmo Place face on bed") },
{ "B", L("Gizmo mesh boolean") },
{ "L", L("Gizmo SLA support points") },
{ "P", L("Gizmo FDM paint-on seam") },
{ "T", L("Gizmo Text emboss / engrave")},
{ "I", L("Zoom in")},
{ "O", L("Zoom out")},
{ "T", L("Gizmo text emboss/engrave") },
{ "U", L("Gizmo measure") },
{ "Y", L("Gizmo assemble") },
{ "E", L("Gizmo brim ears") },
{ "I", L("Zoom in") },
{ "O", L("Zoom out") },
{ "Tab", L("Switch between Prepare/Preview") },
};

View File

@@ -590,7 +590,7 @@ Slic3r::GUI::PageShp Tab::add_options_page(const wxString& title, const std::str
}
// Initialize the page.
//BBS: GUI refactor
PageShp page(new Page(m_page_view, title, icon_idx, this));
PageShp page = std::make_shared<Page>(m_page_view, title, icon_idx, this);
// page->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
#ifdef __WINDOWS__
// page->SetDoubleBuffered(true);
@@ -6263,8 +6263,12 @@ void Page::update_visibility(ConfigOptionMode mode, bool update_contolls_visibil
#ifdef __WXMSW__
if (!m_show) return;
// BBS: fix field control position
wxTheApp->CallAfter([this]() {
for (auto group : m_optgroups) {
wxTheApp->CallAfter([wp=std::weak_ptr<Page>(shared_from_this())]() {
auto page = wp.lock();
if (!page)
return;
for (auto group : page->m_optgroups) {
if (group->custom_ctrl) group->custom_ctrl->fixup_items_positions();
}
});

View File

@@ -57,7 +57,7 @@ class OG_CustomCtrl;
// Single Tab page containing a{ vsizer } of{ optgroups }
// package Slic3r::GUI::Tab::Page;
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
class Page// : public wxScrolledWindow
class Page: public std::enable_shared_from_this<Page>// : public wxScrolledWindow
{
//BBS: GUI refactor
wxPanel* m_tab_owner;