mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-06 23:07:42 -07:00
Merge branch 'main' into dev/p2s-pr
This commit is contained in:
commit
93c4838efe
5 changed files with 19 additions and 5 deletions
|
|
@ -3313,6 +3313,7 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
|
|||
bool imgui_requires_extra_frame = wxGetApp().imgui()->requires_extra_frame();
|
||||
m_dirty |= imgui_requires_extra_frame;
|
||||
#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
|
||||
m_dirty |= GLTexture::Compressor::has_compressed_texture_to_refresh();
|
||||
|
||||
if (!m_dirty)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ void GLTexture::Compressor::send_compressed_data_to_gpu()
|
|||
this->reset();
|
||||
}
|
||||
|
||||
std::atomic<bool> GLTexture::Compressor::m_dirty = false;
|
||||
|
||||
void GLTexture::Compressor::compress()
|
||||
{
|
||||
// reference: https://github.com/Cyan4973/RygsDXTc
|
||||
|
|
@ -123,6 +125,11 @@ void GLTexture::Compressor::compress()
|
|||
level.src_data.clear();
|
||||
++ m_num_levels_compressed;
|
||||
}
|
||||
|
||||
// Trigger an idle event to refresh the scene once the texture data is ready
|
||||
// This fixes the issue that the bed texture is black after switching printer model until mouse moves to the 3d scene
|
||||
m_dirty = true;
|
||||
wxWakeUpIdle();
|
||||
}
|
||||
|
||||
GLTexture::Quad_UVs GLTexture::FullTextureUVs = { { 0.0f, 1.0f }, { 1.0f, 1.0f }, { 1.0f, 0.0f }, { 0.0f, 0.0f } };
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ namespace GUI {
|
|||
|
||||
class GLTexture
|
||||
{
|
||||
public:
|
||||
|
||||
class Compressor
|
||||
{
|
||||
struct Level
|
||||
|
|
@ -39,6 +41,8 @@ namespace GUI {
|
|||
// This atomic also works as a memory barrier for synchronizing results of the worker thread with the calling thread.
|
||||
std::atomic<unsigned int> m_num_levels_compressed;
|
||||
|
||||
static std::atomic<bool> m_dirty;
|
||||
|
||||
public:
|
||||
explicit Compressor(GLTexture& texture) : m_texture(texture), m_abort_compressing(false), m_num_levels_compressed(0) {}
|
||||
~Compressor() { reset(); }
|
||||
|
|
@ -53,11 +57,12 @@ namespace GUI {
|
|||
void send_compressed_data_to_gpu();
|
||||
bool all_compressed_data_sent_to_gpu() const { return m_levels.empty(); }
|
||||
|
||||
static bool has_compressed_texture_to_refresh() { return m_dirty.exchange(false); }
|
||||
|
||||
private:
|
||||
void compress();
|
||||
};
|
||||
|
||||
public:
|
||||
enum ECompressionType : unsigned char
|
||||
{
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "Tab.hpp"
|
||||
#include "format.hpp"
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "slic3r/Utils/FileHelp.hpp"
|
||||
#include <imgui/imgui_internal.h>
|
||||
#include <wx/dcgraph.h>
|
||||
using boost::optional;
|
||||
|
|
@ -5565,8 +5566,10 @@ void PartPlateList::update_logo_texture_filename(const std::string &texture_file
|
|||
if (!texture_filename.empty() && !check_texture(texture_filename)) {
|
||||
m_logo_texture_filename = "";
|
||||
BOOST_LOG_TRIVIAL(error) << "Unable to load bed texture: " << texture_filename;
|
||||
} else
|
||||
} else {
|
||||
m_logo_texture_filename = texture_filename;
|
||||
Utils::slash_to_back_slash(m_logo_texture_filename);
|
||||
}
|
||||
}
|
||||
|
||||
/*slice related functions*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "FileHelp.hpp"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <regex>
|
||||
namespace Slic3r {
|
||||
namespace Utils {
|
||||
|
||||
|
|
@ -20,8 +19,7 @@ bool is_file_too_large(std::string file_path, bool &try_ok)
|
|||
}
|
||||
|
||||
void slash_to_back_slash(std::string &file_path) {
|
||||
std::regex regex("\\\\");
|
||||
file_path = std::regex_replace(file_path, regex, "/");
|
||||
std::replace(file_path.begin(), file_path.end(), '\\', '/');
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::Utils
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue