From 7899f15b58740233225d453315098a8ba5341be4 Mon Sep 17 00:00:00 2001 From: sentientstardust Date: Sat, 2 May 2026 21:14:58 +0100 Subject: [PATCH] Fixing compile errors --- src/libslic3r/Print.cpp | 20 +++++++-- .../GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 44 +++++++++++-------- src/slic3r/GUI/MMUPaintedTexturePreview.cpp | 21 +++++++-- src/slic3r/GUI/Plater.cpp | 2 +- 4 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index e94774af17a..6557a32cd56 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -3376,9 +3376,23 @@ void Print::_make_wipe_tower() texture.enabled = true; texture.generic_fallback_for_missing_channels = auto_mode; texture.angle_offset_deg = m_texture_mapping_global_settings.angle_offset_deg; - texture.global_strength = std::clamp(float(m_config.texture_mapping_outer_wall_gradient_global_strength.value) / 100.f, 0.f, 1.f); - texture.max_line_width = std::max(0.05f, float(m_config.texture_mapping_outer_wall_gradient_max_line_width.value)); - texture.min_line_width = std::max(0.05f, float(m_config.texture_mapping_outer_wall_gradient_min_line_width.value)); + float texture_global_strength_pct = float(m_default_region_config.texture_mapping_outer_wall_gradient_global_strength.value); + float texture_max_line_width = float(m_default_region_config.texture_mapping_outer_wall_gradient_max_line_width.value); + float texture_min_line_width = float(m_default_region_config.texture_mapping_outer_wall_gradient_min_line_width.value); + for (const PrintRegion *region : m_print_regions) { + if (region == nullptr) + continue; + const PrintRegionConfig ®ion_config = region->config(); + texture_global_strength_pct = std::max(texture_global_strength_pct, + float(region_config.texture_mapping_outer_wall_gradient_global_strength.value)); + texture_max_line_width = std::max(texture_max_line_width, + float(region_config.texture_mapping_outer_wall_gradient_max_line_width.value)); + texture_min_line_width = std::min(texture_min_line_width, + float(region_config.texture_mapping_outer_wall_gradient_min_line_width.value)); + } + texture.global_strength = std::clamp(texture_global_strength_pct / 100.f, 0.f, 1.f); + texture.max_line_width = std::max(0.05f, texture_max_line_width); + texture.min_line_width = std::max(0.05f, texture_min_line_width); texture.image_rgba = m_texture_mapping_prime_tower_image.rgba; texture.image_width = m_texture_mapping_prime_tower_image.width; texture.image_height = m_texture_mapping_prime_tower_image.height; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index d6f261643e6..2c9c4539e7c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -52,6 +52,11 @@ static inline void show_notification_extruders_limit_exceeded() "first %1% filaments will be available in painting tool."), GLGizmoMmuSegmentation::EXTRUDERS_LIMIT)); } +static std::vector get_extruders_colors() +{ + return wxGetApp().plater() != nullptr ? wxGetApp().plater()->get_extruders_colors() : std::vector{}; +} + void GLGizmoMmuSegmentation::on_opening() { if (get_extruders_colors().size() > GLGizmoMmuSegmentation::EXTRUDERS_LIMIT) @@ -81,21 +86,6 @@ bool GLGizmoMmuSegmentation::on_is_activable() const return !selection.is_empty() && (selection.is_single_full_instance() || selection.is_any_volume()) && wxGetApp().filaments_cnt() > 1; } -//BBS: use the global one in 3DScene.cpp -/*static std::vector get_extruders_colors() -{ - unsigned char rgb_color[3] = {}; - std::vector colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config(); - std::vector colors_out(colors.size()); - for (const std::string &color : colors) { - Slic3r::GUI::BitmapCache::parse_color(color, rgb_color); - size_t color_idx = &color - &colors.front(); - colors_out[color_idx] = {float(rgb_color[0]) / 255.f, float(rgb_color[1]) / 255.f, float(rgb_color[2]) / 255.f, 1.f}; - } - - return colors_out; -}*/ - static std::vector get_extruder_id_for_volumes(const ModelObject &model_object) { std::vector extruders_idx; @@ -4158,8 +4148,18 @@ static bool convert_object_to_color_regions(ModelObject &object, const ManagedCo std::vector filament_ids; unsigned char first_extruder_id = 1; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - ObjColorDialog color_dlg(parent, input_colors, is_single_color, extruder_colours, filament_ids, first_extruder_id); - if (color_dlg.ShowModal() != wxID_OK || filament_ids.size() != input_colors.size()) + ObjDialogInOut in_out; + in_out.input_colors = input_colors; + in_out.is_single_color = is_single_color; + in_out.filament_ids = filament_ids; + in_out.first_extruder_id = first_extruder_id; + in_out.deal_vertex_color = true; + ObjColorDialog color_dlg(parent, in_out, extruder_colours); + if (color_dlg.ShowModal() != wxID_OK) + return false; + filament_ids = in_out.filament_ids; + first_extruder_id = in_out.first_extruder_id; + if (filament_ids.size() != input_colors.size()) return false; Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Create 3mf color regions", UndoRedo::SnapshotType::GizmoAction); @@ -5419,9 +5419,17 @@ void GLGizmoMmuSegmentation::open_obj_vertex_color_mapping_dialog() std::vector filament_ids; unsigned char first_extruder_id = 1; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - ObjColorDialog color_dlg(nullptr, input_colors, is_single_color, extruder_colours, filament_ids, first_extruder_id); + ObjDialogInOut in_out; + in_out.input_colors = input_colors; + in_out.is_single_color = is_single_color; + in_out.filament_ids = filament_ids; + in_out.first_extruder_id = first_extruder_id; + in_out.deal_vertex_color = true; + ObjColorDialog color_dlg(nullptr, in_out, extruder_colours); if (color_dlg.ShowModal() != wxID_OK) return; + filament_ids = in_out.filament_ids; + first_extruder_id = in_out.first_extruder_id; if (filament_ids.empty()) return; diff --git a/src/slic3r/GUI/MMUPaintedTexturePreview.cpp b/src/slic3r/GUI/MMUPaintedTexturePreview.cpp index f2f44eadd76..d64c055f40b 100644 --- a/src/slic3r/GUI/MMUPaintedTexturePreview.cpp +++ b/src/slic3r/GUI/MMUPaintedTexturePreview.cpp @@ -116,7 +116,7 @@ struct TexturePreviewSimulationCacheEntry std::future pending_future; }; -bool model_volume_has_texture_preview_data(const ModelVolume &model_volume) +bool model_volume_has_texture_preview_data_impl(const ModelVolume &model_volume) { return !model_volume.imported_texture_rgba.empty() && model_volume.imported_texture_width > 0 && @@ -127,13 +127,13 @@ bool model_volume_has_texture_preview_data(const ModelVolume &model_volume) size_t(model_volume.imported_texture_width) * size_t(model_volume.imported_texture_height) * 4; } -bool model_volume_has_vertex_color_preview_data(const ModelVolume &model_volume) +bool model_volume_has_vertex_color_preview_data_impl(const ModelVolume &model_volume) { return !model_volume.imported_vertex_colors_rgba.empty() && model_volume.imported_vertex_colors_rgba.size() == model_volume.mesh().its.vertices.size(); } -bool model_volume_has_texture_mapping_color_preview_data(const ModelVolume &model_volume) +bool model_volume_has_texture_mapping_color_preview_data_impl(const ModelVolume &model_volume) { return !model_volume.texture_mapping_color_facets.empty(); } @@ -2425,6 +2425,21 @@ void set_common_uniforms(GLShaderProgram &shader, } // namespace +bool model_volume_has_texture_preview_data(const ModelVolume &model_volume) +{ + return model_volume_has_texture_preview_data_impl(model_volume); +} + +bool model_volume_has_vertex_color_preview_data(const ModelVolume &model_volume) +{ + return model_volume_has_vertex_color_preview_data_impl(model_volume); +} + +bool model_volume_has_texture_mapping_color_preview_data(const ModelVolume &model_volume) +{ + return model_volume_has_texture_mapping_color_preview_data_impl(model_volume); +} + bool texture_preview_simulation_is_pending() { return texture_preview_simulation_is_pending_impl(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 64a143403f2..7a49a39e5ed 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5393,7 +5393,7 @@ void Sidebar::update_texture_mapping_panel(bool sync_manager) apply_zone(std::move(updated)); update_texture_mapping_panel(false); }); - advanced_btn->Bind(wxEVT_BUTTON, [this, zone_index, mgr_ptr, palette, apply_zone](wxCommandEvent &) { + advanced_btn->Bind(wxEVT_BUTTON, [this, zone_index, mgr_ptr, palette, apply_zone, bundle, set_config_string](wxCommandEvent &) { if (zone_index >= mgr_ptr->zones().size()) return; TextureMappingZone updated = mgr_ptr->zones()[zone_index];