mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 02:28:59 +08:00
Some fixes to config API
This commit is contained in:
parent
12b661e877
commit
51af10da4f
@ -379,13 +379,13 @@ sub replace_options {
|
|||||||
$string =~ s/\[version\]/$Slic3r::VERSION/eg;
|
$string =~ s/\[version\]/$Slic3r::VERSION/eg;
|
||||||
|
|
||||||
# build a regexp to match the available options
|
# build a regexp to match the available options
|
||||||
my @options = grep !$Slic3r::Config::Options->{$_}{multiline},
|
my @options = grep !$Slic3r::Config::Options->{$_}{multiline}, @{$self->get_keys};
|
||||||
grep $self->has($_),
|
|
||||||
keys %{$Slic3r::Config::Options};
|
|
||||||
my $options_regex = join '|', @options;
|
my $options_regex = join '|', @options;
|
||||||
|
|
||||||
# use that regexp to search and replace option names with option values
|
# use that regexp to search and replace option names with option values
|
||||||
$string =~ s/\[($options_regex)\]/$self->serialize($1)/eg;
|
# it looks like passing $1 as argument to serialize() directly causes a segfault
|
||||||
|
# (maybe some perl optimization? maybe regex captures are not regular SVs?)
|
||||||
|
$string =~ s/\[($options_regex)\]/my $opt_key = $1; $self->serialize($opt_key)/eg;
|
||||||
foreach my $opt_key (grep ref $self->$_ eq 'ARRAY', @options) {
|
foreach my $opt_key (grep ref $self->$_ eq 'ARRAY', @options) {
|
||||||
my $value = $self->$opt_key;
|
my $value = $self->$opt_key;
|
||||||
$string =~ s/\[${opt_key}_${_}\]/$value->[$_]/eg for 0 .. $#$value;
|
$string =~ s/\[${opt_key}_${_}\]/$value->[$_]/eg for 0 .. $#$value;
|
||||||
|
@ -580,10 +580,10 @@ TriangleMesh::slice(const std::vector<double> &z, std::vector<ExPolygons>* layer
|
|||||||
#ifdef SLIC3R_DEBUG
|
#ifdef SLIC3R_DEBUG
|
||||||
size_t holes_count = 0;
|
size_t holes_count = 0;
|
||||||
for (ExPolygons::const_iterator e = ex_slices.begin(); e != ex_slices.end(); ++e) {
|
for (ExPolygons::const_iterator e = ex_slices.begin(); e != ex_slices.end(); ++e) {
|
||||||
holes_count += e->holes.count();
|
holes_count += e->holes.size();
|
||||||
}
|
}
|
||||||
printf("Layer %d (slice_z = %.2f): %d surface(s) having %d holes detected from %d polylines\n",
|
printf("Layer %zu (slice_z = %.2f): %zu surface(s) having %zu holes detected from %zu polylines\n",
|
||||||
layer_id, z[layer_id], ex_slices.count(), holes_count, loops->count());
|
layer_id, z[layer_id], ex_slices.size(), holes_count, loops->size());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ExPolygons* layer = &(*layers)[layer_id];
|
ExPolygons* layer = &(*layers)[layer_id];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user