Fixed conflicts after merge with master
This commit is contained in:
commit
1238afbdfd
@ -1837,6 +1837,7 @@ namespace Slic3r {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int geo_tri_count = (unsigned int)geometry.triangles.size() / 3;
|
unsigned int geo_tri_count = (unsigned int)geometry.triangles.size() / 3;
|
||||||
|
unsigned int renamed_volumes_count = 0;
|
||||||
|
|
||||||
for (const ObjectMetadata::VolumeMetadata& volume_data : volumes) {
|
for (const ObjectMetadata::VolumeMetadata& volume_data : volumes) {
|
||||||
if (geo_tri_count <= volume_data.first_triangle_id || geo_tri_count <= volume_data.last_triangle_id || volume_data.last_triangle_id < volume_data.first_triangle_id) {
|
if (geo_tri_count <= volume_data.first_triangle_id || geo_tri_count <= volume_data.last_triangle_id || volume_data.last_triangle_id < volume_data.first_triangle_id) {
|
||||||
@ -1846,11 +1847,17 @@ namespace Slic3r {
|
|||||||
|
|
||||||
Transform3d volume_matrix_to_object = Transform3d::Identity();
|
Transform3d volume_matrix_to_object = Transform3d::Identity();
|
||||||
bool has_transform = false;
|
bool has_transform = false;
|
||||||
|
#if ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
bool is_left_handed = false;
|
||||||
|
#endif // ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
// extract the volume transformation from the volume's metadata, if present
|
// extract the volume transformation from the volume's metadata, if present
|
||||||
for (const Metadata& metadata : volume_data.metadata) {
|
for (const Metadata& metadata : volume_data.metadata) {
|
||||||
if (metadata.key == MATRIX_KEY) {
|
if (metadata.key == MATRIX_KEY) {
|
||||||
volume_matrix_to_object = Slic3r::Geometry::transform3d_from_string(metadata.value);
|
volume_matrix_to_object = Slic3r::Geometry::transform3d_from_string(metadata.value);
|
||||||
has_transform = ! volume_matrix_to_object.isApprox(Transform3d::Identity(), 1e-10);
|
has_transform = ! volume_matrix_to_object.isApprox(Transform3d::Identity(), 1e-10);
|
||||||
|
#if ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
is_left_handed = Slic3r::Geometry::Transformation(volume_matrix_to_object).is_left_handed();
|
||||||
|
#endif // ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1882,6 +1889,13 @@ namespace Slic3r {
|
|||||||
stl_get_size(&stl);
|
stl_get_size(&stl);
|
||||||
triangle_mesh.repair();
|
triangle_mesh.repair();
|
||||||
|
|
||||||
|
#if ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
// PrusaSlicer older than 2.4.0 saved mirrored volumes with reversed winding of the triangles
|
||||||
|
// This caused the call to TriangleMesh::repair() to reverse all the facets because the calculated volume was negative
|
||||||
|
if (is_left_handed && stl.stats.facets_reversed > 0 && stl.stats.facets_reversed == stl.stats.original_num_facets)
|
||||||
|
stl.stats.facets_reversed = 0;
|
||||||
|
#endif // ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
|
||||||
if (m_version == 0) {
|
if (m_version == 0) {
|
||||||
// if the 3mf was not produced by PrusaSlicer and there is only one instance,
|
// if the 3mf was not produced by PrusaSlicer and there is only one instance,
|
||||||
// bake the transformation into the geometry to allow the reload from disk command
|
// bake the transformation into the geometry to allow the reload from disk command
|
||||||
@ -1945,6 +1959,14 @@ namespace Slic3r {
|
|||||||
else
|
else
|
||||||
volume->config.set_deserialize(metadata.key, metadata.value, config_substitutions);
|
volume->config.set_deserialize(metadata.key, metadata.value, config_substitutions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this may happen for 3mf saved by 3rd part softwares
|
||||||
|
if (volume->name.empty()) {
|
||||||
|
volume->name = object.name;
|
||||||
|
if (renamed_volumes_count > 0)
|
||||||
|
volume->name += "_" + std::to_string(renamed_volumes_count + 1);
|
||||||
|
++renamed_volumes_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2506,6 +2528,10 @@ namespace Slic3r {
|
|||||||
if (volume == nullptr)
|
if (volume == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#if ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
bool is_left_handed = volume->is_left_handed();
|
||||||
|
#endif // ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
|
||||||
VolumeToOffsetsMap::iterator volume_it = volumes_offsets.find(volume);
|
VolumeToOffsetsMap::iterator volume_it = volumes_offsets.find(volume);
|
||||||
assert(volume_it != volumes_offsets.end());
|
assert(volume_it != volumes_offsets.end());
|
||||||
|
|
||||||
@ -2520,6 +2546,15 @@ namespace Slic3r {
|
|||||||
{
|
{
|
||||||
const Vec3i &idx = its.indices[i];
|
const Vec3i &idx = its.indices[i];
|
||||||
char *ptr = buf;
|
char *ptr = buf;
|
||||||
|
#if ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
|
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
|
||||||
|
" v1=\"" << boost::spirit::int_ <<
|
||||||
|
"\" v2=\"" << boost::spirit::int_ <<
|
||||||
|
"\" v3=\"" << boost::spirit::int_ << "\"",
|
||||||
|
idx[is_left_handed ? 2 : 0] + volume_it->second.first_vertex_id,
|
||||||
|
idx[1] + volume_it->second.first_vertex_id,
|
||||||
|
idx[is_left_handed ? 0 : 2] + volume_it->second.first_vertex_id);
|
||||||
|
#else
|
||||||
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
|
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
|
||||||
" v1=\"" << boost::spirit::int_ <<
|
" v1=\"" << boost::spirit::int_ <<
|
||||||
"\" v2=\"" << boost::spirit::int_ <<
|
"\" v2=\"" << boost::spirit::int_ <<
|
||||||
@ -2527,6 +2562,7 @@ namespace Slic3r {
|
|||||||
idx[0] + volume_it->second.first_vertex_id,
|
idx[0] + volume_it->second.first_vertex_id,
|
||||||
idx[1] + volume_it->second.first_vertex_id,
|
idx[1] + volume_it->second.first_vertex_id,
|
||||||
idx[2] + volume_it->second.first_vertex_id);
|
idx[2] + volume_it->second.first_vertex_id);
|
||||||
|
#endif // ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
output_buffer += buf;
|
output_buffer += buf;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
#define ENABLE_SINKING_CONTOURS (1 && ENABLE_2_4_0_ALPHA0)
|
#define ENABLE_SINKING_CONTOURS (1 && ENABLE_2_4_0_ALPHA0)
|
||||||
// Enable implementation of retract acceleration in gcode processor
|
// Enable implementation of retract acceleration in gcode processor
|
||||||
#define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA0)
|
#define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA0)
|
||||||
|
// Enable the fix for exporting and importing to/from 3mf file of mirrored volumes
|
||||||
|
#define ENABLE_FIX_MIRRORED_VOLUMES_3MF_IMPORT_EXPORT (1 && ENABLE_2_4_0_ALPHA0)
|
||||||
// Enable rendering seams (and other options) in preview using models
|
// Enable rendering seams (and other options) in preview using models
|
||||||
#define ENABLE_SEAMS_USING_MODELS (1 && ENABLE_2_4_0_ALPHA0)
|
#define ENABLE_SEAMS_USING_MODELS (1 && ENABLE_2_4_0_ALPHA0)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace {
|
|||||||
std::string escape_string(const std::string& str)
|
std::string escape_string(const std::string& str)
|
||||||
{
|
{
|
||||||
// The buffer needs to be bigger if escaping <,>,&
|
// The buffer needs to be bigger if escaping <,>,&
|
||||||
std::vector<char> out(str.size() * 2, 0);
|
std::vector<char> out(str.size() * 4, 0);
|
||||||
char *outptr = out.data();
|
char *outptr = out.data();
|
||||||
for (size_t i = 0; i < str.size(); ++ i) {
|
for (size_t i = 0; i < str.size(); ++ i) {
|
||||||
char c = str[i];
|
char c = str[i];
|
||||||
@ -45,6 +45,8 @@ std::string escape_string(const std::string& str)
|
|||||||
} else if (c == '\\') { // backslash character
|
} else if (c == '\\') { // backslash character
|
||||||
(*outptr ++) = '\\';
|
(*outptr ++) = '\\';
|
||||||
(*outptr ++) = '\\';
|
(*outptr ++) = '\\';
|
||||||
|
(*outptr ++) = '\\';
|
||||||
|
(*outptr ++) = '\\';
|
||||||
// Reserved characters
|
// Reserved characters
|
||||||
// At Ubuntu, all these characters must NOT be escaped for desktop integration to work
|
// At Ubuntu, all these characters must NOT be escaped for desktop integration to work
|
||||||
/*
|
/*
|
||||||
|
@ -19,6 +19,9 @@ protected:
|
|||||||
|
|
||||||
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
||||||
|
|
||||||
|
std::string get_gizmo_entering_text() const override { return _u8L("Entering Paint-on supports"); }
|
||||||
|
std::string get_gizmo_leaving_text() const override { return _u8L("Leaving Paint-on supports"); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool on_init() override;
|
bool on_init() override;
|
||||||
|
|
||||||
|
@ -128,6 +128,9 @@ protected:
|
|||||||
|
|
||||||
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
||||||
|
|
||||||
|
std::string get_gizmo_entering_text() const override { return _u8L("Entering Multimaterial painting"); }
|
||||||
|
std::string get_gizmo_leaving_text() const override { return _u8L("Leaving Multimaterial painting"); }
|
||||||
|
|
||||||
size_t m_first_selected_extruder_idx = 0;
|
size_t m_first_selected_extruder_idx = 0;
|
||||||
size_t m_second_selected_extruder_idx = 1;
|
size_t m_second_selected_extruder_idx = 1;
|
||||||
std::vector<std::string> m_original_extruders_names;
|
std::vector<std::string> m_original_extruders_names;
|
||||||
|
@ -47,20 +47,14 @@ void GLGizmoPainterBase::activate_internal_undo_redo_stack(bool activate)
|
|||||||
plater->undo_redo_topmost_string_getter(plater->can_undo(), last_snapshot_name);
|
plater->undo_redo_topmost_string_getter(plater->can_undo(), last_snapshot_name);
|
||||||
|
|
||||||
if (activate && !m_internal_stack_active) {
|
if (activate && !m_internal_stack_active) {
|
||||||
std::string str = get_painter_type() == PainterGizmoType::FDM_SUPPORTS
|
if (std::string str = this->get_gizmo_entering_text(); last_snapshot_name != str)
|
||||||
? _u8L("Entering Paint-on supports")
|
|
||||||
: _u8L("Entering Seam painting");
|
|
||||||
if (last_snapshot_name != str)
|
|
||||||
Plater::TakeSnapshot(plater, str);
|
Plater::TakeSnapshot(plater, str);
|
||||||
plater->enter_gizmos_stack();
|
plater->enter_gizmos_stack();
|
||||||
m_internal_stack_active = true;
|
m_internal_stack_active = true;
|
||||||
}
|
}
|
||||||
if (!activate && m_internal_stack_active) {
|
if (!activate && m_internal_stack_active) {
|
||||||
plater->leave_gizmos_stack();
|
plater->leave_gizmos_stack();
|
||||||
std::string str = get_painter_type() == PainterGizmoType::SEAM
|
if (std::string str = this->get_gizmo_leaving_text(); last_snapshot_name != str)
|
||||||
? _u8L("Leaving Seam painting")
|
|
||||||
: _u8L("Leaving Paint-on supports");
|
|
||||||
if (last_snapshot_name != str)
|
|
||||||
Plater::TakeSnapshot(plater, str);
|
Plater::TakeSnapshot(plater, str);
|
||||||
m_internal_stack_active = false;
|
m_internal_stack_active = false;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,9 @@ protected:
|
|||||||
|
|
||||||
virtual wxString handle_snapshot_action_name(bool shift_down, Button button_down) const = 0;
|
virtual wxString handle_snapshot_action_name(bool shift_down, Button button_down) const = 0;
|
||||||
|
|
||||||
|
virtual std::string get_gizmo_entering_text() const = 0;
|
||||||
|
virtual std::string get_gizmo_leaving_text() const = 0;
|
||||||
|
|
||||||
friend class ::Slic3r::GUI::GLGizmoMmuSegmentation;
|
friend class ::Slic3r::GUI::GLGizmoMmuSegmentation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ protected:
|
|||||||
|
|
||||||
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;
|
||||||
|
|
||||||
|
std::string get_gizmo_entering_text() const override { return _u8L("Entering Seam painting"); }
|
||||||
|
std::string get_gizmo_leaving_text() const override { return _u8L("Leaving Seam painting"); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool on_init() override;
|
bool on_init() override;
|
||||||
|
|
||||||
|
@ -620,7 +620,10 @@ void MainFrame::update_title()
|
|||||||
wxString dirty_marker = (!m_plater->model().objects.empty() && m_plater->is_project_dirty()) ? "*" : "";
|
wxString dirty_marker = (!m_plater->model().objects.empty() && m_plater->is_project_dirty()) ? "*" : "";
|
||||||
if (!dirty_marker.empty() || !project.empty()) {
|
if (!dirty_marker.empty() || !project.empty()) {
|
||||||
if (!dirty_marker.empty() && project.empty())
|
if (!dirty_marker.empty() && project.empty())
|
||||||
project = _("Untitled");
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
project = _L("Untitled");
|
||||||
|
// project = _("Untitled");
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
title = dirty_marker + project + " - ";
|
title = dirty_marker + project + " - ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -819,7 +822,7 @@ bool MainFrame::is_active_and_shown_tab(Tab* tab)
|
|||||||
|
|
||||||
bool MainFrame::can_start_new_project() const
|
bool MainFrame::can_start_new_project() const
|
||||||
{
|
{
|
||||||
return (m_plater != nullptr) && (!m_plater->get_project_filename(".3mf").IsEmpty() || !m_plater->model().objects.empty());
|
return (m_plater != nullptr) && (!m_plater->get_project_filename(".3mf").IsEmpty() || GetTitle().StartsWith('*') || !m_plater->model().objects.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainFrame::can_save() const
|
bool MainFrame::can_save() const
|
||||||
|
Loading…
Reference in New Issue
Block a user