mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	ENABLE_THUMBNAIL_GENERATOR set as default
This commit is contained in:
		
							parent
							
								
									fac28ea27a
								
							
						
					
					
						commit
						3d6c9e54e9
					
				
					 16 changed files with 7 additions and 224 deletions
				
			
		| 
						 | 
				
			
			@ -11,9 +11,7 @@
 | 
			
		|||
#include <wx/wfstream.h>
 | 
			
		||||
#include <wx/zipstrm.h>
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include <miniz.h>
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
 | 
			
		||||
#include "libslic3r/Print.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -89,11 +87,7 @@ void BackgroundSlicingProcess::process_fff()
 | 
			
		|||
	assert(m_print == m_fff_print);
 | 
			
		||||
    m_print->process();
 | 
			
		||||
	wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_slicing_completed_id));
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data, m_thumbnail_cb);
 | 
			
		||||
#else
 | 
			
		||||
    m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data);
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
	if (this->set_step_started(bspsGCodeFinalize)) {
 | 
			
		||||
	    if (! m_export_path.empty()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +129,6 @@ void BackgroundSlicingProcess::process_fff()
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
static void write_thumbnail(Zipper& zipper, const ThumbnailData& data)
 | 
			
		||||
{
 | 
			
		||||
    size_t png_size = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +139,6 @@ static void write_thumbnail(Zipper& zipper, const ThumbnailData& data)
 | 
			
		|||
        mz_free(png_data);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
void BackgroundSlicingProcess::process_sla()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +151,6 @@ void BackgroundSlicingProcess::process_sla()
 | 
			
		|||
            Zipper zipper(export_path);
 | 
			
		||||
            m_sla_print->export_raster(zipper);
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
            if (m_thumbnail_cb != nullptr)
 | 
			
		||||
            {
 | 
			
		||||
                ThumbnailsList thumbnails;
 | 
			
		||||
| 
						 | 
				
			
			@ -171,7 +162,6 @@ void BackgroundSlicingProcess::process_sla()
 | 
			
		|||
                        write_thumbnail(zipper, data);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
            zipper.finalize();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -486,7 +476,6 @@ void BackgroundSlicingProcess::prepare_upload()
 | 
			
		|||
 | 
			
		||||
        Zipper zipper{source_path.string()};
 | 
			
		||||
        m_sla_print->export_raster(zipper, m_upload_job.upload_data.upload_path.string());
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
        if (m_thumbnail_cb != nullptr)
 | 
			
		||||
        {
 | 
			
		||||
            ThumbnailsList thumbnails;
 | 
			
		||||
| 
						 | 
				
			
			@ -498,7 +487,6 @@ void BackgroundSlicingProcess::prepare_upload()
 | 
			
		|||
                    write_thumbnail(zipper, data);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
        zipper.finalize();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,9 +49,7 @@ public:
 | 
			
		|||
	void set_fff_print(Print *print) { m_fff_print = print; }
 | 
			
		||||
	void set_sla_print(SLAPrint *print) { m_sla_print = print; }
 | 
			
		||||
	void set_gcode_preview_data(GCodePreviewData *gpd) { m_gcode_preview_data = gpd; }
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void set_thumbnail_cb(ThumbnailsGeneratorCallback cb) { m_thumbnail_cb = cb; }
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
	// The following wxCommandEvent will be sent to the UI thread / Plater window, when the slicing is finished
 | 
			
		||||
	// and the background processing will transition into G-code export.
 | 
			
		||||
| 
						 | 
				
			
			@ -155,10 +153,8 @@ private:
 | 
			
		|||
	SLAPrint 				   *m_sla_print			 = nullptr;
 | 
			
		||||
	// Data structure, to which the G-code export writes its annotations.
 | 
			
		||||
	GCodePreviewData 		   *m_gcode_preview_data = nullptr;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    // Callback function, used to write thumbnails into gcode.
 | 
			
		||||
    ThumbnailsGeneratorCallback m_thumbnail_cb 		 = nullptr;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
	// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.
 | 
			
		||||
	std::string 				m_temp_output_path;
 | 
			
		||||
	// Output path provided by the user. The output path may be set even if the slicing is running,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,6 @@
 | 
			
		|||
#include "libslic3r/libslic3r.h"
 | 
			
		||||
 | 
			
		||||
#include "Camera.hpp"
 | 
			
		||||
#if !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "3DScene.hpp"
 | 
			
		||||
#endif // !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "GUI_App.hpp"
 | 
			
		||||
#include "AppConfig.hpp"
 | 
			
		||||
#if ENABLE_CAMERA_STATISTICS
 | 
			
		||||
| 
						 | 
				
			
			@ -25,10 +22,8 @@ namespace Slic3r {
 | 
			
		|||
namespace GUI {
 | 
			
		||||
 | 
			
		||||
const double Camera::DefaultDistance = 1000.0;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
const double Camera::DefaultZoomToBoxMarginFactor = 1.025;
 | 
			
		||||
const double Camera::DefaultZoomToVolumesMarginFactor = 1.025;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
double Camera::FrustrumMinZRange = 50.0;
 | 
			
		||||
double Camera::FrustrumMinNearZ = 100.0;
 | 
			
		||||
double Camera::FrustrumZMargin = 10.0;
 | 
			
		||||
| 
						 | 
				
			
			@ -219,18 +214,10 @@ void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double fa
 | 
			
		|||
    glsafe(::glMatrixMode(GL_MODELVIEW));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
void Camera::zoom_to_box(const BoundingBoxf3& box, double margin_factor)
 | 
			
		||||
#else
 | 
			
		||||
void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h)
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
{
 | 
			
		||||
    // Calculate the zoom factor needed to adjust the view around the given box.
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    double zoom = calc_zoom_to_bounding_box_factor(box, margin_factor);
 | 
			
		||||
#else
 | 
			
		||||
    double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h);
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    if (zoom > 0.0)
 | 
			
		||||
    {
 | 
			
		||||
        m_zoom = zoom;
 | 
			
		||||
| 
						 | 
				
			
			@ -239,7 +226,6 @@ void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor)
 | 
			
		||||
{
 | 
			
		||||
    Vec3d center;
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +237,6 @@ void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor)
 | 
			
		|||
        set_target(center);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
#if ENABLE_CAMERA_STATISTICS
 | 
			
		||||
void Camera::debug_render() const
 | 
			
		||||
| 
						 | 
				
			
			@ -387,11 +372,7 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo
 | 
			
		|||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor) const
 | 
			
		||||
#else
 | 
			
		||||
double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
{
 | 
			
		||||
    double max_bb_size = box.max_size();
 | 
			
		||||
    if (max_bb_size == 0.0)
 | 
			
		||||
| 
						 | 
				
			
			@ -423,11 +404,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca
 | 
			
		|||
    double max_x = -DBL_MAX;
 | 
			
		||||
    double max_y = -DBL_MAX;
 | 
			
		||||
 | 
			
		||||
#if !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    // margin factor to give some empty space around the box
 | 
			
		||||
    double margin_factor = 1.25;
 | 
			
		||||
#endif // !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
    for (const Vec3d& v : vertices)
 | 
			
		||||
    {
 | 
			
		||||
        // project vertex on the plane perpendicular to camera forward axis
 | 
			
		||||
| 
						 | 
				
			
			@ -458,7 +434,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca
 | 
			
		|||
    return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor) const
 | 
			
		||||
{
 | 
			
		||||
    if (volumes.empty())
 | 
			
		||||
| 
						 | 
				
			
			@ -519,7 +494,6 @@ double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& c
 | 
			
		|||
 | 
			
		||||
    return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy);
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
void Camera::set_distance(double distance) const
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,9 +2,7 @@
 | 
			
		|||
#define slic3r_Camera_hpp_
 | 
			
		||||
 | 
			
		||||
#include "libslic3r/BoundingBox.hpp"
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "3DScene.hpp"
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include <array>
 | 
			
		||||
 | 
			
		||||
namespace Slic3r {
 | 
			
		||||
| 
						 | 
				
			
			@ -13,10 +11,8 @@ namespace GUI {
 | 
			
		|||
struct Camera
 | 
			
		||||
{
 | 
			
		||||
    static const double DefaultDistance;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    static const double DefaultZoomToBoxMarginFactor;
 | 
			
		||||
    static const double DefaultZoomToVolumesMarginFactor;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    static double FrustrumMinZRange;
 | 
			
		||||
    static double FrustrumMinNearZ;
 | 
			
		||||
    static double FrustrumZMargin;
 | 
			
		||||
| 
						 | 
				
			
			@ -97,12 +93,8 @@ public:
 | 
			
		|||
    // If larger z span is needed, pass the desired values of near and far z (negative values are ignored)
 | 
			
		||||
    void apply_projection(const BoundingBoxf3& box, double near_z = -1.0, double far_z = -1.0) const;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor);
 | 
			
		||||
    void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor);
 | 
			
		||||
#else
 | 
			
		||||
    void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h);
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
#if ENABLE_CAMERA_STATISTICS
 | 
			
		||||
    void debug_render() const;
 | 
			
		||||
| 
						 | 
				
			
			@ -138,12 +130,8 @@ private:
 | 
			
		|||
    // returns tight values for nearZ and farZ plane around the given bounding box
 | 
			
		||||
    // the camera MUST be outside of the bounding box in eye coordinate of the given box
 | 
			
		||||
    std::pair<double, double> calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor) const;
 | 
			
		||||
    double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const;
 | 
			
		||||
#else
 | 
			
		||||
    double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void set_distance(double distance) const;
 | 
			
		||||
 | 
			
		||||
    void set_default_orientation();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,9 +7,7 @@
 | 
			
		|||
#include "libslic3r/ClipperUtils.hpp"
 | 
			
		||||
#include "libslic3r/PrintConfig.hpp"
 | 
			
		||||
#include "libslic3r/GCode/PreviewData.hpp"
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "libslic3r/GCode/ThumbnailData.hpp"
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "libslic3r/Geometry.hpp"
 | 
			
		||||
#include "libslic3r/ExtrusionEntity.hpp"
 | 
			
		||||
#include "libslic3r/Utils.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -1457,9 +1455,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
 | 
			
		|||
wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent);
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar)
 | 
			
		||||
    : m_canvas(canvas)
 | 
			
		||||
| 
						 | 
				
			
			@ -2060,7 +2056,6 @@ void GLCanvas3D::render()
 | 
			
		|||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const
 | 
			
		||||
{
 | 
			
		||||
    switch (GLCanvas3DManager::get_framebuffers_type())
 | 
			
		||||
| 
						 | 
				
			
			@ -2070,7 +2065,6 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w,
 | 
			
		|||
    default: { _render_thumbnail_legacy(thumbnail_data, w, h, printable_only, parts_only, show_bed, transparent_background); break; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
void GLCanvas3D::select_all()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -4221,7 +4215,6 @@ bool GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x) const
 | 
			
		|||
    return action_taken;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG_OUTPUT 0
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR_DEBUG_OUTPUT
 | 
			
		||||
static void debug_output_thumbnail(const ThumbnailData& thumbnail_data)
 | 
			
		||||
| 
						 | 
				
			
			@ -4571,7 +4564,6 @@ void GLCanvas3D::_render_thumbnail_legacy(ThumbnailData& thumbnail_data, unsigne
 | 
			
		|||
    // restore the default framebuffer size to avoid flickering on the 3D scene
 | 
			
		||||
    m_camera.apply_viewport(0, 0, cnv_size.get_width(), cnv_size.get_height());
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
bool GLCanvas3D::_init_toolbars()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -4899,20 +4891,11 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_be
 | 
			
		|||
    return bb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box, double margin_factor)
 | 
			
		||||
{
 | 
			
		||||
    m_camera.zoom_to_box(box, margin_factor);
 | 
			
		||||
    m_dirty = true;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box)
 | 
			
		||||
{
 | 
			
		||||
    const Size& cnv_size = get_canvas_size();
 | 
			
		||||
    m_camera.zoom_to_box(box, cnv_size.get_width(), cnv_size.get_height());
 | 
			
		||||
    m_dirty = true;
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
void GLCanvas3D::_update_camera_zoom(double zoom)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5115,9 +5098,6 @@ void GLCanvas3D::_render_objects() const
 | 
			
		|||
    if (m_volumes.empty())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
#if !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    glsafe(::glEnable(GL_LIGHTING));
 | 
			
		||||
#endif // !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    glsafe(::glEnable(GL_DEPTH_TEST));
 | 
			
		||||
 | 
			
		||||
    m_camera_clipping_plane = m_gizmos.get_sla_clipping_plane();
 | 
			
		||||
| 
						 | 
				
			
			@ -5161,9 +5141,6 @@ void GLCanvas3D::_render_objects() const
 | 
			
		|||
    m_shader.stop_using();
 | 
			
		||||
 | 
			
		||||
    m_camera_clipping_plane = ClippingPlane::ClipsNothing();
 | 
			
		||||
#if !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    glsafe(::glDisable(GL_LIGHTING));
 | 
			
		||||
#endif // !ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3D::_render_selection() const
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,9 +38,7 @@ class Bed3D;
 | 
			
		|||
struct Camera;
 | 
			
		||||
class BackgroundSlicingProcess;
 | 
			
		||||
class GCodePreviewData;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
struct ThumbnailData;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
struct SlicingParameters;
 | 
			
		||||
enum LayerHeightEditActionType : unsigned int;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,9 +111,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent);
 | 
			
		|||
 | 
			
		||||
class GLCanvas3D
 | 
			
		||||
{
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    static const double DefaultCameraZoomToBoxMarginFactor;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    struct GCodePreviewVolumeIndex
 | 
			
		||||
| 
						 | 
				
			
			@ -577,11 +573,9 @@ public:
 | 
			
		|||
    bool is_dragging() const { return m_gizmos.is_dragging() || m_moving; }
 | 
			
		||||
 | 
			
		||||
    void render();
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    // printable_only == false -> render also non printable volumes as grayed
 | 
			
		||||
    // parts_only == false -> render also sla support and pad
 | 
			
		||||
    void render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
    void select_all();
 | 
			
		||||
    void deselect_all();
 | 
			
		||||
| 
						 | 
				
			
			@ -702,11 +696,7 @@ private:
 | 
			
		|||
 | 
			
		||||
    BoundingBoxf3 _max_bounding_box(bool include_gizmos, bool include_bed_model) const;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void _zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultCameraZoomToBoxMarginFactor);
 | 
			
		||||
#else
 | 
			
		||||
    void _zoom_to_box(const BoundingBoxf3& box);
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void _update_camera_zoom(double zoom);
 | 
			
		||||
 | 
			
		||||
    void _refresh_if_shown_on_screen();
 | 
			
		||||
| 
						 | 
				
			
			@ -735,7 +725,6 @@ private:
 | 
			
		|||
    void _render_sla_slices() const;
 | 
			
		||||
    void _render_selection_sidebar_hints() const;
 | 
			
		||||
    bool _render_undo_redo_stack(const bool is_undo, float pos_x) const;
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void _render_thumbnail_internal(ThumbnailData& thumbnail_data, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const;
 | 
			
		||||
    // render thumbnail using an off-screen framebuffer
 | 
			
		||||
    void _render_thumbnail_framebuffer(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const;
 | 
			
		||||
| 
						 | 
				
			
			@ -743,7 +732,6 @@ private:
 | 
			
		|||
    void _render_thumbnail_framebuffer_ext(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const;
 | 
			
		||||
    // render thumbnail using the default framebuffer
 | 
			
		||||
    void _render_thumbnail_legacy(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const;
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
    void _update_volumes_hover_state() const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,9 +33,7 @@
 | 
			
		|||
#include "libslic3r/Format/AMF.hpp"
 | 
			
		||||
#include "libslic3r/Format/3mf.hpp"
 | 
			
		||||
#include "libslic3r/GCode/PreviewData.hpp"
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "libslic3r/GCode/ThumbnailData.hpp"
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
#include "libslic3r/Model.hpp"
 | 
			
		||||
#include "libslic3r/SLA/Hollowing.hpp"
 | 
			
		||||
#include "libslic3r/SLA/Rotfinder.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -92,9 +90,7 @@ using Slic3r::_3DScene;
 | 
			
		|||
using Slic3r::Preset;
 | 
			
		||||
using Slic3r::PrintHostJob;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
static const std::pair<unsigned int, unsigned int> THUMBNAIL_SIZE_3MF = { 256, 256 };
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
namespace Slic3r {
 | 
			
		||||
namespace GUI {
 | 
			
		||||
| 
						 | 
				
			
			@ -1955,10 +1951,8 @@ struct Plater::priv
 | 
			
		|||
    bool can_mirror() const;
 | 
			
		||||
    bool can_reload_from_disk() const;
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    void generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background);
 | 
			
		||||
    void generate_thumbnails(ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background);
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
    void msw_rescale_object_menu();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2032,7 +2026,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
 | 
			
		|||
    background_process.set_fff_print(&fff_print);
 | 
			
		||||
    background_process.set_sla_print(&sla_print);
 | 
			
		||||
    background_process.set_gcode_preview_data(&gcode_preview_data);
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    background_process.set_thumbnail_cb([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background)
 | 
			
		||||
        {
 | 
			
		||||
            std::packaged_task<void(ThumbnailsList&, const Vec2ds&, bool, bool, bool, bool)> task([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) {
 | 
			
		||||
| 
						 | 
				
			
			@ -2042,7 +2035,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
 | 
			
		|||
            wxTheApp->CallAfter([&]() { task(thumbnails, sizes, printable_only, parts_only, show_bed, transparent_background); });
 | 
			
		||||
            result.wait();
 | 
			
		||||
        });
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    background_process.set_slicing_completed_event(EVT_SLICING_COMPLETED);
 | 
			
		||||
    background_process.set_finished_event(EVT_PROCESS_COMPLETED);
 | 
			
		||||
    // Default printer technology for default config.
 | 
			
		||||
| 
						 | 
				
			
			@ -3852,7 +3844,6 @@ bool Plater::priv::init_object_menu()
 | 
			
		|||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
void Plater::priv::generate_thumbnail(ThumbnailData& data, unsigned int w, unsigned int h, bool printable_only, bool parts_only, bool show_bed, bool transparent_background)
 | 
			
		||||
{
 | 
			
		||||
    view3D->get_canvas3d()->render_thumbnail(data, w, h, printable_only, parts_only, show_bed, transparent_background);
 | 
			
		||||
| 
						 | 
				
			
			@ -3870,7 +3861,6 @@ void Plater::priv::generate_thumbnails(ThumbnailsList& thumbnails, const Vec2ds&
 | 
			
		|||
            thumbnails.pop_back();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
 | 
			
		||||
void Plater::priv::msw_rescale_object_menu()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -4999,13 +4989,9 @@ void Plater::export_3mf(const boost::filesystem::path& output_path)
 | 
			
		|||
    const std::string path_u8 = into_u8(path);
 | 
			
		||||
    wxBusyCursor wait;
 | 
			
		||||
    bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1";
 | 
			
		||||
#if ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
    ThumbnailData thumbnail_data;
 | 
			
		||||
    p->generate_thumbnail(thumbnail_data, THUMBNAIL_SIZE_3MF.first, THUMBNAIL_SIZE_3MF.second, false, true, true, true);
 | 
			
		||||
    if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames, &thumbnail_data)) {
 | 
			
		||||
#else
 | 
			
		||||
    if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) {
 | 
			
		||||
#endif // ENABLE_THUMBNAIL_GENERATOR
 | 
			
		||||
        // Success
 | 
			
		||||
        p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("3MF file exported to %s"))) % path).str()));
 | 
			
		||||
        p->set_project_filename(path);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue