mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-06 23:07:42 -07:00
FIX:revert offset when exit ObjColorDialog
jira: github 6344 Change-Id: Ia574876aa24fde7c7b958b02d928d1aef6f0633f (cherry picked from commit b852a7113f8926043cd7c49691b5b96768de1b32)
This commit is contained in:
parent
f5314b2ae1
commit
5e0e0a7e7d
3 changed files with 16 additions and 6 deletions
|
|
@ -233,7 +233,7 @@ ObjColorDialog::ObjColorDialog(wxWindow *parent, Slic3r::ObjDialogInOut &in_out,
|
|||
EndModal(wxCANCEL);
|
||||
return;
|
||||
}
|
||||
m_panel_ObjColor->clear_instance();
|
||||
m_panel_ObjColor->clear_instance_and_revert_offset();
|
||||
m_panel_ObjColor->send_new_filament_to_ui();
|
||||
EndModal(wxID_OK);
|
||||
}, wxID_OK);
|
||||
|
|
@ -357,9 +357,11 @@ ObjColorPanel::ObjColorPanel(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, c
|
|||
auto mo = m_obj_in_out.model->objects[0];
|
||||
mo->add_instance();
|
||||
auto mv = mo->volumes[0];
|
||||
m_thumbnail_offset = Slic3r::Vec3d::Zero();
|
||||
auto box = mo->bounding_box_exact();
|
||||
if (box.min.x() < 0 || box.min.y() < 0 || box.min.z() < 0) {
|
||||
mv->translate(box.min.x() < 0 ? -box.min.x() : 0, box.min.y() < 0 ? -box.min.y() : 0, box.min.z() < 0 ? -box.min.z() : 0);
|
||||
m_thumbnail_offset = Slic3r::Vec3d(box.min.x() < 0 ? -box.min.x() : 0, box.min.y() < 0 ? -box.min.y() : 0, box.min.z() < 0 ? -box.min.z() : 0);
|
||||
mv->translate(m_thumbnail_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -518,7 +520,7 @@ void ObjColorPanel::cancel_paint_color() {
|
|||
m_filament_ids.clear();
|
||||
auto mo = m_obj_in_out.model->objects[0];
|
||||
mo->config.set("extruder", 1);
|
||||
clear_instance();
|
||||
clear_instance_and_revert_offset();
|
||||
auto mv = mo->volumes[0];
|
||||
mv->mmu_segmentation_facets.reset();
|
||||
mv->config.set("extruder", 1);
|
||||
|
|
@ -931,10 +933,15 @@ void ObjColorPanel::set_view_angle_type(int value)
|
|||
}
|
||||
|
||||
|
||||
void ObjColorPanel::clear_instance()
|
||||
void ObjColorPanel::clear_instance_and_revert_offset()
|
||||
{
|
||||
auto mo = m_obj_in_out.model->objects[0];
|
||||
mo->clear_instances();
|
||||
auto mv = mo->volumes[0];
|
||||
auto box = mo->bounding_box_exact();
|
||||
if (!m_thumbnail_offset.isApprox(Slic3r::Vec3d::Zero())) {
|
||||
mv->translate(-m_thumbnail_offset);
|
||||
}
|
||||
}
|
||||
|
||||
bool ObjColorPanel::do_show(bool show) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
void set_layout_callback(LayoutChanggeCallback);
|
||||
void do_layout_callback();
|
||||
bool do_show(bool show);
|
||||
void clear_instance();
|
||||
void clear_instance_and_revert_offset();
|
||||
|
||||
private:
|
||||
wxBoxSizer *create_approximate_match_btn_sizer(wxWindow *parent);
|
||||
|
|
@ -105,6 +105,8 @@ private:
|
|||
bool m_is_add_filament{false};
|
||||
unsigned char& m_first_extruder_id;
|
||||
std::vector<unsigned char> &m_filament_ids;
|
||||
|
||||
Slic3r::Vec3d m_thumbnail_offset;
|
||||
};
|
||||
|
||||
class ObjColorDialog : public Slic3r::GUI::DPIDialog
|
||||
|
|
|
|||
|
|
@ -5821,7 +5821,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
|
||||
int model_idx = 0;
|
||||
for (ModelObject *model_object : model.objects) {
|
||||
if (!type_3mf && !type_any_amf) model_object->center_around_origin(false);
|
||||
if (!type_3mf && !type_any_amf)
|
||||
model_object->center_around_origin(false);
|
||||
|
||||
// BBS
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("import 3mf IMPORT_LOAD_MODEL_OBJECTS \n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue