Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-09-23 16:35:49 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-09-23 16:35:49 +0300
commit2dc9949a4c129a448d0a5881ac2d2d165e2fea4c (patch)
treee6dd63f56def320ec86a4074ac5f3eff06be10fb /src/slic3r/GUI
parent1115e77b38ae974f67252524fc401282bec1209f (diff)
ENABLE_ENHANCED_RELOAD_FROM_DISK set as default
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp12
-rw-r--r--src/slic3r/GUI/GUI_ObjectList.cpp12
-rw-r--r--src/slic3r/GUI/GUI_ObjectList.hpp2
-rw-r--r--src/slic3r/GUI/Plater.cpp117
-rw-r--r--src/slic3r/GUI/Plater.hpp4
-rw-r--r--src/slic3r/GUI/Selection.cpp4
6 files changed, 2 insertions, 149 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 7a94b8238..ec79d0ec1 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -1765,7 +1765,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
std::vector<ModelVolumeState> model_volume_state;
std::vector<ModelVolumeState> aux_volume_state;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
struct GLVolumeState {
GLVolumeState() :
volume_idx(-1) {}
@@ -1776,7 +1775,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// Volume index in the old GLVolume vector.
size_t volume_idx;
};
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
// SLA steps to pull the preview meshes for.
typedef std::array<SLAPrintObjectStep, 2> SLASteps;
@@ -1789,9 +1787,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
std::vector<size_t> instance_ids_selected;
std::vector<size_t> map_glvolume_old_to_new(m_volumes.volumes.size(), size_t(-1));
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
std::vector<GLVolumeState> deleted_volumes;
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
std::vector<GLVolume*> glvolumes_new;
glvolumes_new.reserve(m_volumes.volumes.size());
auto model_volume_state_lower = [](const ModelVolumeState& m1, const ModelVolumeState& m2) { return m1.geometry_id < m2.geometry_id; };
@@ -1872,14 +1868,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
volume_idx_wipe_tower_old = (int)volume_id;
}
if (!m_reload_delayed)
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
{
deleted_volumes.emplace_back(volume, volume_id);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
delete volume;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
}
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
}
else {
// This GLVolume will be reused.
@@ -1909,7 +1901,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
bool update_object_list = false;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
auto find_old_volume_id = [&deleted_volumes](const GLVolume::CompositeID& id) -> unsigned int {
for (unsigned int i = 0; i < (unsigned int)deleted_volumes.size(); ++i)
{
@@ -1919,7 +1910,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
}
return (unsigned int)-1;
};
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
if (m_volumes.volumes != glvolumes_new)
update_object_list = true;
@@ -1935,11 +1925,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
assert(it != model_volume_state.end() && it->geometry_id == key.geometry_id);
if (it->new_geometry()) {
// New volume.
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
unsigned int old_id = find_old_volume_id(it->composite_id);
if (old_id != -1)
map_glvolume_old_to_new[old_id] = m_volumes.volumes.size();
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_color_by, m_initialized);
m_volumes.volumes.back()->geometry_id = key.geometry_id;
update_object_list = true;
diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp
index 7c9941bef..a59a1288e 100644
--- a/src/slic3r/GUI/GUI_ObjectList.cpp
+++ b/src/slic3r/GUI/GUI_ObjectList.cpp
@@ -1510,13 +1510,11 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const
menu->AppendSeparator();
}
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const
{
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater());
}
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void ObjectList::append_menu_item_change_extruder(wxMenu* menu) const
{
@@ -1567,9 +1565,7 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
append_menu_items_osx(menu);
#endif // __WXOSX__
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_reload_from_disk(menu);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_export_stl(menu);
append_menu_item_fix_through_netfabb(menu);
append_menu_item_scale_selection_to_fit_print_volume(menu);
@@ -1593,9 +1589,7 @@ void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
append_menu_items_osx(menu);
#endif // __WXOSX__
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_reload_from_disk(menu);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_export_stl(menu);
append_menu_item_fix_through_netfabb(menu);
// rest of a object_sla_menu will be added later in:
@@ -1608,15 +1602,9 @@ void ObjectList::create_part_popupmenu(wxMenu *menu)
append_menu_items_osx(menu);
#endif // __WXOSX__
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_reload_from_disk(menu);
-#else
- append_menu_item_fix_through_netfabb(menu);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_export_stl(menu);
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_fix_through_netfabb(menu);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item_split(menu);
diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp
index c8d89cbe3..e1b0b7993 100644
--- a/src/slic3r/GUI/GUI_ObjectList.hpp
+++ b/src/slic3r/GUI/GUI_ObjectList.hpp
@@ -234,9 +234,7 @@ public:
void append_menu_items_osx(wxMenu* menu);
wxMenuItem* append_menu_item_fix_through_netfabb(wxMenu* menu);
void append_menu_item_export_stl(wxMenu* menu) const;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
void append_menu_item_reload_from_disk(wxMenu* menu) const;
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void append_menu_item_change_extruder(wxMenu* menu) const;
void append_menu_item_delete(wxMenu* menu);
void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu);
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 2819bcdf2..e9ea411e8 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -10,9 +10,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem/path.hpp>
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
#include <boost/filesystem/operations.hpp>
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
#include <boost/log/trivial.hpp>
#include <wx/sizer.h>
@@ -1910,9 +1908,7 @@ struct Plater::priv
bool can_fix_through_netfabb() const;
bool can_set_instance_to_object() const;
bool can_mirror() const;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
bool can_reload_from_disk() const;
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void msw_rescale_object_menu();
@@ -1949,9 +1945,6 @@ private:
* */
std::string m_last_fff_printer_profile_name;
std::string m_last_sla_printer_profile_name;
-#if !ENABLE_ENHANCED_RELOAD_FROM_DISK
- bool m_update_objects_list_on_loading{ true };
-#endif // !ENABLE_ENHANCED_RELOAD_FROM_DISK
};
const std::regex Plater::priv::pattern_bundle(".*[.](amf|amf[.]xml|zip[.]amf|3mf|prusa)", std::regex::icase);
@@ -2477,16 +2470,9 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
_(L("Object too large?")));
}
-#if !ENABLE_ENHANCED_RELOAD_FROM_DISK
- if (m_update_objects_list_on_loading)
- {
-#endif // !ENABLE_ENHANCED_RELOAD_FROM_DISK
- for (const size_t idx : obj_idxs) {
- wxGetApp().obj_list()->add_object_to_list(idx);
- }
-#if !ENABLE_ENHANCED_RELOAD_FROM_DISK
+ for (const size_t idx : obj_idxs) {
+ wxGetApp().obj_list()->add_object_to_list(idx);
}
-#endif // !ENABLE_ENHANCED_RELOAD_FROM_DISK
update();
object_list_changed();
@@ -3110,7 +3096,6 @@ void Plater::priv::update_sla_scene()
void Plater::priv::reload_from_disk()
{
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
Plater::TakeSnapshot snapshot(q, _(L("Reload from disk")));
const Selection& selection = get_selection();
@@ -3215,91 +3200,6 @@ void Plater::priv::reload_from_disk()
{
view3D->get_canvas3d()->update_instance_printable_state_for_object(i);
}
-#else
- Plater::TakeSnapshot snapshot(q, _(L("Reload from Disk")));
-
- auto& selection = get_selection();
- const auto obj_orig_idx = selection.get_object_idx();
- if (selection.is_wipe_tower() || obj_orig_idx == -1) { return; }
- int instance_idx = selection.get_instance_idx();
-
- auto *object_orig = model.objects[obj_orig_idx];
- std::vector<fs::path> input_paths(1, object_orig->input_file);
-
- // disable render to avoid to show intermediate states
- view3D->get_canvas3d()->enable_render(false);
-
- // disable update of objects list while loading to avoid to show intermediate states
- m_update_objects_list_on_loading = false;
-
- const auto new_idxs = load_files(input_paths, true, false);
- if (new_idxs.empty())
- {
- // error while loading
- view3D->get_canvas3d()->enable_render(true);
- m_update_objects_list_on_loading = true;
- return;
- }
-
- for (const auto idx : new_idxs)
- {
- ModelObject *object = model.objects[idx];
- object->config.apply(object_orig->config);
-
- object->clear_instances();
- for (const ModelInstance *instance : object_orig->instances)
- {
- object->add_instance(*instance);
- }
-
- for (const ModelVolume* v : object_orig->volumes)
- {
- if (v->is_modifier())
- object->add_volume(*v);
- }
-
- Vec3d offset = object_orig->origin_translation - object->origin_translation;
-
- if (object->volumes.size() == object_orig->volumes.size())
- {
- for (size_t i = 0; i < object->volumes.size(); i++)
- {
- object->volumes[i]->config.apply(object_orig->volumes[i]->config);
- object->volumes[i]->translate(offset);
- }
- }
-
- // XXX: Restore more: layer_height_ranges, layer_height_profile (?)
- }
-
- // re-enable update of objects list
- m_update_objects_list_on_loading = true;
-
- // puts the new objects into the list
- for (const auto idx : new_idxs)
- {
- wxGetApp().obj_list()->add_object_to_list(idx);
- }
-
- remove(obj_orig_idx);
-
- // new GLVolumes have been created at this point, so update their printable state
- for (size_t i = 0; i < model.objects.size(); ++i)
- {
- view3D->get_canvas3d()->update_instance_printable_state_for_object(i);
- }
-
- // re-enable render
- view3D->get_canvas3d()->enable_render(true);
-
- // the previous call to remove() clears the selection
- // select newly added objects
- selection.clear();
- for (const auto idx : new_idxs)
- {
- selection.add_instance((unsigned int)idx - 1, instance_idx, false);
- }
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
}
void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/)
@@ -3724,10 +3624,8 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
[this](wxCommandEvent&) { q->remove_selected(); }, "delete", nullptr, [this]() { return can_delete(); }, q);
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { q->reload_from_disk(); }, "", menu, [this]() { return can_reload_from_disk(); }, q);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
sidebar->obj_list()->append_menu_item_export_stl(menu);
}
@@ -3755,13 +3653,8 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
wxMenuItem* menu_item_printable = sidebar->obj_list()->append_menu_item_printable(menu, q);
menu->AppendSeparator();
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected object from disk")),
[this](wxCommandEvent&) { reload_from_disk(); }, "", nullptr, [this]() { return can_reload_from_disk(); }, q);
-#else
- append_menu_item(menu, wxID_ANY, _(L("Reload from Disk")), _(L("Reload the selected file from Disk")),
- [this](wxCommandEvent&) { reload_from_disk(); });
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
append_menu_item(menu, wxID_ANY, _(L("Export as STL")) + dots, _(L("Export the selected object as STL file")),
[this](wxCommandEvent&) { q->export_stl(false, true); });
@@ -3916,7 +3809,6 @@ bool Plater::priv::can_mirror() const
return get_selection().is_from_single_instance();
}
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
bool Plater::priv::can_reload_from_disk() const
{
// struct to hold selected ModelVolumes by their indices
@@ -3958,7 +3850,6 @@ bool Plater::priv::can_reload_from_disk() const
return !paths.empty();
}
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void Plater::priv::set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model)
{
@@ -4743,12 +4634,10 @@ void Plater::export_3mf(const boost::filesystem::path& output_path)
}
}
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
void Plater::reload_from_disk()
{
p->reload_from_disk();
}
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
bool Plater::has_toolpaths_to_export() const
{
@@ -5247,9 +5136,7 @@ bool Plater::can_copy_to_clipboard() const
bool Plater::can_undo() const { return p->undo_redo_stack().has_undo_snapshot(); }
bool Plater::can_redo() const { return p->undo_redo_stack().has_redo_snapshot(); }
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); }
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); }
void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); }
void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); }
diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp
index 6ebecac44..d842e37f7 100644
--- a/src/slic3r/GUI/Plater.hpp
+++ b/src/slic3r/GUI/Plater.hpp
@@ -183,9 +183,7 @@ public:
void export_stl(bool extended = false, bool selection_only = false);
void export_amf();
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
void reload_from_disk();
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
bool has_toolpaths_to_export() const;
void export_toolpaths_to_obj() const;
void reslice();
@@ -250,9 +248,7 @@ public:
bool can_copy_to_clipboard() const;
bool can_undo() const;
bool can_redo() const;
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
bool can_reload_from_disk() const;
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void msw_rescale();
diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp
index 346f46e00..79df60464 100644
--- a/src/slic3r/GUI/Selection.cpp
+++ b/src/slic3r/GUI/Selection.cpp
@@ -472,11 +472,7 @@ void Selection::volumes_changed(const std::vector<size_t> &map_volume_old_to_new
for (unsigned int idx : m_list)
if (map_volume_old_to_new[idx] != size_t(-1)) {
unsigned int new_idx = (unsigned int)map_volume_old_to_new[idx];
-#if ENABLE_ENHANCED_RELOAD_FROM_DISK
(*m_volumes)[new_idx]->selected = true;
-#else
- assert((*m_volumes)[new_idx]->selected);
-#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
list_new.insert(new_idx);
}
m_list = std::move(list_new);