Skip to content

Commit

Permalink
FIX: brim gizmo closes the program without prompting dialog
Browse files Browse the repository at this point in the history
jira: STUDIO-8383
Change-Id: I7e83d19768be754ef79f0063d76624358bba5102
  • Loading branch information
MackBambu authored and lanewei120 committed Oct 15, 2024
1 parent cb5c382 commit fe5ebf0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ void PrintConfigDef::init_fff_params()
def->enum_values.emplace_back("no_brim");

def->enum_labels.emplace_back(L("Auto"));
def->enum_labels.emplace_back(L("Manual"));
def->enum_labels.emplace_back(L("Painted"));
def->enum_labels.emplace_back(L("Outer brim only"));
#if 1 //!BBL_RELEASE_TO_PUBLIC
// BBS: The following two types are disabled
Expand Down
23 changes: 13 additions & 10 deletions src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,10 @@ void GLGizmoBrimEars::on_render_input_window(float x, float y, float bottom_limi
ImColor HyperColor = ImColor(48, 221, 114, 255).Value;
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::to_ImVec4(ColorRGB::WARNING()));
float parent_width = ImGui::GetContentRegionAvail().x;
m_imgui->text(_L("Warning: The brim type is not set to manual,"));
m_imgui->text(_L("the brim ears will not take effect !"));
m_imgui->text_wrapped(_L("Warning: The brim type is not set to \"painted\",the brim ears will not take effect !"), parent_width);
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
m_imgui->text(_L("(set)"));
m_imgui->text(_L("(Set the brim type to \"painted\")"));
ImGui::PopStyleColor();
if (ImGui::IsMouseHoveringRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), true)) {
// underline
Expand Down Expand Up @@ -730,6 +728,16 @@ CommonGizmosDataID GLGizmoBrimEars::on_get_requirements() const
int(CommonGizmosDataID::ObjectClipper));
}

void GLGizmoBrimEars::save_model()
{
ModelObject* mo = m_c->selection_info()->model_object();
if (mo) {
mo->brim_points.clear();
for (const CacheEntry& ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
wxGetApp().plater()->set_plater_dirty(true);
}
}

// switch gizmos
void GLGizmoBrimEars::on_set_state()
{
Expand All @@ -744,12 +752,7 @@ void GLGizmoBrimEars::on_set_state()
if (m_state == Off && m_old_state != Off) {
// the gizmo was just turned Off
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Brim ears edit");
ModelObject *mo = m_c->selection_info()->model_object();
if (mo) {
mo->brim_points.clear();
for (const CacheEntry& ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
wxGetApp().plater()->set_plater_dirty(true);
}
save_model();
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);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Gizmos/GLGizmoBrimEars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class GLGizmoBrimEars : public GLGizmoBase
void set_brim_data(ModelObject* model_object, const Selection& selection);
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
void delete_selected_points();
void save_model();
//ClippingPlane get_sla_clipping_plane() const;

bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,8 @@ bool GLGizmosManager::is_in_editing_mode(bool error_notification) const
if (m_current == SlaSupports && dynamic_cast<GLGizmoSlaSupports*>(get_current())->is_in_editing_mode()) {
return true;
} else if (m_current == BrimEars) {
return true;
dynamic_cast<GLGizmoBrimEars*>(get_current())->save_model();
return false;
} else {
return false;
}
Expand Down

0 comments on commit fe5ebf0

Please sign in to comment.