mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Merge branch 'sapir-modelcpp'
This commit is contained in:
commit
6e207d3830
17 changed files with 911 additions and 222 deletions
|
@ -86,7 +86,7 @@ sub apply_config {
|
|||
$new->apply_dynamic($model_object_config);
|
||||
}
|
||||
if (defined $volume->material_id) {
|
||||
my $material_config = $object->model_object->model->materials->{$volume->material_id}->config->clone;
|
||||
my $material_config = $object->model_object->model->get_material($volume->material_id)->config->clone;
|
||||
$material_config->normalize;
|
||||
$new->apply_dynamic($material_config);
|
||||
}
|
||||
|
@ -104,9 +104,8 @@ sub apply_config {
|
|||
if ($rearrange_regions) {
|
||||
# the current subdivision of regions does not make sense anymore.
|
||||
# we need to remove all objects and re-add them
|
||||
my @model_objects = map $_->model_object, @{$self->objects};
|
||||
$self->delete_all_objects;
|
||||
$self->add_model_object($_) for @model_objects;
|
||||
$self->clear_objects;
|
||||
$self->add_model_object($_->model_object) for @{$self->objects};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,7 @@ sub add_model_object {
|
|||
$config->apply_dynamic($object_config);
|
||||
|
||||
if (defined $volume->material_id) {
|
||||
my $material_config = $object->model->materials->{ $volume->material_id }->config->clone;
|
||||
my $material_config = $object->model->get_material($volume->material_id)->config->clone;
|
||||
$material_config->normalize;
|
||||
$config->apply_dynamic($material_config);
|
||||
}
|
||||
|
@ -201,7 +200,7 @@ sub delete_object {
|
|||
$self->_state->invalidate(STEP_BRIM);
|
||||
}
|
||||
|
||||
sub delete_all_objects {
|
||||
sub clear_objects {
|
||||
my ($self) = @_;
|
||||
|
||||
@{$self->objects} = ();
|
||||
|
@ -220,9 +219,9 @@ sub reload_object {
|
|||
# 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 @model_objects = map $_->model_object, @{$self->objects};
|
||||
$self->delete_all_objects;
|
||||
$self->add_model_object($_) for @model_objects;
|
||||
my @models_objects = map $_->model_object, @{$self->objects};
|
||||
$self->clear_objects;
|
||||
$self->add_model_object($_) for @models_objects;
|
||||
}
|
||||
|
||||
sub validate {
|
||||
|
@ -1116,7 +1115,7 @@ sub auto_assign_extruders {
|
|||
foreach my $i (0..$#{$model_object->volumes}) {
|
||||
my $volume = $model_object->volumes->[$i];
|
||||
if (defined $volume->material_id) {
|
||||
my $material = $model_object->model->materials->{ $volume->material_id };
|
||||
my $material = $model_object->model->get_material($volume->material_id);
|
||||
my $config = $material->config;
|
||||
my $extruder_id = $i + 1;
|
||||
$config->set_ifndef('extruder', $extruder_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue