mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-11 11:29:02 +08:00
FIX:revert offset when exit ObjColorDialog
jira: github 6344 Change-Id: Ia574876aa24fde7c7b958b02d928d1aef6f0633f
This commit is contained in:
parent
53959cf579
commit
b852a7113f
@ -236,7 +236,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);
|
||||
@ -360,9 +360,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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +523,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);
|
||||
@ -934,10 +936,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();
|
||||
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
|
||||
|
@ -5876,7 +5876,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…
x
Reference in New Issue
Block a user