New feature: Splitting an object into a multi-part volume.

This commit is contained in:
bubnikv 2017-06-15 15:38:15 +02:00
parent a1f6403463
commit b724d789fd
6 changed files with 95 additions and 30 deletions

View file

@ -161,6 +161,10 @@ public:
void material_id(t_model_material_id material_id);
ModelMaterial* material() const;
void set_material(t_model_material_id material_id, const ModelMaterial &material);
// Split this volume, append the result to the object owning this volume.
// Return the number of volumes created from this one.
// This is useful to assign different materials to different volumes of an object.
size_t split();
ModelMaterial* assign_unique_material();
@ -174,6 +178,9 @@ private:
ModelVolume(ModelObject *object, const ModelVolume &other) :
name(other.name), mesh(other.mesh), config(other.config), modifier(other.modifier), object(object)
{ this->material_id(other.material_id()); }
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
name(other.name), mesh(std::move(mesh)), config(other.config), modifier(other.modifier), object(object)
{ this->material_id(other.material_id()); }
};
// A single instance of a ModelObject.