mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 07:11:12 -06:00
Merge branch 'master' of https://github.com/prusa3d/Slic3r
This commit is contained in:
commit
107152b25e
30 changed files with 327 additions and 68 deletions
|
@ -718,6 +718,8 @@ boost::any& Choice::get_value()
|
|||
m_value = static_cast<PrintHostType>(ret_enum);
|
||||
else if (m_opt_id.compare("display_orientation") == 0)
|
||||
m_value = static_cast<SLADisplayOrientation>(ret_enum);
|
||||
else if (m_opt_id.compare("support_pillar_connection_mode") == 0)
|
||||
m_value = static_cast<SLAPillarConnectionMode>(ret_enum);
|
||||
}
|
||||
else if (m_opt.gui_type == "f_enum_open") {
|
||||
const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
|
||||
|
|
|
@ -2041,7 +2041,7 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
|
|||
if (is_single_full_instance())
|
||||
{
|
||||
::glTranslated(center(0), center(1), center(2));
|
||||
if (boost::starts_with(sidebar_field, "scale"))
|
||||
if (boost::starts_with(sidebar_field, "scale") || boost::starts_with(sidebar_field, "size"))
|
||||
{
|
||||
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||
::glMultMatrixd(orient_matrix.data());
|
||||
|
@ -2983,7 +2983,7 @@ bool GLCanvas3D::Gizmos::is_running() const
|
|||
|
||||
bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
|
||||
{
|
||||
if (!m_enabled)
|
||||
if (!m_enabled || selection.is_empty())
|
||||
return false;
|
||||
|
||||
bool handled = false;
|
||||
|
@ -6915,22 +6915,31 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
}
|
||||
} ctxt;
|
||||
|
||||
ctxt.shifted_copies = &print_object.copies();
|
||||
|
||||
// order layers by print_z
|
||||
ctxt.layers.reserve(print_object.layers().size() + print_object.support_layers().size());
|
||||
for (const Layer *layer : print_object.layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
for (const Layer *layer : print_object.support_layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
std::sort(ctxt.layers.begin(), ctxt.layers.end(), [](const Layer *l1, const Layer *l2) { return l1->print_z < l2->print_z; });
|
||||
|
||||
// Maximum size of an allocation block: 32MB / sizeof(float)
|
||||
ctxt.has_perimeters = print_object.is_step_done(posPerimeters);
|
||||
ctxt.has_infill = print_object.is_step_done(posInfill);
|
||||
ctxt.has_support = print_object.is_step_done(posSupportMaterial);
|
||||
ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors;
|
||||
|
||||
ctxt.shifted_copies = &print_object.copies();
|
||||
|
||||
// order layers by print_z
|
||||
{
|
||||
size_t nlayers = 0;
|
||||
if (ctxt.has_perimeters || ctxt.has_infill)
|
||||
nlayers = print_object.layers().size();
|
||||
if (ctxt.has_support)
|
||||
nlayers += print_object.support_layers().size();
|
||||
ctxt.layers.reserve(nlayers);
|
||||
}
|
||||
if (ctxt.has_perimeters || ctxt.has_infill)
|
||||
for (const Layer *layer : print_object.layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
if (ctxt.has_support)
|
||||
for (const Layer *layer : print_object.support_layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
std::sort(ctxt.layers.begin(), ctxt.layers.end(), [](const Layer *l1, const Layer *l2) { return l1->print_z < l2->print_z; });
|
||||
|
||||
// Maximum size of an allocation block: 32MB / sizeof(float)
|
||||
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - start";
|
||||
|
||||
//FIXME Improve the heuristics for a grain size.
|
||||
|
|
|
@ -36,7 +36,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool generate_mipmap
|
|||
|
||||
// Load a PNG with an alpha channel.
|
||||
wxImage image;
|
||||
if (!image.LoadFile(wxString::FromUTF8(filename), wxBITMAP_TYPE_PNG))
|
||||
if (!image.LoadFile(wxString::FromUTF8(filename.c_str()), wxBITMAP_TYPE_PNG))
|
||||
{
|
||||
reset();
|
||||
return false;
|
||||
|
|
|
@ -200,6 +200,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
|||
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
|
||||
else if (opt_key.compare("display_orientation") == 0)
|
||||
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
|
||||
else if(opt_key.compare("support_pillar_connection_mode") == 0)
|
||||
config.set_key_value(opt_key, new ConfigOptionEnum<SLAPillarConnectionMode>(boost::any_cast<SLAPillarConnectionMode>(value)));
|
||||
}
|
||||
break;
|
||||
case coPoints:{
|
||||
|
@ -232,7 +234,7 @@ void show_error(wxWindow* parent, const wxString& message)
|
|||
void show_error_id(int id, const std::string& message)
|
||||
{
|
||||
auto *parent = id != 0 ? wxWindow::FindWindowById(id) : nullptr;
|
||||
show_error(parent, wxString::FromUTF8(message.data()));
|
||||
show_error(parent, from_u8(message));
|
||||
}
|
||||
|
||||
void show_info(wxWindow* parent, const wxString& message, const wxString& title)
|
||||
|
@ -322,7 +324,7 @@ wxString from_path(const boost::filesystem::path &path)
|
|||
#ifdef _WIN32
|
||||
return wxString(path.string<std::wstring>());
|
||||
#else
|
||||
return wxString::FromUTF8(path.string<std::string>());
|
||||
return from_u8(path.string<std::string>());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -403,7 +405,7 @@ void desktop_open_datadir_folder()
|
|||
|
||||
const auto path = data_dir();
|
||||
#ifdef _WIN32
|
||||
const auto widepath = wxString::FromUTF8(path.data());
|
||||
const wxString widepath = from_u8(path);
|
||||
const wchar_t *argv[] = { L"explorer", widepath.GetData(), nullptr };
|
||||
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
|
||||
#elif __APPLE__
|
||||
|
|
|
@ -67,7 +67,7 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
|||
out += std::string(";*") + custom_extension;
|
||||
}
|
||||
}
|
||||
return wxString::FromUTF8(out.c_str());
|
||||
return from_u8(out);
|
||||
}
|
||||
|
||||
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
|
||||
|
@ -464,7 +464,7 @@ bool GUI_App::select_language( wxArrayString & names,
|
|||
{
|
||||
m_wxLocale = new wxLocale;
|
||||
m_wxLocale->Init(identifiers[index]);
|
||||
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir()));
|
||||
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
||||
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
|
||||
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
||||
wxSetlocale(LC_NUMERIC, "C");
|
||||
|
@ -492,7 +492,7 @@ bool GUI_App::load_language()
|
|||
{
|
||||
m_wxLocale = new wxLocale;
|
||||
m_wxLocale->Init(identifiers[i]);
|
||||
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir()));
|
||||
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
||||
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
|
||||
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
||||
wxSetlocale(LC_NUMERIC, "C");
|
||||
|
@ -520,7 +520,7 @@ void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & ident
|
|||
names.Clear();
|
||||
identifiers.Clear();
|
||||
|
||||
wxDir dir(wxString::FromUTF8(localization_dir()));
|
||||
wxDir dir(from_u8(localization_dir()));
|
||||
wxString filename;
|
||||
const wxLanguageInfo * langinfo;
|
||||
wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT);
|
||||
|
@ -742,6 +742,17 @@ void GUI_App::load_current_presets()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// wxWidgets override to get an event on open files.
|
||||
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
||||
{
|
||||
std::vector<std::string> files;
|
||||
for (size_t i = 0; i < fileNames.GetCount(); ++ i)
|
||||
files.emplace_back(fileNames[i].ToUTF8().data());
|
||||
this->plater()->load_files(files, true, true);
|
||||
}
|
||||
#endif /* __APPLE */
|
||||
|
||||
Sidebar& GUI_App::sidebar()
|
||||
{
|
||||
return plater_->sidebar();
|
||||
|
|
|
@ -144,6 +144,11 @@ public:
|
|||
void delete_tab_from_list(Tab* tab);
|
||||
void load_current_presets();
|
||||
|
||||
#ifdef __APPLE__
|
||||
// wxWidgets override to get an event on open files.
|
||||
void MacOpenFiles(const wxArrayString &fileNames) override;
|
||||
#endif /* __APPLE */
|
||||
|
||||
Sidebar& sidebar();
|
||||
ObjectManipulation* obj_manipul();
|
||||
ObjectSettings* obj_settings();
|
||||
|
|
|
@ -685,29 +685,24 @@ void Preview::load_print_as_fff()
|
|||
// we require that there's at least one object and the posSlice step
|
||||
// is performed on all of them(this ensures that _shifted_copies was
|
||||
// populated and we know the number of layers)
|
||||
unsigned int n_layers = 0;
|
||||
bool has_layers = false;
|
||||
const Print *print = m_process->fff_print();
|
||||
if (print->is_step_done(posSlice))
|
||||
{
|
||||
std::set<float> zs;
|
||||
if (print->is_step_done(posSlice)) {
|
||||
for (const PrintObject* print_object : print->objects())
|
||||
{
|
||||
const LayerPtrs& layers = print_object->layers();
|
||||
const SupportLayerPtrs& support_layers = print_object->support_layers();
|
||||
for (const Layer* layer : layers)
|
||||
{
|
||||
zs.insert(layer->print_z);
|
||||
if (! print_object->layers().empty()) {
|
||||
has_layers = true;
|
||||
break;
|
||||
}
|
||||
for (const SupportLayer* layer : support_layers)
|
||||
{
|
||||
zs.insert(layer->print_z);
|
||||
}
|
||||
if (print->is_step_done(posSupportMaterial)) {
|
||||
for (const PrintObject* print_object : print->objects())
|
||||
if (! print_object->support_layers().empty()) {
|
||||
has_layers = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
n_layers = (unsigned int)zs.size();
|
||||
}
|
||||
|
||||
if (n_layers == 0)
|
||||
if (! has_layers)
|
||||
{
|
||||
reset_sliders();
|
||||
m_canvas->reset_legend_texture();
|
||||
|
@ -761,8 +756,8 @@ void Preview::load_print_as_fff()
|
|||
show_hide_ui_elements("full");
|
||||
|
||||
// recalculates zs and update sliders accordingly
|
||||
n_layers = (unsigned int)m_canvas->get_current_print_zs(true).size();
|
||||
if (n_layers == 0)
|
||||
has_layers = ! m_canvas->get_current_print_zs(true).empty();
|
||||
if (! has_layers)
|
||||
{
|
||||
// all layers filtered out
|
||||
reset_sliders();
|
||||
|
@ -777,7 +772,7 @@ void Preview::load_print_as_fff()
|
|||
}
|
||||
|
||||
|
||||
if (n_layers > 0)
|
||||
if (has_layers)
|
||||
update_sliders(m_canvas->get_current_print_zs(true));
|
||||
|
||||
m_loaded = true;
|
||||
|
|
|
@ -557,6 +557,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||
else if (opt_key.compare("display_orientation") == 0) {
|
||||
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
|
||||
}
|
||||
else if (opt_key.compare("support_pillar_connection_mode") == 0) {
|
||||
ret = static_cast<int>(config.option<ConfigOptionEnum<SLAPillarConnectionMode>>(opt_key)->value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case coPoints:
|
||||
|
|
|
@ -410,6 +410,7 @@ const std::vector<std::string>& Preset::sla_print_options()
|
|||
"support_head_penetration",
|
||||
"support_head_width",
|
||||
"support_pillar_diameter",
|
||||
"support_pillar_connection_mode",
|
||||
"support_pillar_widening_factor",
|
||||
"support_base_diameter",
|
||||
"support_base_height",
|
||||
|
|
|
@ -3161,6 +3161,7 @@ void TabSLAPrint::build()
|
|||
|
||||
optgroup = page->new_optgroup(_(L("Support pillar")));
|
||||
optgroup->append_single_option_line("support_pillar_diameter");
|
||||
optgroup->append_single_option_line("support_pillar_connection_mode");
|
||||
optgroup->append_single_option_line("support_pillar_widening_factor");
|
||||
optgroup->append_single_option_line("support_base_diameter");
|
||||
optgroup->append_single_option_line("support_base_height");
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
#include <wx/numformatter.h>
|
||||
|
||||
#include "BitmapCache.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
||||
using Slic3r::GUI::from_u8;
|
||||
|
||||
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
|
||||
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
|
||||
|
||||
|
@ -37,7 +40,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler)
|
||||
{
|
||||
const wxBitmap& bmp = !icon.empty() ? wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap;
|
||||
const wxBitmap& bmp = !icon.empty() ? wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap;
|
||||
return append_menu_item(menu, id, string, description, cb, bmp, event_handler);
|
||||
}
|
||||
|
||||
|
@ -48,7 +51,7 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
|
|||
|
||||
wxMenuItem* item = new wxMenuItem(menu, id, string, description);
|
||||
if (!icon.empty())
|
||||
item->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG));
|
||||
item->SetBitmap(wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG));
|
||||
|
||||
item->SetSubMenu(sub_menu);
|
||||
menu->Append(item);
|
||||
|
|
|
@ -330,7 +330,7 @@ public:
|
|||
{
|
||||
if (GetChildCount() == 0)
|
||||
return;
|
||||
for (size_t id = GetChildCount() - 1; id >= 0; --id)
|
||||
for (int id = int(GetChildCount()) - 1; id >= 0; --id)
|
||||
{
|
||||
if (m_children.Item(id)->GetChildCount() > 0)
|
||||
m_children[id]->RemoveAllChildren();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue