Merge remote-tracking branch 'origin/master' into tm_colldetection_upgr

This commit is contained in:
tamasmeszaros 2019-03-11 16:28:12 +01:00
commit f876908c0e
5 changed files with 84 additions and 52 deletions

View file

@ -587,8 +587,10 @@ namespace Slic3r {
object.second->layer_height_profile = obj_layer_heights_profile->second;
IdToSlaSupportPointsMap::iterator obj_sla_support_points = m_sla_support_points.find(object.first);
if (obj_sla_support_points != m_sla_support_points.end() && !obj_sla_support_points->second.empty())
if (obj_sla_support_points != m_sla_support_points.end() && !obj_sla_support_points->second.empty()) {
object.second->sla_support_points = obj_sla_support_points->second;
object.second->sla_points_status = sla::PointsStatus::UserModified;
}
IdToMetadataMap::iterator obj_metadata = m_objects_metadata.find(object.first);
if (obj_metadata != m_objects_metadata.end())

View file

@ -600,6 +600,7 @@ void AMFParserContext::endElement(const char * /* name */)
break;
p = end + 1;
}
m_object->sla_points_status = sla::PointsStatus::UserModified;
}
else if (m_path.size() == 5 && m_path[3] == NODE_TYPE_VOLUME && m_volume) {
if (strcmp(opt_key, "modifier") == 0) {

View file

@ -1773,8 +1773,10 @@ void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const G
if (model_object && selection.is_from_single_instance())
{
if (is_mesh_update_necessary())
if (is_mesh_update_necessary()) {
update_mesh();
editing_mode_reload_cache();
}
if (m_model_object != m_old_model_object)
m_editing_mode = false;
@ -1953,9 +1955,6 @@ void GLGizmoSlaSupports::update_mesh()
m_AABB = igl::AABB<Eigen::MatrixXf,3>();
m_AABB.init(m_V, m_F);
// we'll now reload support points (selection might have changed):
editing_mode_reload_cache();
}
Vec3f GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse_pos)
@ -2441,32 +2440,33 @@ std::string GLGizmoSlaSupports::on_get_name() const
void GLGizmoSlaSupports::on_set_state()
{
if (m_state == On) {
if (m_state == On && m_old_state != On) { // the gizmo was just turned on
if (is_mesh_update_necessary())
update_mesh();
// we'll now reload support points:
if (m_model_object)
editing_mode_reload_cache();
m_parent.toggle_model_objects_visibility(false);
if (m_model_object)
m_parent.toggle_model_objects_visibility(true, m_model_object, m_active_instance);
}
if (m_state == Off) {
if (m_old_state != Off) { // the gizmo was just turned Off
if (m_model_object) {
if (m_unsaved_changes) {
wxMessageDialog dlg(GUI::wxGetApp().plater(), _(L("Do you want to save your manually edited support points ?\n")),
_(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO);
if (dlg.ShowModal() == wxID_YES)
editing_mode_apply_changes();
else
editing_mode_discard_changes();
}
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
if (m_model_object) {
if (m_unsaved_changes) {
wxMessageDialog dlg(GUI::wxGetApp().plater(), _(L("Do you want to save your manually edited support points ?\n")),
_(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO);
if (dlg.ShowModal() == wxID_YES)
editing_mode_apply_changes();
else
editing_mode_discard_changes();
}
m_parent.toggle_model_objects_visibility(true);
m_editing_mode = false; // so it is not active next time the gizmo opens
m_editing_mode_cache.clear();
}
m_parent.toggle_model_objects_visibility(true);
m_editing_mode = false; // so it is not active next time the gizmo opens
m_editing_mode_cache.clear();
}
m_old_state = m_state;
}

View file

@ -365,20 +365,20 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
Line line = Line { "", "" };
ConfigOptionDef def;
def.label = L("Supports");
def.type = coStrings;
def.gui_type = "select_open";
def.tooltip = L("Select what kind of support do you need");
def.enum_labels.push_back(L("None"));
def.enum_labels.push_back(L("Support on build plate only"));
def.enum_labels.push_back(L("Everywhere"));
const std::string selection = !config->opt_bool("support_material") ?
"None" : config->opt_bool("support_material_buildplate_only") ?
"Support on build plate only" :
"Everywhere";
def.default_value = new ConfigOptionStrings{ selection };
Option option = Option(def, "support");
ConfigOptionDef support_def;
support_def.label = L("Supports");
support_def.type = coStrings;
support_def.gui_type = "select_open";
support_def.tooltip = L("Select what kind of support do you need");
support_def.enum_labels.push_back(L("None"));
support_def.enum_labels.push_back(L("Support on build plate only"));
support_def.enum_labels.push_back(L("Everywhere"));
std::string selection = !config->opt_bool("support_material") ?
"None" : config->opt_bool("support_material_buildplate_only") ?
"Support on build plate only" :
"Everywhere";
support_def.default_value = new ConfigOptionStrings{ selection };
Option option = Option(support_def, "support");
option.opt.full_width = true;
line.append_option(option);
m_og->append_line(line);
@ -393,6 +393,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
line.append_option(option);
m_brim_width = config->opt_float("brim_width");
ConfigOptionDef def;
def.label = L("Brim");
def.type = coBool;
def.tooltip = L("This flag enables the brim that will be printed around each object on the first layer.");
@ -428,6 +429,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
m_og->append_line(line);
// Frequently changed parameters for SLA_technology
m_og_sla = std::make_shared<ConfigOptionsGroup>(parent, "");
DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
@ -438,20 +440,43 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
if (!tab) return;
tab->set_value(opt_key, value);
if (opt_key == "pad_enable") {
tab->set_value(opt_key, value);
tab->update();
}
else //(opt_key == "support")
{
DynamicPrintConfig new_conf = *config_sla;
const wxString& selection = boost::any_cast<wxString>(value);
const bool supports_enable = selection == _("None") ? false : true;
new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable));
if (selection == _("Everywhere"))
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
else if (selection == _("Support on build plate only"))
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
tab->load_config(new_conf);
}
DynamicPrintConfig new_conf = *config_sla;
new_conf.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast<bool>(value)));
tab->load_config(new_conf);
tab->update_dirty();
};
};
line = Line{ "", "" };
option = m_og_sla->get_option("supports_enable");
option.opt.sidetext = " ";
selection = !config_sla->opt_bool("supports_enable") ?
"None" : config_sla->opt_bool("support_buildplate_only") ?
"Support on build plate only" :
"Everywhere";
support_def.default_value = new ConfigOptionStrings{ selection };
option = Option(support_def, "support");
option.opt.full_width = true;
line.append_option(option);
m_og_sla->append_line(line);
line = Line{ "", "" };
option = m_og_sla->get_option("pad_enable");
option.opt.sidetext = " ";

View file

@ -751,21 +751,25 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
{
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
const bool is_fff = supports_printer_technology(ptFFF);
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
if (opt_key == "fill_density" || opt_key == "pad_enable")
{
boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
og_freq_chng_params->set_value(opt_key, val);
}
if (opt_key == "support_material" || opt_key == "support_material_buildplate_only")
if ( is_fff && (opt_key == "support_material" || opt_key == "support_material_buildplate_only") ||
!is_fff && (opt_key == "supports_enable" || opt_key == "support_buildplate_only"))
{
wxString new_selection = !m_config->opt_bool("support_material") ?
_("None") :
m_config->opt_bool("support_material_buildplate_only") ?
_("Support on build plate only") :
_("Everywhere");
const std::string support = is_fff ? "support_material" : "supports_enable";
const std::string buildplate_only = is_fff ? "support_material_buildplate_only" : "support_buildplate_only";
wxString new_selection = !m_config->opt_bool(support) ? _("None") :
m_config->opt_bool(buildplate_only) ? _("Support on build plate only") :
_("Everywhere");
og_freq_chng_params->set_value("support", new_selection);
}
if (opt_key == "brim_width")
{
bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;