OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::MainFrame::GLResourcesPrebuild Class Reference
Inheritance diagram for Slic3r::GUI::MainFrame::GLResourcesPrebuild:
Collaboration diagram for Slic3r::GUI::MainFrame::GLResourcesPrebuild:

Public Member Functions

 GLResourcesPrebuild (MainFrame &frame)
const std::string & name () const override
bool built () const override
bool pending () const override
bool build_step () override
int prebuild_order () const override

Static Protected Member Functions

static void log_null_factory (const std::string &name)

Private Attributes

MainFrame & m_frame
std::string m_name { "gl_resources" }
int m_step { 0 }
bool m_failed { false }

Detailed Description

Constructor & Destructor Documentation

◆ GLResourcesPrebuild()

Slic3r::GUI::MainFrame::GLResourcesPrebuild::GLResourcesPrebuild ( MainFrame & frame)
inlineexplicit
159: m_frame(frame) {}
MainFrame & m_frame
Definition MainFrame.hpp:167

References Slic3r::GUI::MainFrame::MainFrame(), and m_frame.

Here is the call graph for this function:

Member Function Documentation

◆ build_step()

bool Slic3r::GUI::MainFrame::GLResourcesPrebuild::build_step ( )
overridevirtual

Implements Slic3r::GUI::LazyBase.

4201{
4202 GLCanvas3D* canvas = m_frame.m_plater->canvas3D();
4203#ifdef __WXGTK__
4204 // wx creates a GTK canvas's GL surface when the widget is realized, so the context can be
4205 // made current on it while hidden.
4206 gtk_widget_realize(canvas->get_wxglcanvas()->GetHandle());
4207#endif
4208 if (!canvas->make_current_for_postinit()) {
4209 // The first render of the canvas loads everything instead.
4210 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": cannot make the GL context current on the hidden canvas";
4211 m_failed = true;
4212 return false;
4213 }
4214 switch (m_step) {
4215 case 0:
4216 m_failed = !wxGetApp().init_opengl();
4217 break;
4218 case 1: {
4219 const Size size = canvas->get_canvas_size();
4220 wxGetApp().imgui()->set_display_size(float(std::max(1, size.get_width())), float(std::max(1, size.get_height())));
4221 canvas->set_imgui_scaling();
4222 // Builds the font atlas without leaving a frame open at the hidden canvas's size.
4223 wxGetApp().imgui()->new_frame();
4224 wxGetApp().imgui()->end_frame();
4225 break;
4226 }
4227 case 2:
4228 // One texture per unit until none remain.
4229 if (m_frame.m_plater->get_partplate_list().load_next_plate_texture())
4230 return true;
4231 break;
4232 case 3:
4233 m_failed = !canvas->init();
4234 break;
4235 default:
4236 // Runs after init(), which sets the color mode the icons are drawn for.
4237 m_frame.m_plater->get_partplate_list().load_icon_textures();
4238 return false;
4239 }
4240 ++m_step;
4241 return !m_failed;
4242}
int m_step
Definition MainFrame.hpp:169
bool m_failed
Definition MainFrame.hpp:170

References Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), Slic3r::GUI::GLCanvas3D::get_wxglcanvas(), Slic3r::GUI::GLCanvas3D::init(), m_failed, m_frame, m_step, Slic3r::GUI::GLCanvas3D::make_current_for_postinit(), and Slic3r::GUI::GLCanvas3D::set_imgui_scaling().

Here is the call graph for this function:

◆ built()

bool Slic3r::GUI::MainFrame::GLResourcesPrebuild::built ( ) const
overridevirtual

Implements Slic3r::GUI::LazyBase.

4195{
4196 return m_frame.m_plater != nullptr && m_frame.m_plater->canvas3D()->is_initialized() &&
4197 m_frame.m_plater->get_partplate_list().icon_textures_loaded();
4198}

References m_frame.

Referenced by pending().

Here is the caller graph for this function:

◆ log_null_factory()

void Slic3r::GUI::LazyBase::log_null_factory ( const std::string & name)
staticprotectedinherited
26{
27 BOOST_LOG_TRIVIAL(error) << "Lazy::build_step: the factory for " << name << " returned null";
28}
virtual const std::string & name() const =0

References name().

Referenced by Slic3r::GUI::Lazy< T >::build_step().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

const std::string & Slic3r::GUI::MainFrame::GLResourcesPrebuild::name ( ) const
inlineoverridevirtual

Implements Slic3r::GUI::LazyBase.

160{ return m_name; }
std::string m_name
Definition MainFrame.hpp:168

References m_name.

◆ pending()

bool Slic3r::GUI::MainFrame::GLResourcesPrebuild::pending ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::GUI::LazyBase.

162{ return !m_failed && !built(); }
bool built() const override
Definition MainFrame.cpp:4194

References built(), and m_failed.

Here is the call graph for this function:

◆ prebuild_order()

int Slic3r::GUI::MainFrame::GLResourcesPrebuild::prebuild_order ( ) const
inlineoverridevirtual

Implements Slic3r::GUI::LazyBase.

164{ return 0; }

Member Data Documentation

◆ m_failed

bool Slic3r::GUI::MainFrame::GLResourcesPrebuild::m_failed { false }
private
170{ false };

Referenced by build_step(), and pending().

◆ m_frame

MainFrame& Slic3r::GUI::MainFrame::GLResourcesPrebuild::m_frame
private

◆ m_name

std::string Slic3r::GUI::MainFrame::GLResourcesPrebuild::m_name { "gl_resources" }
private
168{ "gl_resources" };

Referenced by name().

◆ m_step

int Slic3r::GUI::MainFrame::GLResourcesPrebuild::m_step { 0 }
private
169{ 0 };

Referenced by build_step().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/MainFrame.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/MainFrame.cpp