mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 15:43:16 +08:00
FIX:Brim ear merge incorrectly omitted volume ID update
jira: nojia Change-Id: Id71fa0b691bcd227d3827d94bd4d3c475448b962
This commit is contained in:
parent
fcb4ca7a41
commit
ed7c232073
@ -21,7 +21,7 @@ struct BrimPoint
|
|||||||
int volume_idx;
|
int volume_idx;
|
||||||
|
|
||||||
BrimPoint()
|
BrimPoint()
|
||||||
: pos(Vec3f::Zero()), head_front_radius(0.f)
|
: pos(Vec3f::Zero()), head_front_radius(0.f), volume_idx(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
BrimPoint(float pos_x,
|
BrimPoint(float pos_x,
|
||||||
|
@ -3053,8 +3053,20 @@ void ObjectList::merge(bool to_multipart_object)
|
|||||||
const Transform3d& transformation_matrix = transformation.get_matrix();
|
const Transform3d& transformation_matrix = transformation.get_matrix();
|
||||||
|
|
||||||
// merge volumes
|
// merge volumes
|
||||||
for (const ModelVolume* volume : object->volumes) {
|
for(int volume_idx = 0; volume_idx < object->volumes.size(); volume_idx++) {
|
||||||
|
const ModelVolume* volume = object->volumes[volume_idx];
|
||||||
ModelVolume* new_volume = new_object->add_volume(*volume);
|
ModelVolume* new_volume = new_object->add_volume(*volume);
|
||||||
|
int new_volume_idx = new_object->volumes.size() - 1;
|
||||||
|
// merge brim ears
|
||||||
|
for (auto p : object->brim_points) {
|
||||||
|
if (p.volume_idx == volume_idx) {
|
||||||
|
Transform3d v_matrix = Transform3d::Identity();
|
||||||
|
v_matrix = object->volumes[p.volume_idx]->get_matrix();
|
||||||
|
p.set_transform(transformation_matrix* v_matrix);
|
||||||
|
p.volume_idx = new_volume_idx;
|
||||||
|
new_object->brim_points.push_back(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//BBS: keep volume's transform
|
//BBS: keep volume's transform
|
||||||
const Transform3d& volume_matrix = new_volume->get_matrix();
|
const Transform3d& volume_matrix = new_volume->get_matrix();
|
||||||
@ -3122,13 +3134,12 @@ void ObjectList::merge(bool to_multipart_object)
|
|||||||
new_object->layer_config_ranges.emplace(range);
|
new_object->layer_config_ranges.emplace(range);
|
||||||
|
|
||||||
// merge brim ears
|
// merge brim ears
|
||||||
BrimPoints temp_brim_points = object->brim_points;
|
for(auto& p : object->brim_points) {
|
||||||
for(auto& p : temp_brim_points) {
|
if (p.volume_idx < 0) {
|
||||||
Transform3d v_matrix = Transform3d::Identity();
|
Transform3d v_matrix = Transform3d::Identity();
|
||||||
if (p.volume_idx >= 0)
|
p.set_transform(transformation_matrix * v_matrix);
|
||||||
v_matrix = object->volumes[p.volume_idx]->get_matrix();
|
new_object->brim_points.push_back(p);
|
||||||
p.set_transform(transformation_matrix * v_matrix);
|
}
|
||||||
new_object->brim_points.push_back(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user