Large refactoring to allow processing multimaterial files

This commit is contained in:
Alessandro Ranellucci 2012-09-22 19:04:36 +02:00
parent 04be94023b
commit 02356fd613
13 changed files with 982 additions and 891 deletions

View file

@ -15,6 +15,7 @@ sub read_from_file {
: $input_file =~ /\.amf(\.xml)?$/i ? Slic3r::Format::AMF->read_file($input_file)
: die "Input file must have .stl, .obj or .amf(.xml) extension\n";
$_->input_file($input_file) for @{$model->objects};
return $model;
}
@ -26,6 +27,16 @@ sub add_object {
return $object;
}
sub set_material {
my $self = shift;
my ($material_id, $attributes) = @_;
return $self->materials->{$material_id} = Slic3r::Model::Material->new(
model => $self,
attributes => $attributes || {},
);
}
# flattens everything to a single mesh
sub mesh {
my $self = shift;