mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 17:15:53 +08:00
Fixed conflicts after merge with branch et_opengl_3
This commit is contained in:
commit
73fed3e119
@ -414,6 +414,7 @@ if(SLIC3R_STATIC)
|
||||
endif()
|
||||
set(TBB_DEBUG 1)
|
||||
find_package(TBB REQUIRED)
|
||||
slic3r_remap_configs(TBB::tbb RelWithDebInfo Release)
|
||||
# include_directories(${TBB_INCLUDE_DIRS})
|
||||
# add_definitions(${TBB_DEFINITIONS})
|
||||
# if(MSVC)
|
||||
|
@ -581,11 +581,6 @@ static void process_arrangeable(const ArrangePolygon &arrpoly,
|
||||
const Vec2crd &offs = arrpoly.translation;
|
||||
double rotation = arrpoly.rotation;
|
||||
|
||||
// This fixes:
|
||||
// https://github.com/prusa3d/PrusaSlicer/issues/2209
|
||||
if (p.points.size() < 3)
|
||||
return;
|
||||
|
||||
outp.emplace_back(std::move(p));
|
||||
outp.back().rotation(rotation);
|
||||
outp.back().translation({offs.x(), offs.y()});
|
||||
|
@ -503,21 +503,19 @@ static void write_thumbnail(Zipper &zipper, const ThumbnailData &data)
|
||||
}
|
||||
}
|
||||
|
||||
void SL1Archive::export_print(const std::string fname,
|
||||
void SL1Archive::export_print(Zipper &zipper,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &prjname)
|
||||
{
|
||||
Zipper zipper{fname};
|
||||
|
||||
std::string project =
|
||||
prjname.empty() ?
|
||||
boost::filesystem::path(zipper.get_filename()).stem().string() :
|
||||
prjname;
|
||||
|
||||
|
||||
ConfMap iniconf, slicerconf;
|
||||
fill_iniconf(iniconf, print);
|
||||
|
||||
|
||||
iniconf["jobDir"] = project;
|
||||
|
||||
fill_slicerconf(slicerconf, print);
|
||||
@ -527,13 +525,13 @@ void SL1Archive::export_print(const std::string fname,
|
||||
zipper << to_ini(iniconf);
|
||||
zipper.add_entry("prusaslicer.ini");
|
||||
zipper << to_ini(slicerconf);
|
||||
|
||||
|
||||
size_t i = 0;
|
||||
for (const sla::EncodedRaster &rst : m_layers) {
|
||||
|
||||
std::string imgname = project + string_printf("%.5d", i++) + "." +
|
||||
rst.extension();
|
||||
|
||||
|
||||
zipper.add_entry(imgname.c_str(), rst.data(), rst.size());
|
||||
}
|
||||
|
||||
@ -549,4 +547,14 @@ void SL1Archive::export_print(const std::string fname,
|
||||
}
|
||||
}
|
||||
|
||||
void SL1Archive::export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &prjname)
|
||||
{
|
||||
Zipper zipper{fname, Zipper::FAST_COMPRESSION};
|
||||
|
||||
export_print(zipper, print, thumbnails, prjname);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -22,8 +22,13 @@ protected:
|
||||
SLAPrinterConfig & cfg() { return m_cfg; }
|
||||
const SLAPrinterConfig & cfg() const { return m_cfg; }
|
||||
|
||||
void export_print(Zipper &,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &projectname);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
SL1Archive() = default;
|
||||
explicit SL1Archive(const SLAPrinterConfig &cfg): m_cfg(cfg) {}
|
||||
explicit SL1Archive(SLAPrinterConfig &&cfg): m_cfg(std::move(cfg)) {}
|
||||
|
@ -224,4 +224,14 @@ sla::RasterEncoder SL1_SVGArchive::get_encoder() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SL1_SVGArchive::export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &projectname)
|
||||
{
|
||||
Zipper zipper{fname, Zipper::TIGHT_COMPRESSION};
|
||||
|
||||
SL1Archive::export_print(zipper, print, thumbnails, projectname);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -14,6 +14,11 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
void export_print(const std::string fname,
|
||||
const SLAPrint &print,
|
||||
const ThumbnailsList &thumbnails,
|
||||
const std::string &projectname = "") override;
|
||||
|
||||
using SL1Archive::SL1Archive;
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -818,7 +818,7 @@ private:
|
||||
}
|
||||
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
|
||||
ModelVolume(ModelObject *object, const ModelVolume &other, TriangleMesh &&mesh) :
|
||||
name(other.name), source(other.source), m_mesh(new TriangleMesh(std::move(mesh))), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
||||
name(other.name), source(other.source), config(other.config), object(object), m_mesh(new TriangleMesh(std::move(mesh))), m_type(other.m_type), m_transformation(other.m_transformation)
|
||||
{
|
||||
assert(this->id().valid());
|
||||
assert(this->config.id().valid());
|
||||
@ -833,7 +833,7 @@ private:
|
||||
assert(this->config.id() == other.config.id());
|
||||
this->set_material_id(other.material_id());
|
||||
this->config.set_new_unique_id();
|
||||
if (mesh.facets_count() > 1)
|
||||
if (m_mesh->facets_count() > 1)
|
||||
calculate_convex_hull();
|
||||
assert(this->config.id().valid());
|
||||
assert(this->config.id() != other.config.id());
|
||||
|
@ -1,82 +1,86 @@
|
||||
#ifndef _prusaslicer_technologies_h_
|
||||
#define _prusaslicer_technologies_h_
|
||||
|
||||
//=============
|
||||
// debug techs
|
||||
//=============
|
||||
// Shows camera target in the 3D scene
|
||||
#define ENABLE_SHOW_CAMERA_TARGET 0
|
||||
// Log debug messages to console when changing selection
|
||||
#define ENABLE_SELECTION_DEBUG_OUTPUT 0
|
||||
// Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active
|
||||
#define ENABLE_RENDER_SELECTION_CENTER 0
|
||||
// Shows an imgui dialog with camera related data
|
||||
#define ENABLE_CAMERA_STATISTICS 0
|
||||
// Render the picking pass instead of the main scene (use [T] key to toggle between regular rendering and picking pass only rendering)
|
||||
#define ENABLE_RENDER_PICKING_PASS 0
|
||||
// Enable extracting thumbnails from selected gcode and save them as png files
|
||||
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG 0
|
||||
// Disable synchronization of unselected instances
|
||||
#define DISABLE_INSTANCES_SYNCH 0
|
||||
// Use wxDataViewRender instead of wxDataViewCustomRenderer
|
||||
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING 0
|
||||
// Enable G-Code viewer statistics imgui dialog
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS 0
|
||||
// Enable G-Code viewer comparison between toolpaths height and width detected from gcode and calculated at gcode generation
|
||||
#define ENABLE_GCODE_VIEWER_DATA_CHECKING 0
|
||||
// Enable project dirty state manager debug window
|
||||
#define ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW 0
|
||||
// Disable using instanced models to render options in gcode preview
|
||||
#define DISABLE_GCODEVIEWER_INSTANCED_MODELS 1
|
||||
|
||||
|
||||
// Enable rendering of objects using environment map
|
||||
#define ENABLE_ENVIRONMENT_MAP 0
|
||||
// Enable smoothing of objects normals
|
||||
#define ENABLE_SMOOTH_NORMALS 0
|
||||
|
||||
|
||||
//====================
|
||||
// 2.5.0.alpha1 techs
|
||||
//====================
|
||||
#define ENABLE_2_5_0_ALPHA1 1
|
||||
|
||||
// Enable changes in preview layout
|
||||
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable drawing the items in legend toolbar using icons
|
||||
#define ENABLE_LEGEND_TOOLBAR_ICONS (1 && ENABLE_PREVIEW_LAYOUT)
|
||||
// Enable coloring of toolpaths in preview by layer time
|
||||
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing time estimate for travel moves in legend
|
||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable not killing focus in object manipulator fields when hovering over 3D scene
|
||||
#define ENABLE_OBJECT_MANIPULATOR_FOCUS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of wipe tower magic object_id equal to 1000
|
||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of legacy OpenGL calls
|
||||
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable OpenGL ES
|
||||
#define ENABLE_OPENGL_ES (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable OpenGL core profile context (tested against Mesa 20.1.8 on Windows)
|
||||
#define ENABLE_GL_CORE_PROFILE (1 && ENABLE_LEGACY_OPENGL_REMOVAL && !ENABLE_OPENGL_ES)
|
||||
// Shows an imgui dialog with GLModel statistics data
|
||||
#define ENABLE_GLMODEL_STATISTICS (0 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable show non-manifold edges
|
||||
#define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable rework of Reload from disk command
|
||||
#define ENABLE_RELOAD_FROM_DISK_REWORK (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing toolpaths center of gravity
|
||||
#define ENABLE_SHOW_TOOLPATHS_COG (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable recalculating toolpaths when switching to/from volumetric rate visualization
|
||||
#define ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified camera control using mouse
|
||||
#define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified rectangle selection
|
||||
#define ENABLE_NEW_RECTANGLE_SELECTION (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable alternative version of file_wildcards()
|
||||
#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable processing of gcode G2 and G3 lines
|
||||
#define ENABLE_PROCESS_G2_G3_LINES (1 && ENABLE_2_5_0_ALPHA1)
|
||||
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
#ifndef _prusaslicer_technologies_h_
|
||||
#define _prusaslicer_technologies_h_
|
||||
|
||||
//=============
|
||||
// debug techs
|
||||
//=============
|
||||
// Shows camera target in the 3D scene
|
||||
#define ENABLE_SHOW_CAMERA_TARGET 0
|
||||
// Log debug messages to console when changing selection
|
||||
#define ENABLE_SELECTION_DEBUG_OUTPUT 0
|
||||
// Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active
|
||||
#define ENABLE_RENDER_SELECTION_CENTER 0
|
||||
// Shows an imgui dialog with camera related data
|
||||
#define ENABLE_CAMERA_STATISTICS 0
|
||||
// Render the picking pass instead of the main scene (use [T] key to toggle between regular rendering and picking pass only rendering)
|
||||
#define ENABLE_RENDER_PICKING_PASS 0
|
||||
// Enable extracting thumbnails from selected gcode and save them as png files
|
||||
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG 0
|
||||
// Disable synchronization of unselected instances
|
||||
#define DISABLE_INSTANCES_SYNCH 0
|
||||
// Use wxDataViewRender instead of wxDataViewCustomRenderer
|
||||
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING 0
|
||||
// Enable G-Code viewer statistics imgui dialog
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS 0
|
||||
// Enable G-Code viewer comparison between toolpaths height and width detected from gcode and calculated at gcode generation
|
||||
#define ENABLE_GCODE_VIEWER_DATA_CHECKING 0
|
||||
// Enable project dirty state manager debug window
|
||||
#define ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW 0
|
||||
// Disable using instanced models to render options in gcode preview
|
||||
#define DISABLE_GCODEVIEWER_INSTANCED_MODELS 1
|
||||
|
||||
|
||||
// Enable rendering of objects using environment map
|
||||
#define ENABLE_ENVIRONMENT_MAP 0
|
||||
// Enable smoothing of objects normals
|
||||
#define ENABLE_SMOOTH_NORMALS 0
|
||||
|
||||
|
||||
//====================
|
||||
// 2.5.0.alpha1 techs
|
||||
//====================
|
||||
#define ENABLE_2_5_0_ALPHA1 1
|
||||
|
||||
// Enable changes in preview layout
|
||||
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable drawing the items in legend toolbar using icons
|
||||
#define ENABLE_LEGEND_TOOLBAR_ICONS (1 && ENABLE_PREVIEW_LAYOUT)
|
||||
// Enable coloring of toolpaths in preview by layer time
|
||||
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing time estimate for travel moves in legend
|
||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable not killing focus in object manipulator fields when hovering over 3D scene
|
||||
#define ENABLE_OBJECT_MANIPULATOR_FOCUS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of wipe tower magic object_id equal to 1000
|
||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of legacy OpenGL calls
|
||||
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable OpenGL ES
|
||||
#define ENABLE_OPENGL_ES (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable OpenGL core profile context (tested against Mesa 20.1.8 on Windows)
|
||||
#define ENABLE_GL_CORE_PROFILE (1 && ENABLE_LEGACY_OPENGL_REMOVAL && !ENABLE_OPENGL_ES)
|
||||
// Shows an imgui dialog with GLModel statistics data
|
||||
#define ENABLE_GLMODEL_STATISTICS (0 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable show non-manifold edges
|
||||
#define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable rework of Reload from disk command
|
||||
#define ENABLE_RELOAD_FROM_DISK_REWORK (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing toolpaths center of gravity
|
||||
#define ENABLE_SHOW_TOOLPATHS_COG (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable recalculating toolpaths when switching to/from volumetric rate visualization
|
||||
#define ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified camera control using mouse
|
||||
#define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified rectangle selection
|
||||
#define ENABLE_NEW_RECTANGLE_SELECTION (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable alternative version of file_wildcards()
|
||||
#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable processing of gcode G2 and G3 lines
|
||||
#define ENABLE_PROCESS_G2_G3_LINES (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable fix of used filament data exported to gcode file
|
||||
#define ENABLE_USED_FILAMENT_POST_PROCESS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable gizmo grabbers to share common models
|
||||
#define ENABLE_GIZMO_GRABBER_REFACTOR (1 && ENABLE_2_5_0_ALPHA1)
|
||||
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
@ -18,10 +18,19 @@ const float GLGizmoBase::Grabber::SizeFactor = 0.05f;
|
||||
const float GLGizmoBase::Grabber::MinHalfSize = 1.5f;
|
||||
const float GLGizmoBase::Grabber::DraggingScaleFactor = 1.25f;
|
||||
|
||||
void GLGizmoBase::Grabber::render(bool hover, float size)
|
||||
{
|
||||
render(size, hover ? complementary(color) : color, false);
|
||||
}
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
GLModel GLGizmoBase::Grabber::s_cube;
|
||||
GLModel GLGizmoBase::Grabber::s_cone;
|
||||
|
||||
GLGizmoBase::Grabber::~Grabber()
|
||||
{
|
||||
if (s_cube.is_initialized())
|
||||
s_cube.reset();
|
||||
|
||||
if (s_cone.is_initialized())
|
||||
s_cone.reset();
|
||||
}
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
float GLGizmoBase::Grabber::get_half_size(float size) const
|
||||
{
|
||||
@ -41,39 +50,151 @@ void GLGizmoBase::Grabber::render(float size, const ColorRGBA& render_color, boo
|
||||
return;
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
if (!m_cube.is_initialized()) {
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
if (!s_cube.is_initialized()) {
|
||||
#else
|
||||
if (!m_cube.is_initialized()) {
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
// This cannot be done in constructor, OpenGL is not yet
|
||||
// initialized at that point (on Linux at least).
|
||||
indexed_triangle_set its = its_make_cube(1., 1., 1.);
|
||||
indexed_triangle_set its = its_make_cube(1.0, 1.0, 1.0);
|
||||
its_translate(its, -0.5f * Vec3f::Ones());
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
m_cube.init_from(its);
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
s_cube.init_from(its);
|
||||
#else
|
||||
m_cube.init_from(its);
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#else
|
||||
m_cube.init_from(its, BoundingBoxf3{ { -0.5, -0.5, -0.5 }, { 0.5, 0.5, 0.5 } });
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
s_cube.init_from(its, BoundingBoxf3{ { -0.5, -0.5, -0.5 }, { 0.5, 0.5, 0.5 } });
|
||||
#else
|
||||
m_cube.init_from(its, BoundingBoxf3{ { -0.5, -0.5, -0.5 }, { 0.5, 0.5, 0.5 } });
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
}
|
||||
|
||||
const float fullsize = 2.0f * (dragging ? get_dragging_half_size(size) : get_half_size(size));
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
if (!s_cone.is_initialized())
|
||||
s_cone.init_from(its_make_cone(0.375, 1.5, double(PI) / 18.0));
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
const float half_size = dragging ? get_dragging_half_size(size) : get_half_size(size);
|
||||
#else
|
||||
const float fullsize = 2.0f * (dragging ? get_dragging_half_size(size) : get_half_size(size));
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
m_cube.set_color(render_color);
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
s_cube.set_color(render_color);
|
||||
s_cone.set_color(render_color);
|
||||
#else
|
||||
m_cube.set_color(render_color);
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
const Transform3d view_model_matrix = camera.get_view_matrix() * matrix * Geometry::assemble_transform(center, angles, fullsize * Vec3d::Ones());
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
const Transform3d view_model_matrix = camera.get_view_matrix() * matrix * Geometry::assemble_transform(center, angles, 2.0 * half_size * Vec3d::Ones());
|
||||
#else
|
||||
const Transform3d view_model_matrix = camera.get_view_matrix() * matrix * Geometry::assemble_transform(center, angles, fullsize * Vec3d::Ones());
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
const Transform3d& projection_matrix = camera.get_projection_matrix();
|
||||
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix);
|
||||
shader->set_uniform("projection_matrix", projection_matrix);
|
||||
shader->set_uniform("normal_matrix", (Matrix3d)view_model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
|
||||
#else
|
||||
m_cube.set_color(-1, render_color);
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
s_cube.set_color(-1, render_color);
|
||||
s_cone.set_color(-1, render_color);
|
||||
#else
|
||||
m_cube.set_color(-1, render_color);
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(center.x(), center.y(), center.z()));
|
||||
glsafe(::glRotated(Geometry::rad2deg(angles.z()), 0.0, 0.0, 1.0));
|
||||
glsafe(::glRotated(Geometry::rad2deg(angles.y()), 0.0, 1.0, 0.0));
|
||||
glsafe(::glRotated(Geometry::rad2deg(angles.x()), 1.0, 0.0, 0.0));
|
||||
glsafe(::glScaled(fullsize, fullsize, fullsize));
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
glsafe(::glScaled(2.0 * half_size, 2.0 * half_size, 2.0 * half_size));
|
||||
#else
|
||||
glsafe(::glScaled(fullsize, fullsize, fullsize));
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
m_cube.render();
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
s_cube.render();
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosX)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitX(), Vec3d(0.0, 0.5 * double(PI), 0.0)));
|
||||
s_cone.render();
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegX)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitX(), Vec3d(0.0, -0.5 * double(PI), 0.0)));
|
||||
s_cone.render();
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosY)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitY(), Vec3d(-0.5 * double(PI), 0.0, 0.0)));
|
||||
s_cone.render();
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegY)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitY(), Vec3d(0.5 * double(PI), 0.0, 0.0)));
|
||||
s_cone.render();
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosZ)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(Vec3d::UnitZ()));
|
||||
s_cone.render();
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegZ)) != 0) {
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix * Geometry::assemble_transform(-Vec3d::UnitZ(), Vec3d(double(PI), 0.0, 0.0)));
|
||||
s_cone.render();
|
||||
}
|
||||
#else
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosX)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(1.0, 0.0, 0.0));
|
||||
glsafe(::glRotated(0.5 * Geometry::rad2deg(double(PI)), 0.0, 1.0, 0.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegX)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(-1.0, 0.0, 0.0));
|
||||
glsafe(::glRotated(-0.5 * Geometry::rad2deg(double(PI)), 0.0, 1.0, 0.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosY)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(0.0, 1.0, 0.0));
|
||||
glsafe(::glRotated(-0.5 * Geometry::rad2deg(double(PI)), 1.0, 0.0, 0.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegY)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(0.0, -1.0, 0.0));
|
||||
glsafe(::glRotated(0.5 * Geometry::rad2deg(double(PI)), 1.0, 0.0, 0.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::PosZ)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(0.0, 0.0, 1.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
if ((int(extensions) & int(GLGizmoBase::EGrabberExtension::NegZ)) != 0) {
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(0.0, 0.0, -1.0));
|
||||
glsafe(::glRotated(Geometry::rad2deg(double(PI)), 1.0, 0.0, 0.0));
|
||||
s_cone.render();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#else
|
||||
m_cube.render();
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
glsafe(::glPopMatrix());
|
||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
@ -38,6 +38,19 @@ public:
|
||||
// (254 is choosen to leave some space for forward compatibility)
|
||||
static const unsigned int BASE_ID = 255 * 255 * 254;
|
||||
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
enum class EGrabberExtension
|
||||
{
|
||||
None = 0,
|
||||
PosX = 1 << 0,
|
||||
NegX = 1 << 1,
|
||||
PosY = 1 << 2,
|
||||
NegY = 1 << 3,
|
||||
PosZ = 1 << 4,
|
||||
NegZ = 1 << 5,
|
||||
};
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
protected:
|
||||
struct Grabber
|
||||
{
|
||||
@ -53,10 +66,16 @@ protected:
|
||||
Transform3d matrix{ Transform3d::Identity() };
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
ColorRGBA color{ ColorRGBA::WHITE() };
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
EGrabberExtension extensions{ EGrabberExtension::None };
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
Grabber() = default;
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
~Grabber();
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
void render(bool hover, float size);
|
||||
void render(bool hover, float size) { render(size, hover ? complementary(color) : color, false); }
|
||||
void render_for_picking(float size) { render(size, color, true); }
|
||||
|
||||
float get_half_size(float size) const;
|
||||
@ -65,7 +84,12 @@ protected:
|
||||
private:
|
||||
void render(float size, const ColorRGBA& render_color, bool picking);
|
||||
|
||||
GLModel m_cube;
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
static GLModel s_cube;
|
||||
static GLModel s_cone;
|
||||
#else
|
||||
GLModel m_cube;
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -49,8 +49,16 @@ bool GLGizmoMove3D::on_init()
|
||||
{
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
m_grabbers.push_back(Grabber());
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
m_grabbers.back().extensions = GLGizmoBase::EGrabberExtension::PosZ;
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
}
|
||||
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
m_grabbers[0].angles = { 0.0, 0.5 * double(PI), 0.0 };
|
||||
m_grabbers[1].angles = { -0.5 * double(PI), 0.0, 0.0 };
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
m_shortcut_key = WXK_CONTROL_M;
|
||||
|
||||
return true;
|
||||
@ -99,8 +107,10 @@ void GLGizmoMove3D::on_dragging(const UpdateData& data)
|
||||
|
||||
void GLGizmoMove3D::on_render()
|
||||
{
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
if (!m_cone.is_initialized())
|
||||
m_cone.init_from(its_make_cone(1.0, 1.0, double(PI) / 18.0));
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
|
||||
@ -196,10 +206,12 @@ void GLGizmoMove3D::on_render()
|
||||
|
||||
// draw grabbers
|
||||
render_grabbers(box);
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
if (m_grabbers[i].enabled)
|
||||
render_grabber_extension((Axis)i, box, false);
|
||||
}
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
}
|
||||
else {
|
||||
// draw axis
|
||||
@ -244,7 +256,9 @@ void GLGizmoMove3D::on_render()
|
||||
m_grabbers[m_hover_id].render(true, mean_size);
|
||||
shader->stop_using();
|
||||
}
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
render_grabber_extension((Axis)m_hover_id, box, false);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,9 +268,11 @@ void GLGizmoMove3D::on_render_for_picking()
|
||||
|
||||
const BoundingBoxf3& box = m_parent.get_selection().get_bounding_box();
|
||||
render_grabbers_for_picking(box);
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
render_grabber_extension(X, box, true);
|
||||
render_grabber_extension(Y, box, true);
|
||||
render_grabber_extension(Z, box, true);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
}
|
||||
|
||||
double GLGizmoMove3D::calc_projection(const UpdateData& data) const
|
||||
@ -285,6 +301,7 @@ double GLGizmoMove3D::calc_projection(const UpdateData& data) const
|
||||
return projection;
|
||||
}
|
||||
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking)
|
||||
{
|
||||
const float mean_size = float((box.size().x() + box.size().y() + box.size().z()) / 3.0);
|
||||
@ -339,6 +356,7 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box
|
||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
shader->stop_using();
|
||||
}
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
@ -1,70 +1,73 @@
|
||||
#ifndef slic3r_GLGizmoMove_hpp_
|
||||
#define slic3r_GLGizmoMove_hpp_
|
||||
|
||||
#include "GLGizmoBase.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class GLGizmoMove3D : public GLGizmoBase
|
||||
{
|
||||
static const double Offset;
|
||||
|
||||
Vec3d m_displacement{ Vec3d::Zero() };
|
||||
double m_snap_step{ 1.0 };
|
||||
Vec3d m_starting_drag_position{ Vec3d::Zero() };
|
||||
Vec3d m_starting_box_center{ Vec3d::Zero() };
|
||||
Vec3d m_starting_box_bottom_center{ Vec3d::Zero() };
|
||||
|
||||
GLModel m_cone;
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
struct GrabberConnection
|
||||
{
|
||||
GLModel model;
|
||||
Vec3d old_center{ Vec3d::Zero() };
|
||||
};
|
||||
std::array<GrabberConnection, 3> m_grabber_connections;
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
public:
|
||||
GLGizmoMove3D(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||
virtual ~GLGizmoMove3D() = default;
|
||||
|
||||
double get_snap_step(double step) const { return m_snap_step; }
|
||||
void set_snap_step(double step) { m_snap_step = step; }
|
||||
|
||||
std::string get_tooltip() const override;
|
||||
|
||||
/// <summary>
|
||||
/// Postpone to Grabber for move
|
||||
/// </summary>
|
||||
/// <param name="mouse_event">Keep information about mouse click</param>
|
||||
/// <returns>Return True when use the information otherwise False.</returns>
|
||||
bool on_mouse(const wxMouseEvent &mouse_event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Detect reduction of move for wipetover on selection change
|
||||
/// </summary>
|
||||
void data_changed() override;
|
||||
protected:
|
||||
bool on_init() override;
|
||||
std::string on_get_name() const override;
|
||||
bool on_is_activable() const override;
|
||||
void on_start_dragging() override;
|
||||
void on_stop_dragging() override;
|
||||
void on_dragging(const UpdateData& data) override;
|
||||
void on_render() override;
|
||||
void on_render_for_picking() override;
|
||||
|
||||
private:
|
||||
double calc_projection(const UpdateData& data) const;
|
||||
void render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking);
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_GLGizmoMove_hpp_
|
||||
#ifndef slic3r_GLGizmoMove_hpp_
|
||||
#define slic3r_GLGizmoMove_hpp_
|
||||
|
||||
#include "GLGizmoBase.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class GLGizmoMove3D : public GLGizmoBase
|
||||
{
|
||||
static const double Offset;
|
||||
|
||||
Vec3d m_displacement{ Vec3d::Zero() };
|
||||
double m_snap_step{ 1.0 };
|
||||
Vec3d m_starting_drag_position{ Vec3d::Zero() };
|
||||
Vec3d m_starting_box_center{ Vec3d::Zero() };
|
||||
Vec3d m_starting_box_bottom_center{ Vec3d::Zero() };
|
||||
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
GLModel m_cone;
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
struct GrabberConnection
|
||||
{
|
||||
GLModel model;
|
||||
Vec3d old_center{ Vec3d::Zero() };
|
||||
};
|
||||
std::array<GrabberConnection, 3> m_grabber_connections;
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
public:
|
||||
GLGizmoMove3D(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||
virtual ~GLGizmoMove3D() = default;
|
||||
|
||||
double get_snap_step(double step) const { return m_snap_step; }
|
||||
void set_snap_step(double step) { m_snap_step = step; }
|
||||
|
||||
std::string get_tooltip() const override;
|
||||
|
||||
/// <summary>
|
||||
/// Postpone to Grabber for move
|
||||
/// </summary>
|
||||
/// <param name="mouse_event">Keep information about mouse click</param>
|
||||
/// <returns>Return True when use the information otherwise False.</returns>
|
||||
bool on_mouse(const wxMouseEvent &mouse_event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Detect reduction of move for wipetover on selection change
|
||||
/// </summary>
|
||||
void data_changed() override;
|
||||
|
||||
protected:
|
||||
bool on_init() override;
|
||||
std::string on_get_name() const override;
|
||||
bool on_is_activable() const override;
|
||||
void on_start_dragging() override;
|
||||
void on_stop_dragging() override;
|
||||
void on_dragging(const UpdateData& data) override;
|
||||
void on_render() override;
|
||||
void on_render_for_picking() override;
|
||||
|
||||
private:
|
||||
double calc_projection(const UpdateData& data) const;
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
void render_grabber_extension(Axis axis, const BoundingBoxf3& box, bool picking);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_GLGizmoMove_hpp_
|
||||
|
@ -91,6 +91,9 @@ void GLGizmoRotate::disable_grabber() { m_grabbers[0].enabled = false; }
|
||||
bool GLGizmoRotate::on_init()
|
||||
{
|
||||
m_grabbers.push_back(Grabber());
|
||||
#if ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
m_grabbers.back().extensions = (GLGizmoBase::EGrabberExtension)(int(GLGizmoBase::EGrabberExtension::PosY) | int(GLGizmoBase::EGrabberExtension::NegY));
|
||||
#endif // ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -142,8 +145,10 @@ void GLGizmoRotate::on_render()
|
||||
if (!m_grabbers.front().enabled)
|
||||
return;
|
||||
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
if (!m_cone.is_initialized())
|
||||
m_cone.init_from(its_make_cone(1.0, 1.0, double(PI) / 12.0));
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
@ -229,7 +234,9 @@ void GLGizmoRotate::on_render()
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
render_grabber(box);
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
render_grabber_extension(box, false);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
glsafe(::glPopMatrix());
|
||||
@ -251,7 +258,9 @@ void GLGizmoRotate::on_render_for_picking()
|
||||
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
render_grabbers_for_picking(box);
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
render_grabber_extension(box, true);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
glsafe(::glPopMatrix());
|
||||
@ -576,7 +585,8 @@ void GLGizmoRotate::render_grabber(const BoundingBoxf3& box)
|
||||
render_grabbers(box);
|
||||
}
|
||||
|
||||
void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool picking)
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
\void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool picking)
|
||||
{
|
||||
const float mean_size = float((box.size().x() + box.size().y() + box.size().z()) / 3.0);
|
||||
const double size = m_dragging ? double(m_grabbers.front().get_dragging_half_size(mean_size)) : double(m_grabbers.front().get_half_size(mean_size));
|
||||
@ -648,6 +658,7 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick
|
||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
shader->stop_using();
|
||||
}
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
Transform3d GLGizmoRotate::local_transform(const Selection& selection) const
|
||||
|
@ -35,7 +35,9 @@ private:
|
||||
float m_snap_fine_in_radius{ 0.0f };
|
||||
float m_snap_fine_out_radius{ 0.0f };
|
||||
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
GLModel m_cone;
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
GLModel m_circle;
|
||||
GLModel m_scale;
|
||||
@ -55,6 +57,7 @@ private:
|
||||
|
||||
ColorRGBA m_drag_color;
|
||||
ColorRGBA m_highlight_color;
|
||||
|
||||
public:
|
||||
GLGizmoRotate(GLCanvas3D& parent, Axis axis);
|
||||
virtual ~GLGizmoRotate() = default;
|
||||
@ -104,7 +107,9 @@ private:
|
||||
void render_angle() const;
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
void render_grabber(const BoundingBoxf3& box);
|
||||
#if !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
void render_grabber_extension(const BoundingBoxf3& box, bool picking);
|
||||
#endif // !ENABLE_GIZMO_GRABBER_REFACTOR
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
Transform3d local_transform(const Selection& selection) const;
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
inp_choices.size(), inp_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
|
||||
|
||||
szchoices->Add(m_import_dropdown);
|
||||
szchoices->AddStretchSpacer(1);
|
||||
szchoices->Add(new wxStaticText(this, wxID_ANY, _L("Quality") + ": "), 0, wxALIGN_CENTER | wxALL, 5);
|
||||
|
||||
static const std::vector<wxString> qual_choices = {
|
||||
@ -65,7 +66,7 @@ public:
|
||||
m_quality_dropdown = new wxComboBox(
|
||||
this, wxID_ANY, qual_choices[0], wxDefaultPosition, wxDefaultSize,
|
||||
qual_choices.size(), qual_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
|
||||
szchoices->Add(m_quality_dropdown);
|
||||
szchoices->Add(m_quality_dropdown, 1);
|
||||
|
||||
m_import_dropdown->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &) {
|
||||
if (get_selection() == Sel::profileOnly)
|
||||
@ -73,14 +74,20 @@ public:
|
||||
else m_quality_dropdown->Enable();
|
||||
});
|
||||
|
||||
szvert->Add(szchoices, 0, wxALL, 5);
|
||||
szvert->AddStretchSpacer(1);
|
||||
szvert->Add(szchoices, 1, wxEXPAND | wxALL, 5);
|
||||
auto szbtn = new wxBoxSizer(wxHORIZONTAL);
|
||||
szbtn->Add(new wxButton{this, wxID_CANCEL});
|
||||
szbtn->Add(new wxButton{this, wxID_CANCEL}, 0, wxRIGHT, 5);
|
||||
szbtn->Add(new wxButton{this, wxID_OK});
|
||||
szvert->Add(szbtn, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
SetSizerAndFit(szvert);
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
int ShowModal() override
|
||||
{
|
||||
CenterOnParent();
|
||||
return wxDialog::ShowModal();
|
||||
}
|
||||
|
||||
Sel get_selection() const override
|
||||
|
@ -139,6 +139,7 @@ void SLAImportJob::finalize(bool canceled, std::exception_ptr &eptr)
|
||||
config += std::move(p->profile);
|
||||
|
||||
wxGetApp().preset_bundle->load_config_model(name, std::move(config));
|
||||
p->plater->check_selected_presets_visibility(ptSLA);
|
||||
wxGetApp().load_current_presets();
|
||||
}
|
||||
|
||||
|
@ -1821,6 +1821,8 @@ bool MainFrame::load_config_file(const std::string &path)
|
||||
show_error(this, ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_plater->check_selected_presets_visibility(ptFFF);
|
||||
wxGetApp().load_current_presets();
|
||||
return true;
|
||||
}
|
||||
|
@ -2336,6 +2336,52 @@ std::string Plater::priv::get_config(const std::string &key) const
|
||||
return wxGetApp().app_config->get(key);
|
||||
}
|
||||
|
||||
// After loading of the presets from project, check if they are visible.
|
||||
// Set them to visible if they are not.
|
||||
void Plater::check_selected_presets_visibility(PrinterTechnology loaded_printer_technology)
|
||||
{
|
||||
auto update_selected_preset_visibility = [](PresetCollection& presets, std::vector<std::string>& names) {
|
||||
if (!presets.get_selected_preset().is_visible) {
|
||||
assert(presets.get_selected_preset().name == presets.get_edited_preset().name);
|
||||
presets.get_selected_preset().is_visible = true;
|
||||
presets.get_edited_preset().is_visible = true;
|
||||
names.emplace_back(presets.get_selected_preset().name);
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<std::string> names;
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
if (loaded_printer_technology == ptFFF) {
|
||||
update_selected_preset_visibility(preset_bundle->prints, names);
|
||||
for (const std::string& filament : preset_bundle->filament_presets) {
|
||||
Preset* preset = preset_bundle->filaments.find_preset(filament);
|
||||
if (preset && !preset->is_visible) {
|
||||
preset->is_visible = true;
|
||||
names.emplace_back(preset->name);
|
||||
if (preset->name == preset_bundle->filaments.get_edited_preset().name)
|
||||
preset_bundle->filaments.get_selected_preset().is_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
update_selected_preset_visibility(preset_bundle->sla_prints, names);
|
||||
update_selected_preset_visibility(preset_bundle->sla_materials, names);
|
||||
}
|
||||
update_selected_preset_visibility(preset_bundle->printers, names);
|
||||
|
||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
|
||||
|
||||
// show notification about temporarily installed presets
|
||||
if (!names.empty()) {
|
||||
std::string notif_text = into_u8(_L_PLURAL("The preset below was temporarily installed on the active instance of PrusaSlicer",
|
||||
"The presets below were temporarily installed on the active instance of PrusaSlicer", names.size())) + ":";
|
||||
for (std::string& name : names)
|
||||
notif_text += "\n - " + name;
|
||||
get_notification_manager()->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units/* = false*/)
|
||||
{
|
||||
if (input_files.empty()) { return std::vector<size_t>(); }
|
||||
@ -2435,50 +2481,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
Preset::normalize(config);
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
preset_bundle->load_config_model(filename.string(), std::move(config));
|
||||
{
|
||||
// After loading of the presets from project, check if they are visible.
|
||||
// Set them to visible if they are not.
|
||||
|
||||
auto update_selected_preset_visibility = [](PresetCollection& presets, std::vector<std::string>& names) {
|
||||
if (!presets.get_selected_preset().is_visible) {
|
||||
assert(presets.get_selected_preset().name == presets.get_edited_preset().name);
|
||||
presets.get_selected_preset().is_visible = true;
|
||||
presets.get_edited_preset().is_visible = true;
|
||||
names.emplace_back(presets.get_selected_preset().name);
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<std::string> names;
|
||||
if (loaded_printer_technology == ptFFF) {
|
||||
update_selected_preset_visibility(preset_bundle->prints, names);
|
||||
for (const std::string& filament : preset_bundle->filament_presets) {
|
||||
Preset* preset = preset_bundle->filaments.find_preset(filament);
|
||||
if (preset && !preset->is_visible) {
|
||||
preset->is_visible = true;
|
||||
names.emplace_back(preset->name);
|
||||
if (preset->name == preset_bundle->filaments.get_edited_preset().name)
|
||||
preset_bundle->filaments.get_selected_preset().is_visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
update_selected_preset_visibility(preset_bundle->sla_prints, names);
|
||||
update_selected_preset_visibility(preset_bundle->sla_materials, names);
|
||||
}
|
||||
update_selected_preset_visibility(preset_bundle->printers, names);
|
||||
|
||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
|
||||
|
||||
// show notification about temporarily installed presets
|
||||
if (!names.empty()) {
|
||||
std::string notif_text = into_u8(_L_PLURAL("The preset below was temporarily installed on the active instance of PrusaSlicer",
|
||||
"The presets below were temporarily installed on the active instance of PrusaSlicer", names.size())) + ":";
|
||||
for (std::string& name : names)
|
||||
notif_text += "\n - " + name;
|
||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
|
||||
}
|
||||
}
|
||||
q->check_selected_presets_visibility(loaded_printer_technology);
|
||||
|
||||
if (loaded_printer_technology == ptFFF)
|
||||
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &preset_bundle->project_config);
|
||||
|
@ -175,6 +175,7 @@ public:
|
||||
std::vector<size_t> load_files(const std::vector<std::string>& input_files, bool load_model = true, bool load_config = true, bool imperial_units = false);
|
||||
// to be called on drag and drop
|
||||
bool load_files(const wxArrayString& filenames);
|
||||
void check_selected_presets_visibility(PrinterTechnology loaded_printer_technology);
|
||||
|
||||
const wxString& get_last_loaded_gcode() const { return m_last_loaded_gcode; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user