Have Print::apply_config() return true if any step was invalidated
This commit is contained in:
parent
5e80d7a388
commit
97231327e0
@ -43,13 +43,17 @@ sub apply_config {
|
||||
# apply variables to placeholder parser
|
||||
$self->placeholder_parser->apply_config($config);
|
||||
|
||||
my $invalidated = 0;
|
||||
|
||||
# handle changes to print config
|
||||
my $print_diff = $self->config->diff($config);
|
||||
if (@$print_diff) {
|
||||
$self->config->apply_dynamic($config);
|
||||
|
||||
$self->invalidate_all_steps
|
||||
my $res;
|
||||
$res = $self->invalidate_all_steps
|
||||
if !$self->invalidate_state_by_config_options($print_diff);
|
||||
$invalidated = 1 if $res;
|
||||
}
|
||||
|
||||
# handle changes to object config defaults
|
||||
@ -69,8 +73,11 @@ sub apply_config {
|
||||
my $diff = $object->config->diff($new);
|
||||
if (@$diff) {
|
||||
$object->config->apply($new);
|
||||
$object->invalidate_all_steps
|
||||
|
||||
my $res;
|
||||
$res = $object->invalidate_all_steps
|
||||
if !$object->invalidate_state_by_config_options($diff);
|
||||
$invalidated = 1 if $res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,8 +131,10 @@ sub apply_config {
|
||||
if (@$region_config_diff) {
|
||||
$region->config->apply($new);
|
||||
foreach my $o (@{$self->objects}) {
|
||||
$o->invalidate_all_steps
|
||||
my $res;
|
||||
$res = $o->invalidate_all_steps
|
||||
if !$o->invalidate_state_by_config_options($region_config_diff);
|
||||
$invalidated = 1 if $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,7 +148,10 @@ sub apply_config {
|
||||
my @model_objects = map $_->model_object, @{$self->objects};
|
||||
$self->clear_objects;
|
||||
$self->add_model_object($_) for @model_objects;
|
||||
$invalidated = 1;
|
||||
}
|
||||
|
||||
return $invalidated;
|
||||
}
|
||||
|
||||
sub has_support_material {
|
||||
|
@ -40,11 +40,13 @@ PrintState<StepClass>::invalidate(StepClass step)
|
||||
}
|
||||
|
||||
template <class StepClass>
|
||||
void
|
||||
bool
|
||||
PrintState<StepClass>::invalidate_all()
|
||||
{
|
||||
bool empty = this->_started.empty();
|
||||
this->_started.clear();
|
||||
this->_done.clear();
|
||||
return !empty; // return true if we invalidated something
|
||||
}
|
||||
|
||||
template class PrintState<PrintStep>;
|
||||
|
@ -36,7 +36,7 @@ class PrintState
|
||||
void set_started(StepType step);
|
||||
void set_done(StepType step);
|
||||
void invalidate(StepType step);
|
||||
void invalidate_all();
|
||||
bool invalidate_all();
|
||||
};
|
||||
|
||||
// A PrintRegion object represents a group of volumes to print
|
||||
|
@ -87,8 +87,8 @@ _constant()
|
||||
|
||||
bool invalidate_state_by_config_options(std::vector<std::string> opt_keys);
|
||||
void invalidate_step(PrintObjectStep step);
|
||||
void invalidate_all_steps()
|
||||
%code%{ THIS->state.invalidate_all(); %};
|
||||
bool invalidate_all_steps()
|
||||
%code%{ RETVAL = THIS->state.invalidate_all(); %};
|
||||
bool step_done(PrintObjectStep step)
|
||||
%code%{ RETVAL = THIS->state.done(step); %};
|
||||
void set_step_done(PrintObjectStep step)
|
||||
@ -142,8 +142,8 @@ _constant()
|
||||
|
||||
bool invalidate_state_by_config_options(std::vector<std::string> opt_keys);
|
||||
void invalidate_step(PrintStep step);
|
||||
void invalidate_all_steps()
|
||||
%code%{ THIS->state.invalidate_all(); %};
|
||||
bool invalidate_all_steps()
|
||||
%code%{ RETVAL = THIS->state.invalidate_all(); %};
|
||||
bool step_done(PrintStep step)
|
||||
%code%{ RETVAL = THIS->state.done(step); %};
|
||||
void set_step_done(PrintStep step)
|
||||
|
Loading…
Reference in New Issue
Block a user