mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 21:44:08 -06:00
Initial implementation of a wipe tower preview UI.
This commit is contained in:
parent
7b6c9b3b3c
commit
cb0a66b743
7 changed files with 102 additions and 36 deletions
|
@ -29,13 +29,8 @@ sub new {
|
|||
|
||||
$self->on_select(sub {
|
||||
my ($volume_idx) = @_;
|
||||
|
||||
my $obj_idx = undef;
|
||||
if ($volume_idx != -1) {
|
||||
$obj_idx = $self->volumes->[$volume_idx]->object_idx;
|
||||
}
|
||||
$self->{on_select_object}->($obj_idx)
|
||||
if $self->{on_select_object};
|
||||
$self->{on_select_object}->(($volume_idx == -1) ? undef : $self->volumes->[$volume_idx]->object_idx)
|
||||
if ($self->{on_select_object});
|
||||
});
|
||||
$self->on_move(sub {
|
||||
my @volume_idxs = @_;
|
||||
|
@ -47,13 +42,17 @@ sub new {
|
|||
my $instance_idx = $volume->instance_idx;
|
||||
next if $done{"${obj_idx}_${instance_idx}"};
|
||||
$done{"${obj_idx}_${instance_idx}"} = 1;
|
||||
|
||||
my $model_object = $self->{model}->get_object($obj_idx);
|
||||
$model_object
|
||||
->instances->[$instance_idx]
|
||||
->offset
|
||||
->translate($volume->origin->x, $volume->origin->y); #))
|
||||
$model_object->invalidate_bounding_box;
|
||||
if ($obj_idx < 1000) {
|
||||
# Move a regular object.
|
||||
my $model_object = $self->{model}->get_object($obj_idx);
|
||||
$model_object
|
||||
->instances->[$instance_idx]
|
||||
->offset
|
||||
->translate($volume->origin->x, $volume->origin->y); #))
|
||||
$model_object->invalidate_bounding_box;
|
||||
} elsif ($obj_idx == 1000) {
|
||||
# Move a wipe tower proxy.
|
||||
}
|
||||
}
|
||||
|
||||
$self->{on_instances_moved}->()
|
||||
|
@ -88,19 +87,45 @@ sub set_on_model_update {
|
|||
$self->on_model_update($cb);
|
||||
}
|
||||
|
||||
sub update {
|
||||
sub reload_scene {
|
||||
my ($self) = @_;
|
||||
|
||||
if (0) {
|
||||
my $i = 1;
|
||||
print STDERR "3D::reload_scene - Stack Trace:\n";
|
||||
while ( (my @call_details = (caller($i++))) ){
|
||||
print STDERR $call_details[1].":".$call_details[2]." in function ".$call_details[3]."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$self->reset_objects;
|
||||
$self->update_bed_size;
|
||||
|
||||
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
|
||||
my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx);
|
||||
|
||||
if ($self->{objects}[$obj_idx]->selected) {
|
||||
$self->select_volume($_) for @volume_idxs;
|
||||
}
|
||||
}
|
||||
if (0) {
|
||||
print "Config: $self->{config}\n";
|
||||
$self->{config}->save('d:\temp\cfg.ini');
|
||||
}
|
||||
if (defined $self->{config}->nozzle_diameter) {
|
||||
# Should the wipe tower be visualized?
|
||||
my $extruders_count = scalar @{ $self->{config}->nozzle_diameter };
|
||||
# Height of a print.
|
||||
my $height = $self->{model}->bounding_box->z_max;
|
||||
# Show at least a slab.
|
||||
$height = 10 if $height < 10;
|
||||
if ($extruders_count > 1 && $self->{config}->single_extruder_multi_material && $self->{config}->wipe_tower &&
|
||||
! $self->{config}->complete_objects) {
|
||||
$self->volumes->load_wipe_tower_preview(1000,
|
||||
$self->{config}->wipe_tower_x, $self->{config}->wipe_tower_y,
|
||||
$self->{config}->wipe_tower_width, $self->{config}->wipe_tower_per_color_wipe * ($extruders_count - 1),
|
||||
$self->{model}->bounding_box->z_max, $self->UseVBOs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub update_bed_size {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue