diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index c1b496e6a4..034f8b577a 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -223,6 +223,7 @@ set(lisbslic3r_sources Format/DRC.hpp Format/bbs_3mf.cpp Format/bbs_3mf.hpp + Format/ProjectStrategy.hpp format.hpp Format/OBJ.cpp Format/OBJ.hpp diff --git a/src/libslic3r/Format/ProjectStrategy.hpp b/src/libslic3r/Format/ProjectStrategy.hpp new file mode 100644 index 0000000000..a274dd52b9 --- /dev/null +++ b/src/libslic3r/Format/ProjectStrategy.hpp @@ -0,0 +1,78 @@ +#pragma once + +#include +#include + +// Flags steering how a project (3MF) is loaded and saved. Kept apart from bbs_3mf.hpp so +// headers that only name the flags, such as Plater.hpp, need not pull in the 3MF reader. + +namespace Slic3r { + +enum class LoadStrategy +{ + Default = 0, + AddDefaultInstances = 1, + CheckVersion = 2, + LoadModel = 4, + LoadConfig = 8, + LoadAuxiliary = 16, + Silence = 32, + ImperialUnits = 64, + + Restore = 0x10000 | LoadModel | LoadConfig | LoadAuxiliary | Silence, +}; + +inline LoadStrategy operator | (LoadStrategy lhs, LoadStrategy rhs) +{ + using T = std::underlying_type_t ; + return static_cast(static_cast(lhs) | static_cast(rhs)); +} + +inline bool operator & (LoadStrategy & lhs, LoadStrategy rhs) +{ + using T = std::underlying_type_t ; + return (static_cast(lhs) & static_cast(rhs)) == static_cast(rhs); +} + +enum class SaveStrategy +{ + Default = 0, + FullPathSources = 1, + Zip64 = 1 << 1, + ProductionExt = 1 << 2, + SecureContentExt = 1 << 3, + WithGcode = 1 << 4, + Silence = 1 << 5, + SkipStatic = 1 << 6, + SkipModel = 1 << 7, + WithSliceInfo = 1 << 8, + SkipAuxiliary = 1 << 9, + UseLoadedId = 1 << 10, + ShareMesh = 1 << 11, + // Keep this separate from SplitModel, which uses the 0x1000 bit as part of its + // production-extension value. + MinimalPublished = 1 << 13, + // With WithGcode, also the G-code's statistics. + WithStatistics = 1 << 14, + + SplitModel = 0x1000 | ProductionExt, + Encrypted = SecureContentExt | SplitModel, + Backup = 0x10000 | WithGcode | Silence | SkipStatic | SplitModel, +}; + +inline SaveStrategy operator | (SaveStrategy lhs, SaveStrategy rhs) +{ + using T = std::underlying_type_t ; + return static_cast(static_cast(lhs) | static_cast(rhs)); +} + +inline bool operator & (SaveStrategy & lhs, SaveStrategy rhs) +{ + using T = std::underlying_type_t ; + return ((static_cast(lhs) & static_cast(rhs))) == static_cast(rhs); +} + +// Progress callback of the 3MF export; cancel may be set to stop it. +typedef std::function Export3mfProgressFn; + +} // namespace Slic3r diff --git a/src/libslic3r/Format/bbs_3mf.hpp b/src/libslic3r/Format/bbs_3mf.hpp index 611cc26e03..0868260db9 100644 --- a/src/libslic3r/Format/bbs_3mf.hpp +++ b/src/libslic3r/Format/bbs_3mf.hpp @@ -3,6 +3,7 @@ #include "../GCode/ThumbnailData.hpp" #include "libslic3r/MultiNozzleUtils.hpp" +#include "libslic3r/Format/ProjectStrategy.hpp" #include "libslic3r/Semver.hpp" #include "libslic3r/ProjectTask.hpp" #include "libslic3r/GCode/GCodeProcessor.hpp" @@ -159,32 +160,6 @@ struct PlateData }; // BBS: encrypt -enum class SaveStrategy -{ - Default = 0, - FullPathSources = 1, - Zip64 = 1 << 1, - ProductionExt = 1 << 2, - SecureContentExt = 1 << 3, - WithGcode = 1 << 4, - Silence = 1 << 5, - SkipStatic = 1 << 6, - SkipModel = 1 << 7, - WithSliceInfo = 1 << 8, - SkipAuxiliary = 1 << 9, - UseLoadedId = 1 << 10, - ShareMesh = 1 << 11, - // Keep this separate from SplitModel, which uses the 0x1000 bit as part of its - // production-extension value. - MinimalPublished = 1 << 13, - // With WithGcode, also the G-code's statistics. - WithStatistics = 1 << 14, - - SplitModel = 0x1000 | ProductionExt, - Encrypted = SecureContentExt | SplitModel, - Backup = 0x10000 | WithGcode | Silence | SkipStatic | SplitModel, -}; - // Model metadata keys of a "published" 3MF (see MinimalPublished): the flag marks a minimal, // tag-less publish export, the others carry the author-selected settings payload. Namespaced // with the "orca_published" prefix because metadata_items round-trips verbatim through other @@ -198,48 +173,10 @@ inline constexpr const char *ORCA_PUBLISHED_CONFIG_TAG = "orca_published_confi // exact value, so a "0"/"false"/unknown value is rejected consistently. bool is_published_3mf_flag(const std::string &value); -inline SaveStrategy operator | (SaveStrategy lhs, SaveStrategy rhs) -{ - using T = std::underlying_type_t ; - return static_cast(static_cast(lhs) | static_cast(rhs)); -} - -inline bool operator & (SaveStrategy & lhs, SaveStrategy rhs) -{ - using T = std::underlying_type_t ; - return ((static_cast(lhs) & static_cast(rhs))) == static_cast(rhs); -} - enum { brim_points_format_version = 0 }; -enum class LoadStrategy -{ - Default = 0, - AddDefaultInstances = 1, - CheckVersion = 2, - LoadModel = 4, - LoadConfig = 8, - LoadAuxiliary = 16, - Silence = 32, - ImperialUnits = 64, - - Restore = 0x10000 | LoadModel | LoadConfig | LoadAuxiliary | Silence, -}; - -inline LoadStrategy operator | (LoadStrategy lhs, LoadStrategy rhs) -{ - using T = std::underlying_type_t ; - return static_cast(static_cast(lhs) | static_cast(rhs)); -} - -inline bool operator & (LoadStrategy & lhs, LoadStrategy rhs) -{ - using T = std::underlying_type_t ; - return (static_cast(lhs) & static_cast(rhs)) == static_cast(rhs); -} - const int EXPORT_STAGE_OPEN_3MF = 0; const int EXPORT_STAGE_CONTENT_TYPES = 1; const int EXPORT_STAGE_ADD_THUMBNAILS = 2; @@ -272,7 +209,6 @@ const int IMPORT_LOAD_MODEL_OBJECTS = 12; const int IMPORT_STAGE_MAX = 13; //BBS export 3mf progress -typedef std::function Export3mfProgressFn; typedef std::function Import3mfProgressFn; typedef std::vector PlateDataPtrs; diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 7dad07c9f7..a69084eae9 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -9,6 +9,7 @@ #include "GUI_App.hpp" #include "GUI_Colors.hpp" #include "Plater.hpp" +#include "PartPlate.hpp" #include "BitmapCache.hpp" #include "Camera.hpp" diff --git a/src/slic3r/GUI/NativeCommands.cpp b/src/slic3r/GUI/NativeCommands.cpp index 6f9918dee2..6f3cea8096 100644 --- a/src/slic3r/GUI/NativeCommands.cpp +++ b/src/slic3r/GUI/NativeCommands.cpp @@ -16,6 +16,7 @@ #include "NetworkTestDialog.hpp" #include "Plater.hpp" #include "PluginsDialog.hpp" +#include "PartPlate.hpp" #include "PlateSettingsDialog.hpp" #include "SceneBenchmark.hpp" #include "DeviceCore/DevManager.h" diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 868f90ccab..9b6ca73e29 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -46,6 +46,7 @@ #include "libslic3r/Model.hpp" #include #include "slic3r/GUI/Plater.hpp" +#include "slic3r/GUI/PartPlate.hpp" #include #include #include diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 40bbb0e01c..38c33c0f3a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -71,6 +71,7 @@ #include "slic3r/GUI/GUI_ObjectSettings.hpp" #include "slic3r/GUI/ColorDecomposeDialog.hpp" #include "slic3r/GUI/SettingsIndex.hpp" +#include "slic3r/GUI/Widgets/TextInput.hpp" #include "slic3r/GUI/Jobs/Job.hpp" #include "slic3r/GUI/ParamsPanel.hpp" #include "slic3r/GUI/SceneRaycaster.hpp" @@ -180,6 +181,7 @@ #include "libslic3r/PresetBundle.hpp" #include "libslic3r/IMEXHelpers.hpp" #include "libslic3r/PublishSettings.hpp" +#include "libslic3r/TriangleMesh.hpp" #include "slic3r/Utils/CrealityPrint.hpp" #include "libslic3r/ClipperUtils.hpp" // For stl export diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index f00cdbacc8..931ae9716c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -7,21 +7,16 @@ #include #include "libslic3r/Technologies.hpp" #include "libslic3r/Color.hpp" -#include "libslic3r/Format/bbs_3mf.hpp" +#include "libslic3r/Format/ProjectStrategy.hpp" #include #include #include "libslic3r/Point.hpp" -#include "libslic3r/PublishSettings.hpp" -#include "libslic3r/TriangleMesh.hpp" #include "libslic3r/libslic3r.h" #include #include #include "slic3r/GUI/Event.hpp" #include "slic3r/GUI/I18N.hpp" #include -#include "slic3r/GUI/ObjectDataViewModel.hpp" -#include "slic3r/GUI/SettingsIndex.hpp" -#include "slic3r/GUI/Widgets/TextInput.hpp" #include #include @@ -43,8 +38,6 @@ #include "libslic3r/GCode/GCodeProcessor.hpp" #include "Jobs/Job.hpp" #include "Jobs/Worker.hpp" -#include "Search.hpp" -#include "PartPlate.hpp" #include "GUI_App.hpp" #include "Jobs/PrintJob.hpp" #include "Jobs/SendJob.hpp" @@ -63,9 +56,19 @@ class wxScrolledWindow; class wxString; class ComboBox; class Button; +class TextInput; namespace Slic3r { +struct PlateData; +typedef std::vector PlateDataPtrs; +struct PublishedMaterialEntry; +class TriangleMesh; +namespace Search { +class OptionsSearcher; +class SettingsIndex; +} + class BuildVolume; class MachineObject; enum class BuildVolume_Type : char; @@ -105,7 +108,9 @@ class DailyTipsWindow; struct Camera; class GLToolbar; class PlaterPresetComboBox; +class PartPlate; class PartPlateList; +class ObjectDataViewModelNode; class SyncNozzleAndAmsDialog; class FinishSyncAmsDialog; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c5191dddbf..535b922b0e 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -91,6 +91,7 @@ #include "slic3r/plugin/PluginConfig.hpp" #include "slic3r/plugin/PluginManager.hpp" #include "Plater.hpp" +#include "PartPlate.hpp" #include "ParamsDialog.hpp" #include "MainFrame.hpp" #include "format.hpp"