mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-07 15:51:08 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6186329ef3 |
@@ -2427,11 +2427,15 @@ void GLCanvas3D::_render_scene(const Camera& camera, const Size& cnv_size)
|
||||
if (m_canvas_type == ECanvasType::CanvasView3D) {
|
||||
// m_show_bed gates the plate list too: hiding the bed but leaving its grid and outline
|
||||
// floating would read as a rendering fault rather than a deliberate view option.
|
||||
// Design tab: while its reference planes are up they draw their own axes from the modeling
|
||||
// origin, where the bed's triad would otherwise sit on top of them.
|
||||
if (show_bed)
|
||||
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(),
|
||||
m_show_world_axes && !(m_design_sketch_tool != nullptr && m_design_sketch_tool->draws_reference_axes()));
|
||||
if (show_bed) {
|
||||
bool show_axes = m_show_world_axes;
|
||||
#ifdef SLIC3R_CAD
|
||||
// Design tab: while its reference planes are up they draw their own axes from the modeling
|
||||
// origin, where the bed's triad would otherwise sit on top of them.
|
||||
show_axes = show_axes && !(m_design_sketch_tool != nullptr && m_design_sketch_tool->draws_reference_axes());
|
||||
#endif
|
||||
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), show_axes);
|
||||
}
|
||||
m_frame_profiler.mark("bed");
|
||||
if (show_bed) //BBS: add outline logic
|
||||
_render_platelist(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), only_current, only_body, hover_id, true, show_grid);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <wx/app.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/toplevel.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/progdlg.h>
|
||||
@@ -416,44 +415,6 @@ struct UiDockPanelHandle
|
||||
int id{0};
|
||||
};
|
||||
|
||||
// Polls until the plater is shown on screen, then runs the callback with it (null when the app
|
||||
// is closing instead) and deletes itself. A plugin loaded at startup opens its panes from
|
||||
// on_load, before the main window exists, and a pane added before that window is laid out is
|
||||
// sized against the unsized frame and keeps that width (AuiMgr::track_docked_size).
|
||||
class PlaterShownWaiter : public wxTimer
|
||||
{
|
||||
public:
|
||||
explicit PlaterShownWaiter(std::function<void(GUI::Plater*)> fn) : m_fn(std::move(fn)) {}
|
||||
|
||||
// True once the callback ran.
|
||||
bool try_run()
|
||||
{
|
||||
const bool closing = GUI::wxGetApp().is_closing();
|
||||
GUI::Plater* plater = closing ? nullptr : GUI::wxGetApp().plater();
|
||||
if (!closing && (plater == nullptr || !plater->IsShownOnScreen()))
|
||||
return false;
|
||||
Stop();
|
||||
m_fn(plater);
|
||||
// Off the timer callback's stack: wxGTK's timeout callback still reads the timer after Notify().
|
||||
GUI::wxGetApp().CallAfter([this]() { delete this; });
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notify() override { try_run(); }
|
||||
|
||||
private:
|
||||
std::function<void(GUI::Plater*)> m_fn;
|
||||
};
|
||||
|
||||
void run_when_plater_shown(std::function<void(GUI::Plater*)> fn)
|
||||
{
|
||||
GUI::wxGetApp().CallAfter([fn = std::move(fn)]() mutable {
|
||||
auto* waiter = new PlaterShownWaiter(std::move(fn));
|
||||
if (!waiter->try_run())
|
||||
waiter->Start(100);
|
||||
});
|
||||
}
|
||||
|
||||
py::object ui_create_dock_panel(const std::string& html, const std::string& title, int width, int height,
|
||||
py::object on_message, py::object on_close, const std::string& dock)
|
||||
{
|
||||
@@ -473,13 +434,14 @@ py::object ui_create_dock_panel(const std::string& html, const std::string& titl
|
||||
const int new_id = UiRegistry::instance().reserve_id();
|
||||
UiRegistry::instance().bind(new_id, nullptr, plugin_key);
|
||||
|
||||
run_when_plater_shown([new_id, plugin_key, html, title, dock, w, h,
|
||||
msg_adapter = std::move(msg_adapter),
|
||||
close_holder = std::move(close_holder)](GUI::Plater* plater) mutable {
|
||||
GUI::wxGetApp().CallAfter([new_id, plugin_key, html, title, dock, w, h,
|
||||
msg_adapter = std::move(msg_adapter),
|
||||
close_holder = std::move(close_holder)]() mutable {
|
||||
if (!UiRegistry::instance().is_open(new_id))
|
||||
return;
|
||||
|
||||
if (plater == nullptr) {
|
||||
GUI::Plater* plater = GUI::wxGetApp().plater();
|
||||
if (plater == nullptr || GUI::wxGetApp().is_closing()) {
|
||||
UiRegistry::instance().remove(new_id);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user