mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 20:02:17 +00:00
Add support for Draco (.drc) format (#10681)
* Add read support for Google's Draco (.drc) format. * Fix build on Linux * Use boost instead of fstat. * Switch to boost memory-mapped file to save RAM and potentially improve performance. * Trim trailing whitespace. * Initial Draco write support. Currently always exports with 16-bit precision and speed 0 (best compression). The back-end function does have arguments to specify them, it's just not hooked into the GUI. * Add Draco to the About dialogue. * Fix Linux compile (hopefully) * Add an option to associate DRC files on Windows. * Implement a Preferences option to set Draco position quantization bits * Update src/slic3r/GUI/Preferences.cpp Co-authored-by: Ian Bassi <ian.bassi@outlook.com> * Some slight changes to ianalexis's suggestion. * Implement a create_item_spinctrl() function for numeric inputs, and use that instead of create_item_input(). * Move "bits" to inside the spinctrl box. * Refactor following yw4z's feedback * Update src/slic3r/GUI/Preferences.cpp Co-authored-by: Ian Bassi <ian.bassi@outlook.com> * Change to 0 bits as the default setting for Draco export precision. * Change to a lossy checkbox and a bits field with a range of 8-30. * Proper SpinInput code from yw4z * Revert "Proper SpinInput code from yw4z" This reverts commit7e9c85f31a. * Revert "Change to a lossy checkbox and a bits field with a range of 8-30." This reverts commitd642c9bcc0. * Redo preferences based on SoftFever's feedback * Refactor to minimize code duplication * Fix padding * Improve Draco export quality level tooltip clarity Clarify that 0 means lossless compression (not uncompressed), document the valid lossy range (8-30), and better explain the tradeoff between file size and geometric detail. --------- Co-authored-by: SoftFever <softfeverever@gmail.com> Co-authored-by: Noisyfox <timemanager.rick@gmail.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
This commit is contained in:
@@ -863,6 +863,27 @@ void MenuFactory::append_menu_item_export_stl(wxMenu* menu, bool is_mulity_menu)
|
||||
}, m_parent);
|
||||
}
|
||||
|
||||
void MenuFactory::append_menu_item_export_drc(wxMenu* menu, bool is_mulity_menu)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _L("Export as one DRC") + dots, "",
|
||||
[](wxCommandEvent&) { plater()->export_stl(false, true, false, FT_DRC); }, "", nullptr,
|
||||
[is_mulity_menu]() {
|
||||
const Selection& selection = plater()->canvas3D()->get_selection();
|
||||
if (is_mulity_menu)
|
||||
return selection.is_multiple_full_instance() || selection.is_multiple_full_object();
|
||||
else
|
||||
return selection.is_single_full_instance() || selection.is_single_full_object();
|
||||
}, m_parent);
|
||||
if (!is_mulity_menu)
|
||||
return;
|
||||
append_menu_item(menu, wxID_ANY, _L("Export as DRCs") + dots, "",
|
||||
[](wxCommandEvent&) { plater()->export_stl(false, true, true, FT_DRC); }, "", nullptr,
|
||||
[]() {
|
||||
const Selection& selection = plater()->canvas3D()->get_selection();
|
||||
return selection.is_multiple_full_instance() || selection.is_multiple_full_object();
|
||||
}, m_parent);
|
||||
}
|
||||
|
||||
void MenuFactory::append_menu_item_reload_from_disk(wxMenu* menu)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _L("Reload from disk"), _L("Reload the selected parts from disk"),
|
||||
@@ -1282,6 +1303,7 @@ void MenuFactory::create_common_object_menu(wxMenu* menu)
|
||||
|
||||
append_menu_item_reload_from_disk(menu);
|
||||
append_menu_item_export_stl(menu);
|
||||
append_menu_item_export_drc(menu);
|
||||
// "Scale to print volume" makes a sense just for whole object
|
||||
append_menu_item_scale_selection_to_fit_print_volume(menu);
|
||||
|
||||
@@ -1367,6 +1389,7 @@ void MenuFactory::create_extra_object_menu()
|
||||
append_menu_item_replace_with_stl(&m_object_menu);
|
||||
append_menu_item_replace_all_with_stl(&m_object_menu);
|
||||
append_menu_item_export_stl(&m_object_menu);
|
||||
append_menu_item_export_drc(&m_object_menu);
|
||||
}
|
||||
|
||||
void MenuFactory::create_bbl_assemble_object_menu()
|
||||
@@ -1401,6 +1424,7 @@ void MenuFactory::create_part_menu()
|
||||
append_menu_item_delete(menu);
|
||||
append_menu_item_reload_from_disk(menu);
|
||||
append_menu_item_export_stl(menu);
|
||||
append_menu_item_export_drc(menu);
|
||||
append_menu_item_fix_through_netfabb(menu);
|
||||
append_menu_items_mirror(menu);
|
||||
append_menu_item_merge_parts_to_single_part(menu);
|
||||
@@ -1782,6 +1806,7 @@ wxMenu* MenuFactory::multi_selection_menu()
|
||||
append_menu_item_change_filament(menu);
|
||||
menu->AppendSeparator();
|
||||
append_menu_item_export_stl(menu, true);
|
||||
append_menu_item_export_drc(menu, true);
|
||||
}
|
||||
else {
|
||||
append_menu_item_center(menu);
|
||||
|
||||
Reference in New Issue
Block a user