mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-04-22 22:19:40 +08:00
Density tooltip for whole slider
+ allowe value out of slider range + add minimal value + slider starts at 50%
This commit is contained in:
parent
8e956f68c3
commit
8fe57e5a11
@ -97,3 +97,24 @@ SampleConfig &SampleConfigFactory::get_sample_config() {
|
|||||||
gui_sample_config_opt = sla::SampleConfigFactory::create(.4f);
|
gui_sample_config_opt = sla::SampleConfigFactory::create(.4f);
|
||||||
return *gui_sample_config_opt;
|
return *gui_sample_config_opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SampleConfig SampleConfigFactory::get_sample_config(float density) {
|
||||||
|
const SampleConfig ¤t = get_sample_config();
|
||||||
|
if (is_approx(density, 1.f))
|
||||||
|
return current;
|
||||||
|
if (density < .1f)
|
||||||
|
density = .1f; // minimal 10%
|
||||||
|
|
||||||
|
SampleConfig result = current; // copy
|
||||||
|
result.thin_max_distance = static_cast<coord_t>(current.thin_max_distance / density); // linear
|
||||||
|
result.thick_inner_max_distance = static_cast<coord_t>( // controll radius - quadratic
|
||||||
|
std::sqrt(sqr((double)current.thick_inner_max_distance) / density));
|
||||||
|
result.thick_outline_max_distance = static_cast<coord_t>(current.thick_outline_max_distance / density); // linear
|
||||||
|
// result.head_radius .. no change
|
||||||
|
// result.minimal_distance_from_outline .. no change
|
||||||
|
// result.maximal_distance_from_outline .. no change
|
||||||
|
// result.max_length_for_one_support_point .. no change
|
||||||
|
// result.max_length_for_two_support_points .. no change
|
||||||
|
verify(result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -24,6 +24,16 @@ private:
|
|||||||
static std::optional<SampleConfig> gui_sample_config_opt;
|
static std::optional<SampleConfig> gui_sample_config_opt;
|
||||||
public:
|
public:
|
||||||
static SampleConfig &get_sample_config();
|
static SampleConfig &get_sample_config();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create scaled copy of sample config
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="density"> Scale for config values(minimal value is .1f)
|
||||||
|
/// 1.f .. no scale
|
||||||
|
/// .9f .. less support points (approx 90%)
|
||||||
|
/// 1.1f.. extend count of supports (approx to 110%) </param>
|
||||||
|
/// <returns>Scaled configuration</returns>
|
||||||
|
static SampleConfig get_sample_config(float density);
|
||||||
};
|
};
|
||||||
} // namespace Slic3r::sla
|
} // namespace Slic3r::sla
|
||||||
#endif // slic3r_SLA_SuppotstIslands_SampleConfigFactory_hpp_
|
#endif // slic3r_SLA_SuppotstIslands_SampleConfigFactory_hpp_
|
||||||
|
@ -680,7 +680,7 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy current configuration for sampling islands
|
// copy current configuration for sampling islands
|
||||||
config.island_configuration = SampleConfigFactory::get_sample_config(); // copy
|
config.island_configuration = SampleConfigFactory::get_sample_config(config.density_relative);
|
||||||
|
|
||||||
// scaling for the sub operations
|
// scaling for the sub operations
|
||||||
double d = objectstep_scale * OBJ_STEP_LEVELS[slaposSupportPoints] / 100.0;
|
double d = objectstep_scale * OBJ_STEP_LEVELS[slaposSupportPoints] / 100.0;
|
||||||
|
@ -742,19 +742,23 @@ RENDER_AGAIN:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *support_points_density = "support_points_density_relative";
|
const char *support_points_density = "support_points_density_relative";
|
||||||
float density = static_cast<const ConfigOptionInt*>(get_config_options({support_points_density})[0])->value;
|
float density = static_cast<const ConfigOptionInt*>(get_config_options({support_points_density})[0])->value;
|
||||||
if (m_imgui->slider_float("##density", &density, 0.f, 200.f, "%.f %%")){
|
|
||||||
|
wxString tooltip = _L(
|
||||||
|
"Divider for the supported radius\n"
|
||||||
|
"Smaller value means less point, supported radius is enlarged.\n"
|
||||||
|
"Larger value means more points, supported radius is reduced.\n"
|
||||||
|
"-- density percent ----- radisu change from 100 --\n"
|
||||||
|
"| 50 | 200 |\n"
|
||||||
|
"| 75 | 133 |\n"
|
||||||
|
"| 125 | 80 |\n"
|
||||||
|
"| 150 | 66 |\n"
|
||||||
|
"| 200 | 50 |\n");
|
||||||
|
if (m_imgui->slider_float("##density", &density, 50.f, 200.f, "%.f %%", 1.f, false, tooltip)){
|
||||||
|
if (density < 10.f) // not neccessary, but lower value seems pointless. Zero cause issues inside algorithms.
|
||||||
|
density = 10.f;
|
||||||
mo->config.set(support_points_density, (int) density);
|
mo->config.set(support_points_density, (int) density);
|
||||||
} else if (ImGui::IsItemHovered())
|
}
|
||||||
ImGui::SetTooltip("Divider for the supported radius\n"
|
|
||||||
"Smaller value means less point, supported radius is enlarged.\n"
|
|
||||||
"Larger value means more points, supported radius is reduced.\n"
|
|
||||||
"-- density percent ----- radisu change from 100 --\n"
|
|
||||||
"| 50 | 200 |\n"
|
|
||||||
"| 75 | 133 |\n"
|
|
||||||
"| 125 | 80 |\n"
|
|
||||||
"| 150 | 66 |\n"
|
|
||||||
"| 200 | 50 |\n");
|
|
||||||
|
|
||||||
const ImGuiWrapper::LastSliderStatus &density_status = m_imgui->get_last_slider_status();
|
const ImGuiWrapper::LastSliderStatus &density_status = m_imgui->get_last_slider_status();
|
||||||
static std::optional<int> density_stash; // Value for undo/redo stack is written on stop dragging
|
static std::optional<int> density_stash; // Value for undo/redo stack is written on stop dragging
|
||||||
|
Loading…
x
Reference in New Issue
Block a user