Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
e1abd1256c
@ -918,12 +918,14 @@ bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config)
|
|||||||
auto &stl = volume->mesh.stl;
|
auto &stl = volume->mesh.stl;
|
||||||
if (stl.v_shared == nullptr)
|
if (stl.v_shared == nullptr)
|
||||||
stl_generate_shared_vertices(&stl);
|
stl_generate_shared_vertices(&stl);
|
||||||
for (size_t i = 0; i < stl.stats.shared_vertices; ++ i) {
|
const Transform3d& matrix = volume->get_matrix();
|
||||||
|
for (size_t i = 0; i < stl.stats.shared_vertices; ++i) {
|
||||||
stream << " <vertex>\n";
|
stream << " <vertex>\n";
|
||||||
stream << " <coordinates>\n";
|
stream << " <coordinates>\n";
|
||||||
stream << " <x>" << stl.v_shared[i](0) << "</x>\n";
|
Vec3d v = matrix * stl.v_shared[i].cast<double>();
|
||||||
stream << " <y>" << stl.v_shared[i](1) << "</y>\n";
|
stream << " <x>" << v(0) << "</x>\n";
|
||||||
stream << " <z>" << stl.v_shared[i](2) << "</z>\n";
|
stream << " <y>" << v(1) << "</y>\n";
|
||||||
|
stream << " <z>" << v(2) << "</z>\n";
|
||||||
stream << " </coordinates>\n";
|
stream << " </coordinates>\n";
|
||||||
stream << " </vertex>\n";
|
stream << " </vertex>\n";
|
||||||
}
|
}
|
||||||
|
@ -2173,7 +2173,7 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
|
|||||||
if (is_single_full_instance())
|
if (is_single_full_instance())
|
||||||
{
|
{
|
||||||
::glTranslated(center(0), center(1), center(2));
|
::glTranslated(center(0), center(1), center(2));
|
||||||
if (boost::starts_with(sidebar_field, "scale") || boost::starts_with(sidebar_field, "size"))
|
if (!boost::starts_with(sidebar_field, "position"))
|
||||||
{
|
{
|
||||||
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
::glMultMatrixd(orient_matrix.data());
|
::glMultMatrixd(orient_matrix.data());
|
||||||
@ -2182,9 +2182,7 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
|
|||||||
else if (is_single_volume() || is_single_modifier())
|
else if (is_single_volume() || is_single_modifier())
|
||||||
{
|
{
|
||||||
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
const Vec3d& offset = get_bounding_box().center();
|
::glTranslated(center(0), center(1), center(2));
|
||||||
|
|
||||||
::glTranslated(offset(0), offset(1), offset(2));
|
|
||||||
::glMultMatrixd(orient_matrix.data());
|
::glMultMatrixd(orient_matrix.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -147,32 +147,29 @@ bool GUI_App::OnInit()
|
|||||||
wxImage::AddHandler(new wxPNGHandler());
|
wxImage::AddHandler(new wxPNGHandler());
|
||||||
mainframe = new MainFrame();
|
mainframe = new MainFrame();
|
||||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||||
// update_mode(); // do that later
|
// update_mode(); // !!! do that later
|
||||||
SetTopWindow(mainframe);
|
SetTopWindow(mainframe);
|
||||||
|
|
||||||
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
||||||
|
|
||||||
CallAfter([this]() {
|
|
||||||
// temporary workaround for the correct behavior of the Scrolled sidebar panel
|
|
||||||
auto& panel = sidebar();
|
|
||||||
if (panel.obj_list()->GetMinHeight() > 200) {
|
|
||||||
wxWindowUpdateLocker noUpdates_sidebar(&panel);
|
|
||||||
panel.obj_list()->SetMinSize(wxSize(-1, 200));
|
|
||||||
// panel.Layout();
|
|
||||||
}
|
|
||||||
update_mode(); // update view mode after fix of the object_list size
|
|
||||||
// to correct later layouts
|
|
||||||
});
|
|
||||||
|
|
||||||
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
|
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
if (app_config->dirty())
|
if (app_config->dirty())
|
||||||
app_config->save();
|
app_config->save();
|
||||||
|
|
||||||
#if !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
// ! Temporary workaround for the correct behavior of the Scrolled sidebar panel
|
||||||
|
// Do this "manipulations" only once ( after (re)create of the application )
|
||||||
|
if (sidebar().obj_list()->GetMinHeight() > 200)
|
||||||
|
{
|
||||||
|
wxWindowUpdateLocker noUpdates_sidebar(&sidebar());
|
||||||
|
sidebar().obj_list()->SetMinSize(wxSize(-1, 200));
|
||||||
|
|
||||||
|
// !!! to correct later layouts
|
||||||
|
update_mode(); // update view mode after fix of the object_list size
|
||||||
|
}
|
||||||
|
|
||||||
if (this->plater() != nullptr)
|
if (this->plater() != nullptr)
|
||||||
this->obj_manipul()->update_if_dirty();
|
this->obj_manipul()->update_if_dirty();
|
||||||
#endif // !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// On OS X the UI tends to freeze in weird ways if modal dialogs(config wizard, update notifications, ...)
|
// On OS X the UI tends to freeze in weird ways if modal dialogs(config wizard, update notifications, ...)
|
||||||
@ -275,10 +272,12 @@ void GUI_App::recreate_GUI()
|
|||||||
{
|
{
|
||||||
std::cerr << "recreate_GUI" << std::endl;
|
std::cerr << "recreate_GUI" << std::endl;
|
||||||
|
|
||||||
|
clear_tabs_list();
|
||||||
|
|
||||||
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
||||||
mainframe = new MainFrame();
|
mainframe = new MainFrame();
|
||||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||||
// update_mode(); // do that later
|
|
||||||
if (topwindow) {
|
if (topwindow) {
|
||||||
SetTopWindow(mainframe);
|
SetTopWindow(mainframe);
|
||||||
topwindow->Destroy();
|
topwindow->Destroy();
|
||||||
@ -286,17 +285,7 @@ void GUI_App::recreate_GUI()
|
|||||||
|
|
||||||
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
||||||
|
|
||||||
CallAfter([this]() {
|
load_current_presets();
|
||||||
// temporary workaround for the correct behavior of the Scrolled sidebar panel
|
|
||||||
auto& panel = sidebar();
|
|
||||||
if (panel.obj_list()->GetMinHeight() > 200) {
|
|
||||||
wxWindowUpdateLocker noUpdates_sidebar(&panel);
|
|
||||||
panel.obj_list()->SetMinSize(wxSize(-1, 200));
|
|
||||||
// panel.Layout();
|
|
||||||
}
|
|
||||||
update_mode(); // update view mode after fix of the object_list size
|
|
||||||
// to correct later layouts
|
|
||||||
});
|
|
||||||
|
|
||||||
mainframe->Show(true);
|
mainframe->Show(true);
|
||||||
|
|
||||||
@ -682,13 +671,6 @@ bool GUI_App::checked_tab(Tab* tab)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::delete_tab_from_list(Tab* tab)
|
|
||||||
{
|
|
||||||
std::vector<Tab *>::iterator itr = find(tabs_list.begin(), tabs_list.end(), tab);
|
|
||||||
if (itr != tabs_list.end())
|
|
||||||
tabs_list.erase(itr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update UI / Tabs to reflect changes in the currently loaded presets
|
// Update UI / Tabs to reflect changes in the currently loaded presets
|
||||||
void GUI_App::load_current_presets()
|
void GUI_App::load_current_presets()
|
||||||
{
|
{
|
||||||
@ -702,6 +684,15 @@ void GUI_App::load_current_presets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI_App::clear_tabs_list()
|
||||||
|
{
|
||||||
|
for (auto tab : tabs_list) {
|
||||||
|
tab->Destroy();
|
||||||
|
tab = nullptr;
|
||||||
|
}
|
||||||
|
tabs_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// wxWidgets override to get an event on open files.
|
// wxWidgets override to get an event on open files.
|
||||||
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
||||||
|
@ -133,8 +133,8 @@ public:
|
|||||||
void add_config_menu(wxMenuBar *menu);
|
void add_config_menu(wxMenuBar *menu);
|
||||||
bool check_unsaved_changes();
|
bool check_unsaved_changes();
|
||||||
bool checked_tab(Tab* tab);
|
bool checked_tab(Tab* tab);
|
||||||
void delete_tab_from_list(Tab* tab);
|
|
||||||
void load_current_presets();
|
void load_current_presets();
|
||||||
|
void clear_tabs_list();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// wxWidgets override to get an event on open files.
|
// wxWidgets override to get an event on open files.
|
||||||
|
@ -327,15 +327,14 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||||||
else
|
else
|
||||||
reset_settings_value();
|
reset_settings_value();
|
||||||
|
|
||||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
update_if_dirty();
|
|
||||||
#else
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManipulation::update_if_dirty()
|
void ObjectManipulation::update_if_dirty()
|
||||||
{
|
{
|
||||||
|
if (!m_dirty)
|
||||||
|
return;
|
||||||
|
|
||||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||||
if (m_cache.move_label_string != _(m_new_move_label_string)+ ":")
|
if (m_cache.move_label_string != _(m_new_move_label_string)+ ":")
|
||||||
{
|
{
|
||||||
@ -414,9 +413,6 @@ void ObjectManipulation::update_if_dirty()
|
|||||||
else
|
else
|
||||||
m_og->disable();
|
m_og->disable();
|
||||||
#else
|
#else
|
||||||
if (! m_dirty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_move_Label->SetLabel(_(m_new_move_label_string));
|
m_move_Label->SetLabel(_(m_new_move_label_string));
|
||||||
m_rotate_Label->SetLabel(_(m_new_rotate_label_string));
|
m_rotate_Label->SetLabel(_(m_new_rotate_label_string));
|
||||||
m_scale_Label->SetLabel(_(m_new_scale_label_string));
|
m_scale_Label->SetLabel(_(m_new_scale_label_string));
|
||||||
@ -446,9 +442,9 @@ void ObjectManipulation::update_if_dirty()
|
|||||||
m_og->enable();
|
m_og->enable();
|
||||||
else
|
else
|
||||||
m_og->disable();
|
m_og->disable();
|
||||||
|
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||||
|
|
||||||
m_dirty = false;
|
m_dirty = false;
|
||||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManipulation::reset_settings_value()
|
void ObjectManipulation::reset_settings_value()
|
||||||
@ -461,9 +457,7 @@ void ObjectManipulation::reset_settings_value()
|
|||||||
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||||
m_cache.instance.reset();
|
m_cache.instance.reset();
|
||||||
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
||||||
#if !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
#endif // !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectManipulation::change_position_value(const Vec3d& position)
|
void ObjectManipulation::change_position_value(const Vec3d& position)
|
||||||
|
@ -62,10 +62,8 @@ class ObjectManipulation : public OG_Settings
|
|||||||
wxStaticText* m_scale_Label = nullptr;
|
wxStaticText* m_scale_Label = nullptr;
|
||||||
wxStaticText* m_rotate_Label = nullptr;
|
wxStaticText* m_rotate_Label = nullptr;
|
||||||
|
|
||||||
#if !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
// Needs to be updated from OnIdle?
|
// Needs to be updated from OnIdle?
|
||||||
bool m_dirty = false;
|
bool m_dirty = false;
|
||||||
#endif // !ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
|
|
||||||
// Cached labels for the delayed update, not localized!
|
// Cached labels for the delayed update, not localized!
|
||||||
std::string m_new_move_label_string;
|
std::string m_new_move_label_string;
|
||||||
std::string m_new_rotate_label_string;
|
std::string m_new_rotate_label_string;
|
||||||
@ -75,7 +73,7 @@ class ObjectManipulation : public OG_Settings
|
|||||||
Vec3d m_new_scale;
|
Vec3d m_new_scale;
|
||||||
Vec3d m_new_size;
|
Vec3d m_new_size;
|
||||||
bool m_new_enabled;
|
bool m_new_enabled;
|
||||||
bool m_uniform_scale {false};
|
bool m_uniform_scale {true};
|
||||||
PrusaLockButton* m_lock_bnt{ nullptr };
|
PrusaLockButton* m_lock_bnt{ nullptr };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -121,6 +121,11 @@ void MainFrame::init_tabpanel()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (wxGetApp().plater_) {
|
||||||
|
// before creating a new plater let's delete old one
|
||||||
|
wxGetApp().plater_->Destroy();
|
||||||
|
wxGetApp().plater_ = nullptr;
|
||||||
|
}
|
||||||
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
||||||
wxGetApp().plater_ = m_plater;
|
wxGetApp().plater_ = m_plater;
|
||||||
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
||||||
|
@ -1593,7 +1593,14 @@ void Plater::priv::selection_changed()
|
|||||||
view3D->enable_toolbar_item("fewer", can_decrease_instances());
|
view3D->enable_toolbar_item("fewer", can_decrease_instances());
|
||||||
view3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/());
|
view3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/());
|
||||||
view3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/());
|
view3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/());
|
||||||
view3D->enable_toolbar_item("layersediting", layers_height_allowed());
|
|
||||||
|
// if the selection is not valid to allow for layer editing, we need to turn off the tool if it is running
|
||||||
|
bool enable_layer_editing = layers_height_allowed();
|
||||||
|
if (!enable_layer_editing && view3D->is_layers_editing_enabled())
|
||||||
|
on_action_layersediting(SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING));
|
||||||
|
|
||||||
|
view3D->enable_toolbar_item("layersediting", enable_layer_editing);
|
||||||
|
|
||||||
// forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
|
// forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
|
||||||
view3D->render();
|
view3D->render();
|
||||||
}
|
}
|
||||||
|
@ -213,9 +213,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
||||||
~Tab() {
|
~Tab() {}
|
||||||
wxGetApp().delete_tab_from_list(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* parent() const { return m_parent; }
|
wxWindow* parent() const { return m_parent; }
|
||||||
wxString title() const { return m_title; }
|
wxString title() const { return m_title; }
|
||||||
|
Loading…
Reference in New Issue
Block a user