New perl callback to force reloading of 3d scene after Purging volumes are changed
After the changes in previous commit, the 3D scene must be reloaded after the wipe tower is invalidated. This can mostly be done on the C++ side, but reloading after Purging volumes are changed required this C++ -> Perl call
This commit is contained in:
parent
d5f042b4b8
commit
7683870350
4 changed files with 25 additions and 0 deletions
|
@ -144,6 +144,11 @@ sub new {
|
|||
my ($angle_z) = @_;
|
||||
$self->rotate(rad2deg($angle_z), Z, 'absolute');
|
||||
};
|
||||
|
||||
# callback to call schedule_background_process
|
||||
my $on_request_update = sub {
|
||||
$self->schedule_background_process;
|
||||
};
|
||||
|
||||
# callback to update object's geometry info while using gizmos
|
||||
my $on_update_geometry_info = sub {
|
||||
|
@ -202,6 +207,8 @@ sub new {
|
|||
|
||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{canvas3D}, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D}); });
|
||||
}
|
||||
|
||||
Slic3r::_GUI::register_on_request_update_callback($on_request_update);
|
||||
|
||||
# Initialize 2D preview canvas
|
||||
$self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config});
|
||||
|
|
|
@ -901,6 +901,7 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
|
|||
std::vector<float> extruders = dlg.get_extruders();
|
||||
(config.option<ConfigOptionFloats>("wiping_volumes_matrix"))->values = std::vector<double>(matrix.begin(),matrix.end());
|
||||
(config.option<ConfigOptionFloats>("wiping_volumes_extruders"))->values = std::vector<double>(extruders.begin(),extruders.end());
|
||||
g_on_request_update_callback.call();
|
||||
}
|
||||
}));
|
||||
return sizer;
|
||||
|
@ -917,6 +918,10 @@ ConfigOptionsGroup* get_optgroup()
|
|||
return m_optgroup.get();
|
||||
}
|
||||
|
||||
void register_on_request_update_callback(void* callback) {
|
||||
if (callback != nullptr)
|
||||
g_on_request_update_callback.register_callback(callback);
|
||||
}
|
||||
|
||||
wxButton* get_wiping_dialog_button()
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "Config.hpp"
|
||||
#include "../../libslic3r/Utils.hpp"
|
||||
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
|
@ -171,6 +172,9 @@ wxString from_u8(const std::string &str);
|
|||
|
||||
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer);
|
||||
|
||||
static PerlCallback g_on_request_update_callback;
|
||||
void register_on_request_update_callback(void* callback);
|
||||
|
||||
ConfigOptionsGroup* get_optgroup();
|
||||
wxButton* get_wiping_dialog_button();
|
||||
|
||||
|
|
|
@ -104,3 +104,12 @@ void fix_model_by_win10_sdk_gui(ModelObject *model_object_src, Print *print, Mod
|
|||
|
||||
void set_3DScene(SV *scene)
|
||||
%code%{ Slic3r::GUI::set_3DScene((_3DScene *)wxPli_sv_2_object(aTHX_ scene, "Slic3r::Model::3DScene") ); %};
|
||||
|
||||
%package{Slic3r::_GUI};
|
||||
%{
|
||||
void
|
||||
register_on_request_update_callback(callback)
|
||||
SV *callback;
|
||||
CODE:
|
||||
Slic3r::GUI::register_on_request_update_callback((void*)callback);
|
||||
%}
|
||||
|
|
Loading…
Reference in a new issue