Merge branch 'xs-reload-object'
Conflicts: lib/Slic3r/Print.pm
This commit is contained in:
commit
a5787cfb04
4 changed files with 26 additions and 14 deletions
|
@ -34,20 +34,6 @@ sub status_cb {
|
||||||
return $status_cb // sub {};
|
return $status_cb // sub {};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub reload_object {
|
|
||||||
my ($self, $obj_idx) = @_;
|
|
||||||
|
|
||||||
# TODO: this method should check whether the per-object config and per-material configs
|
|
||||||
# have changed in such a way that regions need to be rearranged or we can just apply
|
|
||||||
# the diff and invalidate something. Same logic as apply_config()
|
|
||||||
# For now we just re-add all objects since we haven't implemented this incremental logic yet.
|
|
||||||
# This should also check whether object volumes (parts) have changed.
|
|
||||||
|
|
||||||
my @models_objects = map $_->model_object, @{$self->objects};
|
|
||||||
$self->clear_objects;
|
|
||||||
$self->add_model_object($_) for @models_objects;
|
|
||||||
}
|
|
||||||
|
|
||||||
# this value is not supposed to be compared with $layer->id
|
# this value is not supposed to be compared with $layer->id
|
||||||
# since they have different semantics
|
# since they have different semantics
|
||||||
sub total_layer_count {
|
sub total_layer_count {
|
||||||
|
|
|
@ -116,6 +116,30 @@ Print::delete_object(size_t idx)
|
||||||
this->state.invalidate(psBrim);
|
this->state.invalidate(psBrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Print::reload_object(size_t idx)
|
||||||
|
{
|
||||||
|
/* TODO: this method should check whether the per-object config and per-material configs
|
||||||
|
have changed in such a way that regions need to be rearranged or we can just apply
|
||||||
|
the diff and invalidate something. Same logic as apply_config()
|
||||||
|
For now we just re-add all objects since we haven't implemented this incremental logic yet.
|
||||||
|
This should also check whether object volumes (parts) have changed. */
|
||||||
|
|
||||||
|
// collect all current model objects
|
||||||
|
ModelObjectPtrs model_objects;
|
||||||
|
FOREACH_OBJECT(this, object) {
|
||||||
|
model_objects.push_back((*object)->model_object());
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove our print objects
|
||||||
|
this->clear_objects();
|
||||||
|
|
||||||
|
// re-add model objects
|
||||||
|
for (ModelObjectPtrs::iterator it = model_objects.begin(); it != model_objects.end(); ++it) {
|
||||||
|
this->add_model_object(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Print::clear_regions()
|
Print::clear_regions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,6 +164,7 @@ class Print
|
||||||
PrintObject* add_object(ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
PrintObject* add_object(ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
||||||
PrintObject* set_new_object(size_t idx, ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
PrintObject* set_new_object(size_t idx, ModelObject *model_object, const BoundingBoxf3 &modobj_bbox);
|
||||||
void delete_object(size_t idx);
|
void delete_object(size_t idx);
|
||||||
|
void reload_object(size_t idx);
|
||||||
|
|
||||||
// methods for handling regions
|
// methods for handling regions
|
||||||
PrintRegion* get_region(size_t idx);
|
PrintRegion* get_region(size_t idx);
|
||||||
|
|
|
@ -135,6 +135,7 @@ _constant()
|
||||||
BoundingBoxf3 *modobj_bbox)
|
BoundingBoxf3 *modobj_bbox)
|
||||||
%code%{ RETVAL = THIS->set_new_object(idx, model_object, *modobj_bbox); %};
|
%code%{ RETVAL = THIS->set_new_object(idx, model_object, *modobj_bbox); %};
|
||||||
void delete_object(int idx);
|
void delete_object(int idx);
|
||||||
|
void reload_object(int idx);
|
||||||
size_t object_count()
|
size_t object_count()
|
||||||
%code%{ RETVAL = THIS->objects.size(); %};
|
%code%{ RETVAL = THIS->objects.size(); %};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue