From bf0232308b5b8584ec036ba1626b0539f93f9e3b Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 23 Jan 2019 09:29:50 +0100 Subject: [PATCH 1/5] Place on face - fix of updating on selection change --- src/slic3r/GUI/GLGizmo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 1f37b7aec..d45dbf2ed 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -1511,7 +1511,7 @@ void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object) bool object_changed = m_model_object != model_object; m_model_object = model_object; - if (object_changed && is_plane_update_necessary()) + if (object_changed || is_plane_update_necessary()) update_planes(); } From 78a9e6036ac767fa3772bf1d81b843ec88b48b19 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 23 Jan 2019 09:42:04 +0100 Subject: [PATCH 2/5] Fix of previous commit --- src/slic3r/GUI/GLGizmo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index d45dbf2ed..7efb8786c 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -1511,7 +1511,7 @@ void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object) bool object_changed = m_model_object != model_object; m_model_object = model_object; - if (object_changed || is_plane_update_necessary()) + if (model_object && (object_changed || is_plane_update_necessary())) update_planes(); } From fde299bf808347aa1748b503c71039bce9ee5e5d Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 22 Jan 2019 17:52:14 +0100 Subject: [PATCH 3/5] I18N: wx 3.0 back-compat for translations with context, fix #1694 --- src/slic3r/GUI/I18N.hpp | 20 +++++++++++++++++++- src/slic3r/GUI/OptionsGroup.cpp | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/I18N.hpp b/src/slic3r/GUI/I18N.hpp index c86ff7501..a899eaa59 100644 --- a/src/slic3r/GUI/I18N.hpp +++ b/src/slic3r/GUI/I18N.hpp @@ -2,6 +2,10 @@ #define _(s) Slic3r::GUI::I18N::translate((s)) #endif /* _ */ +#ifndef _CTX +#define _CTX(s, ctx) Slic3r::GUI::I18N::translate((s), (ctx)) +#endif /* _ */ + #ifndef L // !!! If you needed to translate some wxString, // !!! please use _(L(string)) @@ -21,6 +25,7 @@ #define slic3r_GUI_I18N_hpp_ #include +#include namespace Slic3r { namespace GUI { @@ -29,7 +34,20 @@ namespace I18N { inline wxString translate(const wchar_t *s) { return wxGetTranslation(s); } inline wxString translate(const std::string &s) { return wxGetTranslation(wxString(s.c_str(), wxConvUTF8)); } inline wxString translate(const std::wstring &s) { return wxGetTranslation(s.c_str()); } -} + +#if wxCHECK_VERSION(3, 1, 1) + #define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX)) +#else + #define _wxGetTranslation_ctx(S, CTX) ((void)(CTX), wxGetTranslation((S))) +#endif + + inline wxString translate(const char *s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s, wxConvUTF8), ctx); } + inline wxString translate(const wchar_t *s, const char* ctx) { return _wxGetTranslation_ctx(s, ctx); } + inline wxString translate(const std::string &s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s.c_str(), wxConvUTF8), ctx); } + inline wxString translate(const std::wstring &s, const char* ctx) { return _wxGetTranslation_ctx(s.c_str(), ctx); } + +#undef _wxGetTranslation_ctx +} // Return translated std::string as a wxString wxString L_str(const std::string &str); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 4952398f3..78bbe4fec 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -234,7 +234,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n // wxString str_label = _(option.label); //! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1 wxString str_label = (option.label == "Top" || option.label == "Bottom") ? - wxGETTEXT_IN_CONTEXT("Layers", wxString(option.label)) : + _CTX(option.label, "Layers") : _(option.label); label = new wxStaticText(parent(), wxID_ANY, str_label + ":", wxDefaultPosition, wxDefaultSize); label->SetFont(label_font); From fbf5460ac24d47ef9d00237d1756f4e23673df65 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 23 Jan 2019 11:38:13 +0100 Subject: [PATCH 4/5] Fixed gizmo update when selecting objects using the sidebar table --- src/slic3r/GUI/GLCanvas3D.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 0bd3d26ca..82f4fd4f7 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5822,6 +5822,7 @@ void GLCanvas3D::set_camera_zoom(float zoom) void GLCanvas3D::update_gizmos_on_off_state() { set_as_dirty(); + _update_gizmos_data(); m_gizmos.update_on_off_state(get_selection()); } From d5b354c053854ed1f109af437bf1a09b4850b1c6 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 23 Jan 2019 12:45:58 +0100 Subject: [PATCH 5/5] Apply anisotropic filtering to bed textures --- src/libslic3r/Technologies.hpp | 2 ++ src/slic3r/GUI/GLCanvas3D.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 05bb07616..75913ad1e 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -62,3 +62,5 @@ #define ENABLE_GENERIC_SUBPARTS_PLACEMENT (1 && ENABLE_1_42_0_ALPHA4) // Reworked management of bed shape changes #define ENABLE_REWORKED_BED_SHAPE_CHANGE (1 && ENABLE_1_42_0_ALPHA4) +// Use anisotropic filtering on bed plate texture +#define ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES (1 && ENABLE_1_42_0_ALPHA4) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 82f4fd4f7..012c3191d 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -545,6 +545,11 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const std::string model_path = resources_dir() + "/models/" + key; #endif // ENABLE_PRINT_BED_MODELS +#if ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES + GLfloat max_anisotropy = 0.0f; + ::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy); +#endif // ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES + std::string filename = tex_path + "_top.png"; if ((m_top_texture.get_id() == 0) || (m_top_texture.get_source() != filename)) { @@ -553,6 +558,14 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const _render_custom(); return; } +#if ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES + if (max_anisotropy > 0.0f) + { + ::glBindTexture(GL_TEXTURE_2D, m_top_texture.get_id()); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); + ::glBindTexture(GL_TEXTURE_2D, 0); + } +#endif // ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES } filename = tex_path + "_bottom.png"; @@ -563,6 +576,14 @@ void GLCanvas3D::Bed::_render_prusa(const std::string &key, float theta) const _render_custom(); return; } +#if ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES + if (max_anisotropy > 0.0f) + { + ::glBindTexture(GL_TEXTURE_2D, m_bottom_texture.get_id()); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); + ::glBindTexture(GL_TEXTURE_2D, 0); + } +#endif // ENABLE_ANISOTROPIC_FILTER_ON_BED_TEXTURES } #if ENABLE_PRINT_BED_MODELS