ENH:Brim ear updates model object in real-time
jira: studio-8687 8683 Change-Id: Ic730957bf8c1e96c0464791cce60cb097d1a4dc9 (cherry picked from commit af174cb8b64e870929f926d3957d3471d0b09e29)
This commit is contained in:
parent
6a12df8afa
commit
a1037509ae
|
@ -140,6 +140,7 @@ void GLGizmoBrimEars::render_points(const Selection &selection, bool picking) co
|
||||||
const bool &point_selected = editing_cache[i].selected;
|
const bool &point_selected = editing_cache[i].selected;
|
||||||
const bool &hover = editing_cache[i].is_hover;
|
const bool &hover = editing_cache[i].is_hover;
|
||||||
const bool &error = editing_cache[i].is_error;
|
const bool &error = editing_cache[i].is_error;
|
||||||
|
if (!is_use_point(brim_point) && !hover) continue;
|
||||||
// keep show brim ear
|
// keep show brim ear
|
||||||
// if (is_mesh_point_clipped(brim_point.pos.cast<double>()))
|
// if (is_mesh_point_clipped(brim_point.pos.cast<double>()))
|
||||||
// continue;
|
// continue;
|
||||||
|
@ -464,6 +465,7 @@ void GLGizmoBrimEars::delete_selected_points()
|
||||||
|
|
||||||
select_point(NoPoints);
|
select_point(NoPoints);
|
||||||
find_single();
|
find_single();
|
||||||
|
update_model_object();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoBrimEars::on_update(const UpdateData &data)
|
void GLGizmoBrimEars::on_update(const UpdateData &data)
|
||||||
|
@ -563,6 +565,7 @@ void GLGizmoBrimEars::on_render_input_window(float x, float y, float bottom_limi
|
||||||
if (cache_entry.selected) {
|
if (cache_entry.selected) {
|
||||||
cache_entry.brim_point.head_front_radius = m_new_point_head_diameter / 2.f;
|
cache_entry.brim_point.head_front_radius = m_new_point_head_diameter / 2.f;
|
||||||
find_single();
|
find_single();
|
||||||
|
update_model_object();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
m_imgui->bbl_slider_float_style("##head_diameter", &m_new_point_head_diameter, 5, 20, "%.1f", 1.0f, true);
|
m_imgui->bbl_slider_float_style("##head_diameter", &m_new_point_head_diameter, 5, 20, "%.1f", 1.0f, true);
|
||||||
|
@ -648,7 +651,7 @@ void GLGizmoBrimEars::on_render_input_window(float x, float y, float bottom_limi
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
|
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
|
||||||
ImGui::Dummy(ImVec2(font_size * 1.8, font_size * 1.3));
|
ImGui::Dummy(ImVec2(font_size * 1.8, font_size * 1.3));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
m_imgui->bold_text(_u8L("Set the brim type to \"painted\""));
|
m_imgui->bold_text(_u8L("Set the brim type of this object to \"painted\""));
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
// underline
|
// underline
|
||||||
ImVec2 lineEnd = ImGui::GetItemRectMax();
|
ImVec2 lineEnd = ImGui::GetItemRectMax();
|
||||||
|
@ -748,7 +751,7 @@ CommonGizmosDataID GLGizmoBrimEars::on_get_requirements() const
|
||||||
int(CommonGizmosDataID::ObjectClipper));
|
int(CommonGizmosDataID::ObjectClipper));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoBrimEars::save_model()
|
void GLGizmoBrimEars::update_model_object()
|
||||||
{
|
{
|
||||||
ModelObject* mo = m_c->selection_info()->model_object();
|
ModelObject* mo = m_c->selection_info()->model_object();
|
||||||
if (mo) {
|
if (mo) {
|
||||||
|
@ -756,6 +759,7 @@ void GLGizmoBrimEars::save_model()
|
||||||
for (const CacheEntry& ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
|
for (const CacheEntry& ce : m_editing_cache) mo->brim_points.emplace_back(ce.brim_point);
|
||||||
wxGetApp().plater()->set_plater_dirty(true);
|
wxGetApp().plater()->set_plater_dirty(true);
|
||||||
}
|
}
|
||||||
|
m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch gizmos
|
// switch gizmos
|
||||||
|
@ -771,8 +775,7 @@ void GLGizmoBrimEars::on_set_state()
|
||||||
if (m_state == Off && m_old_state != Off) {
|
if (m_state == Off && m_old_state != Off) {
|
||||||
// the gizmo was just turned Off
|
// the gizmo was just turned Off
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Brim ears edit");
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Brim ears edit");
|
||||||
save_model();
|
update_model_object();
|
||||||
m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
|
||||||
wxGetApp().plater()->leave_gizmos_stack();
|
wxGetApp().plater()->leave_gizmos_stack();
|
||||||
// wxGetApp().mainframe->update_slice_print_status(MainFrame::SlicePrintEventType::eEventSliceUpdate, true, true);
|
// wxGetApp().mainframe->update_slice_print_status(MainFrame::SlicePrintEventType::eEventSliceUpdate, true, true);
|
||||||
}
|
}
|
||||||
|
@ -980,6 +983,7 @@ bool GLGizmoBrimEars::add_point_to_cache(Vec3f pos, float head_radius, bool sele
|
||||||
if (m_editing_cache[i].brim_point == point) { return false; }
|
if (m_editing_cache[i].brim_point == point) { return false; }
|
||||||
}
|
}
|
||||||
m_editing_cache.emplace_back(point, selected, normal);
|
m_editing_cache.emplace_back(point, selected, normal);
|
||||||
|
update_model_object();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
void set_brim_data(ModelObject* model_object, const Selection& selection);
|
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);
|
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
|
||||||
void delete_selected_points();
|
void delete_selected_points();
|
||||||
void save_model();
|
void update_model_object();
|
||||||
//ClippingPlane get_sla_clipping_plane() const;
|
//ClippingPlane get_sla_clipping_plane() const;
|
||||||
|
|
||||||
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
|
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
|
||||||
|
|
|
@ -1951,7 +1951,7 @@ bool GLGizmosManager::is_in_editing_mode(bool error_notification) const
|
||||||
if (m_current == SlaSupports && dynamic_cast<GLGizmoSlaSupports*>(get_current())->is_in_editing_mode()) {
|
if (m_current == SlaSupports && dynamic_cast<GLGizmoSlaSupports*>(get_current())->is_in_editing_mode()) {
|
||||||
return true;
|
return true;
|
||||||
} else if (m_current == BrimEars) {
|
} else if (m_current == BrimEars) {
|
||||||
dynamic_cast<GLGizmoBrimEars*>(get_current())->save_model();
|
dynamic_cast<GLGizmoBrimEars *>(get_current())->update_model_object();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue