Merge branch 'master' into fs_emboss

# Conflicts:
#	src/libslic3r/Model.hpp
This commit is contained in:
Filip Sykala 2022-04-05 15:55:24 +02:00
commit 8719ec8977
40 changed files with 171 additions and 67 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,15 @@
#version 110
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
uniform vec4 uniform_color;
varying vec3 clipping_planes_dots;
void main()
{
if (any(lessThan(clipping_planes_dots, ZERO)))
discard;
gl_FragColor = uniform_color;
}

View File

@ -0,0 +1,23 @@
#version 110
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
uniform mat4 volume_world_matrix;
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
uniform vec2 z_range;
// Clipping plane - general orientation. Used by the SLA gizmo.
uniform vec4 clipping_plane;
attribute vec3 v_position;
varying vec3 clipping_planes_dots;
void main()
{
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0);
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
}

View File

@ -0,0 +1,17 @@
#version 140
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
uniform vec4 uniform_color;
in vec3 clipping_planes_dots;
out vec4 out_color;
void main()
{
if (any(lessThan(clipping_planes_dots, ZERO)))
discard;
out_color = uniform_color;
}

View File

@ -0,0 +1,23 @@
#version 140
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
uniform mat4 volume_world_matrix;
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
uniform vec2 z_range;
// Clipping plane - general orientation. Used by the SLA gizmo.
uniform vec4 clipping_plane;
in vec3 v_position;
out vec3 clipping_planes_dots;
void main()
{
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0);
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
}

View File

@ -552,7 +552,7 @@ static CircleBed to_circle(const Point &center, const Points& points) {
std::vector<double> vertex_distances;
double avg_dist = 0;
for (auto pt : points)
for (const Point& pt : points)
{
double distance = distance_to(center, pt);
vertex_distances.push_back(distance);

View File

@ -130,6 +130,8 @@ bool ColorRGB::operator < (const ColorRGB& other) const
for (size_t i = 0; i < 3; ++i) {
if (m_data[i] < other.m_data[i])
return true;
else if (m_data[i] > other.m_data[i])
return false;
}
return false;
@ -140,6 +142,8 @@ bool ColorRGB::operator > (const ColorRGB& other) const
for (size_t i = 0; i < 3; ++i) {
if (m_data[i] > other.m_data[i])
return true;
else if (m_data[i] < other.m_data[i])
return false;
}
return false;
@ -179,6 +183,8 @@ bool ColorRGBA::operator < (const ColorRGBA& other) const
for (size_t i = 0; i < 3; ++i) {
if (m_data[i] < other.m_data[i])
return true;
else if (m_data[i] > other.m_data[i])
return false;
}
return false;
@ -189,6 +195,8 @@ bool ColorRGBA::operator > (const ColorRGBA& other) const
for (size_t i = 0; i < 3; ++i) {
if (m_data[i] > other.m_data[i])
return true;
else if (m_data[i] < other.m_data[i])
return false;
}
return false;

View File

@ -306,7 +306,7 @@ ConfigOptionDef* ConfigDef::add_nullable(const t_config_option_key &opt_key, Con
std::ostream& ConfigDef::print_cli_help(std::ostream& out, bool show_defaults, std::function<bool(const ConfigOptionDef &)> filter) const
{
// prepare a function for wrapping text
auto wrap = [](std::string text, size_t line_length) -> std::string {
auto wrap = [](const std::string& text, size_t line_length) -> std::string {
std::istringstream words(text);
std::ostringstream wrapped;
std::string word;
@ -335,7 +335,7 @@ std::ostream& ConfigDef::print_cli_help(std::ostream& out, bool show_defaults, s
categories.insert(def.category);
}
for (auto category : categories) {
for (const std::string& category : categories) {
if (category != "") {
out << category << ":" << std::endl;
} else if (categories.size() > 1) {

View File

@ -41,7 +41,7 @@ extern void check_mode_for_custom_gcode_per_print_z(Info& info)
return;
bool is_single_extruder = true;
for (auto item : info.gcodes)
for (const Item& item : info.gcodes)
{
if (item.type == ToolChange) {
info.mode = MultiAsSingle;

View File

@ -171,10 +171,10 @@ inline Polylines to_polylines(ExPolygon &&src)
Polyline &pl = polylines[idx ++];
pl.points = std::move(src.contour.points);
pl.points.push_back(pl.points.front());
for (Polygons::const_iterator ith = src.holes.begin(); ith != src.holes.end(); ++ith) {
for (auto ith = src.holes.begin(); ith != src.holes.end(); ++ith) {
Polyline &pl = polylines[idx ++];
pl.points = std::move(ith->points);
pl.points.push_back(ith->points.front());
pl.points.push_back(pl.points.front());
}
assert(idx == polylines.size());
return polylines;
@ -185,14 +185,14 @@ inline Polylines to_polylines(ExPolygons &&src)
Polylines polylines;
polylines.assign(number_polygons(src), Polyline());
size_t idx = 0;
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++it) {
for (auto it = src.begin(); it != src.end(); ++it) {
Polyline &pl = polylines[idx ++];
pl.points = std::move(it->contour.points);
pl.points.push_back(pl.points.front());
for (Polygons::const_iterator ith = it->holes.begin(); ith != it->holes.end(); ++ith) {
for (auto ith = it->holes.begin(); ith != it->holes.end(); ++ith) {
Polyline &pl = polylines[idx ++];
pl.points = std::move(ith->points);
pl.points.push_back(ith->points.front());
pl.points.push_back(pl.points.front());
}
}
assert(idx == polylines.size());

View File

@ -242,7 +242,7 @@ public:
ExtrusionLoop(ExtrusionPaths &&paths, ExtrusionLoopRole role = elrDefault) : paths(std::move(paths)), m_loop_role(role) {}
ExtrusionLoop(const ExtrusionPath &path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
{ this->paths.push_back(path); }
ExtrusionLoop(const ExtrusionPath &&path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
ExtrusionLoop(ExtrusionPath &&path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
{ this->paths.emplace_back(std::move(path)); }
bool is_loop() const override{ return true; }
bool can_reverse() const override { return false; }

View File

@ -125,7 +125,7 @@ protected:
unsigned int /* thickness_layers */,
const std::pair<float, Point> & /* direction */,
ExPolygon /* expolygon */,
Polylines & /* polylines_out */) {};
Polylines & /* polylines_out */) {}
virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; }

View File

@ -18,7 +18,7 @@ class PrintObject;
namespace FillAdaptive {
struct Octree;
};
}
namespace FillLightning {
class Generator;

View File

@ -903,7 +903,7 @@ indexed_triangle_set ModelObject::raw_indexed_triangle_set() const
size_t j = out.indices.size();
append(out.vertices, v->mesh().its.vertices);
append(out.indices, v->mesh().its.indices);
auto m = v->get_matrix();
const Transform3d& m = v->get_matrix();
for (; i < out.vertices.size(); ++ i)
out.vertices[i] = (m * out.vertices[i].cast<double>()).cast<float>().eval();
if (v->is_left_handed()) {

View File

@ -815,9 +815,9 @@ private:
this->set_material_id(other.material_id());
}
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
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),
config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation),
text_configuration(other.text_configuration)
{
assert(this->id().valid());

View File

@ -220,10 +220,10 @@ inline Polylines to_polylines(Polygons &&polys)
Polylines polylines;
polylines.assign(polys.size(), Polyline());
size_t idx = 0;
for (Polygons::const_iterator it = polys.begin(); it != polys.end(); ++ it) {
for (auto it = polys.begin(); it != polys.end(); ++ it) {
Polyline &pl = polylines[idx ++];
pl.points = std::move(it->points);
pl.points.push_back(it->points.front());
pl.points.push_back(pl.points.front());
}
assert(idx == polylines.size());
return polylines;
@ -242,7 +242,7 @@ inline Polygons to_polygons(std::vector<Points> &&paths)
{
Polygons out;
out.reserve(paths.size());
for (const Points &path : paths)
for (Points &path : paths)
out.emplace_back(std::move(path));
return out;
}

View File

@ -139,7 +139,7 @@ inline Polylines to_polylines(std::vector<Points> &&paths)
{
Polylines out;
out.reserve(paths.size());
for (const Points &path : paths)
for (Points &path : paths)
out.emplace_back(std::move(path));
return out;
}

View File

@ -1498,7 +1498,7 @@ void PhysicalPrinter::update_preset_names_in_config()
if (!preset_names.empty()) {
std::vector<std::string>& values = config.option<ConfigOptionStrings>("preset_names")->values;
values.clear();
for (auto preset : preset_names)
for (const std::string& preset : preset_names)
values.push_back(preset);
// temporary workaround for compatibility with older Slicer
@ -1571,7 +1571,7 @@ void PhysicalPrinter::set_name(const std::string& name)
this->name = name;
}
std::string PhysicalPrinter::get_full_name(std::string preset_name) const
std::string PhysicalPrinter::get_full_name(const std::string& preset_name) const
{
return name + separator() + preset_name;
}
@ -1888,7 +1888,7 @@ std::vector<std::string> PhysicalPrinterCollection::get_printers_with_only_prese
{
std::vector<std::string> printers;
for (auto printer : m_printers)
for (const PhysicalPrinter& printer : m_printers)
if (printer.preset_names.size() == 1 && *printer.preset_names.begin() == preset_name)
printers.emplace_back(printer.name);

View File

@ -675,7 +675,7 @@ public:
bool operator<(const PhysicalPrinter& other) const { return this->name < other.name; }
// get full printer name included a name of the preset
std::string get_full_name(std::string preset_name) const;
std::string get_full_name(const std::string &preset_name) const;
// get printer name from the full name uncluded preset name
static std::string get_short_name(std::string full_name);

View File

@ -267,7 +267,7 @@ PresetsConfigSubstitutions PresetBundle::load_presets(AppConfig &config, Forward
std::string errors_cummulative;
std::tie(substitutions, errors_cummulative) = this->load_system_presets(substitution_rule);
const std::string dir_user_presets = data_dir()
const std::string& dir_user_presets = data_dir()
#ifdef SLIC3R_PROFILE_USE_PRESETS_SUBDIR
// Store the print/filament/printer presets into a "presets" directory.
+ "/presets"

View File

@ -885,9 +885,9 @@ std::string Print::export_gcode(const std::string& path_template, GCodeProcessor
message = L("Generating G-code");
this->set_status(90, message);
// The following line may die for multiple reasons.
GCode gcode;
gcode.do_export(this, path.c_str(), result, thumbnail_cb);
// Create GCode on heap, it has quite a lot of data.
std::unique_ptr<GCode> gcode(new GCode);
gcode->do_export(this, path.c_str(), result, thumbnail_cb);
return path.c_str();
}

View File

@ -58,11 +58,11 @@ public:
thickness(rhs.thickness), thickness_layers(rhs.thickness_layers),
bridge_angle(rhs.bridge_angle), extra_perimeters(rhs.extra_perimeters)
{};
Surface(SurfaceType _surface_type, const ExPolygon &&_expolygon)
Surface(SurfaceType _surface_type, ExPolygon &&_expolygon)
: surface_type(_surface_type), expolygon(std::move(_expolygon)),
thickness(-1), thickness_layers(1), bridge_angle(-1), extra_perimeters(0)
{};
Surface(const Surface &other, const ExPolygon &&_expolygon)
Surface(const Surface &other, ExPolygon &&_expolygon)
: surface_type(other.surface_type), expolygon(std::move(_expolygon)),
thickness(other.thickness), thickness_layers(other.thickness_layers),
bridge_angle(other.bridge_angle), extra_perimeters(other.extra_perimeters)
@ -159,7 +159,7 @@ inline ExPolygons to_expolygons(Surfaces &&src)
{
ExPolygons expolygons;
expolygons.reserve(src.size());
for (Surfaces::const_iterator it = src.begin(); it != src.end(); ++it)
for (auto it = src.begin(); it != src.end(); ++it)
expolygons.emplace_back(ExPolygon(std::move(it->expolygon)));
src.clear();
return expolygons;
@ -260,8 +260,8 @@ inline void surfaces_append(Surfaces &dst, ExPolygons &&src, SurfaceType surface
inline void surfaces_append(Surfaces &dst, ExPolygons &&src, const Surface &surfaceTempl)
{
dst.reserve(dst.size() + number_polygons(src));
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++ it)
dst.emplace_back(Surface(surfaceTempl, std::move(*it)));
for (ExPolygon& explg : src)
dst.emplace_back(Surface(surfaceTempl, std::move(explg)));
src.clear();
}

View File

@ -961,9 +961,11 @@ std::string string_printf(const char *format, ...)
buffer.resize(size_t(bufflen) + 1);
::vsnprintf(buffer.data(), buffer.size(), format, args2);
}
va_end(args1);
va_end(args2);
buffer.resize(bufflen);
return buffer;
}

View File

@ -1130,8 +1130,8 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
shader->set_uniform("z_range", m_z_range, 2);
shader->set_uniform("clipping_plane", m_clipping_plane, 4);
shader->set_uniform("z_range", m_z_range);
shader->set_uniform("clipping_plane", m_clipping_plane);
shader->set_uniform("print_volume.type", static_cast<int>(m_print_volume.type));
shader->set_uniform("print_volume.xy_data", m_print_volume.data);
shader->set_uniform("print_volume.z_data", m_print_volume.zs);

View File

@ -591,10 +591,10 @@ private:
PrintVolume m_print_volume;
// z range for clipping in shaders
float m_z_range[2];
std::array<float, 2> m_z_range;
// plane coeffs for clipping in shaders
float m_clipping_plane[4];
std::array<double, 4> m_clipping_plane;
struct Slope
{
@ -712,7 +712,10 @@ public:
void set_print_volume(const PrintVolume& print_volume) { m_print_volume = print_volume; }
void set_z_range(float min_z, float max_z) { m_z_range[0] = min_z; m_z_range[1] = max_z; }
void set_clipping_plane(const double* coeffs) { m_clipping_plane[0] = coeffs[0]; m_clipping_plane[1] = coeffs[1]; m_clipping_plane[2] = coeffs[2]; m_clipping_plane[3] = coeffs[3]; }
void set_clipping_plane(const std::array<double, 4>& coeffs) { m_clipping_plane = coeffs; }
const std::array<float, 2>& get_z_range() const { return m_z_range; }
const std::array<double, 4>& get_clipping_plane() const { return m_clipping_plane; }
bool is_slope_active() const { return m_slope.active; }
void set_slope_active(bool active) { m_slope.active = active; }

View File

@ -1084,7 +1084,7 @@ void Control::Ruler::update(const std::vector<double>& values, double scroll_ste
{
if (!m_parent || values.empty() ||
// check if need to update ruler in respect to input values
values.front() == m_min_val && values.back() == m_max_val && m_scroll_step == scroll_step && max_values.size() == m_max_values_cnt)
(values.front() == m_min_val && values.back() == m_max_val && m_scroll_step == scroll_step && max_values.size() == m_max_values_cnt))
return;
m_min_val = values.front();

View File

@ -5348,14 +5348,18 @@ void GLCanvas3D::_picking_pass()
glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
#if !ENABLE_GL_SHADERS_ATTRIBUTES
m_camera_clipping_plane = m_gizmos.get_clipping_plane();
if (m_camera_clipping_plane.is_active()) {
::glClipPlane(GL_CLIP_PLANE0, (GLdouble*)m_camera_clipping_plane.get_data());
::glEnable(GL_CLIP_PLANE0);
}
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
_render_volumes_for_picking();
#if !ENABLE_GL_SHADERS_ATTRIBUTES
if (m_camera_clipping_plane.is_active())
::glDisable(GL_CLIP_PLANE0);
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
const Camera& camera = wxGetApp().plater()->get_camera();
@ -5882,7 +5886,11 @@ void GLCanvas3D::_render_overlays()
void GLCanvas3D::_render_volumes_for_picking() const
{
#if ENABLE_LEGACY_OPENGL_REMOVAL
#if ENABLE_GL_SHADERS_ATTRIBUTES
GLShaderProgram* shader = wxGetApp().get_shader("flat_clip");
#else
GLShaderProgram* shader = wxGetApp().get_shader("flat");
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
if (shader == nullptr)
return;
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
@ -5914,6 +5922,9 @@ void GLCanvas3D::_render_volumes_for_picking() const
const Camera& camera = wxGetApp().plater()->get_camera();
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * volume.first->world_matrix());
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
shader->set_uniform("volume_world_matrix", volume.first->world_matrix());
shader->set_uniform("z_range", m_volumes.get_z_range());
shader->set_uniform("clipping_plane", m_volumes.get_clipping_plane());
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
volume.first->render();
#if ENABLE_LEGACY_OPENGL_REMOVAL

View File

@ -198,7 +198,6 @@ Vec2f GLModel::Geometry::extract_tex_coord_2(size_t id) const
return { *(start + 0), *(start + 1) };
}
#if ENABLE_LEGACY_OPENGL_REMOVAL
void GLModel::Geometry::set_vertex(size_t id, const Vec3f& position, const Vec3f& normal)
{
assert(format.vertex_layout == EVertexLayout::P3N3);
@ -240,7 +239,6 @@ void GLModel::Geometry::remove_vertex(size_t id)
vertices.erase(it, it + stride);
}
}
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
size_t GLModel::Geometry::vertex_stride_floats(const Format& format)
{

View File

@ -85,8 +85,7 @@ namespace GUI {
ColorRGBA color{ ColorRGBA::BLACK() };
void reserve_vertices(size_t vertices_count) { vertices.reserve(vertices_count * vertex_stride_floats(format)); }
void reserve_indices(size_t indices_count) { indices.reserve(indices_count * index_stride_bytes(*this)); }
void reserve_indices(size_t indices_count) { indices.reserve(indices_count); }
void add_vertex(const Vec2f& position); // EVertexLayout::P2
void add_vertex(const Vec2f& position, const Vec2f& tex_coord); // EVertexLayout::P2T2

View File

@ -264,6 +264,12 @@ void GLShaderProgram::set_uniform(int id, const std::array<float, 4>& value) con
glsafe(::glUniform4fv(id, 1, static_cast<const GLfloat*>(value.data())));
}
void GLShaderProgram::set_uniform(int id, const std::array<double, 4>& value) const
{
const std::array<float, 4> f_value = { float(value[0]), float(value[1]), float(value[2]), float(value[3]) };
set_uniform(id, f_value);
}
void GLShaderProgram::set_uniform(int id, const float* value, size_t size) const
{
if (id >= 0) {

View File

@ -57,6 +57,7 @@ public:
void set_uniform(const char* name, const std::array<float, 2>& value) const { set_uniform(get_uniform_location(name), value); }
void set_uniform(const char* name, const std::array<float, 3>& value) const { set_uniform(get_uniform_location(name), value); }
void set_uniform(const char* name, const std::array<float, 4>& value) const { set_uniform(get_uniform_location(name), value); }
void set_uniform(const char* name, const std::array<double, 4>& value) const { set_uniform(get_uniform_location(name), value); }
void set_uniform(const char* name, const float* value, size_t size) const { set_uniform(get_uniform_location(name), value, size); }
void set_uniform(const char* name, const Transform3f& value) const { set_uniform(get_uniform_location(name), value); }
void set_uniform(const char* name, const Transform3d& value) const { set_uniform(get_uniform_location(name), value); }
@ -83,6 +84,7 @@ public:
void set_uniform(int id, const std::array<float, 2>& value) const;
void set_uniform(int id, const std::array<float, 3>& value) const;
void set_uniform(int id, const std::array<float, 4>& value) const;
void set_uniform(int id, const std::array<double, 4>& value) const;
void set_uniform(int id, const float* value, size_t size) const;
void set_uniform(int id, const Transform3f& value) const;
void set_uniform(int id, const Transform3d& value) const;

View File

@ -40,6 +40,8 @@ std::pair<bool, std::string> GLShadersManager::init()
valid &= append_shader("imgui", { prefix + "imgui.vs", prefix + "imgui.fs" });
// basic shader, used to render all what was previously rendered using the immediate mode
valid &= append_shader("flat", { prefix + "flat.vs", prefix + "flat.fs" });
// basic shader with plane clipping, used to render volumes in picking pass
valid &= append_shader("flat_clip", { prefix + "flat_clip.vs", prefix + "flat_clip.fs" });
// basic shader for textures, used to render textures
valid &= append_shader("flat_texture", { prefix + "flat_texture.vs", prefix + "flat_texture.fs" });
// used to render 3D scene background

View File

@ -530,9 +530,6 @@ wxExecuteEnv get_appimage_exec_env()
} // namespace
void desktop_execute(const char* argv[])
{
if (sizeof(argv) == 0)
return;
// Check if we're running in an AppImage container, if so, we need to remove AppImage's env vars,
// because they may mess up the environment expected by the file manager.
// Mostly this is about LD_LIBRARY_PATH, but we remove a few more too for good measure.

View File

@ -25,16 +25,14 @@ struct Camera;
// lm_FIXME: Following class might possibly be replaced by Eigen::Hyperplane
class ClippingPlane
{
double m_data[4];
std::array<double, 4> m_data;
public:
ClippingPlane()
{
ClippingPlane() {
*this = ClipsNothing();
}
ClippingPlane(const Vec3d& direction, double offset)
{
ClippingPlane(const Vec3d& direction, double offset) {
set_normal(direction);
set_offset(offset);
}
@ -50,8 +48,7 @@ public:
}
bool is_point_clipped(const Vec3d& point) const { return distance(point) < 0.; }
void set_normal(const Vec3d& normal)
{
void set_normal(const Vec3d& normal) {
const Vec3d norm_dir = normal.normalized();
m_data[0] = norm_dir.x();
m_data[1] = norm_dir.y();
@ -62,12 +59,11 @@ public:
Vec3d get_normal() const { return Vec3d(m_data[0], m_data[1], m_data[2]); }
bool is_active() const { return m_data[3] != DBL_MAX; }
static ClippingPlane ClipsNothing() { return ClippingPlane(Vec3d(0., 0., 1.), DBL_MAX); }
const double* get_data() const { return m_data; }
const std::array<double, 4>& get_data() const { return m_data; }
// Serialization through cereal library
template <class Archive>
void serialize( Archive & ar )
{
void serialize( Archive & ar ) {
ar( m_data[0], m_data[1], m_data[2], m_data[3] );
}
};

View File

@ -160,8 +160,8 @@ public:
// customization of the message box buttons
virtual bool SetYesNoLabels(const wxMD::ButtonLabel& yes, const wxMD::ButtonLabel& no)
{
DoSetCustomLabel(m_yes, yes);
DoSetCustomLabel(m_no, no);
DoSetCustomLabel(m_yes, yes, wxID_YES);
DoSetCustomLabel(m_no, no, wxID_NO);
return true;
}
@ -169,29 +169,29 @@ public:
const wxMD::ButtonLabel& no,
const wxMD::ButtonLabel& cancel)
{
DoSetCustomLabel(m_yes, yes);
DoSetCustomLabel(m_no, no);
DoSetCustomLabel(m_cancel, cancel);
DoSetCustomLabel(m_yes, yes, wxID_YES);
DoSetCustomLabel(m_no, no, wxID_NO);
DoSetCustomLabel(m_cancel, cancel, wxID_CANCEL);
return true;
}
virtual bool SetOKLabel(const wxMD::ButtonLabel& ok)
{
DoSetCustomLabel(m_ok, ok);
DoSetCustomLabel(m_ok, ok, wxID_OK);
return true;
}
virtual bool SetOKCancelLabels(const wxMD::ButtonLabel& ok,
const wxMD::ButtonLabel& cancel)
{
DoSetCustomLabel(m_ok, ok);
DoSetCustomLabel(m_cancel, cancel);
DoSetCustomLabel(m_ok, ok, wxID_OK);
DoSetCustomLabel(m_cancel, cancel, wxID_CANCEL);
return true;
}
virtual bool SetHelpLabel(const wxMD::ButtonLabel& help)
{
DoSetCustomLabel(m_help, help);
DoSetCustomLabel(m_help, help, wxID_HELP);
return true;
}
// test if any custom labels were set
@ -230,9 +230,10 @@ protected:
// the value to var with possibly some transformation (e.g. Cocoa version
// currently uses this to remove any accelerators from the button strings
// while GTK+ one handles stock items specifically here)
void DoSetCustomLabel(wxString& var, const wxMD::ButtonLabel& label)
void DoSetCustomLabel(wxString& var, const wxMD::ButtonLabel& label, wxWindowID btn_id)
{
var = label.GetAsString();
SetButtonLabel(btn_id, var);
}
// these functions return the custom label or empty string and should be

View File

@ -1700,6 +1700,7 @@ struct Plater::priv
std::string act = wxGetApp().app_config->get(act_key);
if (act.empty()) {
RichMessageDialog dialog(mainframe, reason + "\n" + format_wxstr(_L("Do you want to save the changes to \"%1%\"?"), suggested_project_name), wxString(SLIC3R_APP_NAME), wxYES_NO | wxCANCEL);
dialog.SetYesNoLabels(_L("Save"), _L("Discard"));
dialog.ShowCheckBox(_L("Remember my choice"));
res = dialog.ShowModal();
if (res != wxID_CANCEL)

View File

@ -207,7 +207,7 @@ bool AppUpdateDownloadDialog::run_after_download() const
boost::filesystem::path AppUpdateDownloadDialog::get_download_path() const
{
return std::move(boost::filesystem::path(txtctrl_path->GetValue().ToUTF8().data()));
return boost::filesystem::path(txtctrl_path->GetValue().ToUTF8().data());
}
// MsgUpdateConfig