Fixed instance printable property after reload from disk
This commit is contained in:
parent
0387401d8e
commit
27f01bb09e
2 changed files with 16 additions and 3 deletions
|
@ -674,7 +674,7 @@ private:
|
||||||
explicit ModelInstance(ModelObject* object) : print_volume_state(PVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
|
explicit ModelInstance(ModelObject* object) : print_volume_state(PVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
|
||||||
// Constructor, which assigns a new unique ID.
|
// Constructor, which assigns a new unique ID.
|
||||||
explicit ModelInstance(ModelObject *object, const ModelInstance &other) :
|
explicit ModelInstance(ModelObject *object, const ModelInstance &other) :
|
||||||
m_transformation(other.m_transformation), print_volume_state(PVS_Inside), printable(true), object(object) {assert(this->id().valid() && this->id() != other.id());}
|
m_transformation(other.m_transformation), print_volume_state(PVS_Inside), printable(other.printable), object(object) { assert(this->id().valid() && this->id() != other.id()); }
|
||||||
|
|
||||||
explicit ModelInstance(ModelInstance &&rhs) = delete;
|
explicit ModelInstance(ModelInstance &&rhs) = delete;
|
||||||
ModelInstance& operator=(const ModelInstance &rhs) = delete;
|
ModelInstance& operator=(const ModelInstance &rhs) = delete;
|
||||||
|
|
|
@ -3106,6 +3106,7 @@ void Plater::priv::reload_from_disk()
|
||||||
for (const auto idx : new_idxs) {
|
for (const auto idx : new_idxs) {
|
||||||
ModelObject *object = model.objects[idx];
|
ModelObject *object = model.objects[idx];
|
||||||
object->config.apply(object_orig->config);
|
object->config.apply(object_orig->config);
|
||||||
|
|
||||||
object->clear_instances();
|
object->clear_instances();
|
||||||
for (const ModelInstance *instance : object_orig->instances) {
|
for (const ModelInstance *instance : object_orig->instances) {
|
||||||
object->add_instance(*instance);
|
object->add_instance(*instance);
|
||||||
|
@ -3117,14 +3118,26 @@ void Plater::priv::reload_from_disk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object_orig->instances.size() > 1)
|
if (object->instances.size() > 1)
|
||||||
sidebar->obj_list()->increase_object_instances(idx, object_orig->instances.size());
|
{
|
||||||
|
sidebar->obj_list()->increase_object_instances(idx, object->instances.size());
|
||||||
|
for (int i = 0; i < (int)object->instances.size(); ++i)
|
||||||
|
{
|
||||||
|
sidebar->obj_list()->update_printable_state((int)idx, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: Restore more: layer_height_ranges, layer_height_profile (?)
|
// XXX: Restore more: layer_height_ranges, layer_height_profile (?)
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(obj_orig_idx);
|
remove(obj_orig_idx);
|
||||||
|
|
||||||
|
// new GLVolumes have been created at this point, so update their printable state
|
||||||
|
for (size_t i = 0; i < model.objects.size(); ++i)
|
||||||
|
{
|
||||||
|
view3D->get_canvas3d()->update_instance_printable_state_for_object(i);
|
||||||
|
}
|
||||||
|
|
||||||
// re-enable render
|
// re-enable render
|
||||||
view3D->get_canvas3d()->enable_render(true);
|
view3D->get_canvas3d()->enable_render(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue