mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:45:56 +08:00
Make thumbnail regeneration a wxEvent
Also call the event when a bed texture is fully loaded.
This commit is contained in:
parent
567a2cdc38
commit
5e6a721683
@ -421,6 +421,7 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& v
|
||||
else if (m_texture.unsent_compressed_data_available()) {
|
||||
// sends to gpu the already available compressed levels of the main texture
|
||||
m_texture.send_compressed_data_to_gpu();
|
||||
wxQueueEvent(wxGetApp().plater(), new SimpleEvent(EVT_REGENERATE_BED_THUMBNAILS));
|
||||
|
||||
// the temporary texture is not needed anymore, reset it
|
||||
if (m_temp_texture.get_id() != 0)
|
||||
|
@ -170,6 +170,7 @@ wxDEFINE_EVENT(EVT_SLICING_COMPLETED, wxCommandEvent);
|
||||
// BackgroundSlicingProcess finished either with success or error.
|
||||
wxDEFINE_EVENT(EVT_PROCESS_COMPLETED, SlicingProcessCompletedEvent);
|
||||
wxDEFINE_EVENT(EVT_EXPORT_BEGAN, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_REGENERATE_BED_THUMBNAILS, SimpleEvent);
|
||||
|
||||
// Plater::DropTarget
|
||||
|
||||
@ -563,7 +564,7 @@ struct Plater::priv
|
||||
|
||||
void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, Camera::EType camera_type);
|
||||
ThumbnailsList generate_thumbnails(const ThumbnailsParams& params, Camera::EType camera_type);
|
||||
void regenerate_thumbnails();
|
||||
void regenerate_thumbnails(SimpleEvent&);
|
||||
|
||||
void bring_instance_forward() const;
|
||||
|
||||
@ -771,6 +772,7 @@ void Plater::priv::init()
|
||||
q->Bind(EVT_EXPORT_BEGAN, &priv::on_export_began, this);
|
||||
q->Bind(EVT_GLVIEWTOOLBAR_3D, [this](SimpleEvent&) { q->select_view_3D("3D"); });
|
||||
q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [this](SimpleEvent&) { q->select_view_3D("Preview"); });
|
||||
q->Bind(EVT_REGENERATE_BED_THUMBNAILS, &priv::regenerate_thumbnails, this);
|
||||
}
|
||||
|
||||
// Drop target:
|
||||
@ -2229,7 +2231,7 @@ std::vector<Print::ApplyStatus> apply_to_inactive_beds(
|
||||
return result;
|
||||
}
|
||||
|
||||
void Plater::priv::regenerate_thumbnails() {
|
||||
void Plater::priv::regenerate_thumbnails(SimpleEvent&) {
|
||||
const int num{s_multiple_beds.get_number_of_beds()};
|
||||
if (num <= 1 || num > MAX_NUMBER_OF_BEDS) {
|
||||
return;
|
||||
@ -2391,7 +2393,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||
|
||||
// If current bed was invalidated, update thumbnails for all beds:
|
||||
if (any_status_changed) {
|
||||
regenerate_thumbnails();
|
||||
wxQueueEvent(this->q, new SimpleEvent(EVT_REGENERATE_BED_THUMBNAILS));
|
||||
}
|
||||
|
||||
// Just redraw the 3D canvas without reloading the scene to consume the update of the layer height profile.
|
||||
@ -4789,10 +4791,6 @@ void Plater::object_list_changed()
|
||||
p->object_list_changed();
|
||||
}
|
||||
|
||||
void Plater::regenerate_thumbnails() {
|
||||
p->regenerate_thumbnails();
|
||||
}
|
||||
|
||||
std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units /*= false*/) { return p->load_files(input_files, load_model, load_config, imperial_units); }
|
||||
|
||||
// To be called when providing a list of files to the GUI slic3r on command line.
|
||||
|
@ -58,6 +58,7 @@ namespace UndoRedo {
|
||||
namespace GUI {
|
||||
|
||||
wxDECLARE_EVENT(EVT_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
|
||||
wxDECLARE_EVENT(EVT_REGENERATE_BED_THUMBNAILS, SimpleEvent);
|
||||
|
||||
class MainFrame;
|
||||
class GLCanvas3D;
|
||||
@ -122,7 +123,6 @@ public:
|
||||
void reload_print();
|
||||
void object_list_changed();
|
||||
void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, Camera::EType camera_type);
|
||||
void regenerate_thumbnails();
|
||||
|
||||
std::vector<size_t> load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true, bool imperial_units = false);
|
||||
// To be called when providing a list of files to the GUI slic3r on command line.
|
||||
|
@ -761,7 +761,7 @@ void Sidebar::on_select_preset(wxCommandEvent& evt)
|
||||
m_object_list->update_object_list_by_printer_technology();
|
||||
s_multiple_beds.stop_autoslice(false);
|
||||
this->switch_from_autoslicing_mode();
|
||||
this->m_plater->regenerate_thumbnails();
|
||||
wxQueueEvent(this->m_plater, new SimpleEvent(EVT_REGENERATE_BED_THUMBNAILS));
|
||||
this->m_plater->update();
|
||||
s_print_statuses.fill(PrintStatus::idle);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user