mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 04:42:33 +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:
@@ -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"));
|
||||
|
||||
// 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");
|
||||
toggle_line("fuzzy_skin_scale", fuzzy_skin_noise_type != NoiseType::Classic);
|
||||
toggle_line("fuzzy_skin_octaves", fuzzy_skin_noise_type != NoiseType::Classic && fuzzy_skin_noise_type != NoiseType::Voronoi);
|
||||
toggle_line("fuzzy_skin_persistence", fuzzy_skin_noise_type == NoiseType::Perlin || fuzzy_skin_noise_type == NoiseType::Billow);
|
||||
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 && has_fuzzy_skin);
|
||||
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;
|
||||
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"})
|
||||
toggle_line(el, 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)
|
||||
{
|
||||
if (!m_c->selection_info()->model_object())
|
||||
ModelObject *mo = m_c->selection_info()->model_object();
|
||||
if (!mo)
|
||||
return;
|
||||
|
||||
const DynamicPrintConfig &obj_cfg = mo->config.get();
|
||||
|
||||
const float approx_height = m_imgui->scaled(22.f);
|
||||
y = std::min(y, bottom_limit - approx_height);
|
||||
//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"))) {
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _u8L("Reset selection"), UndoRedo::SnapshotType::GizmoAction);
|
||||
ModelObject *mo = m_c->selection_info()->model_object();
|
||||
int idx = -1;
|
||||
for (ModelVolume *mv : mo->volumes)
|
||||
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();
|
||||
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);
|
||||
GizmoImguiEnd();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user