From 2406cc35b675b1a65e5eba1cb98fe8c436c38dce Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Mon, 31 Oct 2022 22:36:28 +0800 Subject: [PATCH] FIX: cli: fix the thumbnail rendering issue 1. fix the color not correct issue 2. fix the warning when loading thumbnail under cli 3. remove the invalid error log Change-Id: I4dd553b218e264bb811606053d920b5861ad6bd4 --- src/BambuStudio.cpp | 9 ++++++++- src/slic3r/GUI/OpenGLManager.cpp | 16 ++++++++-------- src/slic3r/GUI/PartPlate.cpp | 6 +++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index d1a2bb942..e8323525f 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -126,7 +126,7 @@ int CLI::run(int argc, char **argv) BOOST_LOG_TRIVIAL(info) << "index="<< index <<", arg is "<< argv[index] <set_render_color( float(rgb_color[0]) / 255.f, float(rgb_color[1]) / 255.f, float(rgb_color[2]) / 255.f, 1.f); + + std::array new_color; + new_color[0] = float(rgb_color[0]) / 255.f; + new_color[1] = float(rgb_color[1]) / 255.f; + new_color[2] = float(rgb_color[2]) / 255.f; + new_color[3] = 1.f; + glvolume_collection.volumes.back()->set_color(new_color); } } } diff --git a/src/slic3r/GUI/OpenGLManager.cpp b/src/slic3r/GUI/OpenGLManager.cpp index cfed0f996..1e6b6cd7e 100644 --- a/src/slic3r/GUI/OpenGLManager.cpp +++ b/src/slic3r/GUI/OpenGLManager.cpp @@ -211,16 +211,16 @@ bool OpenGLManager::m_use_manually_generated_mipmaps = true; OpenGLManager::EMultisampleState OpenGLManager::s_multisample = OpenGLManager::EMultisampleState::Unknown; OpenGLManager::EFramebufferType OpenGLManager::s_framebuffers_type = OpenGLManager::EFramebufferType::Unknown; -#ifdef __APPLE__ +#ifdef __APPLE__ // Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets OpenGLManager::OSInfo OpenGLManager::s_os_info; -#endif // __APPLE__ +#endif // __APPLE__ OpenGLManager::~OpenGLManager() { m_shaders_manager.shutdown(); -#ifdef __APPLE__ +#ifdef __APPLE__ // This is an ugly hack needed to solve the crash happening when closing the application on OSX 10.9.5 with newer wxWidgets // The crash is triggered inside wxGLContext destructor if (s_os_info.major != 10 || s_os_info.minor != 9 || s_os_info.micro != 5) @@ -228,7 +228,7 @@ OpenGLManager::~OpenGLManager() #endif //__APPLE__ if (m_context != nullptr) delete m_context; -#ifdef __APPLE__ +#ifdef __APPLE__ } #endif //__APPLE__ } @@ -302,7 +302,7 @@ bool OpenGLManager::init_gl() BOOST_LOG_TRIVIAL(error) << "Not recognized format of version."; } } else { - BOOST_LOG_TRIVIAL(error) << "Unable to parse version of AMD driver."; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "not AMD driver."; } #endif } @@ -315,7 +315,7 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas) if (m_context == nullptr) { m_context = new wxGLContext(&canvas); -#ifdef __APPLE__ +#ifdef __APPLE__ // Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets s_os_info.major = wxPlatformInfo::Get().GetOSMajorVersion(); s_os_info.minor = wxPlatformInfo::Get().GetOSMinorVersion(); @@ -327,7 +327,7 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas) wxGLCanvas* OpenGLManager::create_wxglcanvas(wxWindow& parent) { - int attribList[] = { + int attribList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, // RGB channels each should be allocated with 8 bit depth. One should almost certainly get these bit depths by default. @@ -361,7 +361,7 @@ void OpenGLManager::detect_multisample(int* attribList) { int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER; bool enable_multisample = wxVersion >= 30003; - s_multisample = + s_multisample = enable_multisample && // Disable multi-sampling on ChromeOS, as the OpenGL virtualization swaps Red/Blue channels with multi-sampling enabled, // at least on some platforms. diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 9f77f83e9..c7668c4ad 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -4137,19 +4137,19 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list) gcode_result->toolpath_outside = plate_data_list[i]->toolpath_outside; m_plate_list[index]->slice_filaments_info = plate_data_list[i]->slice_filaments_info; gcode_result->warnings = plate_data_list[i]->warnings; - if (!plate_data_list[i]->thumbnail_file.empty()) { + if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) { if (boost::filesystem::exists(plate_data_list[i]->thumbnail_file)) { m_plate_list[index]->load_thumbnail_data(plate_data_list[i]->thumbnail_file); } } - if (!plate_data_list[i]->pattern_file.empty()) { + if (m_plater && !plate_data_list[i]->pattern_file.empty()) { if (boost::filesystem::exists(plate_data_list[i]->pattern_file)) { //no need to load pattern data currently //m_plate_list[index]->load_pattern_thumbnail_data(plate_data_list[i]->pattern_file); } } - if (!plate_data_list[i]->pattern_bbox_file.empty()) { + if (m_plater && !plate_data_list[i]->pattern_bbox_file.empty()) { if (boost::filesystem::exists(plate_data_list[i]->pattern_bbox_file)) { m_plate_list[index]->load_pattern_box_data(plate_data_list[i]->pattern_bbox_file); }