Fixing compile errors

This commit is contained in:
sentientstardust
2026-05-02 21:14:58 +01:00
parent e70831f5b5
commit 7899f15b58
4 changed files with 62 additions and 25 deletions

View File

@@ -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 &region_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;

View File

@@ -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<ColorRGBA> get_extruders_colors()
{
return wxGetApp().plater() != nullptr ? wxGetApp().plater()->get_extruders_colors() : std::vector<ColorRGBA>{};
}
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<ColorRGBA> get_extruders_colors()
{
unsigned char rgb_color[3] = {};
std::vector<std::string> colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config();
std::vector<ColorRGBA> 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<int> get_extruder_id_for_volumes(const ModelObject &model_object)
{
std::vector<int> extruders_idx;
@@ -4158,8 +4148,18 @@ static bool convert_object_to_color_regions(ModelObject &object, const ManagedCo
std::vector<unsigned char> filament_ids;
unsigned char first_extruder_id = 1;
const std::vector<std::string> 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<unsigned char> filament_ids;
unsigned char first_extruder_id = 1;
const std::vector<std::string> 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;

View File

@@ -116,7 +116,7 @@ struct TexturePreviewSimulationCacheEntry
std::future<TexturePreviewSimulationResult> 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();

View File

@@ -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];