Added callback for 3dScene updating after extruder changing
This commit is contained in:
parent
ef0d667d6c
commit
da18e25dfb
@ -31,6 +31,8 @@ our $OBJECT_SELECTION_CHANGED_EVENT = Wx::NewEventType;
|
||||
our $OBJECT_SETTINGS_CHANGED_EVENT = Wx::NewEventType;
|
||||
# 5) To inform about a remove of object
|
||||
our $OBJECT_REMOVE_EVENT = Wx::NewEventType;
|
||||
# 6) To inform about a update of the scene
|
||||
our $UPDATE_SCENE_EVENT = Wx::NewEventType;
|
||||
|
||||
sub new {
|
||||
my ($class, %params) = @_;
|
||||
@ -125,6 +127,7 @@ sub _init_tabpanel {
|
||||
event_object_selection_changed => $OBJECT_SELECTION_CHANGED_EVENT,
|
||||
event_object_settings_changed => $OBJECT_SETTINGS_CHANGED_EVENT,
|
||||
event_remove_object => $OBJECT_REMOVE_EVENT,
|
||||
event_update_scene => $UPDATE_SCENE_EVENT,
|
||||
), L("Plater"));
|
||||
if (!$self->{no_controller}) {
|
||||
$panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), L("Controller"));
|
||||
@ -191,7 +194,7 @@ sub _init_tabpanel {
|
||||
$self->{plater}->item_changed_selection($obj_idx);
|
||||
});
|
||||
|
||||
# The following event is emited by the C++ Tab implementation on object settings change.
|
||||
# The following event is emited by the C++ GUI implementation on object settings change.
|
||||
EVT_COMMAND($self, -1, $OBJECT_SETTINGS_CHANGED_EVENT, sub {
|
||||
my ($self, $event) = @_;
|
||||
|
||||
@ -201,12 +204,18 @@ sub _init_tabpanel {
|
||||
$self->{plater}->changed_object_settings($obj_idx, $parts_changed, $part_settings_changed);
|
||||
});
|
||||
|
||||
# The following event is emited by the C++ Tab implementation on object settings change.
|
||||
# The following event is emited by the C++ GUI implementation on object remove.
|
||||
EVT_COMMAND($self, -1, $OBJECT_REMOVE_EVENT, sub {
|
||||
my ($self, $event) = @_;
|
||||
$self->{plater}->remove();
|
||||
});
|
||||
|
||||
# The following event is emited by the C++ GUI implementation on extruder change for object.
|
||||
EVT_COMMAND($self, -1, $UPDATE_SCENE_EVENT, sub {
|
||||
my ($self, $event) = @_;
|
||||
$self->{plater}->update();
|
||||
});
|
||||
|
||||
|
||||
Slic3r::GUI::create_preset_tabs($self->{no_controller}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
|
||||
$self->{options_tabs} = {};
|
||||
|
@ -58,6 +58,7 @@ sub new {
|
||||
$self->{event_object_selection_changed} = $params{event_object_selection_changed};
|
||||
$self->{event_object_settings_changed} = $params{event_object_settings_changed};
|
||||
$self->{event_remove_object} = $params{event_remove_object};
|
||||
$self->{event_update_scene} = $params{event_update_scene};
|
||||
|
||||
# C++ Slic3r::Model with Perl extensions in Slic3r/Model.pm
|
||||
$self->{model} = Slic3r::Model->new;
|
||||
@ -452,7 +453,8 @@ sub new {
|
||||
$self->{model},
|
||||
$self->{event_object_selection_changed},
|
||||
$self->{event_object_settings_changed},
|
||||
$self->{event_remove_object});
|
||||
$self->{event_remove_object},
|
||||
$self->{event_update_scene});
|
||||
# if ($expert_mode_part_sizer->IsShown(2)==1)
|
||||
# {
|
||||
# $expert_mode_part_sizer->Layout;
|
||||
|
BIN
resources/icons/erase.png
Normal file
BIN
resources/icons/erase.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 488 B |
BIN
resources/icons/exclamation_mark_.png
Normal file
BIN
resources/icons/exclamation_mark_.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 327 B |
@ -896,11 +896,13 @@ void add_expert_mode_part( wxWindow* parent, wxBoxSizer* sizer,
|
||||
Model &model,
|
||||
int event_object_selection_changed,
|
||||
int event_object_settings_changed,
|
||||
int event_remove_object)
|
||||
int event_remove_object,
|
||||
int event_update_scene)
|
||||
{
|
||||
set_event_object_selection_changed(event_object_selection_changed);
|
||||
set_event_object_settings_changed(event_object_settings_changed);
|
||||
set_event_remove_object(event_remove_object);
|
||||
set_event_update_scene(event_update_scene);
|
||||
set_objects_from_model(model);
|
||||
init_mesh_icons();
|
||||
|
||||
|
@ -191,7 +191,8 @@ void add_expert_mode_part( wxWindow* parent, wxBoxSizer* sizer,
|
||||
Model &model,
|
||||
int event_object_selection_changed,
|
||||
int event_object_settings_changed,
|
||||
int event_remove_object);
|
||||
int event_remove_object,
|
||||
int event_update_scene);
|
||||
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer);
|
||||
// Update view mode according to selected menu
|
||||
void update_mode();
|
||||
|
@ -51,6 +51,7 @@ std::vector <std::shared_ptr<ConfigOptionsGroup>> m_og_settings;
|
||||
int m_event_object_selection_changed = 0;
|
||||
int m_event_object_settings_changed = 0;
|
||||
int m_event_remove_object = 0;
|
||||
int m_event_update_scene = 0;
|
||||
|
||||
bool m_parts_changed = false;
|
||||
bool m_part_settings_changed = false;
|
||||
@ -116,6 +117,9 @@ void set_event_object_settings_changed(const int& event){
|
||||
void set_event_remove_object(const int& event){
|
||||
m_event_remove_object = event;
|
||||
}
|
||||
void set_event_update_scene(const int& event){
|
||||
m_event_update_scene = event;
|
||||
}
|
||||
|
||||
void set_objects_from_model(Model &model) {
|
||||
m_objects = &(model.objects);
|
||||
@ -126,7 +130,7 @@ void init_mesh_icons(){
|
||||
m_icon_solidmesh = wxIcon(Slic3r::GUI::from_u8(Slic3r::var("object.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("package.png")), wxBITMAP_TYPE_PNG);
|
||||
|
||||
// init icon for manifold warning
|
||||
m_icon_manifold_warning = wxIcon(Slic3r::GUI::from_u8(Slic3r::var("error.png")), wxBITMAP_TYPE_PNG);
|
||||
m_icon_manifold_warning = wxIcon(Slic3r::GUI::from_u8(Slic3r::var("exclamation_mark_.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("error.png")), wxBITMAP_TYPE_PNG);
|
||||
|
||||
// init bitmap for "Add Settings" context menu
|
||||
m_bmp_cog = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("cog.png")), wxBITMAP_TYPE_PNG);
|
||||
@ -208,20 +212,19 @@ wxBoxSizer* content_objects_list(wxWindow *win)
|
||||
event.Skip();
|
||||
});
|
||||
|
||||
m_objects_ctrl->Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, [](wxDataViewEvent& event)
|
||||
{
|
||||
if (event.GetColumn() == 3)
|
||||
m_objects_ctrl->Bind(wxEVT_CHOICE, [](wxCommandEvent& event)
|
||||
{
|
||||
if (!*m_config)
|
||||
return;
|
||||
wxVariant variant;
|
||||
m_objects_model->GetValue(variant, event.GetItem(), 3);
|
||||
auto str = variant.GetString();
|
||||
int extruder = str.size() > 1 ? 0 : atoi(str.c_str());
|
||||
|
||||
// if ((*m_config)->has("extruder"))
|
||||
auto config = m_config;
|
||||
|
||||
wxString str = event.GetString();
|
||||
int extruder = str.size() > 1 ? 0 : atoi(str.c_str());
|
||||
(*m_config)->set_key_value("extruder", new ConfigOptionInt(extruder));
|
||||
|
||||
if (m_event_update_scene > 0) {
|
||||
wxCommandEvent e(m_event_update_scene);
|
||||
get_main_frame()->ProcessWindowEvent(e);
|
||||
}
|
||||
});
|
||||
|
||||
@ -666,7 +669,7 @@ void update_settings_list()
|
||||
// The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
|
||||
// we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
|
||||
#ifdef __linux__
|
||||
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
|
||||
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(parent));
|
||||
#else
|
||||
wxWindowUpdateLocker noUpdates(parent);
|
||||
#endif
|
||||
|
@ -74,6 +74,7 @@ void init_mesh_icons();
|
||||
void set_event_object_selection_changed(const int& event);
|
||||
void set_event_object_settings_changed(const int& event);
|
||||
void set_event_remove_object(const int& event);
|
||||
void set_event_update_scene(const int& event);
|
||||
void set_objects_from_model(Model &model);
|
||||
|
||||
bool is_parts_changed();
|
||||
|
@ -91,13 +91,15 @@ void add_expert_mode_part( SV *ui_parent, SV *ui_sizer,
|
||||
Model *model,
|
||||
int event_object_selection_changed,
|
||||
int event_object_settings_changed,
|
||||
int event_remove_object)
|
||||
int event_remove_object,
|
||||
int event_update_scene)
|
||||
%code%{ Slic3r::GUI::add_expert_mode_part( (wxWindow*)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"),
|
||||
(wxBoxSizer*)wxPli_sv_2_object(aTHX_ ui_sizer, "Wx::BoxSizer"),
|
||||
*model,
|
||||
event_object_selection_changed,
|
||||
event_object_settings_changed,
|
||||
event_remove_object); %};
|
||||
event_remove_object,
|
||||
event_update_scene); %};
|
||||
|
||||
void set_objects_from_perl( SV *ui_parent,
|
||||
SV *frequently_changed_parameters_sizer,
|
||||
|
Loading…
Reference in New Issue
Block a user