FIX:fix brim ear bugs

1.[STUDIO-8385] Fix switch to split tool crash;

2.[STUDIO-8406]brim ears only works in manual mode;

2.[STUDIO-8410] Disable brim width modification when brim type is manual;

3.[STUDIO-8382] Warning message not cleared;

4.[STUDIO-8239] Translation issues;

5.[STUDIO-8380]Disable brim ears for non-part models

6.[STUDIO-8285]Clicking the delete brim button did not recalculate;

jira: details
Change-Id: Id333179236d6b6f23de5081bd9b8d94b08c7dd62
This commit is contained in:
Mack 2024-10-12 09:35:15 +08:00 committed by Lane.Wei
parent 3614033fdc
commit 34fb47a618
4 changed files with 24 additions and 19 deletions

View File

@ -891,8 +891,8 @@ static ExPolygons outer_inner_brim_area(const Print& print,
const float scaled_half_min_adh_length = scale_(1.1);
bool has_brim_auto = object->config().brim_type == btAutoBrim;
bool use_brim_ears = object->config().brim_type == btBrimEars;
if (object->model_object()->brim_points.size()>0 && has_brim_auto)
use_brim_ears = true;
// if (object->model_object()->brim_points.size()>0 && has_brim_auto)
// use_brim_ears = true;
const bool has_inner_brim = brim_type == btInnerOnly || brim_type == btOuterAndInner || use_brim_ears;
const bool has_outer_brim = brim_type == btOuterOnly || brim_type == btOuterAndInner || brim_type == btAutoBrim || use_brim_ears;

View File

@ -982,8 +982,8 @@ void PrintConfigDef::init_fff_params()
"Auto means the brim width is analysed and calculated automatically.");
def->enum_keys_map = &ConfigOptionEnum<BrimType>::get_enum_values();
def->enum_values.emplace_back("auto_brim");
def->enum_values.emplace_back("outer_only");
def->enum_values.emplace_back("brim_ears");
def->enum_values.emplace_back("outer_only");
#if 1 //!BBL_RELEASE_TO_PUBLIC
// BBS: The following two types are disabled
def->enum_values.emplace_back("inner_only");
@ -1014,12 +1014,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.));
def = this->add("brim_ears", coBool);
def->label = L("Brim ears");
def->category = L("Support");
def->tooltip = L("Draw brim");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("compatible_printers", coStrings);
def->label = L("Compatible machine");

View File

@ -598,7 +598,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
bool have_brim = (config->opt_enum<BrimType>("brim_type") != btNoBrim);
toggle_field("brim_object_gap", have_brim);
bool have_brim_width = (config->opt_enum<BrimType>("brim_type") != btNoBrim) && config->opt_enum<BrimType>("brim_type") != btAutoBrim;
bool have_brim_width = (config->opt_enum<BrimType>("brim_type") != btNoBrim) && config->opt_enum<BrimType>("brim_type") != btAutoBrim && config->opt_enum<BrimType>("brim_type") != btBrimEars;
toggle_field("brim_width", have_brim_width);
// wall_filament uses the same logic as in Print::extruders()
toggle_field("wall_filament", have_perimeters || have_brim);

View File

@ -46,7 +46,7 @@ bool GLGizmoBrimEars::on_init()
m_desc["left_click_caption"] = _L("Left click");
m_desc["left_click"] = _L("Add a brim ear");
m_desc["right_click_caption"] = L("Right click");
m_desc["right_click_caption"] = _L("Right click");
m_desc["right_click"] = _L("Delete a brim ear");
m_desc["ctrl_mouse_wheel_caption"] = _L("Ctrl+Mouse wheel");
m_desc["ctrl_mouse_wheel"] = _L("Adjust section view");
@ -405,7 +405,6 @@ bool GLGizmoBrimEars::gizmo_event(SLAGizmoEventType action, const Vec2d &mouse_p
select_point(NoPoints);
select_point(m_hover_id);
delete_selected_points();
find_single();
return true;
}
return false;
@ -449,6 +448,7 @@ void GLGizmoBrimEars::delete_selected_points()
}
select_point(NoPoints);
find_single();
}
void GLGizmoBrimEars::on_update(const UpdateData &data)
@ -665,17 +665,24 @@ bool GLGizmoBrimEars::on_is_activable() const
{
const Selection &selection = m_parent.get_selection();
if (!selection.is_from_single_instance()) return false;
if (!selection.is_single_full_instance()) return false;
// Check that none of the selected volumes is outside. Only SLA auxiliaries (supports) are allowed outside.
const Selection::IndicesList &list = selection.get_volume_idxs();
for (const auto &idx : list)
if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0) return false;
// const Selection::IndicesList &list = selection.get_volume_idxs();
// for (const auto &idx : list)
// if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0) return false;
return true;
}
std::string GLGizmoBrimEars::on_get_name() const { return _u8L("Brim Ears"); }
std::string GLGizmoBrimEars::on_get_name() const
{
if (!on_is_activable() && m_state == EState::Off) {
return _u8L("Brim Ears") + ":\n" + _u8L("Please select single object.");
} else {
return _u8L("Brim Ears");
}
}
CommonGizmosDataID GLGizmoBrimEars::on_get_requirements() const
{
@ -698,8 +705,10 @@ void GLGizmoBrimEars::on_set_state()
// the gizmo was just turned Off
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Brim ears edit");
ModelObject *mo = m_c->selection_info()->model_object();
mo->brim_points.clear();
for (const CacheEntry &ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
if (mo) {
mo->brim_points.clear();
for (const CacheEntry& ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
}
m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
wxGetApp().plater()->leave_gizmos_stack();
// wxGetApp().mainframe->update_slice_print_status(MainFrame::SlicePrintEventType::eEventSliceUpdate, true, true);
@ -867,6 +876,8 @@ void GLGizmoBrimEars::register_single_mesh_pick()
if (idxs.size() > 0) {
for (unsigned int idx : idxs) {
GLVolume *v = const_cast<GLVolume *>(selection.get_volume(idx));
const ModelVolume* mv = get_model_volume(*v, wxGetApp().model());
if (!mv->is_model_part()) continue;
auto world_tran = v->get_instance_transformation() * v->get_volume_transformation();
auto mesh = const_cast<TriangleMesh *>(v->ori_mesh);
if (m_mesh_raycaster_map.find(v) != m_mesh_raycaster_map.end()) {