mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 05:27:50 +00:00
Implement a Preferences option to set Draco position quantization bits
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Format/DRC.hpp"
|
||||
#include "AppConfig.hpp"
|
||||
//BBS
|
||||
#include "Preset.hpp"
|
||||
@@ -124,6 +125,8 @@ void AppConfig::set_defaults()
|
||||
#ifdef _WIN32
|
||||
if (get("associate_3mf").empty())
|
||||
set_bool("associate_3mf", false);
|
||||
if (get("associate_drc").empty())
|
||||
set_bool("associate_drc", false);
|
||||
if (get("associate_stl").empty())
|
||||
set_bool("associate_stl", false);
|
||||
if (get("associate_step").empty())
|
||||
@@ -234,6 +237,9 @@ void AppConfig::set_defaults()
|
||||
if (get("enable_multi_machine").empty())
|
||||
set_bool("enable_multi_machine", false);
|
||||
|
||||
if (get("drc_bits").empty())
|
||||
set("drc_bits", DRC_BITS_DEFAULT_STR);
|
||||
|
||||
if (get("show_gcode_window").empty())
|
||||
set_bool("show_gcode_window", true);
|
||||
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
#define DRC_BITS_MIN 0
|
||||
#define DRC_BITS_MAX 30
|
||||
#define DRC_BITS_DEFAULT 16
|
||||
#define DRC_BITS_DEFAULT_STR "16"
|
||||
|
||||
class TriangleMesh;
|
||||
class ModelObject;
|
||||
class Model;
|
||||
|
||||
@@ -14877,8 +14877,15 @@ void Plater::export_drc(bool extended, bool selection_only, bool multi_drcs)
|
||||
if (p->model.objects.empty()) { return; }
|
||||
|
||||
wxString path;
|
||||
int bits = 16;
|
||||
int bits = 0;
|
||||
int speed = 0;
|
||||
|
||||
AppConfig* app_config = wxGetApp().app_config;
|
||||
if (app_config) bits = stoi(app_config->get("drc_bits"));
|
||||
|
||||
if (bits < DRC_BITS_MIN) bits = DRC_BITS_MIN;
|
||||
if (bits > DRC_BITS_MAX) bits = DRC_BITS_MAX;
|
||||
|
||||
if (multi_drcs) {
|
||||
wxDirDialog dlg(this, _L("Choose a directory"), from_u8(wxGetApp().app_config->get_last_dir()),
|
||||
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "MsgDialog.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#include "libslic3r/Format/DRC.hpp"
|
||||
#include <wx/language.h>
|
||||
#include "OG_CustomCtrl.hpp"
|
||||
#include "wx/graphics.h"
|
||||
@@ -1314,6 +1315,16 @@ void PreferencesDialog::create_items()
|
||||
g_sizer->Add(item_pop_up_filament_map_dialog);
|
||||
#endif
|
||||
|
||||
auto item_draco_position_bits = create_item_input(_L("Draco quantization bits\n(Note: Affects dimensional accuracy)"), _L("(0 for no quantization)"), _L("More bits results in better quality and dimensional accuracy but larger file size.\n0 disables quantization, producing a nearly lossless file. ~16 bits is visually lossless but can introduce small dimensional errors over longer distances."), "drc_bits", [=](wxString value) {
|
||||
long drcBits = DRC_BITS_DEFAULT;
|
||||
if (value.ToLong(&drcBits)) {
|
||||
if (drcBits < DRC_BITS_MIN) drcBits = DRC_BITS_MIN;
|
||||
if (drcBits > DRC_BITS_MAX) drcBits = DRC_BITS_MAX;
|
||||
app_config->set("drc_bits", std::to_string(drcBits));
|
||||
}
|
||||
});
|
||||
g_sizer->Add(item_draco_position_bits);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user