Tech ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED set as default

This commit is contained in:
enricoturri1966 2021-11-30 09:41:43 +01:00
parent 03a6a46dce
commit 781b457035
6 changed files with 1 additions and 49 deletions

View File

@ -2710,16 +2710,10 @@ namespace Slic3r {
bool _3MF_Exporter::_add_build_to_model_stream(std::stringstream& stream, const BuildItemsList& build_items) bool _3MF_Exporter::_add_build_to_model_stream(std::stringstream& stream, const BuildItemsList& build_items)
{ {
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
// This happens for empty projects // This happens for empty projects
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
if (build_items.size() == 0) { if (build_items.size() == 0) {
add_error("No build item found"); add_error("No build item found");
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
return true; return true;
#else
return false;
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
} }
stream << " <" << BUILD_TAG << ">\n"; stream << " <" << BUILD_TAG << ">\n";

View File

@ -160,13 +160,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
if (!result) if (!result)
throw Slic3r::RuntimeError("Loading of a model file failed."); throw Slic3r::RuntimeError("Loading of a model file failed.");
#if !ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED for (ModelObject *o : model.objects) {
if (model.objects.empty())
throw Slic3r::RuntimeError("The supplied file couldn't be read because it's empty");
#endif // !ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
for (ModelObject *o : model.objects)
{
// if (boost::algorithm::iends_with(input_file, ".zip.amf")) // if (boost::algorithm::iends_with(input_file, ".zip.amf"))
// { // {
// // we remove the .zip part of the extension to avoid it be added to filenames when exporting // // we remove the .zip part of the extension to avoid it be added to filenames when exporting

View File

@ -36,17 +36,6 @@
#define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1 #define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS 1
//====================
// 2.4.0.alpha1 techs
//====================
#define ENABLE_2_4_0_ALPHA1 1
// Enable implementation of retract acceleration in gcode processor
#define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA1)
// Enable save and save as commands to be enabled also when the plater is empty and allow to load empty projects
#define ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED (1 && ENABLE_2_4_0_ALPHA1)
//==================== //====================
// 2.4.0.alpha2 techs // 2.4.0.alpha2 techs
//==================== //====================

View File

@ -4130,24 +4130,15 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
} }
} }
#if !ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
if (visible_volumes.empty())
return;
#endif // !ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
BoundingBoxf3 volumes_box; BoundingBoxf3 volumes_box;
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
if (!visible_volumes.empty()) { if (!visible_volumes.empty()) {
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
for (const GLVolume* vol : visible_volumes) { for (const GLVolume* vol : visible_volumes) {
volumes_box.merge(vol->transformed_bounding_box()); volumes_box.merge(vol->transformed_bounding_box());
} }
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
} }
else else
// This happens for empty projects // This happens for empty projects
volumes_box = m_bed.extended_bounding_box(); volumes_box = m_bed.extended_bounding_box();
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
Camera camera; Camera camera;
camera.set_type(camera_type); camera.set_type(camera_type);

View File

@ -831,26 +831,15 @@ bool MainFrame::can_start_new_project() const
bool MainFrame::can_save() const bool MainFrame::can_save() const
{ {
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
return (m_plater != nullptr) && return (m_plater != nullptr) &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false) && !m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false) &&
m_plater->is_project_dirty(); m_plater->is_project_dirty();
#else
return (m_plater != nullptr) && !m_plater->model().objects.empty() &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false) &&
!m_plater->get_project_filename().empty() && m_plater->is_project_dirty();
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
} }
bool MainFrame::can_save_as() const bool MainFrame::can_save_as() const
{ {
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
return (m_plater != nullptr) && return (m_plater != nullptr) &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false); !m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false);
#else
return (m_plater != nullptr) && !m_plater->model().objects.empty() &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false);
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
} }
void MainFrame::save_project() void MainFrame::save_project()

View File

@ -5918,16 +5918,11 @@ void Plater::export_amf()
bool Plater::export_3mf(const boost::filesystem::path& output_path) bool Plater::export_3mf(const boost::filesystem::path& output_path)
{ {
#if ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
if (p->model.objects.empty()) { if (p->model.objects.empty()) {
MessageDialog dialog(nullptr, _L("The plater is empty.\nDo you want to save the project?"), _L("Save project"), wxYES_NO); MessageDialog dialog(nullptr, _L("The plater is empty.\nDo you want to save the project?"), _L("Save project"), wxYES_NO);
if (dialog.ShowModal() != wxID_YES) if (dialog.ShowModal() != wxID_YES)
return false; return false;
} }
#else
if (p->model.objects.empty())
return false;
#endif // ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED
wxString path; wxString path;
bool export_config = true; bool export_config = true;