mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
Merge branch 'main' into feature/orca_network_refactor
This commit is contained in:
@@ -224,7 +224,9 @@ void Fill3DHoneycomb::_fill_surface_single(
|
||||
// This means that the resultant infill won't be an ideal truncated octahedron,
|
||||
// but it should look better than the equivalent quantised version
|
||||
|
||||
coordf_t layerHeight = scale_(thickness_layers);
|
||||
//Orca: uses a fixed layer height to avoid inconsistent bridges and variable layer height artifacts.
|
||||
//coordf_t layerHeight = scale_(thickness_layers);
|
||||
coordf_t layerHeight = scale_(1.0);
|
||||
// ceiling to an integer value of layers per Z
|
||||
// (with a little nudge in case it's close to perfect)
|
||||
coordf_t layersPerModule = floor((gridSize * 2) / (zScale * layerHeight) + 0.05);
|
||||
@@ -300,4 +302,4 @@ void Fill3DHoneycomb::_fill_surface_single(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -1388,7 +1388,7 @@ void PresetCollection::load_presets(
|
||||
}
|
||||
if (presets_loaded.size() > 0)
|
||||
m_presets.insert(m_presets.end(), std::make_move_iterator(presets_loaded.begin()), std::make_move_iterator(presets_loaded.end()));
|
||||
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
|
||||
sort_presets();
|
||||
//BBS: add config related logs
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": loaded %1% presets from %2%, type %3%")%presets_loaded.size() %dir %Preset::get_type_string(m_type);
|
||||
//this->select_preset(first_visible_idx());
|
||||
@@ -1583,7 +1583,7 @@ void PresetCollection::load_project_embedded_presets(std::vector<Preset*>& proje
|
||||
}
|
||||
|
||||
m_presets.insert(m_presets.end(), std::make_move_iterator(presets_loaded.begin()), std::make_move_iterator(presets_loaded.end()));
|
||||
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
|
||||
sort_presets();
|
||||
//don't select it here
|
||||
//this->select_preset(first_visible_idx());
|
||||
unlock();
|
||||
@@ -1976,7 +1976,7 @@ void PresetCollection::update_after_user_presets_loaded()
|
||||
lock();
|
||||
std::string selected_name = get_selected_preset_name();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", before sort, type %1%, selected_idx %2%, selected_name %3%") %m_type %m_idx_selected %selected_name;
|
||||
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
|
||||
sort_presets();
|
||||
this->select_preset_by_name(selected_name, false);
|
||||
unlock();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", after sort, type %1%, selected_idx %2%") %m_type %m_idx_selected;
|
||||
@@ -3129,7 +3129,9 @@ std::vector<std::string> PresetCollection::merge_presets(PresetCollection &&othe
|
||||
if (preset.is_default || preset.is_external)
|
||||
continue;
|
||||
Preset key(m_type, preset.name);
|
||||
auto it = std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key);
|
||||
auto it = (m_type == Preset::TYPE_FILAMENT)
|
||||
? std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key, filament_preset_less)
|
||||
: std::lower_bound(m_presets.begin() + m_num_default_presets, m_presets.end(), key);
|
||||
if (it == m_presets.end() || it->name != preset.name) {
|
||||
if (preset.vendor != nullptr) {
|
||||
// Re-assign a pointer to the vendor structure in the new PresetBundle.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <unordered_set>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
|
||||
@@ -77,6 +78,8 @@
|
||||
#define ORCA_JSON_KEY_RENAMED_FROM "renamed_from"
|
||||
|
||||
|
||||
static constexpr const char* GENERIC_PREFIX = "Generic ";
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class AppConfig;
|
||||
@@ -766,13 +769,39 @@ protected:
|
||||
void set_custom_preset_alias(Preset &preset);
|
||||
|
||||
private:
|
||||
// Comparator that sorts "Generic " prefixed presets before others, then alphabetically within each group.
|
||||
static bool filament_preset_less(const Preset &a, const Preset &b) {
|
||||
bool a_generic = boost::starts_with(a.name, GENERIC_PREFIX);
|
||||
bool b_generic = boost::starts_with(b.name, GENERIC_PREFIX);
|
||||
if (a_generic != b_generic)
|
||||
return a_generic; // generics first
|
||||
return a.name < b.name;
|
||||
}
|
||||
|
||||
// Sort presets: filament presets use generic-first ordering, others sort alphabetically.
|
||||
void sort_presets() {
|
||||
if (m_type == Preset::TYPE_FILAMENT)
|
||||
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end(), filament_preset_less);
|
||||
else
|
||||
std::sort(m_presets.begin() + m_num_default_presets, m_presets.end());
|
||||
}
|
||||
|
||||
// Find a preset position in the sorted list of presets.
|
||||
// The "-- default -- " preset is always the first, so it needs
|
||||
// to be handled differently.
|
||||
// If a preset does not exist, an iterator is returned indicating where to insert a preset with the same name.
|
||||
std::deque<Preset>::iterator find_preset_internal(const std::string &name, bool from_orca_lib_only = false)
|
||||
{
|
||||
auto it = Slic3r::lower_bound_by_predicate(m_presets.begin() + m_num_default_presets, m_presets.end(), [&name](const auto& l) { return l.name < name; });
|
||||
auto it = Slic3r::lower_bound_by_predicate(m_presets.begin() + m_num_default_presets, m_presets.end(),
|
||||
[&name, this](const auto& l) {
|
||||
if (m_type == Preset::TYPE_FILAMENT) {
|
||||
bool l_generic = boost::starts_with(l.name, GENERIC_PREFIX);
|
||||
bool name_generic = boost::starts_with(name, GENERIC_PREFIX);
|
||||
if (l_generic && !name_generic) return true;
|
||||
if (!l_generic && name_generic) return false;
|
||||
}
|
||||
return l.name < name;
|
||||
});
|
||||
if (it == m_presets.end() || it->name != name) {
|
||||
// Preset has not been not found in the sorted list of non-default presets. Try the defaults.
|
||||
for (size_t i = 0; i < m_num_default_presets; ++ i)
|
||||
|
||||
@@ -2615,13 +2615,16 @@ void PrintObject::bridge_over_infill()
|
||||
auto determine_bridging_angle = [](const Polygons &bridged_area, const Lines &anchors, InfillPattern dominant_pattern, double infill_direction) {
|
||||
AABBTreeLines::LinesDistancer<Line> lines_tree(anchors);
|
||||
|
||||
// Orca: since 3D Honeycomb was "fixed" by forcing coordf_t layerHeight = scale_(1.0), this is no longer needed.
|
||||
// CorssHatch also does not need fixed angle.
|
||||
//
|
||||
// Check it the infill that require a fixed infill angle.
|
||||
switch (dominant_pattern) {
|
||||
case ip3DHoneycomb:
|
||||
case ipCrossHatch:
|
||||
return (infill_direction + 45.0) * 2.0 * M_PI / 360.;
|
||||
default: break;
|
||||
}
|
||||
//switch (dominant_pattern) {
|
||||
//case ip3DHoneycomb:
|
||||
//case ipCrossHatch:
|
||||
// return (infill_direction + 45.0) * 2.0 * M_PI / 360.;
|
||||
//default: break;
|
||||
//}
|
||||
|
||||
std::map<double, int> counted_directions;
|
||||
for (const Polygon &p : bridged_area) {
|
||||
|
||||
Reference in New Issue
Block a user