mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-10 07:15:08 -06:00
Some fixes after the recent Model refactoring
This commit is contained in:
parent
65b7d27def
commit
27c73f5983
6 changed files with 37 additions and 9 deletions
|
@ -321,8 +321,31 @@ ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh)
|
|||
{}
|
||||
|
||||
ModelVolume::ModelVolume(ModelObject* object, const ModelVolume &other)
|
||||
: object(object), material_id(other.material_id), mesh(other.mesh), modifier(other.modifier)
|
||||
{}
|
||||
: object(object), mesh(other.mesh), modifier(other.modifier)
|
||||
{
|
||||
this->material_id(other.material_id());
|
||||
}
|
||||
|
||||
t_model_material_id
|
||||
ModelVolume::material_id() const
|
||||
{
|
||||
return this->_material_id;
|
||||
}
|
||||
|
||||
void
|
||||
ModelVolume::material_id(t_model_material_id material_id)
|
||||
{
|
||||
this->_material_id = material_id;
|
||||
|
||||
// ensure this->_material_id references an existing material
|
||||
(void)this->object->get_model()->add_material(material_id);
|
||||
}
|
||||
|
||||
ModelMaterial*
|
||||
ModelVolume::material() const
|
||||
{
|
||||
return this->object->get_model()->get_material(this->_material_id);
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(ModelVolume, "Model::Volume");
|
||||
|
|
|
@ -138,14 +138,17 @@ class ModelVolume
|
|||
{
|
||||
friend class ModelObject;
|
||||
public:
|
||||
t_model_material_id material_id;
|
||||
TriangleMesh mesh;
|
||||
bool modifier;
|
||||
|
||||
ModelObject* get_object() const { return this->object; };
|
||||
t_model_material_id material_id() const;
|
||||
void material_id(t_model_material_id material_id);
|
||||
ModelMaterial* material() const;
|
||||
|
||||
private:
|
||||
ModelObject* object;
|
||||
t_model_material_id _material_id;
|
||||
|
||||
ModelVolume(ModelObject *object, const TriangleMesh &mesh);
|
||||
ModelVolume(ModelObject *object, const ModelVolume &other);
|
||||
|
|
|
@ -162,10 +162,10 @@ ModelMaterial::attributes()
|
|||
Ref<ModelObject> object()
|
||||
%code%{ RETVAL = THIS->get_object(); %};
|
||||
|
||||
t_model_material_id material_id()
|
||||
%code%{ RETVAL = THIS->material_id; %};
|
||||
t_model_material_id material_id();
|
||||
void set_material_id(t_model_material_id material_id)
|
||||
%code%{ THIS->material_id = material_id; %};
|
||||
%code%{ THIS->material_id(material_id); %};
|
||||
Ref<ModelMaterial> material();
|
||||
|
||||
Ref<TriangleMesh> mesh()
|
||||
%code%{ RETVAL = &THIS->mesh; %};
|
||||
|
|
|
@ -64,6 +64,7 @@ Point::coincides_with(point_sv)
|
|||
%code{% RETVAL = THIS->x; %};
|
||||
double y()
|
||||
%code{% RETVAL = THIS->y; %};
|
||||
void translate(double x, double y);
|
||||
};
|
||||
|
||||
%name{Slic3r::Pointf3} class Pointf3 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue