diff --git a/resources/icons/PrusaSlicer-gcodeviewer.svg b/resources/icons/PrusaSlicer-gcodeviewer.svg
new file mode 100644
index 000000000..6312beee3
--- /dev/null
+++ b/resources/icons/PrusaSlicer-gcodeviewer.svg
@@ -0,0 +1,73 @@
+
+
+
diff --git a/resources/icons/prusa_slicer_logo.svg b/resources/icons/PrusaSlicer.svg
similarity index 100%
rename from resources/icons/prusa_slicer_logo.svg
rename to resources/icons/PrusaSlicer.svg
diff --git a/resources/icons/colorchange_add_off.png b/resources/icons/colorchange_add_off.png
deleted file mode 100644
index 6ddeccbe0..000000000
Binary files a/resources/icons/colorchange_add_off.png and /dev/null differ
diff --git a/resources/icons/colorchange_add_on.png b/resources/icons/colorchange_add_on.png
deleted file mode 100644
index cc800b81e..000000000
Binary files a/resources/icons/colorchange_add_on.png and /dev/null differ
diff --git a/resources/icons/colorchange_delete_off.png b/resources/icons/colorchange_delete_off.png
deleted file mode 100644
index c16655271..000000000
Binary files a/resources/icons/colorchange_delete_off.png and /dev/null differ
diff --git a/resources/icons/colorchange_delete_on.png b/resources/icons/colorchange_delete_on.png
deleted file mode 100644
index 8f27ce9fe..000000000
Binary files a/resources/icons/colorchange_delete_on.png and /dev/null differ
diff --git a/resources/icons/down_half_circle.png b/resources/icons/down_half_circle.png
deleted file mode 100644
index f86a2932c..000000000
Binary files a/resources/icons/down_half_circle.png and /dev/null differ
diff --git a/resources/icons/left_half_circle.png b/resources/icons/left_half_circle.png
deleted file mode 100644
index 3bdc4c3ee..000000000
Binary files a/resources/icons/left_half_circle.png and /dev/null differ
diff --git a/resources/icons/mirroring_transparent.png b/resources/icons/mirroring_transparent.png
deleted file mode 100644
index 841010fcc..000000000
Binary files a/resources/icons/mirroring_transparent.png and /dev/null differ
diff --git a/resources/icons/mirroring_transparent.svg b/resources/icons/mirroring_transparent.svg
new file mode 100644
index 000000000..c0e831cc3
--- /dev/null
+++ b/resources/icons/mirroring_transparent.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/resources/icons/mode_advanced_.png b/resources/icons/mode_advanced_.png
deleted file mode 100644
index d98d8f709..000000000
Binary files a/resources/icons/mode_advanced_.png and /dev/null differ
diff --git a/resources/icons/mode_advanced_sq.png b/resources/icons/mode_advanced_sq.png
deleted file mode 100644
index 6df2a52fe..000000000
Binary files a/resources/icons/mode_advanced_sq.png and /dev/null differ
diff --git a/resources/icons/mode_expert_.png b/resources/icons/mode_expert_.png
deleted file mode 100644
index 4d78bcccf..000000000
Binary files a/resources/icons/mode_expert_.png and /dev/null differ
diff --git a/resources/icons/mode_expert_sq.png b/resources/icons/mode_expert_sq.png
deleted file mode 100644
index 742ffc088..000000000
Binary files a/resources/icons/mode_expert_sq.png and /dev/null differ
diff --git a/resources/icons/mode_simple_.png b/resources/icons/mode_simple_.png
deleted file mode 100644
index aac2b61b0..000000000
Binary files a/resources/icons/mode_simple_.png and /dev/null differ
diff --git a/resources/icons/mode_simple_sq.png b/resources/icons/mode_simple_sq.png
deleted file mode 100644
index cb8ab7bd4..000000000
Binary files a/resources/icons/mode_simple_sq.png and /dev/null differ
diff --git a/resources/icons/one_layer_lock_off.png b/resources/icons/one_layer_lock_off.png
deleted file mode 100644
index f6e61d058..000000000
Binary files a/resources/icons/one_layer_lock_off.png and /dev/null differ
diff --git a/resources/icons/one_layer_lock_on.png b/resources/icons/one_layer_lock_on.png
deleted file mode 100644
index 011099972..000000000
Binary files a/resources/icons/one_layer_lock_on.png and /dev/null differ
diff --git a/resources/icons/one_layer_unlock_off.png b/resources/icons/one_layer_unlock_off.png
deleted file mode 100644
index 46fabfb05..000000000
Binary files a/resources/icons/one_layer_unlock_off.png and /dev/null differ
diff --git a/resources/icons/one_layer_unlock_on.png b/resources/icons/one_layer_unlock_on.png
deleted file mode 100644
index 265b92610..000000000
Binary files a/resources/icons/one_layer_unlock_on.png and /dev/null differ
diff --git a/resources/icons/pause_add.png b/resources/icons/pause_add.png
deleted file mode 100644
index afe881de8..000000000
Binary files a/resources/icons/pause_add.png and /dev/null differ
diff --git a/resources/icons/right_half_circle.png b/resources/icons/right_half_circle.png
deleted file mode 100644
index ecc8980b3..000000000
Binary files a/resources/icons/right_half_circle.png and /dev/null differ
diff --git a/resources/icons/row.png b/resources/icons/row.png
deleted file mode 100644
index 18a6034fd..000000000
Binary files a/resources/icons/row.png and /dev/null differ
diff --git a/resources/icons/shape_ungroup.png b/resources/icons/shape_ungroup.png
deleted file mode 100644
index 97aaceb23..000000000
Binary files a/resources/icons/shape_ungroup.png and /dev/null differ
diff --git a/resources/icons/table.png b/resources/icons/table.png
deleted file mode 100644
index 3bc0bd32f..000000000
Binary files a/resources/icons/table.png and /dev/null differ
diff --git a/resources/icons/up_half_circle.png b/resources/icons/up_half_circle.png
deleted file mode 100644
index aac6e32c3..000000000
Binary files a/resources/icons/up_half_circle.png and /dev/null differ
diff --git a/resources/icons/variable_layer_height_reset.png b/resources/icons/variable_layer_height_reset.png
deleted file mode 100644
index 6e051fe95..000000000
Binary files a/resources/icons/variable_layer_height_reset.png and /dev/null differ
diff --git a/resources/icons/variable_layer_height_tooltip.png b/resources/icons/variable_layer_height_tooltip.png
deleted file mode 100644
index 182005292..000000000
Binary files a/resources/icons/variable_layer_height_tooltip.png and /dev/null differ
diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp
index 26c5b470e..fd2c4f865 100644
--- a/src/libslic3r/AppConfig.cpp
+++ b/src/libslic3r/AppConfig.cpp
@@ -85,9 +85,6 @@ void AppConfig::set_defaults()
if (get("associate_stl").empty())
set("associate_stl", "0");
- if (get("dark_color_mode").empty())
- set("dark_color_mode", "0");
-
if (get("tabs_as_menu").empty())
set("tabs_as_menu", "0");
#endif // _WIN32
@@ -179,6 +176,9 @@ void AppConfig::set_defaults()
#ifdef _WIN32
if (get("use_legacy_3DConnexion").empty())
set("use_legacy_3DConnexion", "0");
+
+ if (get("dark_color_mode").empty())
+ set("dark_color_mode", "0");
#endif // _WIN32
// Remove legacy window positions/sizes
diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp
index 1fd748197..b36618dd1 100644
--- a/src/libslic3r/Model.cpp
+++ b/src/libslic3r/Model.cpp
@@ -552,6 +552,22 @@ void Model::convert_from_meters(bool only_small_volumes)
}
}
+static constexpr const double zero_volume = 0.0000000001;
+
+int Model::removed_objects_with_zero_volume()
+{
+ if (objects.size() == 0)
+ return 0;
+
+ int removed = 0;
+ for (int i = int(objects.size()) - 1; i >= 0; i--)
+ if (objects[i]->get_object_stl_stats().volume < zero_volume) {
+ delete_object(size_t(i));
+ removed++;
+ }
+ return removed;
+}
+
void Model::adjust_min_z()
{
if (objects.empty())
@@ -1701,10 +1717,10 @@ TriangleMeshStats ModelObject::get_object_stl_stats() const
return full_stats;
}
-int ModelObject::get_mesh_errors_count(const int vol_idx /*= -1*/) const
+int ModelObject::get_repaired_errors_count(const int vol_idx /*= -1*/) const
{
if (vol_idx >= 0)
- return this->volumes[vol_idx]->get_mesh_errors_count();
+ return this->volumes[vol_idx]->get_repaired_errors_count();
const RepairedMeshErrors& stats = get_object_stl_stats().repaired_errors;
@@ -1776,7 +1792,7 @@ void ModelVolume::calculate_convex_hull()
assert(m_convex_hull.get());
}
-int ModelVolume::get_mesh_errors_count() const
+int ModelVolume::get_repaired_errors_count() const
{
const RepairedMeshErrors &stats = this->mesh().stats().repaired_errors;
diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp
index 1b92e01ed..0a6a73cbc 100644
--- a/src/libslic3r/Model.hpp
+++ b/src/libslic3r/Model.hpp
@@ -381,7 +381,7 @@ public:
// Get full stl statistics for all object's meshes
TriangleMeshStats get_object_stl_stats() const;
// Get count of errors in the mesh( or all object's meshes, if volume index isn't defined)
- int get_mesh_errors_count(const int vol_idx = -1) const;
+ int get_repaired_errors_count(const int vol_idx = -1) const;
private:
friend class Model;
@@ -686,7 +686,7 @@ public:
const TriangleMesh& get_convex_hull() const;
std::shared_ptr get_convex_hull_shared_ptr() const { return m_convex_hull; }
// Get count of errors in the mesh
- int get_mesh_errors_count() const;
+ int get_repaired_errors_count() const;
// Helpers for loading / storing into AMF / 3MF files.
static ModelVolumeType type_from_string(const std::string &s);
@@ -1140,6 +1140,7 @@ public:
void convert_from_imperial_units(bool only_small_volumes);
bool looks_like_saved_in_meters() const;
void convert_from_meters(bool only_small_volumes);
+ int removed_objects_with_zero_volume();
// Ensures that the min z of the model is not negative
void adjust_min_z();
diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp
index 9456f5077..b48c71828 100644
--- a/src/libslic3r/MultiMaterialSegmentation.cpp
+++ b/src/libslic3r/MultiMaterialSegmentation.cpp
@@ -1214,7 +1214,7 @@ static void cut_segmented_layers(const std::vector
const std::function &throw_on_cancel_callback)
{
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - cutting segmented layers in parallel - begin";
- tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()),[&](const tbb::blocked_range& range) {
+ tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()),[&segmented_regions, &input_expolygons, &cut_width, &throw_on_cancel_callback](const tbb::blocked_range& range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
throw_on_cancel_callback();
std::vector> segmented_regions_cuts;
@@ -1366,7 +1366,8 @@ static inline std::vector> mmu_segmentation_top_and_bott
return out;
};
- tbb::parallel_for(tbb::blocked_range(0, num_layers, granularity), [&](const tbb::blocked_range &range) {
+ tbb::parallel_for(tbb::blocked_range(0, num_layers, granularity), [&granularity, &num_layers, &num_extruders, &layer_color_stat, &top_raw, &triangles_by_color_top,
+ &throw_on_cancel_callback, &input_expolygons, &bottom_raw, &triangles_by_color_bottom](const tbb::blocked_range &range) {
size_t group_idx = range.begin() / granularity;
size_t layer_idx_offset = (group_idx & 1) * num_layers;
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
@@ -1417,7 +1418,7 @@ static inline std::vector> mmu_segmentation_top_and_bott
std::vector> triangles_by_color_merged(num_extruders);
triangles_by_color_merged.assign(num_extruders, std::vector(num_layers));
- tbb::parallel_for(tbb::blocked_range(0, num_layers), [&](const tbb::blocked_range &range) {
+ tbb::parallel_for(tbb::blocked_range(0, num_layers), [&triangles_by_color_merged, &triangles_by_color_bottom, &triangles_by_color_top, &num_layers, &throw_on_cancel_callback](const tbb::blocked_range &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
throw_on_cancel_callback();
for (size_t color_idx = 0; color_idx < triangles_by_color_merged.size(); ++color_idx) {
@@ -1446,7 +1447,7 @@ static std::vector>> merge_segmented_la
std::vector>> segmented_regions_merged(segmented_regions.size());
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - merging segmented layers in parallel - begin";
- tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()), [&](const tbb::blocked_range &range) {
+ tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()), [&segmented_regions, &top_and_bottom_layers, &segmented_regions_merged, &throw_on_cancel_callback](const tbb::blocked_range &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
for (const std::pair &colored_expoly : segmented_regions[layer_idx]) {
throw_on_cancel_callback();
@@ -1526,6 +1527,20 @@ void export_processed_input_expolygons_to_svg(const std::string &path, const Lay
}
#endif // MMU_SEGMENTATION_DEBUG_INPUT
+// Check if all ColoredLine representing a single layer uses the same color.
+static bool has_layer_only_one_color(const std::vector> &colored_polygons)
+{
+ assert(!colored_polygons.empty());
+ assert(!colored_polygons.front().empty());
+ int first_line_color = colored_polygons.front().front().color;
+ for (const std::vector &colored_polygon : colored_polygons)
+ for (const ColoredLine &colored_line : colored_polygon)
+ if (first_line_color != colored_line.color)
+ return false;
+
+ return true;
+}
+
std::vector>> multi_material_segmentation_by_painting(const PrintObject &print_object, const std::function &throw_on_cancel_callback)
{
std::vector>> segmented_regions(print_object.layers().size());
@@ -1539,7 +1554,7 @@ std::vector>> multi_material_segmentati
// Merge all regions and remove small holes
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - slices preparation in parallel - begin";
- tbb::parallel_for(tbb::blocked_range(0, layers.size()), [&](const tbb::blocked_range &range) {
+ tbb::parallel_for(tbb::blocked_range(0, layers.size()), [&layers, &input_expolygons, &throw_on_cancel_callback](const tbb::blocked_range &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
throw_on_cancel_callback();
ExPolygons ex_polygons;
@@ -1649,16 +1664,16 @@ std::vector>> multi_material_segmentati
edge_grids[layer_idx].visit_cells_intersecting_line(line_start, line_end, visitor);
}
}
- });
+ }); // end of parallel_for
}
- });
+ }); // end of parallel_for
}
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - projection of painted triangles - end";
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - painted layers count: "
<< std::count_if(painted_lines.begin(), painted_lines.end(), [](const std::vector &pl) { return !pl.empty(); });
BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - layers segmentation in parallel - begin";
- tbb::parallel_for(tbb::blocked_range(0, print_object.layers().size()), [&](const tbb::blocked_range &range) {
+ tbb::parallel_for(tbb::blocked_range(0, print_object.layers().size()), [&edge_grids, &input_expolygons, &painted_lines, &segmented_regions, &throw_on_cancel_callback](const tbb::blocked_range &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
throw_on_cancel_callback();
auto comp = [&edge_grids, layer_idx](const PaintedLine &first, const PaintedLine &second) {
@@ -1677,20 +1692,28 @@ std::vector>> multi_material_segmentati
if (!painted_lines_single.empty()) {
std::vector> color_poly = colorize_polygons(edge_grids[layer_idx].contours(), painted_lines_single);
- MMU_Graph graph = build_graph(layer_idx, color_poly);
- remove_multiple_edges_in_vertices(graph, color_poly);
- graph.remove_nodes_with_one_arc();
+ assert(!color_poly.empty());
+ assert(!color_poly.front().empty());
+ if (has_layer_only_one_color(color_poly)) {
+ // If the whole layer is painted using the same color, it is not needed to construct a Voronoi diagram for the segmentation of this layer.
+ for (const ExPolygon &ex_polygon : input_expolygons[layer_idx])
+ segmented_regions[layer_idx].emplace_back(ex_polygon, size_t(color_poly.front().front().color));
+ } else {
+ MMU_Graph graph = build_graph(layer_idx, color_poly);
+ remove_multiple_edges_in_vertices(graph, color_poly);
+ graph.remove_nodes_with_one_arc();
#ifdef MMU_SEGMENTATION_DEBUG_GRAPH
- {
- static int iRun = 0;
- export_graph_to_svg(debug_out_path("mm-graph-final-%d-%d.svg", layer_idx, iRun++), graph, input_expolygons[layer_idx]);
- }
+ {
+ static int iRun = 0;
+ export_graph_to_svg(debug_out_path("mm-graph-final-%d-%d.svg", layer_idx, iRun++), graph, input_expolygons[layer_idx]);
+ }
#endif // MMU_SEGMENTATION_DEBUG_GRAPH
- std::vector> segmentation = extract_colored_segments(graph);
- for (std::pair ®ion : segmentation)
- segmented_regions[layer_idx].emplace_back(std::move(region));
+ std::vector> segmentation = extract_colored_segments(graph);
+ for (std::pair ®ion : segmentation)
+ segmented_regions[layer_idx].emplace_back(std::move(region));
+ }
#ifdef MMU_SEGMENTATION_DEBUG_REGIONS
{
diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp
index 0c2757b75..09cb89372 100644
--- a/src/libslic3r/TriangleMesh.cpp
+++ b/src/libslic3r/TriangleMesh.cpp
@@ -68,8 +68,7 @@ TriangleMesh::TriangleMesh(const indexed_triangle_set &its) : its(its)
TriangleMesh::TriangleMesh(indexed_triangle_set &&its, const RepairedMeshErrors& errors/* = RepairedMeshErrors()*/) : its(std::move(its))
{
- if (errors.repaired())
- m_stats.repaired_errors = errors;
+ m_stats.repaired_errors = errors;
fill_initial_stats(this->its, m_stats);
}
diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp
index b03ae0949..ec6401982 100644
--- a/src/libslic3r/TriangleMesh.hpp
+++ b/src/libslic3r/TriangleMesh.hpp
@@ -33,14 +33,12 @@ struct RepairedMeshErrors {
void clear() { *this = RepairedMeshErrors(); }
- RepairedMeshErrors merge(const RepairedMeshErrors& rhs) const {
- RepairedMeshErrors out;
- out.edges_fixed = this->edges_fixed + rhs.edges_fixed;
- out.degenerate_facets = this->degenerate_facets + rhs.degenerate_facets;
- out.facets_removed = this->facets_removed + rhs.facets_removed;
- out.facets_reversed = this->facets_reversed + rhs.facets_reversed;
- out.backwards_edges = this->backwards_edges + rhs.backwards_edges;
- return out;
+ void merge(const RepairedMeshErrors& rhs) {
+ this->edges_fixed += rhs.edges_fixed;
+ this->degenerate_facets += rhs.degenerate_facets;
+ this->facets_removed += rhs.facets_removed;
+ this->facets_reversed += rhs.facets_reversed;
+ this->backwards_edges += rhs.backwards_edges;
}
bool repaired() const { return degenerate_facets > 0 || edges_fixed > 0 || facets_removed > 0 || facets_reversed > 0 || backwards_edges > 0; }
diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp
index a6b99a08b..05f301186 100644
--- a/src/slic3r/GUI/AboutDialog.cpp
+++ b/src/slic3r/GUI/AboutDialog.cpp
@@ -220,7 +220,7 @@ AboutDialog::AboutDialog()
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
// logo
- m_logo_bitmap = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_192px.png" : "PrusaSlicer-gcodeviewer_192px.png", 192);
+ m_logo_bitmap = ScalableBitmap(this, wxGetApp().logo_name(), 192);
m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bitmap.bmp());
hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL);
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index e1fcc029a..e2a9df25d 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -193,7 +193,7 @@ public:
// load bitmap for logo
BitmapCache bmp_cache;
int logo_size = lround(width * 0.25);
- wxBitmap logo_bmp = *bmp_cache.load_svg(wxGetApp().is_editor() ? "prusa_slicer_logo" : "add_gcode", logo_size, logo_size);
+ wxBitmap logo_bmp = *bmp_cache.load_svg(wxGetApp().logo_name(), logo_size, logo_size);
wxCoord margin = int(m_scale * 20);
@@ -883,7 +883,7 @@ bool GUI_App::on_init_inner()
}
// create splash screen with updated bmp
- scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap("prusa_slicer_logo", nullptr, 400),
+ scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap("PrusaSlicer", nullptr, 400),
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, splashscreen_pos);
#ifndef __linux__
wxYield();
diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp
index a581cf8b3..3061bbe13 100644
--- a/src/slic3r/GUI/GUI_App.hpp
+++ b/src/slic3r/GUI/GUI_App.hpp
@@ -166,6 +166,7 @@ public:
bool is_editor() const { return m_app_mode == EAppMode::Editor; }
bool is_gcode_viewer() const { return m_app_mode == EAppMode::GCodeViewer; }
bool is_recreating_gui() const { return m_is_recreating_gui; }
+ std::string logo_name() const { return is_editor() ? "PrusaSlicer" : "PrusaSlicer-gcodeviewer"; }
// To be called after the GUI is fully built up.
// Process command line parameters cached in this->init_params,
diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp
index 6c416c475..e6e7336f7 100644
--- a/src/slic3r/GUI/GUI_ObjectList.cpp
+++ b/src/slic3r/GUI/GUI_ObjectList.cpp
@@ -375,9 +375,9 @@ void ObjectList::get_selection_indexes(std::vector& obj_idxs, std::vector= 0 ? (*m_objects)[obj_idx]->get_mesh_errors_count(vol_idx) : 0;
+ return obj_idx >= 0 ? (*m_objects)[obj_idx]->get_repaired_errors_count(vol_idx) : 0;
}
static std::string get_warning_icon_name(const TriangleMeshStats& stats)
@@ -385,8 +385,11 @@ static std::string get_warning_icon_name(const TriangleMeshStats& stats)
return stats.manifold() ? (stats.repaired() ? "exclamation_manifold" : "") : "exclamation";
}
-std::pair ObjectList::get_mesh_errors(const int obj_idx, const int vol_idx /*= -1*/, wxString* sidebar_info /*= nullptr*/) const
+MeshErrorsInfo ObjectList::get_mesh_errors_info(const int obj_idx, const int vol_idx /*= -1*/, wxString* sidebar_info /*= nullptr*/) const
{
+ if (obj_idx < 0)
+ return { {}, {} }; // hide tooltip
+
const TriangleMeshStats& stats = vol_idx == -1 ?
(*m_objects)[obj_idx]->get_object_stl_stats() :
(*m_objects)[obj_idx]->volumes[vol_idx]->mesh().stats();
@@ -401,7 +404,7 @@ std::pair ObjectList::get_mesh_errors(const int obj_idx,
// Create tooltip string, if there are errors
if (stats.repaired()) {
- const int errors = get_mesh_errors_count(obj_idx, vol_idx);
+ const int errors = get_repaired_errors_count(obj_idx, vol_idx);
auto_repaired_info = format_wxstr(_L_PLURAL("Auto-repaired %1$d error", "Auto-repaired %1$d errors", errors), errors);
tooltip += auto_repaired_info +":\n";
@@ -434,15 +437,24 @@ std::pair ObjectList::get_mesh_errors(const int obj_idx,
return { tooltip, get_warning_icon_name(stats) };
}
-std::pair ObjectList::get_mesh_errors(wxString* sidebar_info /*= nullptr*/)
+MeshErrorsInfo ObjectList::get_mesh_errors_info(wxString* sidebar_info /*= nullptr*/)
{
- if (!GetSelection())
+ wxDataViewItem item = GetSelection();
+ if (!item)
return { "", "" };
int obj_idx, vol_idx;
get_selected_item_indexes(obj_idx, vol_idx);
- return get_mesh_errors(obj_idx, vol_idx, sidebar_info);
+ if (obj_idx < 0) { // child of ObjectItem is selected
+ if (sidebar_info)
+ obj_idx = m_objects_model->GetObjectIdByItem(item);
+ else
+ return { "", "" };
+ }
+ assert(obj_idx >= 0);
+
+ return get_mesh_errors_info(obj_idx, vol_idx, sidebar_info);
}
void ObjectList::set_tooltip_for_item(const wxPoint& pt)
@@ -478,9 +490,12 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
#endif //__WXMSW__
else if (col->GetTitle() == _("Name") && (pt.x >= 2 * wxGetApp().em_unit() && pt.x <= 4 * wxGetApp().em_unit()))
{
- int obj_idx, vol_idx;
- get_selected_item_indexes(obj_idx, vol_idx, item);
- tooltip = get_mesh_errors(obj_idx, vol_idx).first;
+ if (const ItemType type = m_objects_model->GetItemType(item);
+ type & (itObject | itVolume)) {
+ int obj_idx = m_objects_model->GetObjectIdByItem(item);
+ int vol_idx = type & itVolume ? m_objects_model->GetVolumeIdByItem(item) : -1;
+ tooltip = get_mesh_errors_info(obj_idx, vol_idx).tooltip;
+ }
}
GetMainWindow()->SetToolTip(tooltip);
@@ -1797,10 +1812,8 @@ void ObjectList::del_subobject_item(wxDataViewItem& item)
// If last volume item with warning was deleted, unmark object item
if (type & itVolume) {
- if (auto obj = object(obj_idx); obj->get_mesh_errors_count() == 0)
- m_objects_model->DeleteWarningIcon(parent);
- else
- m_objects_model->AddWarningIcon(parent, get_warning_icon_name(obj->mesh().stats()));
+ const std::string& icon_name = get_warning_icon_name(object(obj_idx)->get_object_stl_stats());
+ m_objects_model->UpdateWarningIcon(parent, icon_name);
}
m_objects_model->Delete(item);
@@ -2509,7 +2522,7 @@ void ObjectList::part_selection_changed()
if (item) {
// wxGetApp().obj_manipul()->get_og()->set_value("object_name", m_objects_model->GetName(item));
wxGetApp().obj_manipul()->update_item_name(m_objects_model->GetName(item));
- wxGetApp().obj_manipul()->update_warning_icon_state(get_mesh_errors(obj_idx, volume_id));
+ wxGetApp().obj_manipul()->update_warning_icon_state(get_mesh_errors_info(obj_idx, volume_id));
}
}
@@ -2769,10 +2782,7 @@ void ObjectList::delete_from_model_and_list(const std::vector& it
m_objects_model->SetExtruder(extruder, parent);
}
// If last volume item with warning was deleted, unmark object item
- if (obj->get_mesh_errors_count() == 0)
- m_objects_model->DeleteWarningIcon(parent);
- else
- m_objects_model->AddWarningIcon(parent, get_warning_icon_name(obj->mesh().stats()));
+ m_objects_model->UpdateWarningIcon(parent, get_warning_icon_name(obj->get_object_stl_stats()));
}
wxGetApp().plater()->canvas3D()->ensure_on_bed(item->obj_idx, printer_technology() != ptSLA);
}
@@ -4055,7 +4065,7 @@ void ObjectList::fix_through_netfabb()
if (vol_idxs.empty()) {
#if !FIX_THROUGH_NETFABB_ALWAYS
for (int i = int(obj_idxs.size())-1; i >= 0; --i)
- if (object(obj_idxs[i])->get_mesh_errors_count() == 0)
+ if (object(obj_idxs[i])->get_repaired_errors_count() == 0)
obj_idxs.erase(obj_idxs.begin()+i);
#endif // FIX_THROUGH_NETFABB_ALWAYS
for (int obj_idx : obj_idxs)
@@ -4065,7 +4075,7 @@ void ObjectList::fix_through_netfabb()
ModelObject* obj = object(obj_idxs.front());
#if !FIX_THROUGH_NETFABB_ALWAYS
for (int i = int(vol_idxs.size()) - 1; i >= 0; --i)
- if (obj->get_mesh_errors_count(vol_idxs[i]) == 0)
+ if (obj->get_repaired_errors_count(vol_idxs[i]) == 0)
vol_idxs.erase(vol_idxs.begin() + i);
#endif // FIX_THROUGH_NETFABB_ALWAYS
for (int vol_idx : vol_idxs)
@@ -4113,15 +4123,14 @@ void ObjectList::fix_through_netfabb()
Plater::TakeSnapshot snapshot(plater, _L("Fix through NetFabb"));
// Open a progress dialog.
- wxProgressDialog progress_dlg(_L("Fixing through NetFabb"), "", 100,
- nullptr, // ! parent of the wxProgressDialog should be nullptr to avoid flickering during the model fixing
+ wxProgressDialog progress_dlg(_L("Fixing through NetFabb"), "", 100, plater,
wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
int model_idx{ 0 };
if (vol_idxs.empty()) {
int vol_idx{ -1 };
for (int obj_idx : obj_idxs) {
#if !FIX_THROUGH_NETFABB_ALWAYS
- if (object(obj_idx)->get_mesh_errors_count(vol_idx) == 0)
+ if (object(obj_idx)->get_repaired_errors_count(vol_idx) == 0)
continue;
#endif // FIX_THROUGH_NETFABB_ALWAYS
if (!fix_and_update_progress(obj_idx, vol_idx, model_idx, progress_dlg, succes_models, failed_models))
@@ -4178,24 +4187,18 @@ void ObjectList::simplify()
void ObjectList::update_item_error_icon(const int obj_idx, const int vol_idx) const
{
- const wxDataViewItem item = vol_idx <0 ? m_objects_model->GetItemById(obj_idx) :
- m_objects_model->GetItemByVolumeId(obj_idx, vol_idx);
- if (!item)
+ auto obj = object(obj_idx);
+ if (wxDataViewItem obj_item = m_objects_model->GetItemById(obj_idx)) {
+ const std::string& icon_name = get_warning_icon_name(obj->get_object_stl_stats());
+ m_objects_model->UpdateWarningIcon(obj_item, icon_name);
+ }
+
+ if (vol_idx < 0)
return;
- if (get_mesh_errors_count(obj_idx, vol_idx) == 0)
- {
- // if whole object has no errors more,
- if (get_mesh_errors_count(obj_idx) == 0)
- // unmark all items in the object
- m_objects_model->DeleteWarningIcon(vol_idx >= 0 ? m_objects_model->GetParent(item) : item, true);
- else
- // unmark fixed item only
- m_objects_model->DeleteWarningIcon(item);
- }
- else {
- auto obj = object(obj_idx);
- m_objects_model->AddWarningIcon(item, get_warning_icon_name(vol_idx < 0 ? obj->mesh().stats() : obj->volumes[vol_idx]->mesh().stats()));
+ if (wxDataViewItem vol_item = m_objects_model->GetItemByVolumeId(obj_idx, vol_idx)) {
+ const std::string& icon_name = get_warning_icon_name(obj->volumes[vol_idx]->mesh().stats());
+ m_objects_model->UpdateWarningIcon(vol_item, icon_name);
}
}
diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp
index 54e3f5d45..cc619fc45 100644
--- a/src/slic3r/GUI/GUI_ObjectList.hpp
+++ b/src/slic3r/GUI/GUI_ObjectList.hpp
@@ -67,6 +67,12 @@ struct ItemForDelete
}
};
+struct MeshErrorsInfo
+{
+ wxString tooltip;
+ std::string warning_icon_name;
+};
+
class ObjectList : public wxDataViewCtrl
{
public:
@@ -212,13 +218,13 @@ public:
void get_selected_item_indexes(int& obj_idx, int& vol_idx, const wxDataViewItem& item = wxDataViewItem(0));
void get_selection_indexes(std::vector& obj_idxs, std::vector& vol_idxs);
// Get count of errors in the mesh
- int get_mesh_errors_count(const int obj_idx, const int vol_idx = -1) const;
+ int get_repaired_errors_count(const int obj_idx, const int vol_idx = -1) const;
// Get list of errors in the mesh and name of the warning icon
// Return value is a pair , used for the tooltip and related warning icon
// Function without parameters is for a call from Manipulation panel,
// when we don't know parameters of selected item
- std::pair get_mesh_errors(const int obj_idx, const int vol_idx = -1, wxString* sidebar_info = nullptr) const;
- std::pair get_mesh_errors(wxString* sidebar_info = nullptr);
+ MeshErrorsInfo get_mesh_errors_info(const int obj_idx, const int vol_idx = -1, wxString* sidebar_info = nullptr) const;
+ MeshErrorsInfo get_mesh_errors_info(wxString* sidebar_info = nullptr);
void set_tooltip_for_item(const wxPoint& pt);
void selection_changed();
diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp
index 9faf1a2db..09492db09 100644
--- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp
+++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp
@@ -1,5 +1,4 @@
#include "GUI_ObjectManipulation.hpp"
-#include "GUI_ObjectList.hpp"
#include "I18N.hpp"
#include "BitmapComboBox.hpp"
@@ -132,7 +131,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
return;
wxGetApp().obj_list()->fix_through_netfabb();
- update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors());
+ update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors_info());
});
sizer->Add(m_fix_throught_netfab_bitmap);
@@ -548,8 +547,8 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
}
else {
m_new_rotation = volume->get_instance_rotation() * (180. / M_PI);
- m_new_size = volume->get_instance_transformation().get_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size());
- m_new_scale = volume->get_instance_scaling_factor() * 100.;
+ m_new_size = volume->get_instance_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size());
+ m_new_scale = volume->get_instance_scaling_factor() * 100.;
}
m_new_enabled = true;
@@ -570,7 +569,7 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
m_new_position = volume->get_volume_offset();
m_new_rotation = volume->get_volume_rotation() * (180. / M_PI);
m_new_scale = volume->get_volume_scaling_factor() * 100.;
- m_new_size = volume->get_instance_transformation().get_scaling_factor().cwiseProduct(volume->get_volume_transformation().get_scaling_factor().cwiseProduct(volume->bounding_box().size()));
+ m_new_size = volume->get_instance_scaling_factor().cwiseProduct(volume->get_volume_scaling_factor().cwiseProduct(volume->bounding_box().size()));
m_new_enabled = true;
}
else if (obj_list->multiple_selection() || obj_list->is_selected(itInstanceRoot)) {
@@ -786,12 +785,12 @@ void ObjectManipulation::update_item_name(const wxString& item_name)
m_item_name->SetLabel(item_name);
}
-void ObjectManipulation::update_warning_icon_state(const std::pair& warning)
+void ObjectManipulation::update_warning_icon_state(const MeshErrorsInfo& warning)
{
- if (const std::string& warning_icon_name = warning.second;
+ if (const std::string& warning_icon_name = warning.warning_icon_name;
!warning_icon_name.empty())
m_manifold_warning_bmp = ScalableBitmap(m_parent, warning_icon_name);
- const wxString& tooltip = warning.first;
+ const wxString& tooltip = warning.tooltip;
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0,0) : m_manifold_warning_bmp.bmp().GetSize());
m_fix_throught_netfab_bitmap->SetToolTip(tooltip);
@@ -867,7 +866,7 @@ void ObjectManipulation::change_scale_value(int axis, double value)
Vec3d scale = m_cache.scale;
scale(axis) = value;
- this->do_scale(axis, scale);
+ this->do_scale(axis, 0.01 * scale);
m_cache.scale = scale;
m_cache.scale_rounded(axis) = DBL_MAX;
@@ -886,14 +885,21 @@ void ObjectManipulation::change_size_value(int axis, double value)
const Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
Vec3d ref_size = m_cache.size;
- if (selection.is_single_volume() || selection.is_single_modifier())
- ref_size = selection.get_volume(*selection.get_volume_idxs().begin())->bounding_box().size();
+ if (selection.is_single_volume() || selection.is_single_modifier()) {
+ const GLVolume* v = selection.get_volume(*selection.get_volume_idxs().begin());
+ const Vec3d local_size = size.cwiseQuotient(v->get_instance_scaling_factor());
+ const Vec3d local_ref_size = v->bounding_box().size().cwiseProduct(v->get_volume_scaling_factor());
+ const Vec3d local_change = local_size.cwiseQuotient(local_ref_size);
+
+ size = local_change.cwiseProduct(v->get_volume_scaling_factor());
+ ref_size = Vec3d::Ones();
+ }
else if (selection.is_single_full_instance())
ref_size = m_world_coordinates ?
selection.get_unscaled_instance_bounding_box().size() :
wxGetApp().model().objects[selection.get_volume(*selection.get_volume_idxs().begin())->object_idx()]->raw_mesh_bounding_box().size();
- this->do_scale(axis, 100. * Vec3d(size(0) / ref_size(0), size(1) / ref_size(1), size(2) / ref_size(2)));
+ this->do_scale(axis, size.cwiseQuotient(ref_size));
m_cache.size = size;
m_cache.size_rounded(axis) = DBL_MAX;
@@ -916,7 +922,7 @@ void ObjectManipulation::do_scale(int axis, const Vec3d &scale) const
scaling_factor = scale(axis) * Vec3d::Ones();
selection.start_dragging();
- selection.scale(scaling_factor * 0.01, transformation_type);
+ selection.scale(scaling_factor, transformation_type);
wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale"));
}
diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp
index 9b77591be..a15c72fb8 100644
--- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp
+++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp
@@ -4,6 +4,7 @@
#include
#include "GUI_ObjectSettings.hpp"
+#include "GUI_ObjectList.hpp"
#include "libslic3r/Point.hpp"
#include
@@ -194,7 +195,7 @@ public:
#endif // __APPLE__
void update_item_name(const wxString &item_name);
- void update_warning_icon_state(const std::pair& warning);
+ void update_warning_icon_state(const MeshErrorsInfo& warning);
void msw_rescale();
void sys_color_changed();
void on_change(const std::string& opt_key, int axis, double new_value);
diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp
index a67694541..57840dda2 100644
--- a/src/slic3r/GUI/GUI_Preview.cpp
+++ b/src/slic3r/GUI/GUI_Preview.cpp
@@ -496,13 +496,22 @@ void Preview::on_combochecklist_features(wxCommandEvent& evt)
void Preview::on_combochecklist_options(wxCommandEvent& evt)
{
- unsigned int curr_flags = m_canvas->get_gcode_options_visibility_flags();
- unsigned int new_flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_options);
+ const unsigned int curr_flags = m_canvas->get_gcode_options_visibility_flags();
+ const unsigned int new_flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_options);
if (curr_flags == new_flags)
return;
m_canvas->set_gcode_options_visibility_from_flags(new_flags);
- m_canvas->refresh_gcode_preview_render_paths();
+ if (m_canvas->get_gcode_view_type() == GCodeViewer::EViewType::Feedrate) {
+ const unsigned int diff_flags = curr_flags ^ new_flags;
+ if ((diff_flags & (1 << static_cast(Preview::OptionType::Travel))) != 0)
+ refresh_print();
+ else
+ m_canvas->refresh_gcode_preview_render_paths();
+ }
+ else
+ m_canvas->refresh_gcode_preview_render_paths();
+
update_moves_slider();
}
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp
index 437106fed..12b827e64 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp
@@ -51,10 +51,17 @@ bool GLGizmoFdmSupports::on_init()
m_desc["remove_all"] = _L("Remove all selection");
m_desc["circle"] = _L("Circle");
m_desc["sphere"] = _L("Sphere");
+ m_desc["pointer"] = _L("Triangles");
m_desc["highlight_by_angle"] = _L("Highlight by angle");
m_desc["enforce_button"] = _L("Enforce");
m_desc["cancel"] = _L("Cancel");
+ m_desc["tool_type"] = _L("Tool type") + ": ";
+ m_desc["tool_brush"] = _L("Brush");
+ m_desc["tool_smart_fill"] = _L("Smart fill");
+
+ m_desc["smart_fill_angle"] = _L("Smart fill angle");
+
return true;
}
@@ -82,42 +89,48 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
if (! m_c->selection_info()->model_object())
return;
- const float approx_height = m_imgui->scaled(17.0f);
+ const float approx_height = m_imgui->scaled(20.5f);
y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
- const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,
- m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
- + m_imgui->scaled(1.5f);
- const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
- const float autoset_slider_left = m_imgui->calc_text_size(m_desc.at("highlight_by_angle")).x + m_imgui->scaled(1.f);
- const float cursor_type_radio_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
- const float cursor_type_radio_width1 = m_imgui->calc_text_size(m_desc["circle"]).x
- + m_imgui->scaled(2.5f);
- const float cursor_type_radio_width2 = m_imgui->calc_text_size(m_desc["sphere"]).x
- + m_imgui->scaled(2.5f);
+ const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,
+ m_imgui->calc_text_size(m_desc.at("reset_direction")).x) + m_imgui->scaled(1.5f);
+ const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
+ const float autoset_slider_left = m_imgui->calc_text_size(m_desc.at("highlight_by_angle")).x + m_imgui->scaled(1.f);
+ const float smart_fill_slider_left = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.f);
+
+ const float cursor_type_radio_circle = m_imgui->calc_text_size(m_desc["circle"]).x + m_imgui->scaled(2.5f);
+ const float cursor_type_radio_sphere = m_imgui->calc_text_size(m_desc["sphere"]).x + m_imgui->scaled(2.5f);
+ const float cursor_type_radio_pointer = m_imgui->calc_text_size(m_desc["pointer"]).x + m_imgui->scaled(2.5f);
+
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
const float button_enforce_width = m_imgui->calc_text_size(m_desc.at("enforce_button")).x;
const float button_cancel_width = m_imgui->calc_text_size(m_desc.at("cancel")).x;
const float buttons_width = std::max(button_enforce_width, button_cancel_width) + m_imgui->scaled(0.5f);
const float minimal_slider_width = m_imgui->scaled(4.f);
+ const float tool_type_radio_left = m_imgui->calc_text_size(m_desc["tool_type"]).x + m_imgui->scaled(1.f);
+ const float tool_type_radio_brush = m_imgui->calc_text_size(m_desc["tool_brush"]).x + m_imgui->scaled(2.5f);
+ const float tool_type_radio_smart_fill = m_imgui->calc_text_size(m_desc["tool_smart_fill"]).x + m_imgui->scaled(2.5f);
+
float caption_max = 0.f;
float total_text_max = 0.f;
for (const auto &t : std::array{"enforce", "block", "remove"}) {
- caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc.at(t + "_caption")).x);
- total_text_max = std::max(total_text_max, caption_max + m_imgui->calc_text_size(m_desc.at(t)).x);
+ caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
+ total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
}
- caption_max += m_imgui->scaled(1.f);
- total_text_max += m_imgui->scaled(1.f);
+ total_text_max += caption_max + m_imgui->scaled(1.f);
+ caption_max += m_imgui->scaled(1.f);
- float window_width = minimal_slider_width + std::max(autoset_slider_left, std::max(cursor_slider_left, clipping_slider_left));
+ float sliders_width = std::max(std::max(autoset_slider_left, smart_fill_slider_left), std::max(cursor_slider_left, clipping_slider_left));
+ float window_width = minimal_slider_width + sliders_width;
window_width = std::max(window_width, total_text_max);
window_width = std::max(window_width, button_width);
- window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_width1 + cursor_type_radio_width2);
+ window_width = std::max(window_width, cursor_type_radio_circle + cursor_type_radio_sphere + cursor_type_radio_pointer);
+ window_width = std::max(window_width, tool_type_radio_left + tool_type_radio_brush + tool_type_radio_smart_fill);
window_width = std::max(window_width, 2.f * buttons_width + m_imgui->scaled(1.f));
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
@@ -129,7 +142,6 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
for (const auto &t : std::array{"enforce", "block", "remove"})
draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
- m_imgui->text("");
ImGui::Separator();
ImGui::AlignTextToFramePadding();
@@ -138,9 +150,9 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
std::string format_str = std::string("%.f") + I18N::translate_utf8("°",
"Degree sign to use in the respective slider in FDM supports gizmo,"
"placed after the number with no whitespace in between.");
- ImGui::SameLine(autoset_slider_left);
- ImGui::PushItemWidth(window_width - autoset_slider_left);
- if (m_imgui->slider_float("", &m_angle_threshold_deg, 0.f, 90.f, format_str.data())) {
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
+ if (m_imgui->slider_float("##angle_threshold_deg", &m_angle_threshold_deg, 0.f, 90.f, format_str.data())) {
m_parent.set_slope_normal_angle(90.f - m_angle_threshold_deg);
if (! m_parent.is_using_slope()) {
m_parent.use_slope(true);
@@ -163,79 +175,136 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
}
m_imgui->disabled_end();
- ImGui::Separator();
-
- if (m_imgui->button(m_desc.at("remove_all"))) {
- Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"),
- UndoRedo::SnapshotType::GizmoAction);
- ModelObject* mo = m_c->selection_info()->model_object();
- int idx = -1;
- for (ModelVolume* mv : mo->volumes) {
- if (mv->is_model_part()) {
- ++idx;
- m_triangle_selectors[idx]->reset();
- m_triangle_selectors[idx]->request_update_render_data();
- }
- }
-
- update_model_object();
- m_parent.set_as_dirty();
- }
-
-
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
- ImGui::AlignTextToFramePadding();
- m_imgui->text(m_desc.at("cursor_size"));
- ImGui::SameLine(cursor_slider_left);
- ImGui::PushItemWidth(window_width - cursor_slider_left);
- m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
- if (ImGui::IsItemHovered()) {
- ImGui::BeginTooltip();
- ImGui::PushTextWrapPos(max_tooltip_width);
- ImGui::TextUnformatted(_L("Alt + Mouse wheel").ToUTF8().data());
- ImGui::PopTextWrapPos();
- ImGui::EndTooltip();
- }
-
+ ImGui::Separator();
ImGui::AlignTextToFramePadding();
- m_imgui->text(m_desc.at("cursor_type"));
- ImGui::SameLine(cursor_type_radio_left + m_imgui->scaled(0.f));
- ImGui::PushItemWidth(cursor_type_radio_width1);
+ m_imgui->text(m_desc["tool_type"]);
- bool sphere_sel = m_cursor_type == TriangleSelector::CursorType::SPHERE;
- if (m_imgui->radio_button(m_desc["sphere"], sphere_sel))
- sphere_sel = true;
+ float tool_type_offset = tool_type_radio_left + (window_width - tool_type_radio_left - tool_type_radio_brush - tool_type_radio_smart_fill + m_imgui->scaled(0.5f)) / 2.f;
+ ImGui::SameLine(tool_type_offset);
+ ImGui::PushItemWidth(tool_type_radio_brush);
+ if (m_imgui->radio_button(m_desc["tool_brush"], m_tool_type == ToolType::BRUSH))
+ m_tool_type = ToolType::BRUSH;
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
- ImGui::TextUnformatted(_L("Paints all facets inside, regardless of their orientation.").ToUTF8().data());
+ ImGui::TextUnformatted(_L("Paints facets according to the chosen painting brush.").ToUTF8().data());
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
- ImGui::SameLine(cursor_type_radio_left + cursor_type_radio_width2 + m_imgui->scaled(0.f));
- ImGui::PushItemWidth(cursor_type_radio_width2);
-
- if (m_imgui->radio_button(m_desc["circle"], ! sphere_sel))
- sphere_sel = false;
+ ImGui::SameLine(tool_type_offset + tool_type_radio_brush);
+ ImGui::PushItemWidth(tool_type_radio_smart_fill);
+ if (m_imgui->radio_button(m_desc["tool_smart_fill"], m_tool_type == ToolType::SMART_FILL))
+ m_tool_type = ToolType::SMART_FILL;
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
- ImGui::TextUnformatted(_L("Ignores facets facing away from the camera.").ToUTF8().data());
+ ImGui::TextUnformatted(_L("Paints neighboring facets whose relative angle is less or equal to set angle.").ToUTF8().data());
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
- m_cursor_type = sphere_sel
- ? TriangleSelector::CursorType::SPHERE
- : TriangleSelector::CursorType::CIRCLE;
+ ImGui::Separator();
+ if (m_tool_type == ToolType::BRUSH) {
+ m_imgui->text(m_desc.at("cursor_type"));
+ ImGui::NewLine();
+ float cursor_type_offset = (window_width - cursor_type_radio_sphere - cursor_type_radio_circle - cursor_type_radio_pointer + m_imgui->scaled(1.5f)) / 2.f;
+ ImGui::SameLine(cursor_type_offset);
+ ImGui::PushItemWidth(cursor_type_radio_sphere);
+ if (m_imgui->radio_button(m_desc["sphere"], m_cursor_type == TriangleSelector::CursorType::SPHERE))
+ m_cursor_type = TriangleSelector::CursorType::SPHERE;
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Paints all facets inside, regardless of their orientation.").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere);
+ ImGui::PushItemWidth(cursor_type_radio_circle);
+
+ if (m_imgui->radio_button(m_desc["circle"], m_cursor_type == TriangleSelector::CursorType::CIRCLE))
+ m_cursor_type = TriangleSelector::CursorType::CIRCLE;
+
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Ignores facets facing away from the camera.").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere + cursor_type_radio_circle);
+ ImGui::PushItemWidth(cursor_type_radio_pointer);
+
+ if (m_imgui->radio_button(m_desc["pointer"], m_cursor_type == TriangleSelector::CursorType::POINTER))
+ m_cursor_type = TriangleSelector::CursorType::POINTER;
+
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Paints only one facet.").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ m_imgui->disabled_begin(m_cursor_type != TriangleSelector::CursorType::SPHERE && m_cursor_type != TriangleSelector::CursorType::CIRCLE);
+
+ ImGui::AlignTextToFramePadding();
+ m_imgui->text(m_desc.at("cursor_size"));
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
+ m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Alt + Mouse wheel").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ m_imgui->checkbox(_L("Split triangles"), m_triangle_splitting_enabled);
+
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Split bigger facets into smaller ones while the object is painted.").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ m_imgui->disabled_end();
+ } else {
+ assert(m_tool_type == ToolType::SMART_FILL);
+ ImGui::AlignTextToFramePadding();
+ m_imgui->text(m_desc["smart_fill_angle"] + ":");
+ std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Degree sign to use in the respective slider in MMU gizmo,"
+ "placed after the number with no whitespace in between.");
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
+ if (m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data()))
+ for (auto &triangle_selector : m_triangle_selectors) {
+ triangle_selector->seed_fill_unselect_all_triangles();
+ triangle_selector->request_update_render_data();
+ }
+
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(max_tooltip_width);
+ ImGui::TextUnformatted(_L("Alt + Mouse wheel").ToUTF8().data());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+ }
ImGui::Separator();
if (m_c->object_clipper()->get_position() == 0.f) {
@@ -250,10 +319,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
}
}
- ImGui::SameLine(clipping_slider_left);
- ImGui::PushItemWidth(window_width - clipping_slider_left);
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
auto clp_dist = float(m_c->object_clipper()->get_position());
- if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
+ if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {
@@ -263,6 +332,23 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
+
+ ImGui::Separator();
+ if (m_imgui->button(m_desc.at("remove_all"))) {
+ Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"), UndoRedo::SnapshotType::GizmoAction);
+ ModelObject *mo = m_c->selection_info()->model_object();
+ int idx = -1;
+ for (ModelVolume *mv : mo->volumes)
+ if (mv->is_model_part()) {
+ ++idx;
+ m_triangle_selectors[idx]->reset();
+ m_triangle_selectors[idx]->request_update_render_data();
+ }
+
+ update_model_object();
+ m_parent.set_as_dirty();
+ }
+
m_imgui->end();
}
@@ -291,7 +377,7 @@ void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
// Now calculate dot product of vert_direction and facets' normals.
int idx = 0;
const indexed_triangle_set &its = mv->mesh().its;
- for (stl_triangle_vertex_indices face : its.indices) {
+ for (const stl_triangle_vertex_indices &face : its.indices) {
if (its_face_normal(its, face).dot(down) > dot_limit) {
m_triangle_selectors[mesh_id]->set_facet(idx, block ? EnforcerBlockerType::BLOCKER : EnforcerBlockerType::ENFORCER);
m_triangle_selectors.back()->request_update_render_data();
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp
index ac1c6f6c7..557ac6dcc 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp
@@ -42,7 +42,6 @@ void GLGizmoMmuSegmentation::on_shutdown()
std::string GLGizmoMmuSegmentation::on_get_name() const
{
- // FIXME Lukas H.: Discuss and change shortcut
return _u8L("Multimaterial painting");
}
@@ -107,7 +106,6 @@ void GLGizmoMmuSegmentation::init_extruders_data()
bool GLGizmoMmuSegmentation::on_init()
{
- // FIXME Lukas H.: Discuss and change shortcut
m_shortcut_key = WXK_CONTROL_N;
m_desc["reset_direction"] = _L("Reset direction");
@@ -123,7 +121,7 @@ bool GLGizmoMmuSegmentation::on_init()
m_desc["remove_all"] = _L("Remove all painted areas");
m_desc["circle"] = _L("Circle");
m_desc["sphere"] = _L("Sphere");
- m_desc["pointer"] = _L("Pointer");
+ m_desc["pointer"] = _L("Triangles");
m_desc["tool_type"] = _L("Tool type");
m_desc["tool_brush"] = _L("Brush");
@@ -236,7 +234,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
if (!m_c->selection_info()->model_object())
return;
- const float approx_height = m_imgui->scaled(25.0f);
+ const float approx_height = m_imgui->scaled(22.0f);
y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
@@ -264,13 +262,13 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const float tool_type_radio_smart_fill = m_imgui->calc_text_size(m_desc["tool_smart_fill"]).x + m_imgui->scaled(2.5f);
float caption_max = 0.f;
- float total_text_max = 0.;
+ float total_text_max = 0.f;
for (const auto &t : std::array{"first_color", "second_color", "remove"}) {
- caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc.at(t + "_caption")).x);
- total_text_max = std::max(total_text_max, caption_max + m_imgui->calc_text_size(m_desc.at(t)).x);
+ caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
+ total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
}
- caption_max += m_imgui->scaled(1.f);
- total_text_max += m_imgui->scaled(1.f);
+ total_text_max += caption_max + m_imgui->scaled(1.f);
+ caption_max += m_imgui->scaled(1.f);
float sliders_width = std::max(smart_fill_slider_left, std::max(cursor_slider_left, clipping_slider_left));
float window_width = minimal_slider_width + sliders_width;
@@ -289,7 +287,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
for (const auto &t : std::array{"first_color", "second_color", "remove"})
draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
- m_imgui->text("");
ImGui::Separator();
ImGui::AlignTextToFramePadding();
@@ -321,15 +318,13 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::Separator();
m_imgui->text(m_desc.at("tool_type"));
-
- float tool_type_offset = (window_width - tool_type_radio_brush - tool_type_radio_bucket_fill - tool_type_radio_smart_fill + m_imgui->scaled(2.f)) / 2.f;
-
ImGui::NewLine();
- ImGui::SameLine(tool_type_offset + m_imgui->scaled(0.f));
+ float tool_type_offset = (window_width - tool_type_radio_brush - tool_type_radio_bucket_fill - tool_type_radio_smart_fill + m_imgui->scaled(1.5f)) / 2.f;
+ ImGui::SameLine(tool_type_offset);
ImGui::PushItemWidth(tool_type_radio_brush);
- if (m_imgui->radio_button(m_desc["tool_brush"], m_tool_type == GLGizmoMmuSegmentation::ToolType::BRUSH)) {
- m_tool_type = GLGizmoMmuSegmentation::ToolType::BRUSH;
+ if (m_imgui->radio_button(m_desc["tool_brush"], m_tool_type == ToolType::BRUSH)) {
+ m_tool_type = ToolType::BRUSH;
for (auto &triangle_selector : m_triangle_selectors) {
triangle_selector->seed_fill_unselect_all_triangles();
triangle_selector->request_update_render_data();
@@ -344,10 +339,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::EndTooltip();
}
- ImGui::SameLine(tool_type_offset + tool_type_radio_brush + m_imgui->scaled(0.f));
+ ImGui::SameLine(tool_type_offset + tool_type_radio_brush);
ImGui::PushItemWidth(tool_type_radio_smart_fill);
- if (m_imgui->radio_button(m_desc["tool_smart_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::SMART_FILL)) {
- m_tool_type = GLGizmoMmuSegmentation::ToolType::SMART_FILL;
+ if (m_imgui->radio_button(m_desc["tool_smart_fill"], m_tool_type == ToolType::SMART_FILL)) {
+ m_tool_type = ToolType::SMART_FILL;
for (auto &triangle_selector : m_triangle_selectors) {
triangle_selector->seed_fill_unselect_all_triangles();
triangle_selector->request_update_render_data();
@@ -362,10 +357,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::EndTooltip();
}
- ImGui::SameLine(tool_type_offset + tool_type_radio_brush + tool_type_radio_smart_fill + m_imgui->scaled(0.f));
+ ImGui::SameLine(tool_type_offset + tool_type_radio_brush + tool_type_radio_smart_fill);
ImGui::PushItemWidth(tool_type_radio_bucket_fill);
- if (m_imgui->radio_button(m_desc["tool_bucket_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::BUCKET_FILL)) {
- m_tool_type = GLGizmoMmuSegmentation::ToolType::BUCKET_FILL;
+ if (m_imgui->radio_button(m_desc["tool_bucket_fill"], m_tool_type == ToolType::BUCKET_FILL)) {
+ m_tool_type = ToolType::BUCKET_FILL;
for (auto &triangle_selector : m_triangle_selectors) {
triangle_selector->seed_fill_unselect_all_triangles();
triangle_selector->request_update_render_data();
@@ -386,8 +381,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
m_imgui->text(m_desc.at("cursor_type"));
ImGui::NewLine();
- float cursor_type_offset = (window_width - cursor_type_radio_sphere - cursor_type_radio_circle - cursor_type_radio_pointer + m_imgui->scaled(2.f)) / 2.f;
- ImGui::SameLine(cursor_type_offset + m_imgui->scaled(0.f));
+ float cursor_type_offset = (window_width - cursor_type_radio_sphere - cursor_type_radio_circle - cursor_type_radio_pointer + m_imgui->scaled(1.5f)) / 2.f;
+ ImGui::SameLine(cursor_type_offset);
ImGui::PushItemWidth(cursor_type_radio_sphere);
if (m_imgui->radio_button(m_desc["sphere"], m_cursor_type == TriangleSelector::CursorType::SPHERE))
m_cursor_type = TriangleSelector::CursorType::SPHERE;
@@ -400,7 +395,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::EndTooltip();
}
- ImGui::SameLine(cursor_type_offset +cursor_type_radio_sphere + m_imgui->scaled(0.f));
+ ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere);
ImGui::PushItemWidth(cursor_type_radio_circle);
if (m_imgui->radio_button(m_desc["circle"], m_cursor_type == TriangleSelector::CursorType::CIRCLE))
@@ -414,7 +409,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::EndTooltip();
}
- ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere + cursor_type_radio_circle + m_imgui->scaled(0.f));
+ ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere + cursor_type_radio_circle);
ImGui::PushItemWidth(cursor_type_radio_pointer);
if (m_imgui->radio_button(m_desc["pointer"], m_cursor_type == TriangleSelector::CursorType::POINTER))
@@ -434,7 +429,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
m_imgui->text(m_desc.at("cursor_size"));
ImGui::SameLine(sliders_width);
ImGui::PushItemWidth(window_width - sliders_width);
- m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
+ m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@@ -492,8 +487,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::SameLine(sliders_width);
ImGui::PushItemWidth(window_width - sliders_width);
auto clp_dist = float(m_c->object_clipper()->get_position());
- if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
+ if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
+
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@@ -596,11 +592,6 @@ std::array GLGizmoMmuSegmentation::get_cursor_sphere_right_button_colo
return {color[0], color[1], color[2], 0.25f};
}
-static std::array get_seed_fill_color(const std::array &base_color)
-{
- return {base_color[0] * 0.75f, base_color[1] * 0.75f, base_color[2] * 0.75f, 1.f};
-}
-
void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
{
if (m_update_render_data)
@@ -620,14 +611,14 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
for (size_t color_idx = 0; color_idx < m_gizmo_scene.triangle_indices.size(); ++color_idx)
if (m_gizmo_scene.has_VBOs(color_idx)) {
if (color_idx > m_colors.size()) // Seed fill VBO
- shader->set_uniform("uniform_color", get_seed_fill_color(color_idx == (m_colors.size() + 1) ? m_default_volume_color : m_colors[color_idx - (m_colors.size() + 1) - 1]));
+ shader->set_uniform("uniform_color", TriangleSelectorGUI::get_seed_fill_color(color_idx == (m_colors.size() + 1) ? m_default_volume_color : m_colors[color_idx - (m_colors.size() + 1) - 1]));
else // Normal VBO
shader->set_uniform("uniform_color", color_idx == 0 ? m_default_volume_color : m_colors[color_idx - 1]);
m_gizmo_scene.render(color_idx);
}
- if (m_gizmo_scene.has_contour_VBO()) {
+ if (m_paint_contour.has_VBO()) {
ScopeGuard guard_gouraud([shader]() { shader->start_using(); });
shader->stop_using();
@@ -635,7 +626,7 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
contour_shader->start_using();
glsafe(::glDepthFunc(GL_LEQUAL));
- m_gizmo_scene.render_contour();
+ m_paint_contour.render();
glsafe(::glDepthFunc(GL_LESS));
contour_shader->stop_using();
@@ -674,23 +665,24 @@ void TriangleSelectorMmGui::update_render_data()
m_gizmo_scene.finalize_triangle_indices();
+ m_paint_contour.release_geometry();
std::vector contour_edges = this->get_seed_fill_contour();
- m_gizmo_scene.contour_vertices.reserve(contour_edges.size() * 6);
+ m_paint_contour.contour_vertices.reserve(contour_edges.size() * 6);
for (const Vec2i &edge : contour_edges) {
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(0)].v.x());
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(0)].v.y());
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(0)].v.z());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.x());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.y());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.z());
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(1)].v.x());
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(1)].v.y());
- m_gizmo_scene.contour_vertices.emplace_back(m_vertices[edge(1)].v.z());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.x());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.y());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.z());
}
- m_gizmo_scene.contour_indices.assign(m_gizmo_scene.contour_vertices.size() / 3, 0);
- std::iota(m_gizmo_scene.contour_indices.begin(), m_gizmo_scene.contour_indices.end(), 0);
- m_gizmo_scene.contour_indices_size = m_gizmo_scene.contour_indices.size();
+ m_paint_contour.contour_indices.assign(m_paint_contour.contour_vertices.size() / 3, 0);
+ std::iota(m_paint_contour.contour_indices.begin(), m_paint_contour.contour_indices.end(), 0);
+ m_paint_contour.contour_indices_size = m_paint_contour.contour_indices.size();
- m_gizmo_scene.finalize_contour();
+ m_paint_contour.finalize_geometry();
}
wxString GLGizmoMmuSegmentation::handle_snapshot_action_name(bool shift_down, GLGizmoPainterBase::Button button_down) const
@@ -714,14 +706,6 @@ void GLMmSegmentationGizmo3DScene::release_geometry() {
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
triangle_indices_VBO_id = 0;
}
- if (this->contour_vertices_VBO_id) {
- glsafe(::glDeleteBuffers(1, &this->contour_vertices_VBO_id));
- this->contour_vertices_VBO_id = 0;
- }
- if (this->contour_indices_VBO_id) {
- glsafe(::glDeleteBuffers(1, &this->contour_indices_VBO_id));
- this->contour_indices_VBO_id = 0;
- }
this->clear();
}
@@ -749,29 +733,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
}
-void GLMmSegmentationGizmo3DScene::render_contour() const
-{
- assert(this->contour_vertices_VBO_id != 0);
- assert(this->contour_indices_VBO_id != 0);
-
- glsafe(::glLineWidth(4.0f));
-
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->contour_vertices_VBO_id));
- glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), nullptr));
-
- glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
-
- if (this->contour_indices_size > 0) {
- glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->contour_indices_VBO_id));
- glsafe(::glDrawElements(GL_LINES, GLsizei(this->contour_indices_size), GL_UNSIGNED_INT, nullptr));
- glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
- }
-
- glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
-
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
-}
-
void GLMmSegmentationGizmo3DScene::finalize_vertices()
{
assert(this->vertices_VBO_id == 0);
@@ -799,26 +760,4 @@ void GLMmSegmentationGizmo3DScene::finalize_triangle_indices()
}
}
-void GLMmSegmentationGizmo3DScene::finalize_contour()
-{
- assert(this->contour_vertices_VBO_id == 0);
- assert(this->contour_indices_VBO_id == 0);
-
- if (!this->contour_vertices.empty()) {
- glsafe(::glGenBuffers(1, &this->contour_vertices_VBO_id));
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->contour_vertices_VBO_id));
- glsafe(::glBufferData(GL_ARRAY_BUFFER, this->contour_vertices.size() * sizeof(float), this->contour_vertices.data(), GL_STATIC_DRAW));
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
- this->contour_vertices.clear();
- }
-
- if (!this->contour_indices.empty()) {
- glsafe(::glGenBuffers(1, &this->contour_indices_VBO_id));
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->contour_indices_VBO_id));
- glsafe(::glBufferData(GL_ARRAY_BUFFER, this->contour_indices.size() * sizeof(unsigned int), this->contour_indices.data(), GL_STATIC_DRAW));
- glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
- this->contour_indices.clear();
- }
-}
-
} // namespace Slic3r
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp
index 851a5ac4f..604edf64d 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp
@@ -25,8 +25,6 @@ public:
return this->triangle_indices_VBO_ids[triangle_indices_idx] != 0;
}
- [[nodiscard]] inline bool has_contour_VBO() const { return this->contour_indices_VBO_id != 0; }
-
// Release the geometry data, release OpenGL VBOs.
void release_geometry();
// Finalize the initialization of the geometry, upload the geometry to OpenGL VBO objects
@@ -35,9 +33,6 @@ public:
// Finalize the initialization of the indices, upload the indices to OpenGL VBO objects
// and possibly releasing it if it has been loaded into the VBOs.
void finalize_triangle_indices();
- // Finalize the initialization of the contour geometry and the indices, upload both to OpenGL VBO objects
- // and possibly releasing it if it has been loaded into the VBOs.
- void finalize_contour();
void clear()
{
@@ -47,34 +42,21 @@ public:
for (size_t &triangle_indices_size : this->triangle_indices_sizes)
triangle_indices_size = 0;
-
- this->contour_vertices.clear();
- this->contour_indices.clear();
- this->contour_indices_size = 0;
}
void render(size_t triangle_indices_idx) const;
- void render_contour() const;
-
std::vector vertices;
std::vector> triangle_indices;
- std::vector contour_vertices;
- std::vector contour_indices;
-
// When the triangle indices are loaded into the graphics card as Vertex Buffer Objects,
// the above mentioned std::vectors are cleared and the following variables keep their original length.
std::vector triangle_indices_sizes;
- size_t contour_indices_size{0};
// IDs of the Vertex Array Objects, into which the geometry has been loaded.
// Zero if the VBOs are not sent to GPU yet.
unsigned int vertices_VBO_id{0};
std::vector triangle_indices_VBO_ids;
-
- unsigned int contour_vertices_VBO_id{0};
- unsigned int contour_indices_VBO_id{0};
};
class TriangleSelectorMmGui : public TriangleSelectorGUI {
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp
index b55c628f0..272030177 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp
@@ -553,7 +553,10 @@ void GLGizmoPainterBase::on_load(cereal::BinaryInputArchive&)
m_schedule_update = true;
}
-
+std::array TriangleSelectorGUI::get_seed_fill_color(const std::array &base_color)
+{
+ return {base_color[0] * 0.75f, base_color[1] * 0.75f, base_color[2] * 0.75f, 1.f};
+}
void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
{
@@ -582,6 +585,29 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
}
}
+ for (auto &iva : m_iva_seed_fills)
+ if (iva.has_VBOs()) {
+ size_t color_idx = &iva - &m_iva_seed_fills.front();
+ const std::array &color = TriangleSelectorGUI::get_seed_fill_color(color_idx == 1 ? enforcers_color :
+ color_idx == 2 ? blockers_color :
+ GLVolume::NEUTRAL_COLOR);
+ shader->set_uniform("uniform_color", color);
+ iva.render();
+ }
+
+ if (m_paint_contour.has_VBO()) {
+ ScopeGuard guard_gouraud([shader]() { shader->start_using(); });
+ shader->stop_using();
+
+ auto *contour_shader = wxGetApp().get_shader("mm_contour");
+ contour_shader->start_using();
+
+ glsafe(::glDepthFunc(GL_GEQUAL));
+ m_paint_contour.render();
+ glsafe(::glDepthFunc(GL_LESS));
+
+ contour_shader->stop_using();
+ }
#ifdef PRUSASLICER_TRIANGLE_SELECTOR_DEBUG
if (imgui)
@@ -591,26 +617,33 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
#endif
}
-
-
void TriangleSelectorGUI::update_render_data()
{
- int enf_cnt = 0;
- int blc_cnt = 0;
+ int enf_cnt = 0;
+ int blc_cnt = 0;
+ std::vector seed_fill_cnt(m_iva_seed_fills.size(), 0);
for (auto *iva : {&m_iva_enforcers, &m_iva_blockers})
iva->release_geometry();
+ for (auto &iva : m_iva_seed_fills)
+ iva.release_geometry();
+
for (const Triangle &tr : m_triangles) {
- if (!tr.valid() || tr.is_split() || tr.get_state() == EnforcerBlockerType::NONE)
+ if (!tr.valid() || tr.is_split() || (tr.get_state() == EnforcerBlockerType::NONE && !tr.is_selected_by_seed_fill()))
continue;
- GLIndexedVertexArray &iva = tr.get_state() == EnforcerBlockerType::ENFORCER ? m_iva_enforcers : m_iva_blockers;
- int & cnt = tr.get_state() == EnforcerBlockerType::ENFORCER ? enf_cnt : blc_cnt;
+ int tr_state = int(tr.get_state());
+ GLIndexedVertexArray &iva = tr.is_selected_by_seed_fill() ? m_iva_seed_fills[tr_state] :
+ tr.get_state() == EnforcerBlockerType::ENFORCER ? m_iva_enforcers :
+ m_iva_blockers;
+ int &cnt = tr.is_selected_by_seed_fill() ? seed_fill_cnt[tr_state] :
+ tr.get_state() == EnforcerBlockerType::ENFORCER ? enf_cnt :
+ blc_cnt;
const Vec3f &v0 = m_vertices[tr.verts_idxs[0]].v;
const Vec3f &v1 = m_vertices[tr.verts_idxs[1]].v;
const Vec3f &v2 = m_vertices[tr.verts_idxs[2]].v;
- //FIXME the normal may likely be pulled from m_triangle_selectors, but it may not be worth the effort
+ //FIXME the normal may likely be pulled from m_triangle_selectors, but it may not be worth the effort
// or the current implementation may be more cache friendly.
const Vec3f n = (v1 - v0).cross(v2 - v1).normalized();
iva.push_geometry(v0, n);
@@ -622,9 +655,87 @@ void TriangleSelectorGUI::update_render_data()
for (auto *iva : {&m_iva_enforcers, &m_iva_blockers})
iva->finalize_geometry(true);
+
+ for (auto &iva : m_iva_seed_fills)
+ iva.finalize_geometry(true);
+
+ m_paint_contour.release_geometry();
+ std::vector contour_edges = this->get_seed_fill_contour();
+ m_paint_contour.contour_vertices.reserve(contour_edges.size() * 6);
+ for (const Vec2i &edge : contour_edges) {
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.x());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.y());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(0)].v.z());
+
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.x());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.y());
+ m_paint_contour.contour_vertices.emplace_back(m_vertices[edge(1)].v.z());
+ }
+
+ m_paint_contour.contour_indices.assign(m_paint_contour.contour_vertices.size() / 3, 0);
+ std::iota(m_paint_contour.contour_indices.begin(), m_paint_contour.contour_indices.end(), 0);
+ m_paint_contour.contour_indices_size = m_paint_contour.contour_indices.size();
+
+ m_paint_contour.finalize_geometry();
}
+void GLPaintContour::render() const
+{
+ assert(this->m_contour_VBO_id != 0);
+ assert(this->m_contour_EBO_id != 0);
+ glsafe(::glLineWidth(4.0f));
+
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_contour_VBO_id));
+ glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), nullptr));
+
+ glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
+
+ if (this->contour_indices_size > 0) {
+ glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->m_contour_EBO_id));
+ glsafe(::glDrawElements(GL_LINES, GLsizei(this->contour_indices_size), GL_UNSIGNED_INT, nullptr));
+ glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+ }
+
+ glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
+
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
+}
+
+void GLPaintContour::finalize_geometry()
+{
+ assert(this->m_contour_VBO_id == 0);
+ assert(this->m_contour_EBO_id == 0);
+
+ if (!this->contour_vertices.empty()) {
+ glsafe(::glGenBuffers(1, &this->m_contour_VBO_id));
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_contour_VBO_id));
+ glsafe(::glBufferData(GL_ARRAY_BUFFER, this->contour_vertices.size() * sizeof(float), this->contour_vertices.data(), GL_STATIC_DRAW));
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
+ this->contour_vertices.clear();
+ }
+
+ if (!this->contour_indices.empty()) {
+ glsafe(::glGenBuffers(1, &this->m_contour_EBO_id));
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_contour_EBO_id));
+ glsafe(::glBufferData(GL_ARRAY_BUFFER, this->contour_indices.size() * sizeof(unsigned int), this->contour_indices.data(), GL_STATIC_DRAW));
+ glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
+ this->contour_indices.clear();
+ }
+}
+
+void GLPaintContour::release_geometry()
+{
+ if (this->m_contour_VBO_id) {
+ glsafe(::glDeleteBuffers(1, &this->m_contour_VBO_id));
+ this->m_contour_VBO_id = 0;
+ }
+ if (this->m_contour_EBO_id) {
+ glsafe(::glDeleteBuffers(1, &this->m_contour_EBO_id));
+ this->m_contour_EBO_id = 0;
+ }
+ this->clear();
+}
#ifdef PRUSASLICER_TRIANGLE_SELECTOR_DEBUG
void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp
index 8d37f2404..cc15af41f 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp
@@ -10,6 +10,7 @@
#include "libslic3r/Model.hpp"
#include
+#include
@@ -26,6 +27,41 @@ enum class PainterGizmoType {
MMU_SEGMENTATION
};
+class GLPaintContour
+{
+public:
+ GLPaintContour() = default;
+
+ void render() const;
+
+ inline bool has_VBO() const { return this->m_contour_EBO_id != 0; }
+
+ // Release the geometry data, release OpenGL VBOs.
+ void release_geometry();
+
+ // Finalize the initialization of the contour geometry and the indices, upload both to OpenGL VBO objects
+ // and possibly releasing it if it has been loaded into the VBOs.
+ void finalize_geometry();
+
+ void clear()
+ {
+ this->contour_vertices.clear();
+ this->contour_indices.clear();
+ this->contour_indices_size = 0;
+ }
+
+ std::vector contour_vertices;
+ std::vector contour_indices;
+
+ // When the triangle indices are loaded into the graphics card as Vertex Buffer Objects,
+ // the above mentioned std::vectors are cleared and the following variables keep their original length.
+ size_t contour_indices_size{0};
+
+ // IDs of the Vertex Array Objects, into which the geometry has been loaded.
+ // Zero if the VBOs are not sent to GPU yet.
+ GLuint m_contour_VBO_id{0};
+ GLuint m_contour_EBO_id{0};
+};
class TriangleSelectorGUI : public TriangleSelector {
public:
@@ -49,12 +85,18 @@ public:
protected:
bool m_update_render_data = false;
+ static std::array get_seed_fill_color(const std::array &base_color);
+
private:
void update_render_data();
GLIndexedVertexArray m_iva_enforcers;
GLIndexedVertexArray m_iva_blockers;
+ std::array m_iva_seed_fills;
std::array m_varrays;
+
+protected:
+ GLPaintContour m_paint_contour;
};
class GLGizmoTransparentRender
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
index b23528772..2f9d16f90 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
@@ -77,7 +77,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
if (! m_c->selection_info()->model_object())
return;
- const float approx_height = m_imgui->scaled(14.0f);
+ const float approx_height = m_imgui->scaled(12.5f);
y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
@@ -87,27 +87,28 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
+ m_imgui->scaled(1.5f);
const float cursor_size_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
- const float cursor_type_radio_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
- const float cursor_type_radio_width1 = m_imgui->calc_text_size(m_desc["circle"]).x
- + m_imgui->scaled(2.5f);
- const float cursor_type_radio_width2 = m_imgui->calc_text_size(m_desc["sphere"]).x
- + m_imgui->scaled(2.5f);
+
+ const float cursor_type_radio_left = m_imgui->calc_text_size(m_desc["cursor_type"]).x + m_imgui->scaled(1.f);
+ const float cursor_type_radio_sphere = m_imgui->calc_text_size(m_desc["sphere"]).x + m_imgui->scaled(2.5f);
+ const float cursor_type_radio_circle = m_imgui->calc_text_size(m_desc["circle"]).x + m_imgui->scaled(2.5f);
+
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
const float minimal_slider_width = m_imgui->scaled(4.f);
float caption_max = 0.f;
float total_text_max = 0.f;
for (const auto &t : std::array{"enforce", "block", "remove"}) {
- caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc.at(t + "_caption")).x);
- total_text_max = std::max(total_text_max, caption_max + m_imgui->calc_text_size(m_desc.at(t)).x);
+ caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
+ total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
}
- caption_max += m_imgui->scaled(1.f);
- total_text_max += m_imgui->scaled(1.f);
+ total_text_max += caption_max + m_imgui->scaled(1.f);
+ caption_max += m_imgui->scaled(1.f);
- float window_width = minimal_slider_width + std::max(cursor_size_slider_left, clipping_slider_left);
+ float sliders_width = std::max(cursor_size_slider_left, clipping_slider_left);
+ float window_width = minimal_slider_width + sliders_width;
window_width = std::max(window_width, total_text_max);
window_width = std::max(window_width, button_width);
- window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_width1 + cursor_type_radio_width2);
+ window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_sphere + cursor_type_radio_circle);
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
static const ImVec4 ORANGE(1.0f, 0.49f, 0.22f, 1.0f);
@@ -119,32 +120,15 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
for (const auto &t : std::array{"enforce", "block", "remove"})
draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
- m_imgui->text("");
-
- if (m_imgui->button(m_desc.at("remove_all"))) {
- Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"),
- UndoRedo::SnapshotType::GizmoAction);
- ModelObject* mo = m_c->selection_info()->model_object();
- int idx = -1;
- for (ModelVolume* mv : mo->volumes) {
- if (mv->is_model_part()) {
- ++idx;
- m_triangle_selectors[idx]->reset();
- m_triangle_selectors[idx]->request_update_render_data();
- }
- }
-
- update_model_object();
- m_parent.set_as_dirty();
- }
+ ImGui::Separator();
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("cursor_size"));
- ImGui::SameLine(cursor_size_slider_left);
- ImGui::PushItemWidth(window_width - cursor_size_slider_left);
- m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
+ m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@@ -155,12 +139,12 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("cursor_type"));
- ImGui::SameLine(cursor_type_radio_left + m_imgui->scaled(0.f));
- ImGui::PushItemWidth(cursor_type_radio_width1);
- bool sphere_sel = m_cursor_type == TriangleSelector::CursorType::SPHERE;
- if (m_imgui->radio_button(m_desc["sphere"], sphere_sel))
- sphere_sel = true;
+ float cursor_type_offset = cursor_type_radio_left + (window_width - cursor_type_radio_left - cursor_type_radio_sphere - cursor_type_radio_circle + m_imgui->scaled(0.5f)) / 2.f;
+ ImGui::SameLine(cursor_type_offset);
+ ImGui::PushItemWidth(cursor_type_radio_sphere);
+ if (m_imgui->radio_button(m_desc["sphere"], m_cursor_type == TriangleSelector::CursorType::SPHERE))
+ m_cursor_type = TriangleSelector::CursorType::SPHERE;
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
@@ -170,11 +154,10 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::EndTooltip();
}
- ImGui::SameLine(cursor_type_radio_left + cursor_type_radio_width2 + m_imgui->scaled(0.f));
- ImGui::PushItemWidth(cursor_type_radio_width2);
-
- if (m_imgui->radio_button(m_desc["circle"], ! sphere_sel))
- sphere_sel = false;
+ ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere);
+ ImGui::PushItemWidth(cursor_type_radio_circle);
+ if (m_imgui->radio_button(m_desc["circle"], m_cursor_type == TriangleSelector::CursorType::CIRCLE))
+ m_cursor_type = TriangleSelector::CursorType::CIRCLE;
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
@@ -184,12 +167,6 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::EndTooltip();
}
- m_cursor_type = sphere_sel
- ? TriangleSelector::CursorType::SPHERE
- : TriangleSelector::CursorType::CIRCLE;
-
-
-
ImGui::Separator();
if (m_c->object_clipper()->get_position() == 0.f) {
ImGui::AlignTextToFramePadding();
@@ -203,10 +180,10 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
}
}
- ImGui::SameLine(clipping_slider_left);
- ImGui::PushItemWidth(window_width - clipping_slider_left);
+ ImGui::SameLine(sliders_width);
+ ImGui::PushItemWidth(window_width - sliders_width);
auto clp_dist = float(m_c->object_clipper()->get_position());
- if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
+ if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {
@@ -217,6 +194,22 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::EndTooltip();
}
+ ImGui::Separator();
+ if (m_imgui->button(m_desc.at("remove_all"))) {
+ Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"), UndoRedo::SnapshotType::GizmoAction);
+ ModelObject *mo = m_c->selection_info()->model_object();
+ int idx = -1;
+ for (ModelVolume *mv : mo->volumes)
+ if (mv->is_model_part()) {
+ ++idx;
+ m_triangle_selectors[idx]->reset();
+ m_triangle_selectors[idx]->request_update_render_data();
+ }
+
+ update_model_object();
+ m_parent.set_as_dirty();
+ }
+
m_imgui->end();
}
diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
index 764c42c73..08a94a97d 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
@@ -548,7 +548,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
// mouse anywhere
if (evt.Moving()) {
m_tooltip = update_hover_state(mouse_pos);
- if (m_current == MmuSegmentation)
+ if (m_current == MmuSegmentation || m_current == FdmSupports)
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, evt.ShiftDown(), evt.AltDown());
} else if (evt.LeftUp()) {
if (m_mouse_capture.left) {
diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp
index 0bed7eb74..d16161f89 100644
--- a/src/slic3r/GUI/KBShortcutsDialog.cpp
+++ b/src/slic3r/GUI/KBShortcutsDialog.cpp
@@ -270,7 +270,7 @@ wxPanel* KBShortcutsDialog::create_header(wxWindow* parent, const wxFont& bold_f
sizer->AddStretchSpacer();
// logo
- m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_32px.png" : "PrusaSlicer-gcodeviewer_32px.png", 32);
+ m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 32);
m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp());
sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp
index 78735b925..ed4b477b8 100644
--- a/src/slic3r/GUI/ObjectDataViewModel.cpp
+++ b/src/slic3r/GUI/ObjectDataViewModel.cpp
@@ -1786,6 +1786,14 @@ bool ObjectDataViewModel::HasWarningIcon(const wxDataViewItem& item) const
return node->has_warning_icon();
}
+void ObjectDataViewModel::UpdateWarningIcon(const wxDataViewItem& item, const std::string& warning_icon_name)
+{
+ if (warning_icon_name.empty())
+ DeleteWarningIcon(item, true);
+ else
+ AddWarningIcon(item, warning_icon_name);
+}
+
} // namespace GUI
} // namespace Slic3r
diff --git a/src/slic3r/GUI/ObjectDataViewModel.hpp b/src/slic3r/GUI/ObjectDataViewModel.hpp
index ca7a0cde0..f8885b206 100644
--- a/src/slic3r/GUI/ObjectDataViewModel.hpp
+++ b/src/slic3r/GUI/ObjectDataViewModel.hpp
@@ -389,6 +389,7 @@ public:
const std::string& warning_icon_name = std::string());
void AddWarningIcon(const wxDataViewItem& item, const std::string& warning_name);
void DeleteWarningIcon(const wxDataViewItem& item, const bool unmark_object = false);
+ void UpdateWarningIcon(const wxDataViewItem& item, const std::string& warning_name);
bool HasWarningIcon(const wxDataViewItem& item) const;
t_layer_height_range GetLayerRangeByItem(const wxDataViewItem& item) const;
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 332ab8d17..3c217a59e 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -1204,9 +1204,9 @@ void Sidebar::show_info_sizer()
static_cast(model_object->facets_count()), stats.number_of_parts));
wxString info_manifold_label;
- auto mesh_errors = obj_list()->get_mesh_errors(&info_manifold_label);
- wxString tooltip = mesh_errors.first;
- p->object_info->update_warning_icon(mesh_errors.second);
+ auto mesh_errors = obj_list()->get_mesh_errors_info(&info_manifold_label);
+ wxString tooltip = mesh_errors.tooltip;
+ p->object_info->update_warning_icon(mesh_errors.warning_icon_name);
p->object_info->info_manifold->SetLabel(info_manifold_label);
p->object_info->info_manifold->SetToolTip(tooltip);
p->object_info->manifold_warning_icon->SetToolTip(tooltip);
@@ -2438,6 +2438,14 @@ std::vector Plater::priv::load_files(const std::vector& input_
};
if (!is_project_file) {
+ if (int deleted_objects = model.removed_objects_with_zero_volume(); deleted_objects > 0) {
+ MessageDialog(q, format_wxstr(_L_PLURAL(
+ "Object size from file %s appears to be zero.\n"
+ "This object has been removed from the model",
+ "Objects size from file %s appear to be zero.\n"
+ "These objects have been removed from the model", deleted_objects), from_path(filename)) + "\n",
+ _L("Object size is zero"), wxICON_INFORMATION | wxOK).ShowModal();
+ }
if (imperial_units)
// Convert even if the object is big.
convert_from_imperial_units(model, false);
@@ -4600,14 +4608,14 @@ bool Plater::priv::can_fix_through_netfabb() const
// Fixing only if the model is not manifold.
if (vol_idxs.empty()) {
for (auto obj_idx : obj_idxs)
- if (model.objects[obj_idx]->get_mesh_errors_count() > 0)
+ if (model.objects[obj_idx]->get_repaired_errors_count() > 0)
return true;
return false;
}
int obj_idx = obj_idxs.front();
for (auto vol_idx : vol_idxs)
- if (model.objects[obj_idx]->get_mesh_errors_count(vol_idx) > 0)
+ if (model.objects[obj_idx]->get_repaired_errors_count(vol_idx) > 0)
return true;
return false;
#endif // FIX_THROUGH_NETFABB_ALWAYS
diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp
index 880723693..9d1236922 100644
--- a/src/slic3r/GUI/Preferences.cpp
+++ b/src/slic3r/GUI/Preferences.cpp
@@ -343,6 +343,7 @@ void PreferencesDialog::build(size_t selected_tab)
m_optgroup_gui->append_single_option_line(option);
#ifdef _MSW_DARK_MODE
+ }
def.label = L("Use Dark color mode (experimental)");
def.type = coBool;
def.tooltip = L("If enabled, UI will use Dark mode colors. "
@@ -351,6 +352,7 @@ void PreferencesDialog::build(size_t selected_tab)
option = Option(def, "dark_color_mode");
m_optgroup_gui->append_single_option_line(option);
+ if (is_editor) {
def.label = L("Set settings tabs as menu items (experimental)");
def.type = coBool;
def.tooltip = L("If enabled, Settings Tabs will be placed as menu items. "
diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp
index 6f8eeedcc..5475a36ea 100644
--- a/src/slic3r/GUI/SysInfoDialog.cpp
+++ b/src/slic3r/GUI/SysInfoDialog.cpp
@@ -94,7 +94,7 @@ SysInfoDialog::SysInfoDialog()
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
// logo
- m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_192px.png" : "PrusaSlicer-gcodeviewer_192px.png", 192);
+ m_logo_bmp = ScalableBitmap(this, wxGetApp().logo_name(), 192);
m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp());
hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL);
diff --git a/src/slic3r/Utils/FixModelByWin10.cpp b/src/slic3r/Utils/FixModelByWin10.cpp
index 30c81f6f7..6f6b21f68 100644
--- a/src/slic3r/Utils/FixModelByWin10.cpp
+++ b/src/slic3r/Utils/FixModelByWin10.cpp
@@ -421,7 +421,7 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, wxPro
}
});
while (! finished) {
- condition.wait_for(lock, std::chrono::milliseconds(500), [&progress]{ return progress.updated; });
+ condition.wait_for(lock, std::chrono::milliseconds(250), [&progress]{ return progress.updated; });
// decrease progress.percent value to avoid closing of the progress dialog
if (!progress_dialog.Update(progress.percent-1, msg_header + _(progress.message)))
canceled = true;