mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 10:11:10 -06:00
Merge remote-tracking branch 'origin/master' into ys_search
This commit is contained in:
commit
45d064d4cb
82 changed files with 12211 additions and 6689 deletions
|
|
@ -199,6 +199,10 @@ if(APPLE)
|
|||
target_link_libraries(libslic3r_gui ${DISKARBITRATION_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (SLIC3R_STATIC)
|
||||
target_compile_definitions(libslic3r_gui PRIVATE OPENSSL_CERT_OVERRIDE)
|
||||
endif ()
|
||||
|
||||
if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY)
|
||||
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
|
||||
endif ()
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@
|
|||
#include <time.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Time.hpp"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "libslic3r/Semver.hpp"
|
||||
#include "Version.hpp"
|
||||
|
|
@ -18,7 +18,6 @@ class AppConfig;
|
|||
namespace GUI {
|
||||
namespace Config {
|
||||
|
||||
class Index;
|
||||
|
||||
// A snapshot contains:
|
||||
// Slic3r.ini
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
#include <cctype>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "libslic3r/FileParserError.hpp"
|
||||
#include "libslic3r/Semver.hpp"
|
||||
|
|
@ -54,7 +54,7 @@ struct Version
|
|||
class Index
|
||||
{
|
||||
public:
|
||||
typedef std::vector<Version>::const_iterator const_iterator;
|
||||
typedef std::vector<Version>::const_iterator const_iterator;
|
||||
// Read a config index file in the simple format described in the Index class comment.
|
||||
// Throws Slic3r::file_parser_error and the standard std file access exceptions.
|
||||
size_t load(const boost::filesystem::path &path);
|
||||
|
|
|
|||
|
|
@ -166,4 +166,4 @@ void Bed_2D::set_pos(const Vec2d& pos)
|
|||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
} // Slic3r
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "GUI_App.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "Gizmos/GLGizmoBase.hpp"
|
||||
#include "GLCanvas3D.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
|
@ -630,4 +629,4 @@ void Bed3D::reset()
|
|||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
} // Slic3r
|
||||
|
|
|
|||
|
|
@ -17,23 +17,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/spin_mutex.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "GUI.hpp"
|
||||
|
||||
#ifdef HAS_GLSAFE
|
||||
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "slic3r/GUI/GLCanvas3DManager.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define HAS_GLSAFE
|
||||
|
|
@ -34,13 +33,8 @@ struct Camera;
|
|||
class GLToolbar;
|
||||
} // namespace GUI
|
||||
|
||||
class Print;
|
||||
class PrintObject;
|
||||
class SLAPrint;
|
||||
class SLAPrintObject;
|
||||
enum SLAPrintObjectStep : unsigned int;
|
||||
class Model;
|
||||
class ModelObject;
|
||||
class DynamicPrintConfig;
|
||||
class ExtrusionPath;
|
||||
class ExtrusionMultiPath;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
#include "I18N.hpp"
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef slic3r_GUI_AboutDialog_hpp_
|
||||
#define slic3r_GUI_AboutDialog_hpp_
|
||||
|
||||
#include "GUI.hpp"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
|
|
|
|||
|
|
@ -2,22 +2,18 @@
|
|||
#include "libslic3r/Utils.hpp"
|
||||
#include "AppConfig.hpp"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/nowide/cenv.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/exceptions.hpp>
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/format/format_fwd.hpp>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include "I18N.hpp"
|
||||
|
|
@ -76,7 +72,7 @@ void AppConfig::set_defaults()
|
|||
if (get("remember_output_path").empty())
|
||||
set("remember_output_path", "1");
|
||||
|
||||
if (get("remember_output_path_removable").empty())
|
||||
if (get("remember_output_path_removable").empty())
|
||||
set("remember_output_path_removable", "1");
|
||||
|
||||
if (get("use_custom_toolbar_size").empty())
|
||||
|
|
@ -280,7 +276,7 @@ void AppConfig::set_recent_projects(const std::vector<std::string>& recent_proje
|
|||
}
|
||||
}
|
||||
|
||||
void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed)
|
||||
void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz)
|
||||
{
|
||||
std::string key = std::string("mouse_device:") + name;
|
||||
auto it = m_storage.find(key);
|
||||
|
|
@ -293,6 +289,7 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe
|
|||
it->second["rotation_speed"] = std::to_string(rotation_speed);
|
||||
it->second["rotation_deadzone"] = std::to_string(rotation_deadzone);
|
||||
it->second["zoom_speed"] = std::to_string(zoom_speed);
|
||||
it->second["swap_yz"] = swap_yz ? "1" : "0";
|
||||
}
|
||||
|
||||
std::vector<std::string> AppConfig::get_mouse_device_names() const
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public:
|
|||
std::vector<std::string> get_recent_projects() const;
|
||||
void set_recent_projects(const std::vector<std::string>& recent_projects);
|
||||
|
||||
void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed);
|
||||
void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz);
|
||||
std::vector<std::string> get_mouse_device_names() const;
|
||||
bool get_mouse_device_translation_speed(const std::string& name, double& speed) const
|
||||
{ return get_3dmouse_device_numeric_value(name, "translation_speed", speed); }
|
||||
|
|
@ -153,6 +153,8 @@ public:
|
|||
{ return get_3dmouse_device_numeric_value(name, "rotation_deadzone", deadzone); }
|
||||
bool get_mouse_device_zoom_speed(const std::string& name, double& speed) const
|
||||
{ return get_3dmouse_device_numeric_value(name, "zoom_speed", speed); }
|
||||
bool get_mouse_device_swap_yz(const std::string& name, bool& swap) const
|
||||
{ return get_3dmouse_device_numeric_value(name, "swap_yz", swap); }
|
||||
|
||||
static const std::string SECTION_FILAMENTS;
|
||||
static const std::string SECTION_MATERIALS;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -26,17 +24,16 @@
|
|||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/format/format_fwd.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
#include "I18N.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
|
||||
#include "slic3r/Utils/Thread.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
BackgroundSlicingProcess::BackgroundSlicingProcess()
|
||||
|
|
@ -90,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()) {
|
||||
|
|
@ -136,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;
|
||||
|
|
@ -147,7 +139,6 @@ static void write_thumbnail(Zipper& zipper, const ThumbnailData& data)
|
|||
mz_free(png_data);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
||||
void BackgroundSlicingProcess::process_sla()
|
||||
{
|
||||
|
|
@ -160,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;
|
||||
|
|
@ -172,7 +162,6 @@ void BackgroundSlicingProcess::process_sla()
|
|||
write_thumbnail(zipper, data);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
||||
zipper.finalize();
|
||||
|
||||
|
|
@ -487,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;
|
||||
|
|
@ -499,7 +487,6 @@ void BackgroundSlicingProcess::prepare_upload()
|
|||
write_thumbnail(zipper, data);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
zipper.finalize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <wx/event.h>
|
||||
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
#include "slic3r/Utils/Thread.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1755,7 +1755,7 @@ bool ConfigWizard::priv::on_bnt_finish()
|
|||
page_sla_materials->reload_presets();
|
||||
|
||||
// theres no need to check that filament is selected if we have only custom printer
|
||||
if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true;
|
||||
if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true;
|
||||
// check, that there is selected at least one filament/material
|
||||
return check_and_install_missing_materials(T_ANY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ void TextCtrl::disable() { dynamic_cast<wxTextCtrl*>(window)->Disable(); dynamic
|
|||
#ifdef __WXGTK__
|
||||
void TextCtrl::change_field_value(wxEvent& event)
|
||||
{
|
||||
if (bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP))
|
||||
if ((bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP)))
|
||||
on_change_field();
|
||||
event.Skip();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -22,6 +20,8 @@
|
|||
#include "slic3r/GUI/PresetBundle.hpp"
|
||||
#include "slic3r/GUI/Tab.hpp"
|
||||
#include "slic3r/GUI/GUI_Preview.hpp"
|
||||
#include "slic3r/GUI/3DBed.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
|
@ -61,11 +61,11 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include "DoubleSlider.hpp"
|
||||
#if !ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
#if ENABLE_RENDER_STATISTICS
|
||||
#include <chrono>
|
||||
#endif // ENABLE_RENDER_STATISTICS
|
||||
#endif // !ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
#include <imgui/imgui_internal.h>
|
||||
|
||||
|
|
@ -1298,7 +1298,7 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
|
|||
|
||||
// updates print order strings
|
||||
if (sorted_instances.size() > 1) {
|
||||
for (int i = 0; i < sorted_instances.size(); ++i) {
|
||||
for (size_t i = 0; i < sorted_instances.size(); ++i) {
|
||||
size_t id = sorted_instances[i]->id().id;
|
||||
std::vector<Owner>::iterator it = std::find_if(owners.begin(), owners.end(), [id](const Owner& owner) {
|
||||
return owner.model_instance_id == id;
|
||||
|
|
@ -1373,7 +1373,6 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
|
|||
}
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
void GLCanvas3D::Tooltip::set_text(const std::string& text)
|
||||
{
|
||||
// If the mouse is inside an ImGUI dialog, then the tooltip is suppressed.
|
||||
|
|
@ -1386,15 +1385,9 @@ void GLCanvas3D::Tooltip::set_text(const std::string& text)
|
|||
m_text = new_text;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position, GLCanvas3D& canvas) const
|
||||
#else
|
||||
void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position) const
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
{
|
||||
#if ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
static ImVec2 size(0.0f, 0.0f);
|
||||
|
||||
auto validate_position = [](const Vec2d& position, const GLCanvas3D& canvas, const ImVec2& wnd_size) {
|
||||
|
|
@ -1403,54 +1396,33 @@ void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position) const
|
|||
float y = std::clamp((float)position(1) + 16, 0.0f, (float)cnv_size.get_height() - wnd_size.y);
|
||||
return Vec2f(x, y);
|
||||
};
|
||||
#endif // ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
if (m_text.empty())
|
||||
return;
|
||||
|
||||
// draw the tooltip as hidden until the delay is expired
|
||||
float alpha = (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - m_start_time).count() < 500) ? 0.0f : 1.0;
|
||||
#else
|
||||
if (m_text.empty())
|
||||
return;
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
// use a value of alpha slightly different from 0.0f because newer imgui does not calculate properly the window size if alpha == 0.0f
|
||||
float alpha = (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - m_start_time).count() < 500) ? 0.01f : 1.0f;
|
||||
|
||||
#if ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
Vec2f position = validate_position(mouse_position, canvas, size);
|
||||
#endif // ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#if ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
imgui.set_next_window_pos(position(0), position(1), ImGuiCond_Always, 0.0f, 0.0f);
|
||||
#else
|
||||
imgui.set_next_window_pos(mouse_position(0), mouse_position(1) + 16, ImGuiCond_Always, 0.0f, 0.0f);
|
||||
#endif // ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
|
||||
imgui.begin(_(L("canvas_tooltip")), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
|
||||
ImGui::TextUnformatted(m_text.c_str());
|
||||
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
// force re-render while the windows gets to its final size (it may take several frames) or while hidden
|
||||
if (alpha == 0.0f || ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowExpectedSize(ImGui::GetCurrentWindow()).x)
|
||||
if (alpha < 1.0f || ImGui::GetWindowContentRegionWidth() + 2.0f * ImGui::GetStyle().WindowPadding.x != ImGui::CalcWindowExpectedSize(ImGui::GetCurrentWindow()).x)
|
||||
canvas.request_extra_frame();
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
|
||||
#if ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
size = ImGui::GetWindowSize();
|
||||
#endif // ENABLE_CANVAS_CONSTRAINED_TOOLTIP_USING_IMGUI
|
||||
|
||||
imgui.end();
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
ImGui::PopStyleVar(2);
|
||||
#else
|
||||
ImGui::PopStyleVar();
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
|
|
@ -1483,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)
|
||||
|
|
@ -2050,11 +2020,7 @@ void GLCanvas3D::render()
|
|||
|
||||
set_tooltip(tooltip);
|
||||
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
m_tooltip.render(m_mouse.position, *this);
|
||||
#else
|
||||
m_tooltip.render(m_mouse.position);
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog(*this);
|
||||
|
|
@ -2090,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())
|
||||
|
|
@ -2100,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()
|
||||
{
|
||||
|
|
@ -3340,10 +3304,17 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
Point pos(evt.GetX(), evt.GetY());
|
||||
|
||||
ImGuiWrapper* imgui = wxGetApp().imgui();
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (m_tooltip.is_in_imgui() && evt.LeftUp())
|
||||
// ignore left up events coming from imgui windows and not processed by them
|
||||
m_mouse.ignore_left_up = true;
|
||||
m_tooltip.set_in_imgui(false);
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (imgui->update_mouse_data(evt)) {
|
||||
m_mouse.position = evt.Leaving() ? Vec2d(-1.0, -1.0) : pos.cast<double>();
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
m_tooltip.set_in_imgui(true);
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
render();
|
||||
#ifdef SLIC3R_DEBUG_MOUSE_EVENTS
|
||||
printf((format_mouse_event_debug_message(evt) + " - Consumed by ImGUI\n").c_str());
|
||||
|
|
@ -3351,10 +3322,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
// do not return if dragging or tooltip not empty to allow for tooltip update
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (!m_mouse.dragging && m_tooltip.is_empty())
|
||||
return;
|
||||
#else
|
||||
if (!m_mouse.dragging && m_canvas->GetToolTipText().empty())
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
return;
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
|
@ -3603,9 +3575,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
if ((m_layers_editing.state != LayersEditing::Unknown) && (layer_editing_object_idx != -1))
|
||||
{
|
||||
set_tooltip("");
|
||||
if (m_layers_editing.state == LayersEditing::Editing)
|
||||
{
|
||||
_perform_layer_editing_action(&evt);
|
||||
m_mouse.position = pos.cast<double>();
|
||||
}
|
||||
}
|
||||
// do not process the dragging if the left mouse was set down in another canvas
|
||||
else if (evt.LeftIsDown())
|
||||
|
|
@ -3614,7 +3588,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined())
|
||||
{
|
||||
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.);
|
||||
#if ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
if (wxGetApp().app_config->get("use_free_camera") == "1")
|
||||
// Virtual track ball (similar to the 3DConnexion mouse).
|
||||
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
|
||||
|
|
@ -3627,13 +3600,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_camera.recover_from_free_camera();
|
||||
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
|
||||
}
|
||||
#else
|
||||
if (wxGetApp().plater()->get_mouse3d_controller().connected() || (wxGetApp().app_config->get("use_free_camera") == "1"))
|
||||
// Virtual track ball (similar to the 3DConnexion mouse).
|
||||
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
|
||||
else
|
||||
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
|
||||
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
|
||||
m_dirty = true;
|
||||
}
|
||||
|
|
@ -3648,14 +3614,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
float z = 0.0f;
|
||||
const Vec3d& cur_pos = _mouse_to_3d(pos, &z);
|
||||
Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
|
||||
#if ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
if (wxGetApp().app_config->get("use_free_camera") != "1")
|
||||
// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
|
||||
// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
|
||||
// which checks an atomics (flushes CPU caches).
|
||||
// See GH issue #3816.
|
||||
m_camera.recover_from_free_camera();
|
||||
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
|
||||
m_camera.set_target(m_camera.get_target() + orig - cur_pos);
|
||||
m_dirty = true;
|
||||
|
|
@ -4139,6 +4103,13 @@ Linef3 GLCanvas3D::mouse_ray(const Point& mouse_pos)
|
|||
return Linef3(_mouse_to_3d(mouse_pos, &z0), _mouse_to_3d(mouse_pos, &z1));
|
||||
}
|
||||
|
||||
|
||||
void GLCanvas3D::refresh_camera_scene_box()
|
||||
{
|
||||
m_camera.set_scene_box(scene_bounding_box());
|
||||
}
|
||||
|
||||
|
||||
double GLCanvas3D::get_size_proportional_to_max_bed_size(double factor) const
|
||||
{
|
||||
return factor * m_bed.get_bounding_box(false).max_size();
|
||||
|
|
@ -4198,8 +4169,10 @@ static bool string_getter(const bool is_undo, int idx, const char** out_text)
|
|||
return wxGetApp().plater()->undo_redo_string_getter(is_undo, idx, out_text);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x) const
|
||||
bool GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x) const
|
||||
{
|
||||
bool action_taken = false;
|
||||
|
||||
ImGuiWrapper* imgui = wxGetApp().imgui();
|
||||
|
||||
const float x = pos_x * (float)get_camera().get_zoom() + 0.5f * (float)get_canvas_size().get_width();
|
||||
|
|
@ -4220,14 +4193,18 @@ void GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x) const
|
|||
m_imgui_undo_redo_hovered_pos = -1;
|
||||
|
||||
if (selected >= 0)
|
||||
{
|
||||
is_undo ? wxGetApp().plater()->undo_to(selected) : wxGetApp().plater()->redo_to(selected);
|
||||
action_taken = true;
|
||||
}
|
||||
|
||||
imgui->text(wxString::Format(is_undo ? _L_PLURAL("Undo %1$d Action", "Undo %1$d Actions", hovered + 1) : _L_PLURAL("Redo %1$d Action", "Redo %1$d Actions", hovered + 1), hovered + 1));
|
||||
|
||||
imgui->end();
|
||||
|
||||
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)
|
||||
|
|
@ -4577,7 +4554,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()
|
||||
{
|
||||
|
|
@ -4781,12 +4757,18 @@ bool GLCanvas3D::_init_undoredo_toolbar()
|
|||
|
||||
item.name = "undo";
|
||||
item.icon_filename = "undo_toolbar.svg";
|
||||
item.tooltip = _utf8(L("Undo")) + " [" + GUI::shortkey_ctrl_prefix() + "Z]\n" + _utf8(L("Click right mouse button to open History"));
|
||||
item.tooltip = _utf8(L("Undo")) + " [" + GUI::shortkey_ctrl_prefix() + "Z]\n" + _utf8(L("Click right mouse button to open/close History"));
|
||||
item.sprite_id = 0;
|
||||
item.left.action_callback = [this]() { post_event(SimpleEvent(EVT_GLCANVAS_UNDO)); };
|
||||
item.right.toggable = true;
|
||||
item.right.action_callback = [this]() { m_imgui_undo_redo_hovered_pos = -1; };
|
||||
item.right.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(true, 0.5f * (left + right)); };
|
||||
item.right.render_callback = [this](float left, float right, float, float) {
|
||||
if (m_canvas != nullptr)
|
||||
{
|
||||
if (_render_undo_redo_stack(true, 0.5f * (left + right)))
|
||||
_deactivate_undo_redo_toolbar_items();
|
||||
}
|
||||
};
|
||||
item.enabling_callback = [this]()->bool {
|
||||
bool can_undo = wxGetApp().plater()->can_undo();
|
||||
int id = m_undoredo_toolbar.get_item_id("undo");
|
||||
|
|
@ -4814,11 +4796,17 @@ bool GLCanvas3D::_init_undoredo_toolbar()
|
|||
|
||||
item.name = "redo";
|
||||
item.icon_filename = "redo_toolbar.svg";
|
||||
item.tooltip = _utf8(L("Redo")) + " [" + GUI::shortkey_ctrl_prefix() + "Y]\n" + _utf8(L("Click right mouse button to open History"));
|
||||
item.tooltip = _utf8(L("Redo")) + " [" + GUI::shortkey_ctrl_prefix() + "Y]\n" + _utf8(L("Click right mouse button to open/close History"));
|
||||
item.sprite_id = 1;
|
||||
item.left.action_callback = [this]() { post_event(SimpleEvent(EVT_GLCANVAS_REDO)); };
|
||||
item.right.action_callback = [this]() { m_imgui_undo_redo_hovered_pos = -1; };
|
||||
item.right.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(false, 0.5f * (left + right)); };
|
||||
item.right.render_callback = [this](float left, float right, float, float) {
|
||||
if (m_canvas != nullptr)
|
||||
{
|
||||
if (_render_undo_redo_stack(false, 0.5f * (left + right)))
|
||||
_deactivate_undo_redo_toolbar_items();
|
||||
}
|
||||
};
|
||||
item.enabling_callback = [this]()->bool {
|
||||
bool can_redo = wxGetApp().plater()->can_redo();
|
||||
int id = m_undoredo_toolbar.get_item_id("redo");
|
||||
|
|
@ -4893,20 +4881,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)
|
||||
{
|
||||
|
|
@ -5109,9 +5088,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();
|
||||
|
|
@ -5155,9 +5131,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
|
||||
|
|
|
|||
|
|
@ -3,25 +3,24 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <memory>
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
#include <chrono>
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
#include "3DScene.hpp"
|
||||
#include "GLToolbar.hpp"
|
||||
#include "GLShader.hpp"
|
||||
#include "Event.hpp"
|
||||
#include "3DBed.hpp"
|
||||
#include "Camera.hpp"
|
||||
#include "Selection.hpp"
|
||||
#include "Gizmos/GLGizmosManager.hpp"
|
||||
#include "GUI_ObjectLayers.hpp"
|
||||
#include "GLSelectionRectangle.hpp"
|
||||
#include "MeshUtils.hpp"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include <wx/timer.h>
|
||||
|
||||
class wxWindow;
|
||||
class wxSizeEvent;
|
||||
class wxIdleEvent;
|
||||
class wxKeyEvent;
|
||||
|
|
@ -35,20 +34,16 @@ class wxGLCanvas;
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
class GLShader;
|
||||
class ExPolygon;
|
||||
class Bed3D;
|
||||
struct Camera;
|
||||
class BackgroundSlicingProcess;
|
||||
class GCodePreviewData;
|
||||
#if ENABLE_THUMBNAIL_GENERATOR
|
||||
struct ThumbnailData;
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
struct SlicingParameters;
|
||||
enum LayerHeightEditActionType : unsigned int;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class GLGizmoBase;
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
class RetinaHelper;
|
||||
#endif
|
||||
|
|
@ -116,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
|
||||
|
|
@ -396,23 +389,17 @@ private:
|
|||
class Tooltip
|
||||
{
|
||||
std::string m_text;
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
std::chrono::steady_clock::time_point m_start_time;
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
// Indicator that the mouse is inside an ImGUI dialog, therefore the tooltip should be suppressed.
|
||||
bool m_in_imgui = false;
|
||||
bool m_in_imgui = false;
|
||||
|
||||
public:
|
||||
bool is_empty() const { return m_text.empty(); }
|
||||
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
void set_text(const std::string& text);
|
||||
void render(const Vec2d& mouse_position, GLCanvas3D& canvas) const;
|
||||
#else
|
||||
void set_text(const std::string& text) { m_text = text; }
|
||||
void render(const Vec2d& mouse_position) const;
|
||||
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
|
||||
// Indicates that the mouse is inside an ImGUI dialog, therefore the tooltip should be suppressed.
|
||||
void set_in_imgui(bool b) { m_in_imgui = b; }
|
||||
bool is_in_imgui() const { return m_in_imgui; }
|
||||
};
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
|
|
@ -586,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();
|
||||
|
|
@ -676,7 +661,7 @@ public:
|
|||
Linef3 mouse_ray(const Point& mouse_pos);
|
||||
|
||||
void set_mouse_as_dragging() { m_mouse.dragging = true; }
|
||||
void refresh_camera_scene_box() { m_camera.set_scene_box(scene_bounding_box()); }
|
||||
void refresh_camera_scene_box();
|
||||
bool is_mouse_dragging() const { return m_mouse.dragging; }
|
||||
|
||||
double get_size_proportional_to_max_bed_size(double factor) const;
|
||||
|
|
@ -711,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();
|
||||
|
|
@ -743,8 +724,7 @@ private:
|
|||
#endif // ENABLE_SHOW_CAMERA_TARGET
|
||||
void _render_sla_slices() const;
|
||||
void _render_selection_sidebar_hints() const;
|
||||
void _render_undo_redo_stack(const bool is_undo, float pos_x) const;
|
||||
#if ENABLE_THUMBNAIL_GENERATOR
|
||||
bool _render_undo_redo_stack(const bool is_undo, float pos_x) const;
|
||||
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;
|
||||
|
|
@ -752,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "GLToolbar.hpp"
|
||||
|
||||
#include "../../slic3r/GUI/GLCanvas3D.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include "../../slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <wx/bitmap.h>
|
||||
|
|
@ -86,7 +85,7 @@ bool GLToolbarItem::update_enabled_state()
|
|||
|
||||
void GLToolbarItem::render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const
|
||||
{
|
||||
auto uvs = [this](unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) ->GLTexture::Quad_UVs
|
||||
auto uvs = [this](unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) -> GLTexture::Quad_UVs
|
||||
{
|
||||
assert((tex_width != 0) && (tex_height != 0));
|
||||
GLTexture::Quad_UVs ret;
|
||||
|
|
@ -154,7 +153,9 @@ GLToolbar::GLToolbar(GLToolbar::EType type, const std::string& name)
|
|||
, m_name(name)
|
||||
, m_enabled(false)
|
||||
, m_icons_texture_dirty(true)
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
, m_tooltip("")
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
, m_pressed_toggable_id(-1)
|
||||
{
|
||||
}
|
||||
|
|
@ -358,16 +359,37 @@ int GLToolbar::get_item_id(const std::string& name) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
std::string GLToolbar::get_tooltip() const
|
||||
{
|
||||
std::string tooltip;
|
||||
|
||||
for (GLToolbarItem* item : m_items)
|
||||
{
|
||||
if (item->is_hovered())
|
||||
{
|
||||
tooltip = item->get_tooltip();
|
||||
if (!item->is_pressed())
|
||||
{
|
||||
const std::string& additional_tooltip = item->get_additional_tooltip();
|
||||
if (!additional_tooltip.empty())
|
||||
tooltip += "\n" + additional_tooltip;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
void GLToolbar::get_additional_tooltip(int item_id, std::string& text)
|
||||
{
|
||||
if ((0 <= item_id) && (item_id < (int)m_items.size()))
|
||||
if (0 <= item_id && item_id < (int)m_items.size())
|
||||
{
|
||||
GLToolbarItem* item = m_items[item_id];
|
||||
if (item != nullptr)
|
||||
{
|
||||
text = item->get_additional_tooltip();
|
||||
return;
|
||||
}
|
||||
text = m_items[item_id]->get_additional_tooltip();
|
||||
return;
|
||||
}
|
||||
|
||||
text.clear();
|
||||
|
|
@ -375,12 +397,8 @@ void GLToolbar::get_additional_tooltip(int item_id, std::string& text)
|
|||
|
||||
void GLToolbar::set_additional_tooltip(int item_id, const std::string& text)
|
||||
{
|
||||
if ((0 <= item_id) && (item_id < (int)m_items.size()))
|
||||
{
|
||||
GLToolbarItem* item = m_items[item_id];
|
||||
if (item != nullptr)
|
||||
item->set_additional_tooltip(text);
|
||||
}
|
||||
if (0 <= item_id && item_id < (int)m_items.size())
|
||||
m_items[item_id]->set_additional_tooltip(text);
|
||||
}
|
||||
|
||||
bool GLToolbar::update_items_state()
|
||||
|
|
@ -425,17 +443,19 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
|
|||
// prevents loosing selection into the scene if mouse down was done inside the toolbar and mouse up was down outside it,
|
||||
// as when switching between views
|
||||
m_mouse_capture.reset();
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (contains_mouse(mouse_pos, parent) == -1)
|
||||
// mouse is outside the toolbar
|
||||
m_tooltip.clear();
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
return true;
|
||||
}
|
||||
m_mouse_capture.reset();
|
||||
}
|
||||
|
||||
#if ENABLE_MODIFIED_TOOLBAR_MOUSE_EVENT_HANDLING
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (evt.Moving())
|
||||
m_tooltip = update_hover_state(mouse_pos, parent);
|
||||
update_hover_state(mouse_pos, parent);
|
||||
else if (evt.LeftUp())
|
||||
{
|
||||
if (m_mouse_capture.left)
|
||||
|
|
@ -486,15 +506,19 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
|
|||
else if (evt.Dragging() && m_mouse_capture.any())
|
||||
// if the button down was done on this toolbar, prevent from dragging into the scene
|
||||
processed = true;
|
||||
#endif // ENABLE_MODIFIED_TOOLBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
int item_id = contains_mouse(mouse_pos, parent);
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (item_id != -1)
|
||||
#else
|
||||
if (item_id == -1)
|
||||
{
|
||||
// mouse is outside the toolbar
|
||||
m_tooltip.clear();
|
||||
}
|
||||
else
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
{
|
||||
// mouse inside toolbar
|
||||
if (evt.LeftDown() || evt.LeftDClick())
|
||||
|
|
@ -526,10 +550,10 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
|
|||
parent.set_as_dirty();
|
||||
}
|
||||
}
|
||||
#if !ENABLE_MODIFIED_TOOLBAR_MOUSE_EVENT_HANDLING
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
else if (evt.LeftUp())
|
||||
processed = true;
|
||||
#endif // !ENABLE_MODIFIED_TOOLBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
return processed;
|
||||
|
|
@ -658,6 +682,20 @@ void GLToolbar::do_action(GLToolbarItem::EActionType type, int item_id, GLCanvas
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
void GLToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
switch (m_layout.type)
|
||||
{
|
||||
default:
|
||||
case Layout::Horizontal: { update_hover_state_horizontal(mouse_pos, parent); break; }
|
||||
case Layout::Vertical: { update_hover_state_vertical(mouse_pos, parent); break; }
|
||||
}
|
||||
}
|
||||
#else
|
||||
std::string GLToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
{
|
||||
if (!m_enabled)
|
||||
|
|
@ -670,8 +708,13 @@ std::string GLToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& pa
|
|||
case Layout::Vertical: { return update_hover_state_vertical(mouse_pos, parent); }
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
void GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
#else
|
||||
std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
|
|
@ -692,8 +735,10 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC
|
|||
float left = m_layout.left + scaled_border;
|
||||
float top = m_layout.top - scaled_border;
|
||||
|
||||
std::string tooltip = "";
|
||||
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
std::string tooltip;
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
for (GLToolbarItem* item : m_items)
|
||||
{
|
||||
if (!item->is_visible())
|
||||
|
|
@ -708,6 +753,7 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC
|
|||
|
||||
GLToolbarItem::EState state = item->get_state();
|
||||
bool inside = (left <= (float)scaled_mouse_pos(0)) && ((float)scaled_mouse_pos(0) <= right) && (bottom <= (float)scaled_mouse_pos(1)) && ((float)scaled_mouse_pos(1) <= top);
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (inside)
|
||||
{
|
||||
tooltip = item->get_tooltip();
|
||||
|
|
@ -718,6 +764,7 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC
|
|||
tooltip += "\n" + additional_tooltip;
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
switch (state)
|
||||
{
|
||||
|
|
@ -761,21 +808,54 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC
|
|||
|
||||
break;
|
||||
}
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
case GLToolbarItem::Disabled:
|
||||
{
|
||||
if (inside)
|
||||
{
|
||||
item->set_state(GLToolbarItem::HoverDisabled);
|
||||
parent.set_as_dirty();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GLToolbarItem::HoverDisabled:
|
||||
{
|
||||
if (!inside)
|
||||
{
|
||||
item->set_state(GLToolbarItem::Disabled);
|
||||
parent.set_as_dirty();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
#else
|
||||
default:
|
||||
case GLToolbarItem::Disabled:
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
left += icon_stride;
|
||||
}
|
||||
}
|
||||
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
return tooltip;
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
void GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
#else
|
||||
std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
|
|
@ -795,7 +875,9 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan
|
|||
float left = m_layout.left + scaled_border;
|
||||
float top = m_layout.top - scaled_border;
|
||||
|
||||
std::string tooltip = "";
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
std::string tooltip;
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
for (GLToolbarItem* item : m_items)
|
||||
{
|
||||
|
|
@ -811,6 +893,7 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan
|
|||
|
||||
GLToolbarItem::EState state = item->get_state();
|
||||
bool inside = (left <= (float)scaled_mouse_pos(0)) && ((float)scaled_mouse_pos(0) <= right) && (bottom <= (float)scaled_mouse_pos(1)) && ((float)scaled_mouse_pos(1) <= top);
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (inside)
|
||||
{
|
||||
tooltip = item->get_tooltip();
|
||||
|
|
@ -821,6 +904,7 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan
|
|||
tooltip += "\n" + additional_tooltip;
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
switch (state)
|
||||
{
|
||||
|
|
@ -864,18 +948,47 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan
|
|||
|
||||
break;
|
||||
}
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
case GLToolbarItem::Disabled:
|
||||
{
|
||||
if (inside)
|
||||
{
|
||||
item->set_state(GLToolbarItem::HoverDisabled);
|
||||
parent.set_as_dirty();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GLToolbarItem::HoverDisabled:
|
||||
{
|
||||
if (!inside)
|
||||
{
|
||||
item->set_state(GLToolbarItem::Disabled);
|
||||
parent.set_as_dirty();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
#else
|
||||
default:
|
||||
case GLToolbarItem::Disabled:
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
top -= icon_stride;
|
||||
}
|
||||
}
|
||||
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
return tooltip;
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
int GLToolbar::contains_mouse(const Vec2d& mouse_pos, const GLCanvas3D& parent) const
|
||||
|
|
@ -1224,19 +1337,37 @@ bool GLToolbar::generate_icons_texture() const
|
|||
std::vector<std::pair<int, bool>> states;
|
||||
if (m_name == "Top")
|
||||
{
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
states.push_back({ 1, false }); // Normal
|
||||
states.push_back({ 0, false }); // Pressed
|
||||
states.push_back({ 2, false }); // Disabled
|
||||
states.push_back({ 0, false }); // Hover
|
||||
states.push_back({ 0, false }); // HoverPressed
|
||||
states.push_back({ 2, false }); // HoverDisabled
|
||||
#else
|
||||
states.push_back(std::make_pair(1, false));
|
||||
states.push_back(std::make_pair(0, false));
|
||||
states.push_back(std::make_pair(2, false));
|
||||
states.push_back(std::make_pair(0, false));
|
||||
states.push_back(std::make_pair(0, false));
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
else if (m_name == "View")
|
||||
{
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
states.push_back({ 1, false }); // Normal
|
||||
states.push_back({ 1, true }); // Pressed
|
||||
states.push_back({ 1, false }); // Disabled
|
||||
states.push_back({ 0, false }); // Hover
|
||||
states.push_back({ 1, true }); // HoverPressed
|
||||
states.push_back({ 1, false }); // HoverDisabled
|
||||
#else
|
||||
states.push_back(std::make_pair(1, false));
|
||||
states.push_back(std::make_pair(1, true));
|
||||
states.push_back(std::make_pair(1, false));
|
||||
states.push_back(std::make_pair(0, false));
|
||||
states.push_back(std::make_pair(1, true));
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
unsigned int sprite_size_px = (unsigned int)(m_layout.icons_size * m_layout.scale);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ public:
|
|||
Disabled,
|
||||
Hover,
|
||||
HoverPressed,
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
HoverDisabled,
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
Num_States
|
||||
};
|
||||
|
||||
|
|
@ -119,9 +122,15 @@ public:
|
|||
void do_left_action() { m_last_action_type = Left; m_data.left.action_callback(); }
|
||||
void do_right_action() { m_last_action_type = Right; m_data.right.action_callback(); }
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
bool is_enabled() const { return (m_state != Disabled) && (m_state != HoverDisabled); }
|
||||
bool is_disabled() const { return (m_state == Disabled) || (m_state == HoverDisabled); }
|
||||
bool is_hovered() const { return (m_state == Hover) || (m_state == HoverPressed) || (m_state == HoverDisabled); }
|
||||
#else
|
||||
bool is_enabled() const { return m_state != Disabled; }
|
||||
bool is_disabled() const { return m_state == Disabled; }
|
||||
bool is_hovered() const { return (m_state == Hover) || (m_state == HoverPressed); }
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
bool is_pressed() const { return (m_state == Pressed) || (m_state == HoverPressed); }
|
||||
bool is_visible() const { return m_data.visible; }
|
||||
bool is_separator() const { return m_type == Separator; }
|
||||
|
|
@ -252,7 +261,9 @@ private:
|
|||
};
|
||||
|
||||
MouseCapture m_mouse_capture;
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
std::string m_tooltip;
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
int m_pressed_toggable_id;
|
||||
|
||||
public:
|
||||
|
|
@ -298,7 +309,11 @@ public:
|
|||
void force_left_action(int item_id, GLCanvas3D& parent) { do_action(GLToolbarItem::Left, item_id, parent, false); }
|
||||
void force_right_action(int item_id, GLCanvas3D& parent) { do_action(GLToolbarItem::Right, item_id, parent, false); }
|
||||
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
std::string get_tooltip() const;
|
||||
#else
|
||||
const std::string& get_tooltip() const { return m_tooltip; }
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
void get_additional_tooltip(int item_id, std::string& text);
|
||||
void set_additional_tooltip(int item_id, const std::string& text);
|
||||
|
|
@ -318,9 +333,15 @@ private:
|
|||
float get_height_vertical() const;
|
||||
float get_main_size() const;
|
||||
void do_action(GLToolbarItem::EActionType type, int item_id, GLCanvas3D& parent, bool check_hover);
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
void update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
void update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
void update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
#else
|
||||
std::string update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
std::string update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
std::string update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent);
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
// returns the id of the item under the given mouse position or -1 if none
|
||||
int contains_mouse(const Vec2d& mouse_pos, const GLCanvas3D& parent) const;
|
||||
int contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3D& parent) const;
|
||||
|
|
|
|||
|
|
@ -594,6 +594,12 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file) const
|
|||
|
||||
void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) const
|
||||
{
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
if (this->plater_ != nullptr)
|
||||
// hides the tooltip
|
||||
plater_->get_current_canvas3D()->set_tooltip("");
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
input_files.Clear();
|
||||
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
||||
_(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")),
|
||||
|
|
|
|||
|
|
@ -483,7 +483,6 @@ void ObjectList::update_extruder_values_for_items(const size_t max_extruder)
|
|||
|
||||
void ObjectList::update_objects_list_extruder_column(size_t extruders_count)
|
||||
{
|
||||
if (!this) return; // #ys_FIXME
|
||||
if (printer_technology() == ptSLA)
|
||||
extruders_count = 1;
|
||||
|
||||
|
|
@ -1558,7 +1557,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
|||
// If there are selected more then one instance but not all of them
|
||||
// don't add settings menu items
|
||||
const Selection& selection = scene_selection();
|
||||
if (selection.is_multiple_full_instance() && !selection.is_single_full_object() ||
|
||||
if ((selection.is_multiple_full_instance() && !selection.is_single_full_object()) ||
|
||||
selection.is_multiple_volume() || selection.is_mixed() ) // more than one volume(part) is selected on the scene
|
||||
return nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "GLGizmoHollow.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
|
@ -99,16 +100,11 @@ void GLGizmoHollow::on_render() const
|
|||
return;
|
||||
}
|
||||
|
||||
// !!! is it necessary?
|
||||
//const_cast<GLGizmoHollow*>(this)->m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
glsafe(::glEnable(GL_BLEND));
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
||||
m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z();
|
||||
|
||||
render_hollowed_mesh();
|
||||
|
||||
if (m_quadric != nullptr && selection.is_from_single_instance())
|
||||
render_points(selection, false);
|
||||
|
||||
|
|
@ -120,28 +116,6 @@ void GLGizmoHollow::on_render() const
|
|||
|
||||
|
||||
|
||||
void GLGizmoHollow::render_hollowed_mesh() const
|
||||
{
|
||||
/*if (m_c->m_volume_with_cavity) {
|
||||
m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift);
|
||||
m_parent.get_shader().start_using();
|
||||
|
||||
GLint current_program_id;
|
||||
glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_id));
|
||||
GLint color_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "uniform_color") : -1;
|
||||
GLint print_box_detection_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_detection") : -1;
|
||||
GLint print_box_worldmatrix_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_world_matrix") : -1;
|
||||
glcheck();
|
||||
m_c->m_volume_with_cavity->set_render_color();
|
||||
const Geometry::Transformation& volume_trafo = m_c->m_model_object->volumes.front()->get_transformation();
|
||||
m_c->m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
||||
m_c->m_volume_with_cavity->set_instance_transformation(m_c->m_model_object->instances[size_t(m_c->m_active_instance)]->get_transformation());
|
||||
m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id);
|
||||
m_parent.get_shader().stop_using();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void GLGizmoHollow::render_clipping_plane(const Selection& selection) const
|
||||
{
|
||||
if (m_c->m_clipping_plane_distance == 0.f)
|
||||
|
|
@ -169,11 +143,6 @@ void GLGizmoHollow::render_clipping_plane(const Selection& selection) const
|
|||
m_c->m_object_clipper->set_plane(*m_c->m_clipping_plane);
|
||||
m_c->m_object_clipper->set_transformation(trafo);
|
||||
|
||||
|
||||
// Next, ask the backend if supports are already calculated. If so, we are gonna cut them too.
|
||||
//if (m_c->m_print_object_idx < 0)
|
||||
// m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
if (m_c->m_print_object_idx >= 0) {
|
||||
const SLAPrintObject* print_object = m_parent.sla_print()->objects()[m_c->m_print_object_idx];
|
||||
|
||||
|
|
@ -229,7 +198,6 @@ void GLGizmoHollow::on_render_for_picking() const
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
render_points(selection, true);
|
||||
render_hollowed_mesh();
|
||||
}
|
||||
|
||||
void GLGizmoHollow::render_points(const Selection& selection, bool picking) const
|
||||
|
|
@ -343,10 +311,6 @@ bool GLGizmoHollow::unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, V
|
|||
if (! m_c->m_mesh_raycaster)
|
||||
return false;
|
||||
|
||||
// if the gizmo doesn't have the V, F structures for igl, calculate them first:
|
||||
// !!! is it really necessary?
|
||||
//m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
const Camera& camera = m_parent.get_camera();
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||
|
|
@ -561,87 +525,15 @@ void GLGizmoHollow::on_update(const UpdateData& data)
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<const TriangleMesh *, sla::HollowingConfig> GLGizmoHollow::get_hollowing_parameters() const
|
||||
{
|
||||
// FIXME this function is probably obsolete, caller could
|
||||
// get the data from model config himself
|
||||
auto opts = get_config_options({"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"});
|
||||
double offset = static_cast<const ConfigOptionFloat*>(opts[0].first)->value;
|
||||
double quality = static_cast<const ConfigOptionFloat*>(opts[1].first)->value;
|
||||
double closing_d = static_cast<const ConfigOptionFloat*>(opts[2].first)->value;
|
||||
return std::make_pair(m_c->m_mesh, sla::HollowingConfig{offset, quality, closing_d});
|
||||
}
|
||||
|
||||
void GLGizmoHollow::update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&rc)
|
||||
{
|
||||
m_c->m_mesh_raycaster = std::move(rc);
|
||||
m_c->m_object_clipper.reset();
|
||||
//m_c->m_volume_with_cavity.reset();
|
||||
}
|
||||
|
||||
void GLGizmoHollow::hollow_mesh(bool postpone_error_messages)
|
||||
{
|
||||
// Trigger a UI job to hollow the mesh.
|
||||
// wxGetApp().plater()->hollow();
|
||||
|
||||
wxGetApp().CallAfter([this, postpone_error_messages]() {
|
||||
wxGetApp().plater()->reslice_SLA_hollowing(*m_c->m_model_object, postpone_error_messages);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void GLGizmoHollow::update_hollowed_mesh(std::unique_ptr<TriangleMesh> &&mesh)
|
||||
{
|
||||
// Called from Plater when the UI job finishes
|
||||
/*m_c->m_cavity_mesh = std::move(mesh);
|
||||
|
||||
if(m_c->m_cavity_mesh) {
|
||||
// First subtract the holes:
|
||||
if (! m_c->m_model_object->sla_drain_holes.empty()) {
|
||||
TriangleMesh holes_mesh;
|
||||
for (const sla::DrainHole& hole : m_c->m_model_object->sla_drain_holes) {
|
||||
TriangleMesh hole_mesh = make_cylinder(hole.radius, hole.height, 2*M_PI/32);
|
||||
|
||||
Vec3d scaling = m_c->m_model_object->instances[m_c->m_active_instance]->get_scaling_factor();
|
||||
Vec3d normal_transformed = Vec3d(hole.normal(0)/scaling(0), hole.normal(1)/scaling(1), hole.normal(2)/scaling(2));
|
||||
normal_transformed.normalize();
|
||||
|
||||
// Rotate the cylinder appropriately
|
||||
Eigen::Quaterniond q;
|
||||
Transform3d m = Transform3d::Identity();
|
||||
m.matrix().block(0, 0, 3, 3) = q.setFromTwoVectors(Vec3d::UnitZ(), normal_transformed).toRotationMatrix();
|
||||
hole_mesh.transform(m);
|
||||
|
||||
// If the instance is scaled, undo the scaling of the hole
|
||||
hole_mesh.scale(Vec3d(1/scaling(0), 1/scaling(1), 1/scaling(2)));
|
||||
|
||||
// Translate the hole into position and merge with the others
|
||||
hole_mesh.translate(hole.pos);
|
||||
holes_mesh.merge(hole_mesh);
|
||||
holes_mesh.repair();
|
||||
}
|
||||
MeshBoolean::minus(*m_c->m_cavity_mesh.get(), holes_mesh);
|
||||
}
|
||||
|
||||
// create a new GLVolume that only has the cavity inside
|
||||
m_c->m_volume_with_cavity.reset(new GLVolume(GLVolume::MODEL_COLOR[2]));
|
||||
m_c->m_volume_with_cavity->indexed_vertex_array.load_mesh(*m_c->m_cavity_mesh.get());
|
||||
m_c->m_volume_with_cavity->finalize_geometry(true);
|
||||
m_c->m_volume_with_cavity->force_transparent = false;
|
||||
|
||||
m_parent.toggle_model_objects_visibility(false, m_c->m_model_object, m_c->m_active_instance);
|
||||
m_parent.toggle_sla_auxiliaries_visibility(true, m_c->m_model_object, m_c->m_active_instance);
|
||||
|
||||
// Reset raycaster so it works with the new mesh:
|
||||
m_c->m_mesh_raycaster.reset(new MeshRaycaster(*m_c->mesh()));
|
||||
}
|
||||
|
||||
if (m_c->m_clipping_plane_distance == 0.f) {
|
||||
m_c->m_clipping_plane_distance = 0.5f;
|
||||
update_clipping_plane();
|
||||
}*/
|
||||
}
|
||||
|
||||
std::vector<std::pair<const ConfigOption*, const ConfigOptionDef*>> GLGizmoHollow::get_config_options(const std::vector<std::string>& keys) const
|
||||
{
|
||||
std::vector<std::pair<const ConfigOption*, const ConfigOptionDef*>> out;
|
||||
|
|
@ -829,7 +721,6 @@ RENDER_AGAIN:
|
|||
bool remove_selected = false;
|
||||
bool remove_all = false;
|
||||
|
||||
// m_imgui->text(" "); // vertical gap
|
||||
ImGui::Separator();
|
||||
|
||||
float diameter_upper_cap = 15.;
|
||||
|
|
@ -1013,10 +904,6 @@ void GLGizmoHollow::on_set_state()
|
|||
m_parent.toggle_model_objects_visibility(true, m_c->m_model_object, m_c->m_active_instance);
|
||||
m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, m_c->m_model_object, m_c->m_active_instance);
|
||||
}
|
||||
|
||||
// Set default head diameter from config.
|
||||
//const DynamicPrintConfig& cfg = wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
|
||||
//m_new_hole_radius = static_cast<const ConfigOptionFloat*>(cfg.option("support_head_front_diameter"))->value;
|
||||
}
|
||||
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
||||
//Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("SLA gizmo turned off")));
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@ public:
|
|||
void delete_selected_points();
|
||||
ClippingPlane get_sla_clipping_plane() const;
|
||||
|
||||
|
||||
std::pair<const TriangleMesh *, sla::HollowingConfig> get_hollowing_parameters() const;
|
||||
void update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&rc);
|
||||
void update_hollowed_mesh(std::unique_ptr<TriangleMesh> &&mesh);
|
||||
|
||||
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
|
||||
void update_clipping_plane(bool keep_normal = false) const;
|
||||
void set_common_data_ptr(CommonGizmosData* ptr) { m_c = ptr; }
|
||||
|
|
@ -53,7 +48,6 @@ private:
|
|||
|
||||
void render_points(const Selection& selection, bool picking = false) const;
|
||||
void render_clipping_plane(const Selection& selection) const;
|
||||
void render_hollowed_mesh() const;
|
||||
void hollow_mesh(bool postpone_error_messages = false);
|
||||
bool unsaved_changes() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Include GLGizmoBase.hpp before I18N.hpp as it includes some libigl code, which overrides our localization "L" macro.
|
||||
#include "GLGizmoSlaSupports.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
|
@ -106,8 +107,6 @@ void GLGizmoSlaSupports::on_render() const
|
|||
|
||||
m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z();
|
||||
|
||||
render_hollowed_mesh();
|
||||
|
||||
if (m_quadric != nullptr && selection.is_from_single_instance())
|
||||
render_points(selection, false);
|
||||
|
||||
|
|
@ -119,29 +118,6 @@ void GLGizmoSlaSupports::on_render() const
|
|||
|
||||
|
||||
|
||||
void GLGizmoSlaSupports::render_hollowed_mesh() const
|
||||
{
|
||||
/*if (m_c->m_volume_with_cavity) {
|
||||
m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift);
|
||||
m_parent.get_shader().start_using();
|
||||
|
||||
GLint current_program_id;
|
||||
glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_id));
|
||||
GLint color_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "uniform_color") : -1;
|
||||
GLint print_box_detection_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_detection") : -1;
|
||||
GLint print_box_worldmatrix_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_world_matrix") : -1;
|
||||
glcheck();
|
||||
m_c->m_volume_with_cavity->set_render_color();
|
||||
const Geometry::Transformation& volume_trafo = m_c->m_model_object->volumes.front()->get_transformation();
|
||||
m_c->m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
||||
m_c->m_volume_with_cavity->set_instance_transformation(m_c->m_model_object->instances[size_t(m_c->m_active_instance)]->get_transformation());
|
||||
m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id);
|
||||
m_parent.get_shader().stop_using();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLGizmoSlaSupports::render_clipping_plane(const Selection& selection) const
|
||||
{
|
||||
if (m_c->m_clipping_plane_distance == 0.f || m_c->m_mesh->empty())
|
||||
|
|
@ -238,7 +214,6 @@ void GLGizmoSlaSupports::on_render_for_picking() const
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
render_points(selection, true);
|
||||
render_hollowed_mesh();
|
||||
}
|
||||
|
||||
void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) const
|
||||
|
|
@ -627,8 +602,6 @@ void GLGizmoSlaSupports::delete_selected_points(bool force)
|
|||
}
|
||||
|
||||
select_point(NoPoints);
|
||||
|
||||
//m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
}
|
||||
|
||||
void GLGizmoSlaSupports::on_update(const UpdateData& data)
|
||||
|
|
@ -643,8 +616,6 @@ void GLGizmoSlaSupports::on_update(const UpdateData& data)
|
|||
m_editing_cache[m_hover_id].support_point.pos = pos_and_normal.first;
|
||||
m_editing_cache[m_hover_id].support_point.is_new_island = false;
|
||||
m_editing_cache[m_hover_id].normal = pos_and_normal.second;
|
||||
// Do not update immediately, wait until the mouse is released.
|
||||
// m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ private:
|
|||
//void render_selection_rectangle() const;
|
||||
void render_points(const Selection& selection, bool picking = false) const;
|
||||
void render_clipping_plane(const Selection& selection) const;
|
||||
void render_hollowed_mesh() const;
|
||||
bool unsaved_changes() const;
|
||||
|
||||
bool m_lock_unique_islands = false;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@
|
|||
#include "slic3r/Utils/UndoRedo.hpp"
|
||||
#include "libslic3r/SLAPrint.hpp"
|
||||
#include "slic3r/GUI/MeshUtils.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
|
@ -456,7 +457,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
int selected_object_idx = selection.get_object_idx();
|
||||
bool processed = false;
|
||||
|
||||
#if !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
// mouse anywhere
|
||||
if (!evt.Dragging() && !evt.Leaving() && !evt.Entering() && (m_mouse_capture.parent != nullptr))
|
||||
{
|
||||
|
|
@ -466,12 +467,12 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
m_mouse_capture.reset();
|
||||
}
|
||||
#endif // !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
|
||||
// mouse anywhere
|
||||
if (evt.Moving())
|
||||
m_tooltip = update_hover_state(mouse_pos);
|
||||
#if ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
else if (evt.LeftUp())
|
||||
{
|
||||
if (m_mouse_capture.left)
|
||||
|
|
@ -531,7 +532,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
#if ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX
|
||||
else if (evt.Dragging() && !is_dragging())
|
||||
#else
|
||||
else if (evt.Dragging()))
|
||||
else if (evt.Dragging())
|
||||
#endif // ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX
|
||||
{
|
||||
if (m_mouse_capture.any())
|
||||
|
|
@ -557,7 +558,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
else if (evt.Dragging() && m_mouse_capture.any())
|
||||
// if the button down was done on this toolbar, prevent from dragging into the scene
|
||||
processed = true;
|
||||
#endif // ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
#if ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX
|
||||
else if (evt.Dragging() && is_dragging())
|
||||
{
|
||||
|
|
@ -696,7 +697,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
processed = true;
|
||||
}
|
||||
#endif // !ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX
|
||||
#if !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
else if (evt.LeftUp() && is_dragging())
|
||||
{
|
||||
switch (m_current) {
|
||||
|
|
@ -718,7 +719,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
processed = true;
|
||||
}
|
||||
#endif // !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
else if (evt.LeftUp() && (m_current == SlaSupports || m_current == Hollow) && !m_parent.is_mouse_dragging())
|
||||
{
|
||||
// in case SLA gizmo is selected, we just pass the LeftUp event and stop processing - neither
|
||||
|
|
@ -757,10 +758,10 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
m_mouse_capture.right = true;
|
||||
m_mouse_capture.parent = &m_parent;
|
||||
}
|
||||
#if !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#if !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
else if (evt.LeftUp())
|
||||
processed = true;
|
||||
#endif // !ENABLE_MODIFIED_GIZMOBAR_MOUSE_EVENT_HANDLING
|
||||
#endif // !ENABLE_CANVAS_TOOLTIP_USING_IMGUI
|
||||
}
|
||||
|
||||
return processed;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "slic3r/GUI/GLTexture.hpp"
|
||||
#include "slic3r/GUI/GLToolbar.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
|
@ -18,6 +18,8 @@ namespace GUI {
|
|||
|
||||
class GLCanvas3D;
|
||||
class ClippingPlane;
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
class CommonGizmosData;
|
||||
|
||||
class Rect
|
||||
{
|
||||
|
|
|
|||
|
|
@ -150,14 +150,16 @@ bool Mouse3DController::State::apply(const Mouse3DController::Params ¶ms, Ca
|
|||
|
||||
for (const QueueItem &input_queue_item : input_queue) {
|
||||
if (input_queue_item.is_translation()) {
|
||||
const Vec3d& translation = input_queue_item.vector;
|
||||
double zoom_factor = camera.min_zoom() / camera.get_zoom();
|
||||
Vec3d translation = params.swap_yz ? Vec3d(input_queue_item.vector.x(), - input_queue_item.vector.z(), input_queue_item.vector.y()) : input_queue_item.vector;
|
||||
double zoom_factor = camera.min_zoom() / camera.get_zoom();
|
||||
camera.set_target(camera.get_target() + zoom_factor * params.translation.scale * (translation.x() * camera.get_dir_right() + translation.z() * camera.get_dir_up()));
|
||||
if (translation.y() != 0.0)
|
||||
camera.update_zoom(params.zoom.scale * translation.y());
|
||||
} else if (input_queue_item.is_rotation()) {
|
||||
Vec3d rot = params.rotation.scale * input_queue_item.vector * (PI / 180.);
|
||||
camera.rotate_local_around_target(Vec3d(rot.x(), - rot.z(), rot.y()));
|
||||
Vec3d rot = params.rotation.scale * input_queue_item.vector * (PI / 180.);
|
||||
if (params.swap_yz)
|
||||
rot = Vec3d(rot.x(), -rot.z(), rot.y());
|
||||
camera.rotate_local_around_target(Vec3d(rot.x(), - rot.z(), rot.y()));
|
||||
break;
|
||||
} else {
|
||||
assert(input_queue_item.is_buttons());
|
||||
|
|
@ -185,19 +187,22 @@ void Mouse3DController::load_config(const AppConfig &appconfig)
|
|||
double translation_deadzone = Params::DefaultTranslationDeadzone;
|
||||
float rotation_deadzone = Params::DefaultRotationDeadzone;
|
||||
double zoom_speed = 2.0;
|
||||
appconfig.get_mouse_device_translation_speed(device_name, translation_speed);
|
||||
bool swap_yz = false;
|
||||
appconfig.get_mouse_device_translation_speed(device_name, translation_speed);
|
||||
appconfig.get_mouse_device_translation_deadzone(device_name, translation_deadzone);
|
||||
appconfig.get_mouse_device_rotation_speed(device_name, rotation_speed);
|
||||
appconfig.get_mouse_device_rotation_deadzone(device_name, rotation_deadzone);
|
||||
appconfig.get_mouse_device_zoom_speed(device_name, zoom_speed);
|
||||
// clamp to valid values
|
||||
appconfig.get_mouse_device_swap_yz(device_name, swap_yz);
|
||||
// clamp to valid values
|
||||
Params params;
|
||||
params.translation.scale = Params::DefaultTranslationScale * std::clamp(translation_speed, 0.1, 10.0);
|
||||
params.translation.deadzone = std::clamp(translation_deadzone, 0.0, Params::MaxTranslationDeadzone);
|
||||
params.rotation.scale = Params::DefaultRotationScale * std::clamp(rotation_speed, 0.1f, 10.0f);
|
||||
params.rotation.deadzone = std::clamp(rotation_deadzone, 0.0f, Params::MaxRotationDeadzone);
|
||||
params.zoom.scale = Params::DefaultZoomScale * std::clamp(zoom_speed, 0.1, 10.0);
|
||||
m_params_by_device[device_name] = std::move(params);
|
||||
params.swap_yz = swap_yz;
|
||||
m_params_by_device[device_name] = std::move(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,9 +215,9 @@ void Mouse3DController::save_config(AppConfig &appconfig) const
|
|||
const std::string &device_name = key_value_pair.first;
|
||||
const Params ¶ms = key_value_pair.second;
|
||||
// Store current device parameters into the config
|
||||
appconfig.set_mouse_device(device_name, params.translation.scale / Params::DefaultTranslationScale, params.translation.deadzone,
|
||||
params.rotation.scale / Params::DefaultRotationScale, params.rotation.deadzone, params.zoom.scale / Params::DefaultZoomScale);
|
||||
}
|
||||
appconfig.set_mouse_device(device_name, params.translation.scale / Params::DefaultTranslationScale, params.translation.deadzone,
|
||||
params.rotation.scale / Params::DefaultRotationScale, params.rotation.deadzone, params.zoom.scale / Params::DefaultZoomScale, params.swap_yz);
|
||||
}
|
||||
}
|
||||
|
||||
bool Mouse3DController::apply(Camera& camera)
|
||||
|
|
@ -315,6 +320,17 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
|
|||
params_changed = true;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, color);
|
||||
imgui.text(_(L("Options:")));
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
bool swap_yz = params_copy.swap_yz;
|
||||
if (imgui.checkbox("Swap Y/Z axes", swap_yz)) {
|
||||
params_copy.swap_yz = swap_yz;
|
||||
params_changed = true;
|
||||
}
|
||||
|
||||
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
|
||||
ImGui::Separator();
|
||||
ImGui::Separator();
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ class Mouse3DController
|
|||
// The effects of changing this value can be tested by setting ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT to 1
|
||||
// and playing with the imgui dialog which shows by pressing CTRL+M
|
||||
size_t input_queue_max_size { 15 };
|
||||
};
|
||||
// Whether to swap Y/Z axes or not.
|
||||
bool swap_yz{ false };
|
||||
};
|
||||
|
||||
// Queue of the 3DConnexion input events (translations, rotations, button presses).
|
||||
class State
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "GUI_ObjectList.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/dc.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -80,7 +78,6 @@
|
|||
#include "../Utils/PrintHost.hpp"
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
#include "../Utils/UndoRedo.hpp"
|
||||
#include "../Utils/Thread.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
#include "SearchComboBox.hpp"
|
||||
|
||||
|
|
@ -94,9 +91,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 {
|
||||
|
|
@ -269,7 +264,7 @@ PresetBitmapComboBox(parent, wxSize(15 * wxGetApp().em_unit(), -1)),
|
|||
EnableTextChangedEvents(false);
|
||||
#endif /* _WIN32 */
|
||||
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &evt) {
|
||||
auto selected_item = this->GetSelection();
|
||||
auto selected_item = evt.GetSelection();
|
||||
|
||||
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
|
||||
if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
|
||||
|
|
@ -389,9 +384,9 @@ void PresetComboBox::set_label_marker(int item, LabelItemType label_item_type)
|
|||
this->SetClientData(item, (void*)label_item_type);
|
||||
}
|
||||
|
||||
void PresetComboBox::check_selection()
|
||||
void PresetComboBox::check_selection(int selection)
|
||||
{
|
||||
this->last_selected = GetSelection();
|
||||
this->last_selected = selection;
|
||||
}
|
||||
|
||||
void PresetComboBox::msw_rescale()
|
||||
|
|
@ -1598,8 +1593,7 @@ struct Plater::priv
|
|||
|
||||
enum class Jobs : size_t {
|
||||
Arrange,
|
||||
Rotoptimize,
|
||||
Hollow
|
||||
Rotoptimize
|
||||
};
|
||||
|
||||
class ArrangeJob : public PlaterJob
|
||||
|
|
@ -1772,22 +1766,6 @@ struct Plater::priv
|
|||
void process() override;
|
||||
};
|
||||
|
||||
class HollowJob : public PlaterJob
|
||||
{
|
||||
public:
|
||||
using PlaterJob::PlaterJob;
|
||||
void prepare() override;
|
||||
void process() override;
|
||||
void finalize() override;
|
||||
private:
|
||||
GLGizmoHollow * get_gizmo();
|
||||
const GLGizmoHollow * get_gizmo() const;
|
||||
|
||||
std::unique_ptr<TriangleMesh> m_output_mesh;
|
||||
std::unique_ptr<MeshRaycaster> m_output_raycaster;
|
||||
const TriangleMesh* m_object_mesh = nullptr;
|
||||
sla::HollowingConfig m_cfg;
|
||||
};
|
||||
|
||||
// Jobs defined inside the group class will be managed so that only one can
|
||||
// run at a time. Also, the background process will be stopped if a job is
|
||||
|
|
@ -1800,7 +1778,6 @@ struct Plater::priv
|
|||
|
||||
ArrangeJob arrange_job{m_plater};
|
||||
RotoptimizeJob rotoptimize_job{m_plater};
|
||||
HollowJob hollow_job{m_plater};
|
||||
|
||||
// To create a new job, just define a new subclass of Job, implement
|
||||
// the process and the optional prepare() and finalize() methods
|
||||
|
|
@ -1808,8 +1785,7 @@ struct Plater::priv
|
|||
// if it cannot run concurrently with other jobs in this group
|
||||
|
||||
std::vector<std::reference_wrapper<Job>> m_jobs{arrange_job,
|
||||
rotoptimize_job,
|
||||
hollow_job};
|
||||
rotoptimize_job};
|
||||
|
||||
public:
|
||||
ExclusiveJobGroup(priv *_plater) : m_plater(_plater) {}
|
||||
|
|
@ -1912,7 +1888,6 @@ struct Plater::priv
|
|||
void reset();
|
||||
void mirror(Axis axis);
|
||||
void arrange();
|
||||
void hollow();
|
||||
void sla_optimize_rotation();
|
||||
void split_object();
|
||||
void split_volume();
|
||||
|
|
@ -2014,10 +1989,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();
|
||||
|
||||
|
|
@ -2091,7 +2064,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) {
|
||||
|
|
@ -2101,7 +2073,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.
|
||||
|
|
@ -2856,11 +2827,6 @@ void Plater::priv::arrange()
|
|||
m_ui_jobs.start(Jobs::Arrange);
|
||||
}
|
||||
|
||||
void Plater::priv::hollow()
|
||||
{
|
||||
this->take_snapshot(_(L("Hollow")));
|
||||
m_ui_jobs.start(Jobs::Hollow);
|
||||
}
|
||||
|
||||
// This method will find an optimal orientation for the currently selected item
|
||||
// Very similar in nature to the arrange method above...
|
||||
|
|
@ -2998,67 +2964,6 @@ void Plater::priv::RotoptimizeJob::process()
|
|||
: _(L("Orientation found.")));
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::prepare()
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
const GLGizmoHollow* gizmo_hollow = dynamic_cast<const GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(gizmo_hollow);
|
||||
auto hlw_data = gizmo_hollow->get_hollowing_parameters();
|
||||
m_object_mesh = hlw_data.first;
|
||||
m_cfg = hlw_data.second;
|
||||
m_output_mesh.reset();
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::process()
|
||||
{
|
||||
sla::JobController ctl;
|
||||
ctl.stopcondition = [this]{ return was_canceled(); };
|
||||
ctl.statuscb = [this](unsigned st, const std::string &s) {
|
||||
if (st < 100) update_status(int(st), s);
|
||||
};
|
||||
|
||||
std::unique_ptr<TriangleMesh> omesh =
|
||||
sla::generate_interior(*m_object_mesh, m_cfg, ctl);
|
||||
|
||||
if (omesh && !omesh->empty()) {
|
||||
m_output_mesh.reset(new TriangleMesh{*m_object_mesh});
|
||||
m_output_mesh->merge(*omesh);
|
||||
m_output_mesh->require_shared_vertices();
|
||||
|
||||
update_status(90, _(L("Indexing hollowed object")));
|
||||
|
||||
m_output_raycaster.reset(new MeshRaycaster(*m_output_mesh));
|
||||
|
||||
update_status(100, was_canceled() ? _(L("Hollowing cancelled.")) :
|
||||
_(L("Hollowing done.")));
|
||||
} else {
|
||||
update_status(100, _(L("Hollowing failed.")));
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::finalize()
|
||||
{
|
||||
if (auto gizmo = get_gizmo()) {
|
||||
gizmo->update_mesh_raycaster(std::move(m_output_raycaster));
|
||||
gizmo->update_hollowed_mesh(std::move(m_output_mesh));
|
||||
}
|
||||
}
|
||||
|
||||
GLGizmoHollow *Plater::priv::HollowJob::get_gizmo()
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
auto ret = dynamic_cast<GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const GLGizmoHollow *Plater::priv::HollowJob::get_gizmo() const
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
auto ret = dynamic_cast<const GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Plater::priv::split_object()
|
||||
{
|
||||
|
|
@ -3665,6 +3570,14 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||
auto preset_type = static_cast<Preset::Type>(evt.GetInt());
|
||||
auto *combo = static_cast<PresetComboBox*>(evt.GetEventObject());
|
||||
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/3889
|
||||
// Under OSX: in case of use of a same names written in different case (like "ENDER" and "Ender"),
|
||||
// m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive.
|
||||
// So, use GetSelection() from event parameter
|
||||
// But in this function we couldn't use evt.GetSelection(), because m_commandInt is used for preset_type
|
||||
// Thus, get selection in this way:
|
||||
int selection = combo->FindString(evt.GetString(), true);
|
||||
|
||||
auto idx = combo->get_extruder_idx();
|
||||
|
||||
//! Because of The MSW and GTK version of wxBitmapComboBox derived from wxComboBox,
|
||||
|
|
@ -3675,7 +3588,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||
//! combo->GetStringSelection().ToUTF8().data());
|
||||
|
||||
const std::string preset_name = wxGetApp().preset_bundle->get_preset_name_by_alias(preset_type,
|
||||
Preset::remove_suffix_modified(combo->GetString(combo->GetSelection()).ToUTF8().data()));
|
||||
Preset::remove_suffix_modified(combo->GetString(selection).ToUTF8().data()));
|
||||
|
||||
if (preset_type == Preset::TYPE_FILAMENT) {
|
||||
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
|
||||
|
|
@ -3981,7 +3894,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);
|
||||
|
|
@ -3999,7 +3911,6 @@ void Plater::priv::generate_thumbnails(ThumbnailsList& thumbnails, const Vec2ds&
|
|||
thumbnails.pop_back();
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
||||
void Plater::priv::msw_rescale_object_menu()
|
||||
{
|
||||
|
|
@ -5128,13 +5039,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);
|
||||
|
|
@ -5173,10 +5080,6 @@ void Plater::export_toolpaths_to_obj() const
|
|||
p->preview->get_canvas3d()->export_toolpaths_to_obj(into_u8(path).c_str());
|
||||
}
|
||||
|
||||
void Plater::hollow()
|
||||
{
|
||||
p->hollow();
|
||||
}
|
||||
|
||||
void Plater::reslice()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,14 +10,11 @@
|
|||
|
||||
#include "Preset.hpp"
|
||||
|
||||
#include "3DScene.hpp"
|
||||
#include "GLTexture.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
class wxButton;
|
||||
class ScalableButton;
|
||||
class wxBoxSizer;
|
||||
class wxGLCanvas;
|
||||
class wxScrolledWindow;
|
||||
class wxString;
|
||||
|
||||
|
|
@ -30,9 +27,9 @@ class SLAPrint;
|
|||
enum SLAPrintObjectStep : unsigned int;
|
||||
|
||||
namespace UndoRedo {
|
||||
class Stack;
|
||||
struct Snapshot;
|
||||
};
|
||||
class Stack;
|
||||
struct Snapshot;
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
@ -44,6 +41,7 @@ class ObjectLayers;
|
|||
class ObjectList;
|
||||
class GLCanvas3D;
|
||||
class Mouse3DController;
|
||||
struct Camera;
|
||||
|
||||
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
||||
|
||||
|
|
@ -71,7 +69,7 @@ public:
|
|||
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
||||
int get_extruder_idx() const { return extruder_idx; }
|
||||
int em_unit() const { return m_em_unit; }
|
||||
void check_selection();
|
||||
void check_selection(int selection);
|
||||
|
||||
void msw_rescale();
|
||||
|
||||
|
|
@ -201,7 +199,6 @@ public:
|
|||
void reload_all_from_disk();
|
||||
bool has_toolpaths_to_export() const;
|
||||
void export_toolpaths_to_obj() const;
|
||||
void hollow();
|
||||
void reslice();
|
||||
void reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages = false);
|
||||
void reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages = false);
|
||||
|
|
|
|||
|
|
@ -1027,7 +1027,7 @@ const std::string& PresetCollection::get_preset_name_by_alias(const std::string&
|
|||
it != m_map_alias_to_profile_name.end() && it->first == alias; ++ it)
|
||||
if (auto it_preset = this->find_preset_internal(it->second);
|
||||
it_preset != m_presets.end() && it_preset->name == it->second &&
|
||||
it_preset->is_visible && (it_preset->is_compatible || (it_preset - m_presets.begin()) == m_idx_selected))
|
||||
it_preset->is_visible && (it_preset->is_compatible || size_t(it_preset - m_presets.begin()) == m_idx_selected))
|
||||
return it_preset->name;
|
||||
return alias;
|
||||
}
|
||||
|
|
@ -1089,6 +1089,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
bool selected = idx_preset == m_idx_selected;
|
||||
Preset &preset_selected = m_presets[idx_preset];
|
||||
Preset &preset_edited = selected ? m_edited_preset : preset_selected;
|
||||
|
||||
const PresetWithVendorProfile this_preset_with_vendor_profile = this->get_preset_with_vendor_profile(preset_edited);
|
||||
bool was_compatible = preset_edited.is_compatible;
|
||||
preset_edited.is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer, &config);
|
||||
|
|
@ -1097,7 +1098,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
preset_edited.is_compatible &= is_compatible_with_print(this_preset_with_vendor_profile, *active_print, active_printer);
|
||||
if (! preset_edited.is_compatible && selected &&
|
||||
(unselect_if_incompatible == PresetSelectCompatibleType::Always || (unselect_if_incompatible == PresetSelectCompatibleType::OnlyIfWasCompatible && was_compatible)))
|
||||
m_idx_selected = -1;
|
||||
m_idx_selected = size_t(-1);
|
||||
if (selected)
|
||||
preset_selected.is_compatible = preset_edited.is_compatible;
|
||||
}
|
||||
|
|
@ -1253,7 +1254,7 @@ void PresetCollection::update_plater_ui(GUI::PresetComboBox *ui)
|
|||
|
||||
ui->SetSelection(selected_preset_item);
|
||||
ui->SetToolTip(tooltip.IsEmpty() ? ui->GetString(selected_preset_item) : tooltip);
|
||||
ui->check_selection();
|
||||
ui->check_selection(selected_preset_item);
|
||||
ui->Thaw();
|
||||
|
||||
// Update control min size after rescale (changed Display DPI under MSW)
|
||||
|
|
@ -1398,7 +1399,7 @@ void add_correct_opts_to_diff(const std::string &opt_key, t_config_option_keys&
|
|||
const T* opt_init = static_cast<const T*>(other.option(opt_key));
|
||||
const T* opt_cur = static_cast<const T*>(this_c.option(opt_key));
|
||||
int opt_init_max_id = opt_init->values.size() - 1;
|
||||
for (int i = 0; i < opt_cur->values.size(); i++)
|
||||
for (int i = 0; i < int(opt_cur->values.size()); i++)
|
||||
{
|
||||
int init_id = i <= opt_init_max_id ? i : 0;
|
||||
if (opt_cur->values[i] != opt_init->values[init_id])
|
||||
|
|
|
|||
|
|
@ -342,9 +342,9 @@ public:
|
|||
// Return the selected preset, without the user modifications applied.
|
||||
Preset& get_selected_preset() { return m_presets[m_idx_selected]; }
|
||||
const Preset& get_selected_preset() const { return m_presets[m_idx_selected]; }
|
||||
int get_selected_idx() const { return m_idx_selected; }
|
||||
size_t get_selected_idx() const { return m_idx_selected; }
|
||||
// Returns the name of the selected preset, or an empty string if no preset is selected.
|
||||
std::string get_selected_preset_name() const { return (m_idx_selected == -1) ? std::string() : this->get_selected_preset().name; }
|
||||
std::string get_selected_preset_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_preset().name; }
|
||||
// For the current edited preset, return the parent preset if there is one.
|
||||
// If there is no parent preset, nullptr is returned.
|
||||
// The parent preset may be a system preset or a user preset, which will be
|
||||
|
|
@ -366,7 +366,7 @@ public:
|
|||
|
||||
// used to update preset_choice from Tab
|
||||
const std::deque<Preset>& get_presets() const { return m_presets; }
|
||||
int get_idx_selected() { return m_idx_selected; }
|
||||
size_t get_idx_selected() { return m_idx_selected; }
|
||||
static const std::string& get_suffix_modified();
|
||||
|
||||
// Return a preset possibly with modifications.
|
||||
|
|
@ -374,7 +374,7 @@ public:
|
|||
const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; }
|
||||
virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); }
|
||||
// Return a preset by an index. If the preset is active, a temporary copy is returned.
|
||||
Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
|
||||
Preset& preset(size_t idx) { return (idx == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
|
||||
const Preset& preset(size_t idx) const { return const_cast<PresetCollection*>(this)->preset(idx); }
|
||||
void discard_current_changes() { m_presets[m_idx_selected].reset_dirty(); m_edited_preset = m_presets[m_idx_selected]; }
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ private:
|
|||
// Initially this preset contains a copy of the selected preset. Later on, this copy may be modified by the user.
|
||||
Preset m_edited_preset;
|
||||
// Selected preset.
|
||||
int m_idx_selected;
|
||||
size_t m_idx_selected;
|
||||
// Is the "- default -" preset suppressed?
|
||||
bool m_default_suppressed = true;
|
||||
size_t m_num_default_presets = 0;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@
|
|||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
|
||||
// Store the print/filament/printer presets into a "presets" subdirectory of the Slic3rPE config dir.
|
||||
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
|
||||
// #define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
|
||||
|
|
@ -971,8 +973,6 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree, co
|
|||
{
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
typedef std::pair<pt::ptree::key_type, pt::ptree> ptree_child_type;
|
||||
|
||||
// 1) For the group given by group_name, initialize the presets.
|
||||
struct Prst {
|
||||
Prst(const std::string &name, pt::ptree *node) : name(name), node(node) {}
|
||||
|
|
@ -1332,7 +1332,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
|||
|
||||
// Derive the profile logical name aka alias from the preset name if the alias was not stated explicitely.
|
||||
if (alias_name.empty()) {
|
||||
int end_pos = preset_name.find_first_of("@");
|
||||
size_t end_pos = preset_name.find_first_of("@");
|
||||
if (end_pos != std::string::npos) {
|
||||
alias_name = preset_name.substr(0, end_pos);
|
||||
if (renamed_from.empty())
|
||||
|
|
@ -1735,9 +1735,9 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
|
|||
if (selected_preset_item == INT_MAX)
|
||||
selected_preset_item = ui->GetCount() - 1;
|
||||
|
||||
ui->SetSelection(selected_preset_item);
|
||||
ui->SetSelection(selected_preset_item);
|
||||
ui->SetToolTip(tooltip.IsEmpty() ? ui->GetString(selected_preset_item) : tooltip);
|
||||
ui->check_selection();
|
||||
ui->check_selection(selected_preset_item);
|
||||
ui->Thaw();
|
||||
|
||||
// Update control min size after rescale (changed Display DPI under MSW)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "PresetBundle.hpp"
|
||||
#include "PresetHints.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
|
|
@ -237,7 +238,13 @@ void Tab::create_preset_tab()
|
|||
//! but the OSX version derived from wxOwnerDrawnCombo, instead of:
|
||||
//! select_preset(m_presets_choice->GetStringSelection().ToUTF8().data());
|
||||
//! we doing next:
|
||||
int selected_item = m_presets_choice->GetSelection();
|
||||
// int selected_item = m_presets_choice->GetSelection();
|
||||
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/3889
|
||||
// Under OSX: in case of use of a same names written in different case (like "ENDER" and "Ender")
|
||||
// m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive.
|
||||
// So, use GetSelection() from event parameter
|
||||
int selected_item = e.GetSelection();
|
||||
if (m_selected_preset_item == size_t(selected_item) && !m_presets->current_is_dirty())
|
||||
return;
|
||||
if (selected_item >= 0) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ wxString FlashAir::get_test_ok_msg () const
|
|||
|
||||
wxString FlashAir::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return GUI::from_u8((boost::format("%s: %s")
|
||||
return GUI::from_u8((boost::format("%s: %s\n%s")
|
||||
% _utf8(L("Could not connect to FlashAir"))
|
||||
% std::string(msg.ToUTF8())
|
||||
% _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());
|
||||
|
|
@ -182,8 +182,6 @@ std::string FlashAir::timestamp_str() const
|
|||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
|
||||
const char *name = get_name();
|
||||
|
||||
unsigned long fattime = ((tm.tm_year - 80) << 25) |
|
||||
((tm.tm_mon + 1) << 21) |
|
||||
(tm.tm_mday << 16) |
|
||||
|
|
|
|||
|
|
@ -7,10 +7,17 @@
|
|||
#include <sstream>
|
||||
#include <exception>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#ifdef OPENSSL_CERT_OVERRIDE
|
||||
#include <openssl/x509.h>
|
||||
#endif
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
||||
|
|
@ -22,14 +29,56 @@ namespace Slic3r {
|
|||
|
||||
// Private
|
||||
|
||||
class CurlGlobalInit
|
||||
struct CurlGlobalInit
|
||||
{
|
||||
static const CurlGlobalInit instance;
|
||||
static std::unique_ptr<CurlGlobalInit> instance;
|
||||
|
||||
CurlGlobalInit() { ::curl_global_init(CURL_GLOBAL_DEFAULT); }
|
||||
CurlGlobalInit()
|
||||
{
|
||||
#ifdef OPENSSL_CERT_OVERRIDE // defined if SLIC3R_STATIC=ON
|
||||
|
||||
// Look for a set of distro specific directories. Don't change the
|
||||
// order: https://bugzilla.redhat.com/show_bug.cgi?id=1053882
|
||||
static const char * CA_BUNDLES[] = {
|
||||
"/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL 6
|
||||
"/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
|
||||
"/usr/share/ssl/certs/ca-bundle.crt",
|
||||
"/usr/local/share/certs/ca-root-nss.crt", // FreeBSD
|
||||
"/etc/ssl/cert.pem",
|
||||
"/etc/ssl/ca-bundle.pem" // OpenSUSE Tumbleweed
|
||||
};
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
// Env var name for the OpenSSL CA bundle (SSL_CERT_FILE nomally)
|
||||
const char *const SSL_CA_FILE = X509_get_default_cert_file_env();
|
||||
const char * ssl_cafile = ::getenv(SSL_CA_FILE);
|
||||
|
||||
if (!ssl_cafile)
|
||||
ssl_cafile = X509_get_default_cert_file();
|
||||
|
||||
int replace = true;
|
||||
|
||||
if (!ssl_cafile || !fs::exists(fs::path(ssl_cafile)))
|
||||
for (const char * bundle : CA_BUNDLES) {
|
||||
if (fs::exists(fs::path(bundle))) {
|
||||
::setenv(SSL_CA_FILE, bundle, replace);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
<< "Detected OpenSSL root CA store: " << ::getenv(SSL_CA_FILE);
|
||||
|
||||
#endif
|
||||
|
||||
::curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
}
|
||||
|
||||
~CurlGlobalInit() { ::curl_global_cleanup(); }
|
||||
};
|
||||
|
||||
std::unique_ptr<CurlGlobalInit> CurlGlobalInit::instance;
|
||||
|
||||
struct Http::priv
|
||||
{
|
||||
enum {
|
||||
|
|
@ -83,6 +132,9 @@ Http::priv::priv(const std::string &url)
|
|||
, limit(0)
|
||||
, cancel(false)
|
||||
{
|
||||
if (!CurlGlobalInit::instance)
|
||||
CurlGlobalInit::instance = std::make_unique<CurlGlobalInit>();
|
||||
|
||||
if (curl == nullptr) {
|
||||
throw std::runtime_error(std::string("Could not construct Curl object"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,8 +526,8 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
|||
existing_idx.load(bundle_path_idx);
|
||||
// Find a recommended config bundle version for the slic3r version last executed. This makes sure that a config bundle update will not be missed
|
||||
// when upgrading an application. On the other side, the user will be bugged every time he will switch between slic3r versions.
|
||||
const auto existing_recommended = existing_idx.recommended(old_slic3r_version);
|
||||
/*if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) {
|
||||
/*const auto existing_recommended = existing_idx.recommended(old_slic3r_version);
|
||||
if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) {
|
||||
// The user has already seen (and presumably rejected) this update
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("Downloaded index for `%1%` is the same as installed one, not offering an update.") % idx.vendor();
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue