mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-21 20:18:17 +08:00
Documentation of the UI config update functions,
documented missing AMF support for the variable layer thickness.
This commit is contained in:
parent
43ac693900
commit
e386a2bf72
@ -61,6 +61,8 @@ sub write_file {
|
|||||||
if ($object->name) {
|
if ($object->name) {
|
||||||
printf $fh qq{ <metadata type=\"name\">%s</metadata>\n}, $object->name;
|
printf $fh qq{ <metadata type=\"name\">%s</metadata>\n}, $object->name;
|
||||||
}
|
}
|
||||||
|
#FIXME Store the layer height ranges (ModelObject::layer_height_ranges)
|
||||||
|
#FIXME Store the layer height profile.
|
||||||
|
|
||||||
printf $fh qq{ <mesh>\n};
|
printf $fh qq{ <mesh>\n};
|
||||||
printf $fh qq{ <vertices>\n};
|
printf $fh qq{ <vertices>\n};
|
||||||
|
@ -132,9 +132,9 @@ sub _init_tabpanel {
|
|||||||
$tab = $self->{options_tabs}{$tab_name} = ($class_prefix . ucfirst $tab_name)->new(
|
$tab = $self->{options_tabs}{$tab_name} = ($class_prefix . ucfirst $tab_name)->new(
|
||||||
$panel,
|
$panel,
|
||||||
no_controller => $self->{no_controller});
|
no_controller => $self->{no_controller});
|
||||||
|
# Callback to be executed after any of the configuration fields (Perl class Slic3r::GUI::OptionsGroup::Field) change their value.
|
||||||
$tab->on_value_change(sub {
|
$tab->on_value_change(sub {
|
||||||
my ($opt_key, $value) = @_;
|
my ($opt_key, $value) = @_;
|
||||||
|
|
||||||
my $config = $tab->config;
|
my $config = $tab->config;
|
||||||
if ($self->{plater}) {
|
if ($self->{plater}) {
|
||||||
$self->{plater}->on_config_change($config); # propagate config change events to the plater
|
$self->{plater}->on_config_change($config); # propagate config change events to the plater
|
||||||
@ -158,6 +158,7 @@ sub _init_tabpanel {
|
|||||||
# a preset changes at Slic3r::GUI::Tab.
|
# a preset changes at Slic3r::GUI::Tab.
|
||||||
$tab->on_presets_changed(sub {
|
$tab->on_presets_changed(sub {
|
||||||
if ($self->{plater}) {
|
if ($self->{plater}) {
|
||||||
|
# Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs.
|
||||||
$self->{plater}->update_presets($tab_name, @_);
|
$self->{plater}->update_presets($tab_name, @_);
|
||||||
$self->{plater}->on_config_change($tab->config);
|
$self->{plater}->on_config_change($tab->config);
|
||||||
if ($self->{controller}) {
|
if ($self->{controller}) {
|
||||||
|
@ -389,6 +389,7 @@ sub append_single_option_line {
|
|||||||
return $self->append_line($self->create_single_option_line($option, $opt_index));
|
return $self->append_line($self->create_single_option_line($option, $opt_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialize UI components with the config values.
|
||||||
sub reload_config {
|
sub reload_config {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
|
# An input field class prototype.
|
||||||
package Slic3r::GUI::OptionsGroup::Field;
|
package Slic3r::GUI::OptionsGroup::Field;
|
||||||
use Moo;
|
use Moo;
|
||||||
|
|
||||||
# This is a base class for option fields.
|
# This is a base class for option fields.
|
||||||
|
|
||||||
has 'parent' => (is => 'ro', required => 1);
|
has 'parent' => (is => 'ro', required => 1);
|
||||||
has 'option' => (is => 'ro', required => 1); # Slic3r::GUI::OptionsGroup::Option
|
# Slic3r::GUI::OptionsGroup::Option
|
||||||
|
has 'option' => (is => 'ro', required => 1);
|
||||||
|
# On change callback
|
||||||
has 'on_change' => (is => 'rw', default => sub { sub {} });
|
has 'on_change' => (is => 'rw', default => sub { sub {} });
|
||||||
has 'on_kill_focus' => (is => 'rw', default => sub { sub {} });
|
has 'on_kill_focus' => (is => 'rw', default => sub { sub {} });
|
||||||
|
# If set, the callback $self->on_change is not called.
|
||||||
|
# This is used to avoid recursive invocation of the field change/update by wxWidgets.
|
||||||
has 'disable_change_event' => (is => 'rw', default => sub { 0 });
|
has 'disable_change_event' => (is => 'rw', default => sub { 0 });
|
||||||
|
|
||||||
# This method should not fire the on_change event
|
# This method should not fire the on_change event
|
||||||
|
@ -54,7 +54,9 @@ sub new {
|
|||||||
bed_shape complete_objects extruder_clearance_radius skirts skirt_distance brim_width
|
bed_shape complete_objects extruder_clearance_radius skirts skirt_distance brim_width
|
||||||
serial_port serial_speed octoprint_host octoprint_apikey
|
serial_port serial_speed octoprint_host octoprint_apikey
|
||||||
));
|
));
|
||||||
|
# C++ Slic3r::Model with Perl extensions in Slic3r/Model.pm
|
||||||
$self->{model} = Slic3r::Model->new;
|
$self->{model} = Slic3r::Model->new;
|
||||||
|
# C++ Slic3r::Print with Perl extensions in Slic3r/Print.pm
|
||||||
$self->{print} = Slic3r::Print->new;
|
$self->{print} = Slic3r::Print->new;
|
||||||
# List of Perl objects Slic3r::GUI::Plater::Object, representing a 2D preview of the platter.
|
# List of Perl objects Slic3r::GUI::Plater::Object, representing a 2D preview of the platter.
|
||||||
$self->{objects} = [];
|
$self->{objects} = [];
|
||||||
@ -498,7 +500,7 @@ sub update_ui_from_settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update presets (Print settings, Filament, Printer) from their respective tabs.
|
# Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs.
|
||||||
# Called by
|
# Called by
|
||||||
# Slic3r::GUI::Tab::Print::_on_presets_changed
|
# Slic3r::GUI::Tab::Print::_on_presets_changed
|
||||||
# Slic3r::GUI::Tab::Filament::_on_presets_changed
|
# Slic3r::GUI::Tab::Filament::_on_presets_changed
|
||||||
|
@ -21,8 +21,10 @@ sub new {
|
|||||||
my ($parent, %params) = @_;
|
my ($parent, %params) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
my $object = $self->{model_object} = $params{model_object};
|
# C++ type Slic3r::ModelObject
|
||||||
my $print_object = $self->{print_object} = $params{print_object};
|
$self->{model_object} = $params{model_object};
|
||||||
|
# Not set, not used.
|
||||||
|
# $self->{print_object} = $params{print_object};
|
||||||
|
|
||||||
# create TreeCtrl
|
# create TreeCtrl
|
||||||
my $tree = $self->{tree} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [300, 100],
|
my $tree = $self->{tree} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [300, 100],
|
||||||
|
@ -11,6 +11,9 @@ use Wx qw(:dialog :id :misc :sizer :systemsettings :notebook wxTAB_TRAVERSAL);
|
|||||||
use Wx::Event qw(EVT_BUTTON);
|
use Wx::Event qw(EVT_BUTTON);
|
||||||
use base 'Wx::Dialog';
|
use base 'Wx::Dialog';
|
||||||
|
|
||||||
|
# Called with
|
||||||
|
# %params{object} of a Perl type Slic3r::GUI::Plater::Object
|
||||||
|
# %params{model_object} of a C++ type Slic3r::ModelObject
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($parent, %params) = @_;
|
my ($parent, %params) = @_;
|
||||||
@ -59,6 +62,7 @@ use base 'Wx::Panel';
|
|||||||
|
|
||||||
sub model_object {
|
sub model_object {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
# $self->GetParent->GetParent is of type Slic3r::GUI::Plater::ObjectSettingsDialog
|
||||||
return $self->GetParent->GetParent->{model_object};
|
return $self->GetParent->GetParent->{model_object};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,10 @@ sub new {
|
|||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($parent, %params) = @_;
|
my ($parent, %params) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
|
# C++ class Slic3r::DynamicPrintConfig, initially empty.
|
||||||
$self->{default_config} = Slic3r::Config->new;
|
$self->{default_config} = Slic3r::Config->new;
|
||||||
$self->{config} = Slic3r::Config->new;
|
$self->{config} = Slic3r::Config->new;
|
||||||
|
# On change callback.
|
||||||
$self->{on_change} = $params{on_change};
|
$self->{on_change} = $params{on_change};
|
||||||
$self->{fixed_options} = {};
|
$self->{fixed_options} = {};
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ sub size {
|
|||||||
return $self->bounding_box->size;
|
return $self->bounding_box->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Slicing process, running at a background thread.
|
||||||
sub process {
|
sub process {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user