Fix:Retain the brim ears during model merging
jira: STUDIO-10122 Change-Id: Iae35e4137f64a6d697b90bf76f0e6fbc4d8025c4
This commit is contained in:
parent
76153f8bcd
commit
cf5a2c9046
|
@ -42,6 +42,11 @@ struct BrimPoint
|
||||||
return result.cast<float>();
|
return result.cast<float>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_transform(const Transform3d& trsf)
|
||||||
|
{
|
||||||
|
pos = transform(trsf);
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const BrimPoint &sp) const
|
bool operator==(const BrimPoint &sp) const
|
||||||
{
|
{
|
||||||
float rdiff = std::abs(head_front_radius - sp.head_front_radius);
|
float rdiff = std::abs(head_front_radius - sp.head_front_radius);
|
||||||
|
|
|
@ -3039,6 +3039,13 @@ void ObjectList::merge(bool to_multipart_object)
|
||||||
// merge layers
|
// merge layers
|
||||||
for (const auto& range : object->layer_config_ranges)
|
for (const auto& range : object->layer_config_ranges)
|
||||||
new_object->layer_config_ranges.emplace(range);
|
new_object->layer_config_ranges.emplace(range);
|
||||||
|
|
||||||
|
// merge brim ears
|
||||||
|
BrimPoints temp_brim_points = object->brim_points;
|
||||||
|
for(auto& p : temp_brim_points) {
|
||||||
|
p.set_transform(transformation_matrix);
|
||||||
|
new_object->brim_points.push_back(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: ensure on bed, and no need to center around origin
|
//BBS: ensure on bed, and no need to center around origin
|
||||||
|
@ -3047,8 +3054,13 @@ void ObjectList::merge(bool to_multipart_object)
|
||||||
new_object->translate_instances(-new_object->origin_translation);
|
new_object->translate_instances(-new_object->origin_translation);
|
||||||
new_object->origin_translation = Vec3d::Zero();
|
new_object->origin_translation = Vec3d::Zero();
|
||||||
//BBS init asssmble transformation
|
//BBS init asssmble transformation
|
||||||
Geometry::Transformation t = new_object->instances[0]->get_transformation();
|
Geometry::Transformation new_object_trsf = new_object->instances[0]->get_transformation();
|
||||||
new_object->instances[0]->set_assemble_transformation(t);
|
new_object->instances[0]->set_assemble_transformation(new_object_trsf);
|
||||||
|
|
||||||
|
const Transform3d& new_object_inverse_matrix = new_object_trsf.get_matrix().inverse();
|
||||||
|
for (auto& p : new_object->brim_points) {
|
||||||
|
p.set_transform(new_object_inverse_matrix);
|
||||||
|
}
|
||||||
//BBS: notify it before remove
|
//BBS: notify it before remove
|
||||||
notify_instance_updated(m_objects->size() - 1);
|
notify_instance_updated(m_objects->size() - 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue