Add flag to toggle whether some top-surface coloring options are visible in the UI

This commit is contained in:
sentientstardust
2026-05-27 23:57:37 +01:00
parent 1fcd74ac77
commit 11cacfabab
4 changed files with 250 additions and 128 deletions

View File

@@ -3093,7 +3093,7 @@ static std::vector<TopSurfaceImageRegionPlan> top_surface_image_region_plans(
plan.min_width_mm = std::clamp(zone->top_surface_image_min_line_width_mm,
TextureMappingZone::MinTopSurfaceImageLineWidthMm,
plan.max_width_mm);
plan.fixed_coloring = zone->top_surface_image_fixed_coloring_filaments;
plan.fixed_coloring = zone->top_surface_image_fixed_coloring_filaments_active();
plan.color_lower_surfaces = zone->top_surface_contoning_color_lower_surfaces;
plan.colored_top_layers = std::clamp(zone->top_surface_image_colored_top_layers,
TextureMappingZone::MinTopSurfaceImageColoredTopLayers,
@@ -3108,24 +3108,23 @@ static std::vector<TopSurfaceImageRegionPlan> top_surface_image_region_plans(
plan.contoning_min_feature_mm =
texture_mapping_contoning_min_feature_mm(*zone, print_config, components, plan.contoning_external_width_mm);
plan.contoning_replace_top_perimeters_with_infill =
zone->top_surface_contoning_replace_top_perimeters_with_infill;
zone->effective_top_surface_contoning_replace_top_perimeters_with_infill();
plan.contoning_recolor_surrounding_perimeters =
zone->top_surface_contoning_recolor_surrounding_perimeters &&
!plan.contoning_replace_top_perimeters_with_infill;
zone->effective_top_surface_contoning_recolor_surrounding_perimeters();
plan.contoning_perimeter_mode =
std::clamp(zone->top_surface_contoning_perimeter_mode,
std::clamp(zone->stored_top_surface_contoning_perimeter_mode(),
int(TextureMappingZone::ContoningPerimeterSegmentBlocks),
int(TextureMappingZone::ContoningPerimeterSegmentInfill));
plan.contoning_flat_surface_infill_mode =
std::clamp(TextureMappingZone::effective_top_surface_contoning_flat_surface_infill_mode(
zone->top_surface_contoning_flat_surface_infill_mode),
std::clamp(zone->effective_top_surface_contoning_flat_surface_infill_mode(),
int(TextureMappingZone::ContoningFlatSurfaceInfillRectilinear),
int(TextureMappingZone::ContoningFlatSurfaceInfillRectilinearWithBoundary));
plan.contoning_layer_phase_enabled = zone->top_surface_contoning_layer_phase_enabled;
plan.contoning_varied_infill_angles_enabled = zone->top_surface_contoning_varied_infill_angles_enabled;
plan.contoning_blue_noise_error_diffusion_enabled = zone->top_surface_contoning_blue_noise_error_diffusion_enabled;
plan.contoning_supersampled_cells_enabled = zone->top_surface_contoning_supersampled_cells_enabled;
plan.contoning_surface_anchored_stacks_enabled = zone->top_surface_contoning_surface_anchored_stacks_enabled;
plan.contoning_surface_anchored_stacks_enabled =
zone->effective_top_surface_contoning_surface_anchored_stacks_enabled();
const TextureMappingContoningSolver contoning_solver(*zone, print_config, components);
const int stack_depth = plan.contoning ?

View File

@@ -1128,22 +1128,22 @@ bool TextureMappingZone::operator==(const TextureMappingZone &rhs) const
std::abs(top_surface_image_min_line_width_mm - rhs.top_surface_image_min_line_width_mm) <= eps &&
std::abs(top_surface_image_max_line_width_mm - rhs.top_surface_image_max_line_width_mm) <= eps &&
top_surface_image_colored_top_layers == rhs.top_surface_image_colored_top_layers &&
top_surface_image_fixed_coloring_filaments == rhs.top_surface_image_fixed_coloring_filaments &&
top_surface_image_fixed_coloring_filaments_active() == rhs.top_surface_image_fixed_coloring_filaments_active() &&
std::abs(top_surface_contoning_angle_threshold_deg - rhs.top_surface_contoning_angle_threshold_deg) <= eps &&
top_surface_contoning_stack_layers == rhs.top_surface_contoning_stack_layers &&
top_surface_contoning_pattern_filaments == rhs.top_surface_contoning_pattern_filaments &&
std::abs(top_surface_contoning_min_feature_mm - rhs.top_surface_contoning_min_feature_mm) <= eps &&
top_surface_contoning_color_lower_surfaces == rhs.top_surface_contoning_color_lower_surfaces &&
top_surface_contoning_only_color_surface_infill == rhs.top_surface_contoning_only_color_surface_infill &&
top_surface_contoning_replace_top_perimeters_with_infill == rhs.top_surface_contoning_replace_top_perimeters_with_infill &&
top_surface_contoning_recolor_surrounding_perimeters == rhs.top_surface_contoning_recolor_surrounding_perimeters &&
top_surface_contoning_perimeter_mode == rhs.top_surface_contoning_perimeter_mode &&
top_surface_contoning_flat_surface_infill_mode == rhs.top_surface_contoning_flat_surface_infill_mode &&
effective_top_surface_contoning_only_color_surface_infill() == rhs.effective_top_surface_contoning_only_color_surface_infill() &&
effective_top_surface_contoning_replace_top_perimeters_with_infill() == rhs.effective_top_surface_contoning_replace_top_perimeters_with_infill() &&
effective_top_surface_contoning_recolor_surrounding_perimeters() == rhs.effective_top_surface_contoning_recolor_surrounding_perimeters() &&
stored_top_surface_contoning_perimeter_mode() == rhs.stored_top_surface_contoning_perimeter_mode() &&
stored_top_surface_contoning_flat_surface_infill_mode() == rhs.stored_top_surface_contoning_flat_surface_infill_mode() &&
top_surface_contoning_layer_phase_enabled == rhs.top_surface_contoning_layer_phase_enabled &&
top_surface_contoning_varied_infill_angles_enabled == rhs.top_surface_contoning_varied_infill_angles_enabled &&
top_surface_contoning_blue_noise_error_diffusion_enabled == rhs.top_surface_contoning_blue_noise_error_diffusion_enabled &&
top_surface_contoning_supersampled_cells_enabled == rhs.top_surface_contoning_supersampled_cells_enabled &&
top_surface_contoning_surface_anchored_stacks_enabled == rhs.top_surface_contoning_surface_anchored_stacks_enabled &&
effective_top_surface_contoning_surface_anchored_stacks_enabled() == rhs.effective_top_surface_contoning_surface_anchored_stacks_enabled() &&
compact_offset_mode == rhs.compact_offset_mode &&
use_legacy_fixed_color_mode == rhs.use_legacy_fixed_color_mode &&
high_speed_image_texture_sampling == rhs.high_speed_image_texture_sampling &&
@@ -1497,7 +1497,7 @@ std::string TextureMappingManager::serialize_entries()
clamp_int(zone.top_surface_image_colored_top_layers,
TextureMappingZone::MinTopSurfaceImageColoredTopLayers,
TextureMappingZone::MaxTopSurfaceImageColoredTopLayers);
texture["top_surface_image_fixed_coloring_filaments"] = zone.top_surface_image_fixed_coloring_filaments;
texture["top_surface_image_fixed_coloring_filaments"] = zone.top_surface_image_fixed_coloring_filaments_active();
texture["top_surface_contoning_angle_threshold_deg"] =
std::clamp(finite_or(zone.top_surface_contoning_angle_threshold_deg,
TextureMappingZone::DefaultTopSurfaceContoningAngleThresholdDeg),
@@ -1517,18 +1517,18 @@ std::string TextureMappingManager::serialize_entries()
TextureMappingZone::MinTopSurfaceContoningMinFeatureMm,
TextureMappingZone::MaxTopSurfaceContoningMinFeatureMm);
texture["top_surface_contoning_color_lower_surfaces"] = zone.top_surface_contoning_color_lower_surfaces;
texture["top_surface_contoning_only_color_surface_infill"] = zone.top_surface_contoning_only_color_surface_infill;
texture["top_surface_contoning_only_color_surface_infill"] =
zone.effective_top_surface_contoning_only_color_surface_infill();
texture["top_surface_contoning_replace_top_perimeters_with_infill"] =
zone.top_surface_contoning_replace_top_perimeters_with_infill;
zone.effective_top_surface_contoning_replace_top_perimeters_with_infill();
texture["top_surface_contoning_recolor_surrounding_perimeters"] =
zone.top_surface_contoning_recolor_surrounding_perimeters &&
!zone.top_surface_contoning_replace_top_perimeters_with_infill;
zone.effective_top_surface_contoning_recolor_surrounding_perimeters();
texture["top_surface_contoning_perimeter_mode"] =
clamp_int(zone.top_surface_contoning_perimeter_mode,
clamp_int(zone.stored_top_surface_contoning_perimeter_mode(),
int(TextureMappingZone::ContoningPerimeterSegmentBlocks),
int(TextureMappingZone::ContoningPerimeterSegmentInfill));
texture["top_surface_contoning_flat_surface_infill_mode"] =
top_surface_contoning_flat_surface_infill_mode_name(zone.top_surface_contoning_flat_surface_infill_mode);
top_surface_contoning_flat_surface_infill_mode_name(zone.stored_top_surface_contoning_flat_surface_infill_mode());
texture["top_surface_contoning_layer_phase_enabled"] = zone.top_surface_contoning_layer_phase_enabled;
texture["top_surface_contoning_varied_infill_angles_enabled"] =
zone.top_surface_contoning_varied_infill_angles_enabled;
@@ -1537,7 +1537,7 @@ std::string TextureMappingManager::serialize_entries()
texture["top_surface_contoning_supersampled_cells_enabled"] =
zone.top_surface_contoning_supersampled_cells_enabled;
texture["top_surface_contoning_surface_anchored_stacks_enabled"] =
zone.top_surface_contoning_surface_anchored_stacks_enabled;
zone.effective_top_surface_contoning_surface_anchored_stacks_enabled();
texture["compact_offset_mode"] = zone.compact_offset_mode;
texture["use_legacy_fixed_color_mode"] = zone.use_legacy_fixed_color_mode;
texture["high_speed_image_texture_sampling"] = true;
@@ -1807,8 +1807,6 @@ void TextureMappingManager::load_entries(const std::string &serialized,
TextureMappingZone::DefaultTopSurfaceContoningFlatSurfaceInfillMode,
int(TextureMappingZone::ContoningFlatSurfaceInfillDefault),
int(TextureMappingZone::ContoningFlatSurfaceInfillRectilinearWithBoundary));
if (zone.top_surface_contoning_replace_top_perimeters_with_infill)
zone.top_surface_contoning_recolor_surrounding_perimeters = false;
zone.top_surface_contoning_layer_phase_enabled =
texture.value("top_surface_contoning_layer_phase_enabled",
TextureMappingZone::DefaultTopSurfaceContoningLayerPhaseEnabled);
@@ -1824,6 +1822,7 @@ void TextureMappingManager::load_entries(const std::string &serialized,
zone.top_surface_contoning_surface_anchored_stacks_enabled =
texture.value("top_surface_contoning_surface_anchored_stacks_enabled",
TextureMappingZone::DefaultTopSurfaceContoningSurfaceAnchoredStacksEnabled);
zone.apply_top_surface_contoning_experimental_defaults();
zone.compact_offset_mode = texture.value("compact_offset_mode", TextureMappingZone::DefaultCompactOffsetMode);
zone.use_legacy_fixed_color_mode =
texture.value("use_legacy_fixed_color_mode", TextureMappingZone::DefaultUseLegacyFixedColorMode);

View File

@@ -3,6 +3,10 @@
#ifndef slic3r_TextureMapping_hpp_
#define slic3r_TextureMapping_hpp_
#ifndef SLIC3R_SHOW_EXPERIMENTAL_CONTONING_OPTIONS
#define SLIC3R_SHOW_EXPERIMENTAL_CONTONING_OPTIONS 0
#endif
#include <algorithm>
#include <array>
#include <cmath>
@@ -221,6 +225,7 @@ struct TextureMappingZone
static constexpr bool DefaultPreviewLimitResolution = true;
static constexpr bool DefaultPreviewSimulateTopSurfaceLod = true;
static constexpr bool DefaultAutoAdjustFilamentSelection = true;
static constexpr bool ShowExperimentalTopSurfaceContoningOptions = SLIC3R_SHOW_EXPERIMENTAL_CONTONING_OPTIONS != 0;
static constexpr int default_modulation_mode_for_surface_pattern(int surface_pattern)
{
@@ -233,11 +238,43 @@ struct TextureMappingZone
static constexpr int effective_top_surface_contoning_flat_surface_infill_mode(int mode)
{
if (!ShowExperimentalTopSurfaceContoningOptions)
return SlicerDefaultTopSurfaceContoningFlatSurfaceInfillMode;
return mode == int(ContoningFlatSurfaceInfillDefault) ?
SlicerDefaultTopSurfaceContoningFlatSurfaceInfillMode :
mode;
}
static constexpr int stored_top_surface_contoning_flat_surface_infill_mode(int mode)
{
return ShowExperimentalTopSurfaceContoningOptions ? mode : DefaultTopSurfaceContoningFlatSurfaceInfillMode;
}
static constexpr int stored_top_surface_contoning_perimeter_mode(int mode)
{
return ShowExperimentalTopSurfaceContoningOptions ? mode : DefaultTopSurfaceContoningPerimeterMode;
}
static constexpr bool effective_top_surface_contoning_only_color_surface_infill(bool value)
{
return ShowExperimentalTopSurfaceContoningOptions ? value : true;
}
static constexpr bool effective_top_surface_contoning_replace_top_perimeters_with_infill(bool value)
{
return ShowExperimentalTopSurfaceContoningOptions && value;
}
static constexpr bool effective_top_surface_contoning_recolor_surrounding_perimeters(bool value, bool replace)
{
return ShowExperimentalTopSurfaceContoningOptions && value && !replace;
}
static constexpr bool effective_top_surface_contoning_surface_anchored_stacks_enabled(bool value)
{
return ShowExperimentalTopSurfaceContoningOptions && value;
}
struct LinearGradientAnchor {
bool valid = false;
size_t object_id = 0;
@@ -371,12 +408,77 @@ struct TextureMappingZone
top_surface_image_printing_method == int(TopSurfaceImageContoning) &&
uses_perimeter_path_modulation_v2();
}
bool top_surface_image_fixed_coloring_filaments_active() const
{
return top_surface_image_printing_method == int(TopSurfaceImageContoning) ||
top_surface_image_fixed_coloring_filaments;
}
bool top_surface_contoning_perimeters_active() const
{
return top_surface_contoning_active() &&
!top_surface_contoning_only_color_surface_infill &&
!top_surface_contoning_replace_top_perimeters_with_infill &&
!top_surface_contoning_recolor_surrounding_perimeters;
!effective_top_surface_contoning_only_color_surface_infill() &&
!effective_top_surface_contoning_replace_top_perimeters_with_infill() &&
!effective_top_surface_contoning_recolor_surrounding_perimeters();
}
bool effective_top_surface_contoning_only_color_surface_infill() const
{
return effective_top_surface_contoning_only_color_surface_infill(top_surface_contoning_only_color_surface_infill);
}
bool effective_top_surface_contoning_replace_top_perimeters_with_infill() const
{
return effective_top_surface_contoning_replace_top_perimeters_with_infill(
top_surface_contoning_replace_top_perimeters_with_infill);
}
bool effective_top_surface_contoning_recolor_surrounding_perimeters() const
{
return effective_top_surface_contoning_recolor_surrounding_perimeters(
top_surface_contoning_recolor_surrounding_perimeters,
effective_top_surface_contoning_replace_top_perimeters_with_infill());
}
int stored_top_surface_contoning_perimeter_mode() const
{
return stored_top_surface_contoning_perimeter_mode(top_surface_contoning_perimeter_mode);
}
int stored_top_surface_contoning_flat_surface_infill_mode() const
{
return stored_top_surface_contoning_flat_surface_infill_mode(top_surface_contoning_flat_surface_infill_mode);
}
int effective_top_surface_contoning_flat_surface_infill_mode() const
{
return effective_top_surface_contoning_flat_surface_infill_mode(stored_top_surface_contoning_flat_surface_infill_mode());
}
bool effective_top_surface_contoning_surface_anchored_stacks_enabled() const
{
return effective_top_surface_contoning_surface_anchored_stacks_enabled(
top_surface_contoning_surface_anchored_stacks_enabled);
}
void apply_top_surface_contoning_experimental_defaults()
{
if (top_surface_image_printing_enabled &&
top_surface_image_printing_method == int(TopSurfaceImageContoning)) {
modulation_mode = int(ModulationPerimeterPathV2);
modulation_mode_manually_changed = true;
top_surface_image_fixed_coloring_filaments = true;
}
if (!ShowExperimentalTopSurfaceContoningOptions) {
top_surface_contoning_only_color_surface_infill = true;
top_surface_contoning_replace_top_perimeters_with_infill = false;
top_surface_contoning_recolor_surrounding_perimeters = false;
top_surface_contoning_perimeter_mode = DefaultTopSurfaceContoningPerimeterMode;
top_surface_contoning_flat_surface_infill_mode = DefaultTopSurfaceContoningFlatSurfaceInfillMode;
top_surface_contoning_surface_anchored_stacks_enabled = false;
} else if (top_surface_contoning_replace_top_perimeters_with_infill) {
top_surface_contoning_recolor_surrounding_perimeters = false;
}
}
void apply_default_modulation_mode()

View File

@@ -2561,28 +2561,30 @@ public:
contoning_feature_row->Add(m_top_surface_contoning_min_feature_spin, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, gap / 2);
contoning_feature_row->Add(new wxStaticText(m_top_surface_contoning_panel, wxID_ANY, _L("mm")), 0, wxALIGN_CENTER_VERTICAL);
top_surface_contoning_root->Add(contoning_feature_row, 0, wxEXPAND);
auto *contoning_flat_infill_row = new wxBoxSizer(wxHORIZONTAL);
contoning_flat_infill_row->Add(new wxStaticText(m_top_surface_contoning_panel, wxID_ANY, _L("Flat surface infill mode")),
0,
wxALIGN_CENTER_VERTICAL | wxRIGHT,
gap);
wxArrayString contoning_flat_infill_choices;
contoning_flat_infill_choices.Add(_L("Default (Rectilinear)"));
contoning_flat_infill_choices.Add(_L("Rectilinear"));
contoning_flat_infill_choices.Add(_L("Concentric"));
contoning_flat_infill_choices.Add(_L("Boundary Skin (fixed width)"));
contoning_flat_infill_choices.Add(_L("Boundary Skin (variable width)"));
contoning_flat_infill_choices.Add(_L("Spiral"));
contoning_flat_infill_choices.Add(_L("Boundary Skin Hybrid"));
contoning_flat_infill_choices.Add(_L("Rectilinear with Boundary"));
m_top_surface_contoning_flat_surface_infill_choice =
new wxChoice(m_top_surface_contoning_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_flat_infill_choices);
m_top_surface_contoning_flat_surface_infill_choice->SetSelection(
std::clamp(top_surface_contoning_flat_surface_infill_mode,
int(TextureMappingZone::ContoningFlatSurfaceInfillDefault),
int(TextureMappingZone::ContoningFlatSurfaceInfillRectilinearWithBoundary)));
contoning_flat_infill_row->Add(m_top_surface_contoning_flat_surface_infill_choice, 1, wxEXPAND);
top_surface_contoning_root->Add(contoning_flat_infill_row, 0, wxEXPAND | wxTOP, gap);
if (TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions) {
auto *contoning_flat_infill_row = new wxBoxSizer(wxHORIZONTAL);
contoning_flat_infill_row->Add(new wxStaticText(m_top_surface_contoning_panel, wxID_ANY, _L("Flat surface infill mode")),
0,
wxALIGN_CENTER_VERTICAL | wxRIGHT,
gap);
wxArrayString contoning_flat_infill_choices;
contoning_flat_infill_choices.Add(_L("Default (Rectilinear)"));
contoning_flat_infill_choices.Add(_L("Rectilinear"));
contoning_flat_infill_choices.Add(_L("Concentric"));
contoning_flat_infill_choices.Add(_L("Boundary Skin (fixed width)"));
contoning_flat_infill_choices.Add(_L("Boundary Skin (variable width)"));
contoning_flat_infill_choices.Add(_L("Spiral"));
contoning_flat_infill_choices.Add(_L("Boundary Skin Hybrid"));
contoning_flat_infill_choices.Add(_L("Rectilinear with Boundary"));
m_top_surface_contoning_flat_surface_infill_choice =
new wxChoice(m_top_surface_contoning_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_flat_infill_choices);
m_top_surface_contoning_flat_surface_infill_choice->SetSelection(
std::clamp(top_surface_contoning_flat_surface_infill_mode,
int(TextureMappingZone::ContoningFlatSurfaceInfillDefault),
int(TextureMappingZone::ContoningFlatSurfaceInfillRectilinearWithBoundary)));
contoning_flat_infill_row->Add(m_top_surface_contoning_flat_surface_infill_choice, 1, wxEXPAND);
top_surface_contoning_root->Add(contoning_flat_infill_row, 0, wxEXPAND | wxTOP, gap);
}
top_surface_box->Add(m_top_surface_contoning_panel, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, gap);
m_top_surface_image_fixed_coloring_filaments_checkbox =
new wxCheckBox(top_surface_page, wxID_ANY, _L("Fixed top-surface coloring filaments"));
@@ -2600,56 +2602,58 @@ public:
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_only_color_surface_infill_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Only color surface infill"));
m_top_surface_contoning_only_color_surface_infill_checkbox->SetValue(top_surface_contoning_only_color_surface_infill);
m_top_surface_contoning_only_color_surface_infill_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_only_color_surface_infill_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_only_color_surface_infill_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_replace_top_perimeters_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Replace top perimeters with infill"));
m_top_surface_contoning_replace_top_perimeters_checkbox->SetValue(top_surface_contoning_replace_top_perimeters_with_infill);
m_top_surface_contoning_replace_top_perimeters_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_replace_top_perimeters_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_replace_top_perimeters_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Recolor surrounding perimeters to match"));
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetValue(
top_surface_contoning_recolor_surrounding_perimeters && !top_surface_contoning_replace_top_perimeters_with_infill);
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_recolor_surrounding_perimeters_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_perimeter_mode_panel = new wxPanel(m_top_surface_contoning_checkboxes_panel, wxID_ANY);
auto *contoning_perimeter_mode_row = new wxBoxSizer(wxHORIZONTAL);
m_top_surface_contoning_perimeter_mode_panel->SetSizer(contoning_perimeter_mode_row);
contoning_perimeter_mode_row->Add(new wxStaticText(m_top_surface_contoning_perimeter_mode_panel, wxID_ANY, _L("Perimeter mode")),
0,
wxALIGN_CENTER_VERTICAL | wxRIGHT,
gap);
wxArrayString contoning_perimeter_mode_choices;
contoning_perimeter_mode_choices.Add(_L("Segment perimeter into blocks"));
contoning_perimeter_mode_choices.Add(_L("Divided line"));
contoning_perimeter_mode_choices.Add(_L("Segment perimeter into infill"));
m_top_surface_contoning_perimeter_mode_choice =
new wxChoice(m_top_surface_contoning_perimeter_mode_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_perimeter_mode_choices);
m_top_surface_contoning_perimeter_mode_choice->SetSelection(
std::clamp(top_surface_contoning_perimeter_mode,
int(TextureMappingZone::ContoningPerimeterSegmentBlocks),
int(TextureMappingZone::ContoningPerimeterSegmentInfill)));
contoning_perimeter_mode_row->Add(m_top_surface_contoning_perimeter_mode_choice, 1, wxEXPAND);
contoning_checkboxes_root->Add(m_top_surface_contoning_perimeter_mode_panel,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
if (TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions) {
m_top_surface_contoning_only_color_surface_infill_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Only color surface infill"));
m_top_surface_contoning_only_color_surface_infill_checkbox->SetValue(top_surface_contoning_only_color_surface_infill);
m_top_surface_contoning_only_color_surface_infill_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_only_color_surface_infill_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_only_color_surface_infill_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_replace_top_perimeters_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Replace top perimeters with infill"));
m_top_surface_contoning_replace_top_perimeters_checkbox->SetValue(top_surface_contoning_replace_top_perimeters_with_infill);
m_top_surface_contoning_replace_top_perimeters_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_replace_top_perimeters_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_replace_top_perimeters_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Recolor surrounding perimeters to match"));
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetValue(
top_surface_contoning_recolor_surrounding_perimeters && !top_surface_contoning_replace_top_perimeters_with_infill);
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_recolor_surrounding_perimeters_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_perimeter_mode_panel = new wxPanel(m_top_surface_contoning_checkboxes_panel, wxID_ANY);
auto *contoning_perimeter_mode_row = new wxBoxSizer(wxHORIZONTAL);
m_top_surface_contoning_perimeter_mode_panel->SetSizer(contoning_perimeter_mode_row);
contoning_perimeter_mode_row->Add(new wxStaticText(m_top_surface_contoning_perimeter_mode_panel, wxID_ANY, _L("Perimeter mode")),
0,
wxALIGN_CENTER_VERTICAL | wxRIGHT,
gap);
wxArrayString contoning_perimeter_mode_choices;
contoning_perimeter_mode_choices.Add(_L("Segment perimeter into blocks"));
contoning_perimeter_mode_choices.Add(_L("Divided line"));
contoning_perimeter_mode_choices.Add(_L("Segment perimeter into infill"));
m_top_surface_contoning_perimeter_mode_choice =
new wxChoice(m_top_surface_contoning_perimeter_mode_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_perimeter_mode_choices);
m_top_surface_contoning_perimeter_mode_choice->SetSelection(
std::clamp(top_surface_contoning_perimeter_mode,
int(TextureMappingZone::ContoningPerimeterSegmentBlocks),
int(TextureMappingZone::ContoningPerimeterSegmentInfill)));
contoning_perimeter_mode_row->Add(m_top_surface_contoning_perimeter_mode_choice, 1, wxEXPAND);
contoning_checkboxes_root->Add(m_top_surface_contoning_perimeter_mode_panel,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
}
m_top_surface_contoning_layer_phase_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Layer phase detail"));
m_top_surface_contoning_layer_phase_checkbox->SetValue(top_surface_contoning_layer_phase_enabled);
@@ -2686,35 +2690,43 @@ public:
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
m_top_surface_contoning_surface_anchored_stacks_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Surface-anchored stacks"));
m_top_surface_contoning_surface_anchored_stacks_checkbox->SetValue(top_surface_contoning_surface_anchored_stacks_enabled);
m_top_surface_contoning_surface_anchored_stacks_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_surface_anchored_stacks_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_surface_anchored_stacks_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
if (TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions) {
m_top_surface_contoning_surface_anchored_stacks_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Surface-anchored stacks"));
m_top_surface_contoning_surface_anchored_stacks_checkbox->SetValue(top_surface_contoning_surface_anchored_stacks_enabled);
m_top_surface_contoning_surface_anchored_stacks_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_surface_anchored_stacks_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
contoning_checkboxes_root->Add(m_top_surface_contoning_surface_anchored_stacks_checkbox,
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
}
top_surface_box->Add(m_top_surface_contoning_checkboxes_panel, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, gap);
m_top_surface_contoning_only_color_surface_infill_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
update_top_surface_image_options_visibility(true);
});
m_top_surface_contoning_replace_top_perimeters_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
if (m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr &&
m_top_surface_contoning_replace_top_perimeters_checkbox->GetValue() &&
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr) {
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetValue(false);
}
update_top_surface_image_options_visibility(true);
});
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
if (m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr &&
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->GetValue() &&
m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr) {
m_top_surface_contoning_replace_top_perimeters_checkbox->SetValue(false);
}
update_top_surface_image_options_visibility(true);
});
if (m_top_surface_contoning_only_color_surface_infill_checkbox != nullptr) {
m_top_surface_contoning_only_color_surface_infill_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
update_top_surface_image_options_visibility(true);
});
}
if (m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr) {
m_top_surface_contoning_replace_top_perimeters_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
if (m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr &&
m_top_surface_contoning_replace_top_perimeters_checkbox->GetValue() &&
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr) {
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->SetValue(false);
}
update_top_surface_image_options_visibility(true);
});
}
if (m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr) {
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
if (m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr &&
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->GetValue() &&
m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr) {
m_top_surface_contoning_replace_top_perimeters_checkbox->SetValue(false);
}
update_top_surface_image_options_visibility(true);
});
}
m_top_surface_image_printing_enabled_checkbox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
update_top_surface_image_options_visibility(true);
});
@@ -3065,17 +3077,23 @@ public:
}
bool top_surface_contoning_only_color_surface_infill() const
{
if (!TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions)
return true;
return m_top_surface_contoning_only_color_surface_infill_checkbox != nullptr ?
m_top_surface_contoning_only_color_surface_infill_checkbox->GetValue() :
TextureMappingZone::DefaultTopSurfaceContoningOnlyColorSurfaceInfill;
}
bool top_surface_contoning_replace_top_perimeters_with_infill() const
{
if (!TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions)
return false;
return m_top_surface_contoning_replace_top_perimeters_checkbox != nullptr &&
m_top_surface_contoning_replace_top_perimeters_checkbox->GetValue();
}
bool top_surface_contoning_recolor_surrounding_perimeters() const
{
if (!TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions)
return false;
return m_top_surface_contoning_recolor_surrounding_perimeters_checkbox != nullptr &&
m_top_surface_contoning_recolor_surrounding_perimeters_checkbox->GetValue() &&
!top_surface_contoning_replace_top_perimeters_with_infill();
@@ -3090,6 +3108,8 @@ public:
}
int top_surface_contoning_flat_surface_infill_mode() const
{
if (!TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions)
return TextureMappingZone::DefaultTopSurfaceContoningFlatSurfaceInfillMode;
return m_top_surface_contoning_flat_surface_infill_choice != nullptr ?
std::clamp(m_top_surface_contoning_flat_surface_infill_choice->GetSelection(),
int(TextureMappingZone::ContoningFlatSurfaceInfillDefault),
@@ -3118,6 +3138,8 @@ public:
}
bool top_surface_contoning_surface_anchored_stacks_enabled() const
{
if (!TextureMappingZone::ShowExperimentalTopSurfaceContoningOptions)
return false;
return m_top_surface_contoning_surface_anchored_stacks_checkbox == nullptr ?
TextureMappingZone::DefaultTopSurfaceContoningSurfaceAnchoredStacksEnabled :
m_top_surface_contoning_surface_anchored_stacks_checkbox->GetValue();