mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
make Fuzzy skin options only available when Fuzzy skin is not disabled (#10312)
Mimicking the behavior of Ironing. 
This commit is contained in:
@@ -215,7 +215,7 @@ bool should_fuzzify(const FuzzySkinConfig& config, const int layer_id, const siz
|
|||||||
{
|
{
|
||||||
const auto fuzziy_type = config.type;
|
const auto fuzziy_type = config.type;
|
||||||
|
|
||||||
if (fuzziy_type == FuzzySkinType::None) {
|
if (fuzziy_type == FuzzySkinType::None|| fuzziy_type == FuzzySkinType::Disabled_fuzzy) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!config.fuzzy_first_layer && layer_id <= 0) {
|
if (!config.fuzzy_first_layer && layer_id <= 0) {
|
||||||
|
|||||||
@@ -839,7 +839,7 @@ bool verify_update_print_object_regions(
|
|||||||
for (const PrintObjectRegions::FuzzySkinPaintedRegion ®ion : layer_range.fuzzy_skin_painted_regions) {
|
for (const PrintObjectRegions::FuzzySkinPaintedRegion ®ion : layer_range.fuzzy_skin_painted_regions) {
|
||||||
const PrintRegion &parent_print_region = *region.parent_print_object_region(layer_range);
|
const PrintRegion &parent_print_region = *region.parent_print_object_region(layer_range);
|
||||||
PrintRegionConfig cfg = parent_print_region.config();
|
PrintRegionConfig cfg = parent_print_region.config();
|
||||||
cfg.fuzzy_skin.value = FuzzySkinType::All;
|
if (cfg.fuzzy_skin.value != FuzzySkinType::Disabled_fuzzy) cfg.fuzzy_skin.value = FuzzySkinType::All;
|
||||||
if (cfg != region.region->config()) {
|
if (cfg != region.region->config()) {
|
||||||
// Region configuration changed.
|
// Region configuration changed.
|
||||||
if (print_region_ref_cnt(*region.region) == 0) {
|
if (print_region_ref_cnt(*region.region) == 0) {
|
||||||
@@ -1081,7 +1081,7 @@ static PrintObjectRegions* generate_print_object_regions(
|
|||||||
for (int parent_volume_region_id = 0; parent_volume_region_id < int(layer_range.volume_regions.size()); ++parent_volume_region_id) {
|
for (int parent_volume_region_id = 0; parent_volume_region_id < int(layer_range.volume_regions.size()); ++parent_volume_region_id) {
|
||||||
if (const PrintObjectRegions::VolumeRegion &parent_volume_region = layer_range.volume_regions[parent_volume_region_id]; parent_volume_region.model_volume->is_model_part() || parent_volume_region.model_volume->is_modifier()) {
|
if (const PrintObjectRegions::VolumeRegion &parent_volume_region = layer_range.volume_regions[parent_volume_region_id]; parent_volume_region.model_volume->is_model_part() || parent_volume_region.model_volume->is_modifier()) {
|
||||||
PrintRegionConfig cfg = parent_volume_region.region->config();
|
PrintRegionConfig cfg = parent_volume_region.region->config();
|
||||||
cfg.fuzzy_skin.value = FuzzySkinType::All;
|
if (cfg.fuzzy_skin.value != FuzzySkinType::Disabled_fuzzy) cfg.fuzzy_skin.value = FuzzySkinType::All;
|
||||||
layer_range.fuzzy_skin_painted_regions.push_back({FuzzySkinParentType::VolumeRegion, parent_volume_region_id, get_create_region(std::move(cfg))});
|
layer_range.fuzzy_skin_painted_regions.push_back({FuzzySkinParentType::VolumeRegion, parent_volume_region_id, get_create_region(std::move(cfg))});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1090,7 +1090,7 @@ static PrintObjectRegions* generate_print_object_regions(
|
|||||||
const PrintObjectRegions::PaintedRegion &parent_painted_region = layer_range.painted_regions[parent_painted_regions_id];
|
const PrintObjectRegions::PaintedRegion &parent_painted_region = layer_range.painted_regions[parent_painted_regions_id];
|
||||||
|
|
||||||
PrintRegionConfig cfg = parent_painted_region.region->config();
|
PrintRegionConfig cfg = parent_painted_region.region->config();
|
||||||
cfg.fuzzy_skin.value = FuzzySkinType::All;
|
if (cfg.fuzzy_skin.value != FuzzySkinType::Disabled_fuzzy) cfg.fuzzy_skin.value = FuzzySkinType::All;
|
||||||
layer_range.fuzzy_skin_painted_regions.push_back({FuzzySkinParentType::PaintedRegion, parent_painted_regions_id, get_create_region(std::move(cfg))});
|
layer_range.fuzzy_skin_painted_regions.push_back({FuzzySkinParentType::PaintedRegion, parent_painted_regions_id, get_create_region(std::move(cfg))});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,8 @@ static t_config_enum_values s_keys_map_FuzzySkinType {
|
|||||||
{ "none", int(FuzzySkinType::None) },
|
{ "none", int(FuzzySkinType::None) },
|
||||||
{ "external", int(FuzzySkinType::External) },
|
{ "external", int(FuzzySkinType::External) },
|
||||||
{ "all", int(FuzzySkinType::All) },
|
{ "all", int(FuzzySkinType::All) },
|
||||||
{ "allwalls", int(FuzzySkinType::AllWalls)}
|
{ "allwalls", int(FuzzySkinType::AllWalls)},
|
||||||
|
{ "disabled_fuzzy", int(FuzzySkinType::Disabled_fuzzy)}
|
||||||
};
|
};
|
||||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FuzzySkinType)
|
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FuzzySkinType)
|
||||||
|
|
||||||
@@ -3223,12 +3224,14 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->enum_values.push_back("external");
|
def->enum_values.push_back("external");
|
||||||
def->enum_values.push_back("all");
|
def->enum_values.push_back("all");
|
||||||
def->enum_values.push_back("allwalls");
|
def->enum_values.push_back("allwalls");
|
||||||
def->enum_labels.push_back(L("None"));
|
def->enum_values.push_back("disabled_fuzzy");
|
||||||
|
def->enum_labels.push_back(L("None (allow paint)"));
|
||||||
def->enum_labels.push_back(L("Contour"));
|
def->enum_labels.push_back(L("Contour"));
|
||||||
def->enum_labels.push_back(L("Contour and hole"));
|
def->enum_labels.push_back(L("Contour and hole"));
|
||||||
def->enum_labels.push_back(L("All walls"));
|
def->enum_labels.push_back(L("All walls"));
|
||||||
|
def->enum_labels.push_back(L("Disabled"));
|
||||||
def->mode = comSimple;
|
def->mode = comSimple;
|
||||||
def->set_default_value(new ConfigOptionEnum<FuzzySkinType>(FuzzySkinType::None));
|
def->set_default_value(new ConfigOptionEnum<FuzzySkinType>(FuzzySkinType::Disabled_fuzzy));
|
||||||
|
|
||||||
def = this->add("fuzzy_skin_thickness", coFloat);
|
def = this->add("fuzzy_skin_thickness", coFloat);
|
||||||
def->label = L("Fuzzy skin thickness");
|
def->label = L("Fuzzy skin thickness");
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ enum class FuzzySkinType {
|
|||||||
External,
|
External,
|
||||||
All,
|
All,
|
||||||
AllWalls,
|
AllWalls,
|
||||||
|
Disabled_fuzzy,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FuzzySkinMode {
|
enum class FuzzySkinMode {
|
||||||
|
|||||||
@@ -862,13 +862,21 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
|||||||
|
|
||||||
toggle_line("support_interface_not_for_body",config->opt_int("support_interface_filament")&&!config->opt_int("support_filament"));
|
toggle_line("support_interface_not_for_body",config->opt_int("support_interface_filament")&&!config->opt_int("support_filament"));
|
||||||
|
|
||||||
|
// Get the current fuzzy skin state
|
||||||
|
bool has_fuzzy_skin = config->opt_enum<FuzzySkinType>("fuzzy_skin") != FuzzySkinType::Disabled_fuzzy;
|
||||||
|
|
||||||
|
// Show fuzzy skin options when fuzzy skin is not disabled
|
||||||
|
for (auto el : {"fuzzy_skin_mode", "fuzzy_skin_noise_type", "fuzzy_skin_point_distance", "fuzzy_skin_thickness", "fuzzy_skin_first_layer"})
|
||||||
|
toggle_line(el, has_fuzzy_skin);
|
||||||
|
|
||||||
|
// Show noise type specific options with the same logic
|
||||||
NoiseType fuzzy_skin_noise_type = config->opt_enum<NoiseType>("fuzzy_skin_noise_type");
|
NoiseType fuzzy_skin_noise_type = config->opt_enum<NoiseType>("fuzzy_skin_noise_type");
|
||||||
toggle_line("fuzzy_skin_scale", fuzzy_skin_noise_type != NoiseType::Classic);
|
toggle_line("fuzzy_skin_scale", fuzzy_skin_noise_type != NoiseType::Classic && has_fuzzy_skin);
|
||||||
toggle_line("fuzzy_skin_octaves", fuzzy_skin_noise_type != NoiseType::Classic && fuzzy_skin_noise_type != NoiseType::Voronoi);
|
toggle_line("fuzzy_skin_octaves", fuzzy_skin_noise_type != NoiseType::Classic && fuzzy_skin_noise_type != NoiseType::Voronoi && has_fuzzy_skin);
|
||||||
toggle_line("fuzzy_skin_persistence", fuzzy_skin_noise_type == NoiseType::Perlin || fuzzy_skin_noise_type == NoiseType::Billow);
|
toggle_line("fuzzy_skin_persistence", (fuzzy_skin_noise_type == NoiseType::Perlin || fuzzy_skin_noise_type == NoiseType::Billow) && has_fuzzy_skin);
|
||||||
|
|
||||||
bool have_arachne = config->opt_enum<PerimeterGeneratorType>("wall_generator") == PerimeterGeneratorType::Arachne;
|
bool have_arachne = config->opt_enum<PerimeterGeneratorType>("wall_generator") == PerimeterGeneratorType::Arachne;
|
||||||
for (auto el : { "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
|
for (auto el : {"wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
|
||||||
"min_feature_size", "min_length_factor", "min_bead_width", "wall_distribution_count", "initial_layer_min_bead_width"})
|
"min_feature_size", "min_length_factor", "min_bead_width", "wall_distribution_count", "initial_layer_min_bead_width"})
|
||||||
toggle_line(el, have_arachne);
|
toggle_line(el, have_arachne);
|
||||||
toggle_field("detect_thin_wall", !have_arachne);
|
toggle_field("detect_thin_wall", !have_arachne);
|
||||||
|
|||||||
@@ -128,9 +128,12 @@ void GLGizmoFuzzySkin::show_tooltip_information(float caption_max, float x, floa
|
|||||||
|
|
||||||
void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_limit)
|
void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
{
|
{
|
||||||
if (!m_c->selection_info()->model_object())
|
ModelObject *mo = m_c->selection_info()->model_object();
|
||||||
|
if (!mo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const DynamicPrintConfig &obj_cfg = mo->config.get();
|
||||||
|
|
||||||
const float approx_height = m_imgui->scaled(22.f);
|
const float approx_height = m_imgui->scaled(22.f);
|
||||||
y = std::min(y, bottom_limit - approx_height);
|
y = std::min(y, bottom_limit - approx_height);
|
||||||
//BBS: GUI refactor: move gizmo to the right
|
//BBS: GUI refactor: move gizmo to the right
|
||||||
@@ -320,7 +323,6 @@ void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_lim
|
|||||||
|
|
||||||
if (m_imgui->button(m_desc.at("remove_all"))) {
|
if (m_imgui->button(m_desc.at("remove_all"))) {
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _u8L("Reset selection"), UndoRedo::SnapshotType::GizmoAction);
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _u8L("Reset selection"), UndoRedo::SnapshotType::GizmoAction);
|
||||||
ModelObject *mo = m_c->selection_info()->model_object();
|
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
for (ModelVolume *mv : mo->volumes)
|
for (ModelVolume *mv : mo->volumes)
|
||||||
if (mv->is_model_part()) {
|
if (mv->is_model_part()) {
|
||||||
@@ -332,6 +334,39 @@ void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_lim
|
|||||||
update_model_object();
|
update_model_object();
|
||||||
m_parent.set_as_dirty();
|
m_parent.set_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DynamicPrintConfig &glb_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
|
const bool has_object_fuzzy_override = obj_cfg.option("fuzzy_skin");
|
||||||
|
const FuzzySkinType effective_fuzzy_skin_state = has_object_fuzzy_override ? obj_cfg.opt_enum<FuzzySkinType>("fuzzy_skin")
|
||||||
|
: glb_cfg.opt_enum<FuzzySkinType>("fuzzy_skin");
|
||||||
|
if (effective_fuzzy_skin_state == FuzzySkinType::Disabled_fuzzy) {
|
||||||
|
float font_size = ImGui::GetFontSize();
|
||||||
|
auto link_text = [&]() {
|
||||||
|
ImColor HyperColor = ImGuiWrapper::COL_ORCA;
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::to_ImVec4(ColorRGB::WARNING()));
|
||||||
|
float parent_width = ImGui::GetContentRegionAvail().x;
|
||||||
|
m_imgui->text_wrapped(_L("Warning: Fuzzy skin is disabled, painted fuzzy skin will not take effect!"), parent_width);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
|
||||||
|
ImGui::Dummy(ImVec2(font_size * 1.8f, font_size * 1.3f));
|
||||||
|
ImGui::SameLine();
|
||||||
|
m_imgui->bold_text(_u8L("Enable painted fuzzy skin for this object"));
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
ImVec2 line_end = ImGui::GetItemRectMax();
|
||||||
|
line_end.y -= 2.0f;
|
||||||
|
ImVec2 line_start = line_end;
|
||||||
|
line_start.x = ImGui::GetItemRectMin().x;
|
||||||
|
ImGui::GetWindowDrawList()->AddLine(line_start, line_end, HyperColor);
|
||||||
|
if (ImGui::IsMouseHoveringRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), true)
|
||||||
|
&& ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
|
||||||
|
DynamicPrintConfig new_conf = obj_cfg;
|
||||||
|
new_conf.set_key_value("fuzzy_skin", new ConfigOptionEnum<FuzzySkinType>(FuzzySkinType::None));
|
||||||
|
mo->config.assign_config(new_conf);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
link_text();
|
||||||
|
}
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
GizmoImguiEnd();
|
GizmoImguiEnd();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user