Fixed some issues with front end / back end synchronization.
This commit is contained in:
parent
a4e6b326b5
commit
7ffa22191d
@ -254,6 +254,7 @@ void Model::clear_materials()
|
|||||||
|
|
||||||
ModelMaterial* Model::add_material(t_model_material_id material_id)
|
ModelMaterial* Model::add_material(t_model_material_id material_id)
|
||||||
{
|
{
|
||||||
|
assert(! material_id.empty());
|
||||||
ModelMaterial* material = this->get_material(material_id);
|
ModelMaterial* material = this->get_material(material_id);
|
||||||
if (material == nullptr)
|
if (material == nullptr)
|
||||||
material = this->materials[material_id] = new ModelMaterial(this);
|
material = this->materials[material_id] = new ModelMaterial(this);
|
||||||
@ -262,6 +263,7 @@ ModelMaterial* Model::add_material(t_model_material_id material_id)
|
|||||||
|
|
||||||
ModelMaterial* Model::add_material(t_model_material_id material_id, const ModelMaterial &other)
|
ModelMaterial* Model::add_material(t_model_material_id material_id, const ModelMaterial &other)
|
||||||
{
|
{
|
||||||
|
assert(! material_id.empty());
|
||||||
// delete existing material if any
|
// delete existing material if any
|
||||||
ModelMaterial* material = this->get_material(material_id);
|
ModelMaterial* material = this->get_material(material_id);
|
||||||
delete material;
|
delete material;
|
||||||
@ -1134,7 +1136,8 @@ void ModelVolume::set_material_id(t_model_material_id material_id)
|
|||||||
{
|
{
|
||||||
m_material_id = material_id;
|
m_material_id = material_id;
|
||||||
// ensure m_material_id references an existing material
|
// ensure m_material_id references an existing material
|
||||||
this->object->get_model()->add_material(material_id);
|
if (! material_id.empty())
|
||||||
|
this->object->get_model()->add_material(material_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelMaterial* ModelVolume::material() const
|
ModelMaterial* ModelVolume::material() const
|
||||||
@ -1145,15 +1148,8 @@ ModelMaterial* ModelVolume::material() const
|
|||||||
void ModelVolume::set_material(t_model_material_id material_id, const ModelMaterial &material)
|
void ModelVolume::set_material(t_model_material_id material_id, const ModelMaterial &material)
|
||||||
{
|
{
|
||||||
m_material_id = material_id;
|
m_material_id = material_id;
|
||||||
this->object->get_model()->add_material(material_id, material);
|
if (! material_id.empty())
|
||||||
}
|
this->object->get_model()->add_material(material_id, material);
|
||||||
|
|
||||||
ModelMaterial* ModelVolume::assign_unique_material()
|
|
||||||
{
|
|
||||||
Model* model = this->get_object()->get_model();
|
|
||||||
// as material-id "0" is reserved by the AMF spec we start from 1
|
|
||||||
m_material_id = 1 + model->materials.size(); // watchout for implicit cast
|
|
||||||
return model->add_material(m_material_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelVolume::calculate_convex_hull()
|
void ModelVolume::calculate_convex_hull()
|
||||||
|
@ -22,7 +22,6 @@ class ModelInstance;
|
|||||||
class ModelMaterial;
|
class ModelMaterial;
|
||||||
class ModelObject;
|
class ModelObject;
|
||||||
class ModelVolume;
|
class ModelVolume;
|
||||||
class PresetBundle;
|
|
||||||
class Print;
|
class Print;
|
||||||
|
|
||||||
typedef std::string t_model_material_id;
|
typedef std::string t_model_material_id;
|
||||||
@ -323,8 +322,6 @@ public:
|
|||||||
void rotate(double angle, const Vec3d& axis);
|
void rotate(double angle, const Vec3d& axis);
|
||||||
void mirror(Axis axis);
|
void mirror(Axis axis);
|
||||||
|
|
||||||
ModelMaterial* assign_unique_material();
|
|
||||||
|
|
||||||
void calculate_convex_hull();
|
void calculate_convex_hull();
|
||||||
const TriangleMesh& get_convex_hull() const;
|
const TriangleMesh& get_convex_hull() const;
|
||||||
|
|
||||||
@ -391,14 +388,15 @@ private:
|
|||||||
mesh(std::move(mesh)), m_convex_hull(std::move(convex_hull)), m_type(MODEL_PART), object(object) {}
|
mesh(std::move(mesh)), m_convex_hull(std::move(convex_hull)), m_type(MODEL_PART), object(object) {}
|
||||||
|
|
||||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
|
// Copying an existing volume, therefore this volume will get a copy of the ID assigned.
|
||||||
ModelVolume(ModelObject *object, const ModelVolume &other) :
|
ModelVolume(ModelObject *object, const ModelVolume &other) :
|
||||||
ModelBase(other), // copy the ID
|
ModelBase(other), // copy the ID
|
||||||
name(other.name), mesh(other.mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
name(other.name), mesh(other.mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
||||||
{
|
{
|
||||||
this->set_material_id(other.material_id());
|
this->set_material_id(other.material_id());
|
||||||
}
|
}
|
||||||
|
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
|
||||||
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
|
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
|
||||||
ModelBase(other), // copy the ID
|
|
||||||
name(other.name), mesh(std::move(mesh)), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
name(other.name), mesh(std::move(mesh)), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
||||||
{
|
{
|
||||||
this->set_material_id(other.material_id());
|
this->set_material_id(other.material_id());
|
||||||
@ -406,12 +404,15 @@ private:
|
|||||||
calculate_convex_hull();
|
calculate_convex_hull();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
// Copying an existing volume, therefore this volume will get a copy of the ID assigned.
|
||||||
ModelVolume(ModelObject *object, const ModelVolume &other) :
|
ModelVolume(ModelObject *object, const ModelVolume &other) :
|
||||||
|
ModelBase(other), // copy the ID
|
||||||
name(other.name), mesh(other.mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object)
|
name(other.name), mesh(other.mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object)
|
||||||
{
|
{
|
||||||
if (! other.material_id().empty())
|
if (! other.material_id().empty())
|
||||||
this->set_material_id(other.material_id());
|
this->set_material_id(other.material_id());
|
||||||
}
|
}
|
||||||
|
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
|
||||||
ModelVolume(ModelObject *object, const ModelVolume &other, TriangleMesh &&mesh) :
|
ModelVolume(ModelObject *object, const ModelVolume &other, TriangleMesh &&mesh) :
|
||||||
name(other.name), mesh(std::move(mesh)), config(other.config), m_type(other.m_type), object(object)
|
name(other.name), mesh(std::move(mesh)), config(other.config), m_type(other.m_type), object(object)
|
||||||
{
|
{
|
||||||
|
@ -633,7 +633,7 @@ void PrintObject::detect_surfaces_type()
|
|||||||
// should be visible.
|
// should be visible.
|
||||||
bool interface_shells = m_config.interface_shells.value;
|
bool interface_shells = m_config.interface_shells.value;
|
||||||
|
|
||||||
for (int idx_region = 0; idx_region < m_print->m_regions.size(); ++ idx_region) {
|
for (int idx_region = 0; idx_region < this->region_volumes.size(); ++ idx_region) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " in parallel - start";
|
BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " in parallel - start";
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (Layer *layer : m_layers)
|
for (Layer *layer : m_layers)
|
||||||
|
@ -286,8 +286,6 @@ ModelMaterial::attributes()
|
|||||||
%code%{ THIS->set_type(ModelVolume::SUPPORT_BLOCKER); %};
|
%code%{ THIS->set_type(ModelVolume::SUPPORT_BLOCKER); %};
|
||||||
|
|
||||||
size_t split(unsigned int max_extruders);
|
size_t split(unsigned int max_extruders);
|
||||||
|
|
||||||
ModelMaterial* assign_unique_material();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user