mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Fixed DnD function for volumes inside the object in respect to the volume type
This commit is contained in:
parent
980ca195f5
commit
b7769856d1
7 changed files with 106 additions and 28 deletions
|
@ -652,19 +652,34 @@ ModelVolume* ModelObject::add_volume(const TriangleMesh &mesh)
|
|||
return v;
|
||||
}
|
||||
|
||||
ModelVolume* ModelObject::add_volume(TriangleMesh &&mesh)
|
||||
static void add_v_to_volumes(ModelVolumePtrs* volumes, ModelVolume* v)
|
||||
{
|
||||
ModelVolume* v = new ModelVolume(this, std::move(mesh));
|
||||
this->volumes.push_back(v);
|
||||
if (volumes->empty() || v->type() >= volumes->back()->type())
|
||||
volumes->push_back(v);
|
||||
else {
|
||||
for (int pos = volumes->size() - 1; pos >= 0; pos--)
|
||||
if (v->type() >= (*volumes)[pos]->type()) {
|
||||
volumes->insert(volumes->begin() + pos + 1, v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModelVolume* ModelObject::add_volume(TriangleMesh &&mesh, ModelVolumeType type /*= ModelVolumeType::MODEL_PART*/)
|
||||
{
|
||||
ModelVolume* v = new ModelVolume(this, std::move(mesh), type);
|
||||
add_v_to_volumes(&(this->volumes), v);
|
||||
v->center_geometry_after_creation();
|
||||
this->invalidate_bounding_box();
|
||||
return v;
|
||||
}
|
||||
|
||||
ModelVolume* ModelObject::add_volume(const ModelVolume &other)
|
||||
ModelVolume* ModelObject::add_volume(const ModelVolume &other, ModelVolumeType type /*= ModelVolumeType::MODEL_PART*/)
|
||||
{
|
||||
ModelVolume* v = new ModelVolume(this, other);
|
||||
this->volumes.push_back(v);
|
||||
if (v->type() != type)
|
||||
v->set_type(type);
|
||||
add_v_to_volumes(&(this->volumes), v);
|
||||
// The volume should already be centered at this point of time when copying shared pointers of the triangle mesh and convex hull.
|
||||
// v->center_geometry_after_creation();
|
||||
// this->invalidate_bounding_box();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue