mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-07 15:51:08 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c8e1f1c24 | ||
|
|
6639a32b0c | ||
|
|
1f7a8ec91b | ||
|
|
fb74c8710c | ||
|
|
1ec195a221 | ||
|
|
e5324ae319 | ||
|
|
559ad3e2b7 | ||
|
|
de6b0b9f2d | ||
|
|
f02292f163 | ||
|
|
23546e71ce | ||
|
|
73d32d4791 | ||
|
|
67ff6bd34b |
+9
-4
@@ -1,10 +1,15 @@
|
||||
# clang-tidy configuration, enforced by the clang-tidy CI job on the lines a pull
|
||||
# request changes (scripts/clang_tidy_diff.py). Only missing includes are reported
|
||||
# for now: a file should include the header for every symbol it uses, not rely on
|
||||
# the precompiled header or another header's includes. Run with --fix to add them.
|
||||
# request changes (scripts/clang_tidy_diff.py). Two things are reported.
|
||||
# Missing includes: a file should include the header for every symbol it uses, not
|
||||
# rely on the precompiled header or another header's includes. Run with --fix to
|
||||
# add them.
|
||||
# Using-directives and using-declarations in the global namespace of a header:
|
||||
# they reach every file that includes the header, and a using-declaration also
|
||||
# makes the header look like the one to include for that name. Qualify the name
|
||||
# in the header, and put the using in the source files that want it.
|
||||
# Every check listed here gates pull requests, so enable a new one only once the
|
||||
# code it flags on touched lines is reasonable to fix in passing.
|
||||
Checks: '-*,misc-include-cleaner'
|
||||
Checks: '-*,misc-include-cleaner,google-global-names-in-headers'
|
||||
WarningsAsErrors: '*'
|
||||
CheckOptions:
|
||||
# Missing includes only. Builds without the precompiled header break on these.
|
||||
|
||||
@@ -4,15 +4,17 @@ OrcaSlicer — open-source C++17 3D slicer. wxWidgets GUI, CMake build system.
|
||||
|
||||
## Build Commands
|
||||
|
||||
Build the Release configuration unless asked otherwise.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
cmake --build build/arm64 --config Release --target all --
|
||||
|
||||
# Linux
|
||||
cmake --build build --config RelWithDebInfo --target all --
|
||||
cmake --build build --config Release --target all --
|
||||
|
||||
# Windows (replace %build_type% with Debug/Release/RelWithDebInfo)
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
# Windows
|
||||
cmake --build . --config Release --target ALL_BUILD -- -m
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M5.5,14.5c-1.105,0-2-3.686-2-7s.895-7,2-7" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="8.67" y1="4.67" x2="14.33" y2="10.33" style="fill:none;stroke:#949494;stroke-linecap:square;stroke-linejoin:round"/><line x1="14.33" y1="4.67" x2="8.67" y2="10.33" style="fill:none;stroke:#949494;stroke-linecap:square;stroke-linejoin:round"/><path d="M3.5,13.7c-.294.511-.636.8-1,.8-1.1,0-2-3.686-2-7s.9-7,2-7c.365,0,.707.293,1,.805" style="fill:none;stroke:#949494;stroke-linecap:round;stroke-linejoin:round"/><path d="M6.727,4.5c.334-2.208,1-4,1.773-4,.354,0,.686.378.974,1" style="fill:none;stroke:#949494;stroke-linecap:round;stroke-linejoin:round"/><path d="M9.474,13.5c-.288.622-.62,1-.974,1-.77,0-1.439-1.792-1.773-4" style="fill:none;stroke:#949494;stroke-linecap:round;stroke-linejoin:round"/></svg>
|
||||
|
After Width: | Height: | Size: 931 B |
@@ -29,19 +29,13 @@ uniform vec3 palette_lab[64];
|
||||
uniform vec3 palette_rgb[64];
|
||||
uniform int palette_count;
|
||||
uniform bool pure_only; // match against single filaments only (flat-colour image)
|
||||
// How each entry prints. A pure entry is one filament (a == b); a mix interleaves filaments a and b,
|
||||
// num parts of a in every den, and the print shows that interleave rather than the entry's average
|
||||
// colour. The fragment resolves it exactly as GLGizmoTextureDisplacement::make_mix_resolver() does
|
||||
// per triangle on the CPU, so the preview shows the pattern the bake will print.
|
||||
// How each entry prints. Every entry names a single filament: a mix is given its own mixed filament
|
||||
// slot, whose components the slicer alternates per print layer, so the fragment just looks that slot's
|
||||
// colour up.
|
||||
uniform int palette_a[64];
|
||||
uniform int palette_b[64];
|
||||
uniform int palette_num[64];
|
||||
uniform int palette_den[64];
|
||||
uniform vec3 filament_rgb[16];
|
||||
uniform int filament_count;
|
||||
uniform int mix_mode; // ColorMixMode: 0 Z bands, 1 XY dither, 2 auto
|
||||
uniform float layer_height; // mm; one Z band per print layer
|
||||
uniform float dither_cell; // mm; one XY dither cell
|
||||
uniform sampler2D color_tex; // the layer's colour image, sampled at the same uv as the height
|
||||
uniform bool has_color_tex;
|
||||
uniform bool volume_mirrored;
|
||||
@@ -229,63 +223,16 @@ int nearest_palette_entry(vec3 rgb)
|
||||
}
|
||||
|
||||
// One 2x2 Bayer cell, {0, 2; 3, 1}, for x and y in {0, 1}.
|
||||
float bayer2(float x, float y) { return 2.0 * x + 3.0 * y - 4.0 * x * y; }
|
||||
|
||||
// The colour the printer lays down at world point `pos` for palette entry `index`: its filament, or
|
||||
// for a mix whichever of its two filaments this point falls on. Mirrors make_mix_resolver() on the
|
||||
// CPU, floors on the band/cell size included. All the modular arithmetic is done in floats with
|
||||
// mod(), which wraps negative coordinates the way the CPU's ((v % n) + n) % n does and needs no
|
||||
// integer % (not available on every GLSL 1.10 target).
|
||||
vec3 printed_color(int index, vec3 pos, vec3 normal, vec3 footprint)
|
||||
// The colour the printer lays down at world point `pos` for palette entry `index`. Every entry names a
|
||||
// single filament: a mix is given its own mixed filament slot, whose components the slicer alternates
|
||||
// per print layer, so there is nothing left to interleave here.
|
||||
vec3 printed_color(int index)
|
||||
{
|
||||
int a = palette_a[index];
|
||||
int b = palette_b[index];
|
||||
if (a < 0 || a >= filament_count || b < 0 || b >= filament_count)
|
||||
if (a < 0 || a >= filament_count)
|
||||
return palette_rgb[index]; // no filament to resolve to: the entry's own colour
|
||||
if (a == b)
|
||||
return filament_rgb[a];
|
||||
float num = float(palette_num[index]);
|
||||
float den = float(palette_den[index]);
|
||||
// Auto: bands where the surface is steeper than ~45 degrees, the dominant filament elsewhere.
|
||||
if (mix_mode == 2 && abs(normal.z) >= 0.7)
|
||||
return filament_rgb[(num * 2.0 >= den) ? a : b];
|
||||
|
||||
// Pre-filter. The interleave is an ordered dither the eye is meant to blend away, and no dither
|
||||
// blends when it is drawn at less than a few pixels per period - it aliases, which is what turned
|
||||
// every upright wall into horizontal streaks: the Z band cycle is den * layer_height (around a
|
||||
// millimetre), and every pixel of a row on a vertical wall shares one z, so each row came out as a
|
||||
// 1-bit threshold of the image at that row's phase. `footprint` is mm of world position per pixel,
|
||||
// so this is zoom- and resolution-correct rather than a tuned constant: where the print's own
|
||||
// pattern is finer than this view can resolve, show what the print looks like from here, which is
|
||||
// the entry's perceptual average. The Normal view remains where the per-facet truth lives.
|
||||
float period = (mix_mode == 1) ? 2.0 * max(dither_cell, 0.01) : den * max(layer_height, 0.01);
|
||||
float px = (mix_mode == 1) ? max(footprint.x, footprint.y) : footprint.z;
|
||||
float sharp = clamp(period / max(4.0 * px, 1e-6) - 0.5, 0.0, 1.0);
|
||||
if (sharp <= 0.0)
|
||||
return palette_rgb[index];
|
||||
|
||||
vec3 picked;
|
||||
if (mix_mode == 1) {
|
||||
// Ordered 4x4 Bayer over floor(x / cell), floor(y / cell). The CPU's table
|
||||
// 0 8 2 10
|
||||
// 12 4 14 6
|
||||
// 3 11 1 9
|
||||
// 15 7 13 5
|
||||
// is 4 * bayer2(x % 2, y % 2) + bayer2(x / 2, y / 2), which needs no array (GLSL 1.10 has
|
||||
// no constant arrays).
|
||||
float cell = max(dither_cell, 0.01);
|
||||
float gx = mod(floor(pos.x / cell), 4.0);
|
||||
float gy = mod(floor(pos.y / cell), 4.0);
|
||||
float bayer = 4.0 * bayer2(mod(gx, 2.0), mod(gy, 2.0)) + bayer2(floor(gx / 2.0), floor(gy / 2.0));
|
||||
picked = filament_rgb[(num / den > (bayer + 0.5) / 16.0) ? a : b];
|
||||
} else {
|
||||
// Z bands: one per band height, the band's phase in the a/b cycle picks the filament. Both
|
||||
// operands are integer-valued, so the half keeps "phase < num" exact under float rounding.
|
||||
float slot = floor(pos.z / max(layer_height, 0.01));
|
||||
float phase = mod(slot, den);
|
||||
picked = filament_rgb[(phase < num - 0.5) ? a : b];
|
||||
}
|
||||
return mix(palette_rgb[index], picked, sharp);
|
||||
return filament_rgb[a];
|
||||
}
|
||||
|
||||
void main()
|
||||
@@ -296,9 +243,6 @@ void main()
|
||||
// World millimetres throughout, like the bake - see the 140 variant.
|
||||
vec3 triangle_normal = normalize(cross(dFdx(world_pos.xyz), dFdy(world_pos.xyz)));
|
||||
vec3 tex_pos = world_pos.xyz - tex_anchor; // the frame the texture is projected in, as the bake does
|
||||
// World mm per pixel, for pre-filtering the interleave in printed_color(). Taken here because the
|
||||
// albedo branch at the end of main() is non-uniform control flow, where derivatives are undefined.
|
||||
vec3 pos_fwidth = fwidth(world_pos.xyz);
|
||||
if (volume_mirrored)
|
||||
triangle_normal = -triangle_normal;
|
||||
|
||||
@@ -420,6 +364,6 @@ void main()
|
||||
// orientation and scale about the volume's origin, see texture_displacement_bake_frame()), so
|
||||
// measuring z from the bed instead shifted the band phase by the volume origin's height - a
|
||||
// different filament in the same place than the bake produces.
|
||||
albedo = printed_color(nearest_palette_entry(texture2D(color_tex, color_uv).rgb), tex_pos, triangle_normal, pos_fwidth);
|
||||
albedo = printed_color(nearest_palette_entry(texture2D(color_tex, color_uv).rgb));
|
||||
gl_FragColor = vec4(vec3(intensity.y) + albedo * intensity.x, uniform_color.a);
|
||||
}
|
||||
|
||||
@@ -88,19 +88,13 @@ uniform vec3 palette_lab[64];
|
||||
uniform vec3 palette_rgb[64];
|
||||
uniform int palette_count;
|
||||
uniform bool pure_only; // match against single filaments only (flat-colour image)
|
||||
// How each entry prints. A pure entry is one filament (a == b); a mix interleaves filaments a and b,
|
||||
// num parts of a in every den, and the print shows that interleave rather than the entry's average
|
||||
// colour. The fragment resolves it exactly as GLGizmoTextureDisplacement::make_mix_resolver() does
|
||||
// per triangle on the CPU, so the preview shows the pattern the bake will print.
|
||||
// How each entry prints. Every entry names a single filament: a mix is given its own mixed filament
|
||||
// slot, whose components the slicer alternates per print layer, so the fragment just looks that slot's
|
||||
// colour up.
|
||||
uniform int palette_a[64];
|
||||
uniform int palette_b[64];
|
||||
uniform int palette_num[64];
|
||||
uniform int palette_den[64];
|
||||
uniform vec3 filament_rgb[16];
|
||||
uniform int filament_count;
|
||||
uniform int mix_mode; // ColorMixMode: 0 Z bands, 1 XY dither, 2 auto
|
||||
uniform float layer_height; // mm; one Z band per print layer
|
||||
uniform float dither_cell; // mm; one XY dither cell
|
||||
uniform sampler2D color_tex; // the layer's colour image, sampled at the same uv as the height
|
||||
uniform bool has_color_tex;
|
||||
uniform bool volume_mirrored;
|
||||
@@ -295,63 +289,16 @@ int nearest_palette_entry(vec3 rgb)
|
||||
}
|
||||
|
||||
// One 2x2 Bayer cell, {0, 2; 3, 1}, for x and y in {0, 1}.
|
||||
float bayer2(float x, float y) { return 2.0 * x + 3.0 * y - 4.0 * x * y; }
|
||||
|
||||
// The colour the printer lays down at world point `pos` for palette entry `index`: its filament, or
|
||||
// for a mix whichever of its two filaments this point falls on. Mirrors make_mix_resolver() on the
|
||||
// CPU, floors on the band/cell size included. All the modular arithmetic is done in floats with
|
||||
// mod(), which wraps negative coordinates the way the CPU's ((v % n) + n) % n does and needs no
|
||||
// integer % (not available on every GLSL 1.10 target).
|
||||
vec3 printed_color(int index, vec3 pos, vec3 normal, vec3 footprint)
|
||||
// The colour the printer lays down at world point `pos` for palette entry `index`. Every entry names a
|
||||
// single filament: a mix is given its own mixed filament slot, whose components the slicer alternates
|
||||
// per print layer, so there is nothing left to interleave here.
|
||||
vec3 printed_color(int index)
|
||||
{
|
||||
int a = palette_a[index];
|
||||
int b = palette_b[index];
|
||||
if (a < 0 || a >= filament_count || b < 0 || b >= filament_count)
|
||||
if (a < 0 || a >= filament_count)
|
||||
return palette_rgb[index]; // no filament to resolve to: the entry's own colour
|
||||
if (a == b)
|
||||
return filament_rgb[a];
|
||||
float num = float(palette_num[index]);
|
||||
float den = float(palette_den[index]);
|
||||
// Auto: bands where the surface is steeper than ~45 degrees, the dominant filament elsewhere.
|
||||
if (mix_mode == 2 && abs(normal.z) >= 0.7)
|
||||
return filament_rgb[(num * 2.0 >= den) ? a : b];
|
||||
|
||||
// Pre-filter. The interleave is an ordered dither the eye is meant to blend away, and no dither
|
||||
// blends when it is drawn at less than a few pixels per period - it aliases, which is what turned
|
||||
// every upright wall into horizontal streaks: the Z band cycle is den * layer_height (around a
|
||||
// millimetre), and every pixel of a row on a vertical wall shares one z, so each row came out as a
|
||||
// 1-bit threshold of the image at that row's phase. `footprint` is mm of world position per pixel,
|
||||
// so this is zoom- and resolution-correct rather than a tuned constant: where the print's own
|
||||
// pattern is finer than this view can resolve, show what the print looks like from here, which is
|
||||
// the entry's perceptual average. The Normal view remains where the per-facet truth lives.
|
||||
float period = (mix_mode == 1) ? 2.0 * max(dither_cell, 0.01) : den * max(layer_height, 0.01);
|
||||
float px = (mix_mode == 1) ? max(footprint.x, footprint.y) : footprint.z;
|
||||
float sharp = clamp(period / max(4.0 * px, 1e-6) - 0.5, 0.0, 1.0);
|
||||
if (sharp <= 0.0)
|
||||
return palette_rgb[index];
|
||||
|
||||
vec3 picked;
|
||||
if (mix_mode == 1) {
|
||||
// Ordered 4x4 Bayer over floor(x / cell), floor(y / cell). The CPU's table
|
||||
// 0 8 2 10
|
||||
// 12 4 14 6
|
||||
// 3 11 1 9
|
||||
// 15 7 13 5
|
||||
// is 4 * bayer2(x % 2, y % 2) + bayer2(x / 2, y / 2), which needs no array (GLSL 1.10 has
|
||||
// no constant arrays).
|
||||
float cell = max(dither_cell, 0.01);
|
||||
float gx = mod(floor(pos.x / cell), 4.0);
|
||||
float gy = mod(floor(pos.y / cell), 4.0);
|
||||
float bayer = 4.0 * bayer2(mod(gx, 2.0), mod(gy, 2.0)) + bayer2(floor(gx / 2.0), floor(gy / 2.0));
|
||||
picked = filament_rgb[(num / den > (bayer + 0.5) / 16.0) ? a : b];
|
||||
} else {
|
||||
// Z bands: one per band height, the band's phase in the a/b cycle picks the filament. Both
|
||||
// operands are integer-valued, so the half keeps "phase < num" exact under float rounding.
|
||||
float slot = floor(pos.z / max(layer_height, 0.01));
|
||||
float phase = mod(slot, den);
|
||||
picked = filament_rgb[(phase < num - 0.5) ? a : b];
|
||||
}
|
||||
return mix(palette_rgb[index], picked, sharp);
|
||||
return filament_rgb[a];
|
||||
}
|
||||
|
||||
void main()
|
||||
@@ -364,9 +311,6 @@ void main()
|
||||
// world position and perturb the world normal.
|
||||
vec3 triangle_normal = normalize(cross(dFdx(world_pos.xyz), dFdy(world_pos.xyz)));
|
||||
vec3 tex_pos = world_pos.xyz - tex_anchor; // the frame the texture is projected in, as the bake does
|
||||
// World mm per pixel, for pre-filtering the interleave in printed_color(). Taken here because the
|
||||
// albedo branch at the end of main() is non-uniform control flow, where derivatives are undefined.
|
||||
vec3 pos_fwidth = fwidth(world_pos.xyz);
|
||||
if (volume_mirrored)
|
||||
triangle_normal = -triangle_normal;
|
||||
|
||||
@@ -508,6 +452,6 @@ void main()
|
||||
// orientation and scale about the volume's origin, see texture_displacement_bake_frame()), so
|
||||
// measuring z from the bed instead shifted the band phase by the volume origin's height - a
|
||||
// different filament in the same place than the bake produces.
|
||||
albedo = printed_color(nearest_palette_entry(texture(color_tex, color_uv).rgb), tex_pos, triangle_normal, pos_fwidth);
|
||||
albedo = printed_color(nearest_palette_entry(texture(color_tex, color_uv).rgb));
|
||||
out_color = vec4(vec3(intensity.y) + albedo * intensity.x, uniform_color.a);
|
||||
}
|
||||
|
||||
@@ -311,11 +311,12 @@ def main():
|
||||
for path in fixed:
|
||||
print(f" {path}")
|
||||
if failed and fixed:
|
||||
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not add.")
|
||||
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not fix.")
|
||||
return 1
|
||||
if failed:
|
||||
print(f"\nclang-tidy failed on {len(failed)} file(s). Add the includes it names, or apply its "
|
||||
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows).")
|
||||
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows). "
|
||||
"Other findings need a manual fix.")
|
||||
return 1
|
||||
print("clang-tidy passed.")
|
||||
return 0
|
||||
|
||||
+5
-7
@@ -23,7 +23,6 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "libslic3r/PrintBase.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <cerrno>
|
||||
#include <utility>
|
||||
@@ -78,12 +77,10 @@
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <boost/thread.hpp>
|
||||
//add json logic
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
#endif
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/args.hpp>
|
||||
@@ -157,6 +154,7 @@ using namespace nlohmann;
|
||||
#include <stdio.h>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#if __has_include(<X11/Xlib.h>)
|
||||
@@ -3524,7 +3522,7 @@ int CLI::run(int argc, char **argv)
|
||||
ConfigOptionStrings *curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant");
|
||||
if (!curr_variant_opt) {
|
||||
curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant", true);
|
||||
std::vector<string>& filament_variants = curr_variant_opt->values;
|
||||
std::vector<std::string>& filament_variants = curr_variant_opt->values;
|
||||
filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard));
|
||||
}
|
||||
const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true));
|
||||
@@ -6554,7 +6552,7 @@ int CLI::run(int argc, char **argv)
|
||||
std::vector<int> result_filaments;
|
||||
//result_filaments.reserve(conflict_filaments.size());
|
||||
std::set_intersection(conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(),
|
||||
unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
|
||||
unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
|
||||
conflict_filament_vector = result_filaments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include "libslic3r/Semver.hpp"
|
||||
#include "calib.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
#define ENV_DEV_HOST "0"
|
||||
#define ENV_QAT_HOST "1"
|
||||
#define ENV_PRE_HOST "2"
|
||||
|
||||
@@ -466,8 +466,6 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys)
|
||||
edge.from->incident_edge = &edge;
|
||||
}
|
||||
|
||||
using NodeSet = SkeletalTrapezoidation::NodeSet;
|
||||
|
||||
void SkeletalTrapezoidation::separatePointyQuadEndNodes()
|
||||
{
|
||||
NodeSet visited_nodes;
|
||||
|
||||
@@ -93,7 +93,6 @@ using namespace libnest2d;
|
||||
using Item = _Item<ExPolygon>;
|
||||
using Box = _Box<Point>;
|
||||
using Circle = _Circle<Point>;
|
||||
using Segment = _Segment<Point>;
|
||||
using MultiPolygon = ExPolygons;
|
||||
|
||||
// Summon the spatial indexing facilities from boost
|
||||
|
||||
@@ -23,11 +23,6 @@ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
// import these wherever we're included
|
||||
using Slic3r::jtMiter;
|
||||
using Slic3r::jtRound;
|
||||
using Slic3r::jtSquare;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
static constexpr const float ClipperSafetyOffset = 10.f;
|
||||
|
||||
@@ -2851,7 +2851,6 @@ bool is_patch_inside_of_model(const SurfacePatch &patch,
|
||||
/// <returns>shape point index</returns>
|
||||
uint32_t get_shape_point_index(const CutAOI &cut, const CutMesh &model);
|
||||
|
||||
using PatchNumber = CutMesh::Property_map<FI, size_t>;
|
||||
/// <summary>
|
||||
/// Separate triangles singned with number n
|
||||
/// </summary>
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
// #define DEBUG_FUZZY
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
namespace Slic3r::Feature::FuzzySkin {
|
||||
|
||||
// Produces a random value between 0 and 1. Thread-safe.
|
||||
|
||||
@@ -122,8 +122,6 @@ Polylines get_polylines(const ScalarField& sf, const double tolerance = SCALED_E
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
using namespace std;
|
||||
|
||||
void FillTpmsFK::_fill_surface_single(const FillParams& params,
|
||||
unsigned int thickness_layers,
|
||||
const std::pair<float, Point>& direction,
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -1135,7 +1135,6 @@ void SeamPlacer::gather_seam_candidates(const PrintObject *po, const SeamPlacerI
|
||||
|
||||
void SeamPlacer::calculate_candidates_visibility(const PrintObject *po,
|
||||
const SeamPlacerImpl::GlobalModelInfo &global_model_info) {
|
||||
using namespace SeamPlacerImpl;
|
||||
|
||||
std::vector<PrintObjectSeamData::LayerSeams> &layers = m_seam_per_object[po].layers;
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, layers.size()),
|
||||
|
||||
@@ -1482,7 +1482,6 @@ static FilamentGroupContext build_filament_group_context(
|
||||
FilamentMapMode mode,
|
||||
const std::unordered_map<int, int>& nozzle_status)
|
||||
{
|
||||
using namespace MultiNozzleUtils;
|
||||
using namespace FilamentGroupUtils;
|
||||
|
||||
FilamentGroupContext context;
|
||||
@@ -1691,7 +1690,6 @@ static std::vector<int> apply_master_extruder_preference(const FilamentGroupCont
|
||||
// multi-nozzle (H2C/A2L) resolves to a nozzle-granular result.
|
||||
MultiNozzleUtils::LayeredNozzleGroupResult ToolOrdering::get_recommended_filament_maps(const std::vector<std::vector<unsigned int>>& layer_filaments, const Print* print, const FilamentMapMode mode, const std::vector<std::set<int>>& physical_unprintables, const std::vector<std::set<int>>& geometric_unprintables, const std::map<int, std::set<NozzleVolumeType>>& unprintable_volumes, const std::unordered_map<int, int>& nozzle_status)
|
||||
{
|
||||
using namespace FilamentGroupUtils;
|
||||
using namespace MultiNozzleUtils;
|
||||
|
||||
if (!print || layer_filaments.empty())
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
using VD = VoronoiDiagram;
|
||||
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
|
||||
using LinesIt = Lines::iterator;
|
||||
using ColoredLinesConstIt = ColoredLines::const_iterator;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
using VD = VoronoiDiagram;
|
||||
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
|
||||
using LinesIt = Lines::iterator;
|
||||
using ColoredLinesIt = ColoredLines::iterator;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
using VD = Slic3r::Geometry::VoronoiDiagram;
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
// Represent trapezoid Voronoi cell around segment.
|
||||
@@ -19,8 +17,8 @@ template<typename PT> struct SegmentCellRange
|
||||
{
|
||||
const PT source_segment_start_point; // The start point of the source segment of this cell.
|
||||
const PT source_segment_end_point; // The end point of the source segment of this cell.
|
||||
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
|
||||
SegmentCellRange() = delete;
|
||||
explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point)
|
||||
@@ -34,8 +32,8 @@ template<typename PT> struct SegmentCellRange
|
||||
template<typename PT> struct PointCellRange
|
||||
{
|
||||
const PT source_point; // The source point of this cell.
|
||||
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
|
||||
PointCellRange() = delete;
|
||||
explicit PointCellRange(const PT &source_point) : source_point(source_point) {}
|
||||
@@ -46,20 +44,20 @@ template<typename PT> struct PointCellRange
|
||||
class VoronoiUtils
|
||||
{
|
||||
public:
|
||||
static Vec2i64 to_point(const VD::vertex_type *vertex);
|
||||
static Vec2i64 to_point(const VoronoiDiagram::vertex_type *vertex);
|
||||
|
||||
static Vec2i64 to_point(const VD::vertex_type &vertex);
|
||||
static Vec2i64 to_point(const VoronoiDiagram::vertex_type &vertex);
|
||||
|
||||
static bool is_finite(const VD::vertex_type &vertex);
|
||||
static bool is_finite(const VoronoiDiagram::vertex_type &vertex);
|
||||
|
||||
static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle);
|
||||
static VoronoiDiagram::vertex_type make_rotated_vertex(VoronoiDiagram::vertex_type &vertex, double angle);
|
||||
|
||||
template<typename SegmentIterator>
|
||||
static typename boost::polygon::enable_if<
|
||||
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
typename std::iterator_traits<SegmentIterator>::reference>::type
|
||||
get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
get_source_segment(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
template<typename SegmentIterator>
|
||||
static typename boost::polygon::enable_if<
|
||||
@@ -73,7 +71,7 @@ public:
|
||||
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Arachne::PolygonsPointIndex>::type
|
||||
get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
get_source_point_index(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
/**
|
||||
* Discretize a parabola based on (approximate) step size.
|
||||
@@ -113,7 +111,7 @@ public:
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Geometry::SegmentCellRange<
|
||||
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
|
||||
compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
compute_segment_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
/**
|
||||
* Compute the range of line segments that surround a cell of the skeletal
|
||||
@@ -140,19 +138,19 @@ public:
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Geometry::PointCellRange<
|
||||
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
|
||||
compute_point_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
compute_point_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
template<typename T> static bool is_in_range(double value)
|
||||
{
|
||||
return double(std::numeric_limits<T>::lowest()) <= value && value <= double(std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
template<typename T> static bool is_in_range(const VD::vertex_type &vertex)
|
||||
template<typename T> static bool is_in_range(const VoronoiDiagram::vertex_type &vertex)
|
||||
{
|
||||
return VoronoiUtils::is_finite(vertex) && is_in_range<T>(vertex.x()) && is_in_range<T>(vertex.y());
|
||||
}
|
||||
|
||||
template<typename T> static bool is_in_range(const VD::edge_type &edge)
|
||||
template<typename T> static bool is_in_range(const VoronoiDiagram::edge_type &edge)
|
||||
{
|
||||
if (edge.vertex0() == nullptr || edge.vertex1() == nullptr)
|
||||
return false;
|
||||
|
||||
@@ -230,7 +230,6 @@ std::vector<Bridge> get_grouped_bridges(
|
||||
{
|
||||
result.reserve(bridge_expansions.size());
|
||||
uint32_t group_id = 0;
|
||||
using std::move_iterator;
|
||||
for (ExPolygon& expolygon : bridge_expolygons)
|
||||
result.push_back({ std::move(expolygon), group_id ++, bridge_expansions.end() });
|
||||
}
|
||||
@@ -432,7 +431,6 @@ Surfaces expand_bridges_detect_orientations(
|
||||
const float closing_radius
|
||||
)
|
||||
{
|
||||
using namespace Slic3r::Algorithm;
|
||||
|
||||
double thickness;
|
||||
ExPolygons bridge_expolygons = fill_surfaces_extract_expolygons(surfaces, {stBottomBridge}, thickness);
|
||||
|
||||
@@ -660,7 +660,6 @@ bool empty(const CGALMesh &mesh)
|
||||
|
||||
bool repair(TriangleMesh& mesh, RepairedMeshErrors* repaired_errors, std::string* error)
|
||||
{
|
||||
using namespace CGAL;
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
if (mesh.empty())
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Slic3r { enum class EnforcerBlockerType : int8_t; }
|
||||
|
||||
namespace Slic3r {
|
||||
using boost::polygon::voronoi_diagram;
|
||||
using VD = Geometry::VoronoiDiagram;
|
||||
|
||||
static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; }
|
||||
|
||||
|
||||
@@ -263,7 +263,6 @@ size_t get_shapes_count(const NSVGimage &image)
|
||||
} // namespace Slic3r
|
||||
|
||||
namespace {
|
||||
using namespace Slic3r; // Polygon + Vec2f
|
||||
|
||||
Point::coord_type to_coor(float val, double scale) { return static_cast<Point::coord_type>(std::round(val * scale)); }
|
||||
|
||||
|
||||
@@ -2175,7 +2175,6 @@ namespace client
|
||||
{
|
||||
macro_processor() : macro_processor::base_type(start)
|
||||
{
|
||||
using namespace qi::labels;
|
||||
qi::alpha_type alpha;
|
||||
qi::alnum_type alnum;
|
||||
qi::eps_type eps;
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
#include "libslic3r/GCode/Thumbnails.hpp"
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
using boost::property_tree::ptree;
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
// Mark string for localization and translate.
|
||||
#define L(s) Slic3r::I18N::translate(s)
|
||||
|
||||
@@ -87,6 +89,8 @@
|
||||
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
|
||||
//#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Project-level options imported from a loaded 3MF into project_config. s_project_options_published
|
||||
@@ -1527,7 +1531,6 @@ bool PresetBundle::apply_vendor_config(
|
||||
const std::string& preferred_printer_variant,
|
||||
const std::string& preferred_filament)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
// Get current configuration from AppConfig
|
||||
const auto old_vendors = app_config->vendors();
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class BBLProject;
|
||||
@@ -208,7 +206,7 @@ public:
|
||||
std::string task_profile_id; /* profile id*/
|
||||
std::string task_name; /* task name, generally filename as task name */
|
||||
std::string task_file; /* local full file path of 3mf or gcode */
|
||||
fs::path task_path; /* local path of 3mf or gcode */
|
||||
boost::filesystem::path task_path; /* local path of 3mf or gcode */
|
||||
std::string task_gcode_in_3mf; /* gcode in 3mf */
|
||||
std::string task_create_time; /* time created by cloud */
|
||||
std::string task_thumbnail_url; /* url of task thumbnail */
|
||||
@@ -326,7 +324,7 @@ public:
|
||||
std::string project_url_md5; /* md5 of project url file */
|
||||
std::string project_name;
|
||||
std::string project_3mf_file;
|
||||
fs::path project_path;
|
||||
boost::filesystem::path project_path;
|
||||
std::string project_content;
|
||||
std::string project_country_code;
|
||||
|
||||
|
||||
@@ -551,9 +551,13 @@ DecimateResult decimate(const TriSoup &geometry, size_t target_triangles, bool h
|
||||
|
||||
// Rebuild from the surviving faces, with per-face normals.
|
||||
TriSoup &out = result.geometry;
|
||||
if (!face_color.empty())
|
||||
result.face_color.reserve(active_faces);
|
||||
for (size_t f = 0; f < face_count; ++f) {
|
||||
if (faces[f * 3] < 0)
|
||||
continue;
|
||||
if (!face_color.empty())
|
||||
result.face_color.push_back(f < face_color.size() ? face_color[f] : -1);
|
||||
const Vec3f a = pos[size_t(faces[f * 3])].cast<float>();
|
||||
const Vec3f b = pos[size_t(faces[f * 3 + 1])].cast<float>();
|
||||
const Vec3f c = pos[size_t(faces[f * 3 + 2])].cast<float>();
|
||||
|
||||
@@ -46,6 +46,13 @@ using DecimateProgressFn = std::function<bool(double fraction)>;
|
||||
struct DecimateResult
|
||||
{
|
||||
TriSoup geometry;
|
||||
// One entry per output face, carried from the `face_color` handed in: a colour difference is a
|
||||
// crease, so no collapse ever merges two faces of different colour and every survivor keeps exactly
|
||||
// the colour it came with. Empty when no `face_color` was given.
|
||||
//
|
||||
// This is what lets the caller colour the simplified mesh by *provenance* rather than by sampling it
|
||||
// again: the input colours were masked by the paint on the fine mesh, where that mask is exact.
|
||||
std::vector<int> face_color;
|
||||
// The locked faces alone met the target, so it was unreachable without touching preserved
|
||||
// geometry.
|
||||
bool locked_over_budget = false;
|
||||
|
||||
@@ -42,7 +42,7 @@ TriSoup to_soup(const indexed_triangle_set &its, const std::vector<uint8_t> &fac
|
||||
return out;
|
||||
}
|
||||
|
||||
indexed_triangle_set to_indexed_triangle_set(const TriSoup &soup)
|
||||
indexed_triangle_set to_indexed_triangle_set(const TriSoup &soup, std::vector<int> *face_color)
|
||||
{
|
||||
indexed_triangle_set out;
|
||||
const size_t n = soup.pos.size();
|
||||
@@ -54,12 +54,22 @@ indexed_triangle_set to_indexed_triangle_set(const TriSoup &soup)
|
||||
if (map.inserted())
|
||||
out.vertices.push_back(soup.pos[i]);
|
||||
}
|
||||
const bool track_color = face_color != nullptr && !face_color->empty();
|
||||
std::vector<int> kept_color;
|
||||
if (track_color)
|
||||
kept_color.reserve(face_color->size());
|
||||
for (size_t t = 0; t + 2 < n; t += 3) {
|
||||
// Welded-together corners carry no area.
|
||||
if (id[t] == id[t + 1] || id[t + 1] == id[t + 2] || id[t] == id[t + 2])
|
||||
continue;
|
||||
out.indices.emplace_back(id[t], id[t + 1], id[t + 2]);
|
||||
if (track_color) {
|
||||
const size_t src = t / 3;
|
||||
kept_color.push_back(src < face_color->size() ? (*face_color)[src] : -1);
|
||||
}
|
||||
}
|
||||
if (track_color)
|
||||
*face_color = std::move(kept_color);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ namespace TextureBake {
|
||||
TriSoup to_soup(const indexed_triangle_set &its, const std::vector<uint8_t> &face_excluded = {});
|
||||
|
||||
// Welds at the geometry grid.
|
||||
indexed_triangle_set to_indexed_triangle_set(const TriSoup &soup);
|
||||
// `face_color`, when given, is read as one entry per soup triangle and rewritten to match the output.
|
||||
// Welding can leave a triangle with no area, and those are dropped here, so the two would otherwise
|
||||
// fall out of step.
|
||||
indexed_triangle_set to_indexed_triangle_set(const TriSoup &soup, std::vector<int> *face_color = nullptr);
|
||||
|
||||
} // namespace TextureBake
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -290,6 +290,34 @@ PipelineResult run_pipeline(const TriSoup &input, const HeightSampleFn &sample,
|
||||
return result;
|
||||
}
|
||||
|
||||
// Colour per face, taken here and carried from here on. This is the only point where the paint mask
|
||||
// is exact: `exclude_weight` says which faces the paint left out, and the mesh is still the refined
|
||||
// one the displacement produced. Everything downstream (the collapse, the T-junction repair) carries
|
||||
// these along rather than sampling again, and the caller uses them as they are.
|
||||
//
|
||||
// It also gives the collapse its crease criterion: an edge between two colours is never collapsed
|
||||
// across, which is what keeps a survivor's colour well defined.
|
||||
if (color_sample) {
|
||||
const size_t nf = displaced.triangle_count();
|
||||
result.face_color.assign(nf, -1);
|
||||
const bool have_w = !displaced.exclude_weight.empty();
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, nf), [&](const tbb::blocked_range<size_t> &r) {
|
||||
for (size_t t = r.begin(); t < r.end(); ++t) {
|
||||
// Unpainted faces take no colour at all, which is what stops the texture appearing on
|
||||
// surfaces the paint never covered.
|
||||
if (have_w && (displaced.exclude_weight[t * 3] + displaced.exclude_weight[t * 3 + 1] +
|
||||
displaced.exclude_weight[t * 3 + 2]) / 3.f > 0.99f)
|
||||
continue; // stays FACE_UNPAINTED
|
||||
const Vec3f &a = displaced.pos[t * 3], &b = displaced.pos[t * 3 + 1], &c = displaced.pos[t * 3 + 2];
|
||||
const int sampled = color_sample((a + b + c) / 3.f, displaced.nrm[t * 3]);
|
||||
// Painted either way. The sampler expects a point on the base surface and these are on
|
||||
// the displaced one, so off the patch by more than its tolerance it simply says "no
|
||||
// colour" - which must not be confused with "not painted".
|
||||
result.face_color[t] = (sampled >= 0) ? sampled : FACE_NO_COLOUR;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 4. Decimate - export only. A bake needs the face-parent map, which a collapse destroys.
|
||||
std::vector<int> parent = std::move(sub.face_parent_id);
|
||||
const size_t displaced_before_decimate = displaced.triangle_count();
|
||||
@@ -323,24 +351,8 @@ PipelineResult run_pipeline(const TriSoup &input, const HeightSampleFn &sample,
|
||||
// unless the budget was lowered until decimation had to run. Only collapses costing less than
|
||||
// harvest_tol are taken, so this does not reach the relief.
|
||||
const bool harvest_only = !over_budget && settings.harvest_flat && displaced.triangle_count() > 0;
|
||||
std::vector<int> &face_color = result.face_color;
|
||||
if (over_budget || harvest_only) {
|
||||
// Colour per face on the fine mesh, so colour boundaries become creases the collapse
|
||||
// respects. Excluded (unpainted) faces take no colour.
|
||||
std::vector<int> face_color;
|
||||
if (color_sample) {
|
||||
const size_t nf = displaced.triangle_count();
|
||||
face_color.assign(nf, -1);
|
||||
const bool have_w = !displaced.exclude_weight.empty();
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, nf), [&](const tbb::blocked_range<size_t> &r) {
|
||||
for (size_t t = r.begin(); t < r.end(); ++t) {
|
||||
if (have_w && (displaced.exclude_weight[t * 3] + displaced.exclude_weight[t * 3 + 1] +
|
||||
displaced.exclude_weight[t * 3 + 2]) / 3.f > 0.99f)
|
||||
continue;
|
||||
const Vec3f &a = displaced.pos[t * 3], &b = displaced.pos[t * 3 + 1], &c = displaced.pos[t * 3 + 2];
|
||||
face_color[t] = color_sample((a + b + c) / 3.f, displaced.nrm[t * 3]);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Harvesting alone is asked for by handing it the count it already has: nothing is then
|
||||
// over the target, so the loop only ever pops collapses under the tolerance.
|
||||
const size_t before = displaced.triangle_count();
|
||||
@@ -350,6 +362,7 @@ PipelineResult run_pipeline(const TriSoup &input, const HeightSampleFn &sample,
|
||||
result.locked_over_budget = dec.locked_over_budget;
|
||||
result.budget_limited = result.simplified = dec.target_cost_detail;
|
||||
displaced = std::move(dec.geometry);
|
||||
face_color = std::move(dec.face_color);
|
||||
lap("decimate", displaced, over_budget ? "over budget, simplified" : "flat faces harvested");
|
||||
BOOST_LOG_TRIVIAL(info) << "TextureBake decimate: " << before << " -> " << displaced.triangle_count()
|
||||
<< (over_budget ? " (budget " : " (flat harvest, budget ") << target << ")";
|
||||
@@ -377,7 +390,7 @@ PipelineResult run_pipeline(const TriSoup &input, const HeightSampleFn &sample,
|
||||
|
||||
// 6. Close the T-junctions decimation left behind. Only meaningful when it ran.
|
||||
if (mode == PipelineMode::Export && parent.empty()) {
|
||||
displaced = resolve_t_junctions(displaced);
|
||||
displaced = resolve_t_junctions(displaced, {}, &result.face_color);
|
||||
lap("repair", displaced);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,9 +108,27 @@ using PipelineProgressFn = std::function<bool(const char *stage, double fraction
|
||||
// colour-boundary creases. Only consulted when the mesh is over budget.
|
||||
using ColorSampleFn = std::function<int(const Vec3f ¢roid, const Vec3f &normal)>;
|
||||
|
||||
// Sentinels for PipelineResult::face_color.
|
||||
static constexpr int FACE_UNPAINTED = -1; // the paint did not cover this face's origin
|
||||
static constexpr int FACE_NO_COLOUR = -2; // painted, but the sampler returned nothing at this point
|
||||
|
||||
struct PipelineResult
|
||||
{
|
||||
TriSoup geometry;
|
||||
// One entry per output face, carried through decimation, the T-junction repair and the weld.
|
||||
// FACE_UNPAINTED means the paint never covered the geometry this face came from; anything else means
|
||||
// it did, and is the palette index `color_sample` returned there (FACE_NO_COLOUR when it returned
|
||||
// none). The distinction matters: the sampler answers for points on the *base* surface, and these
|
||||
// are sampled on the displaced one, so a painted face can easily come back without a colour. Only
|
||||
// the painted/unpainted split is reliable here, and that is what a caller should use it for.
|
||||
//
|
||||
// Empty unless the caller gave a `color_sample`.
|
||||
//
|
||||
// A caller that needs per-face colour must use this rather than sampling the result again. The
|
||||
// result is displaced geometry: a point on it is no longer where its base surface was, so matching
|
||||
// it back by proximity colours whatever base surface happens to be nearest - which on a part thinner
|
||||
// than the relief depth is the *opposite* face, picking up the texture meant for the painted one.
|
||||
std::vector<int> face_color;
|
||||
// Output face -> input face. Empty in Export mode, where decimation invalidates it.
|
||||
std::vector<int> face_parent_id;
|
||||
bool safety_cap_hit = false;
|
||||
|
||||
@@ -72,7 +72,8 @@ size_t count_area_slivers(const TriSoup &geometry)
|
||||
return n;
|
||||
}
|
||||
|
||||
TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts)
|
||||
TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts,
|
||||
std::vector<int> *face_color)
|
||||
{
|
||||
const size_t n_tri = geometry.triangle_count();
|
||||
const double on_tol2 = opts.on_seg_tol * opts.on_seg_tol;
|
||||
@@ -98,7 +99,12 @@ TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts)
|
||||
// grid. A needle reads as watertight yet is deleted downstream, and dropping it leaves exactly
|
||||
// the on-edge-vertex topology the pass below closes.
|
||||
std::vector<std::array<int, 3>> faces;
|
||||
// Parallel to `faces` throughout, so a split or a dropped degenerate keeps the two in step.
|
||||
const bool track_color = face_color != nullptr && !face_color->empty();
|
||||
std::vector<int> colors;
|
||||
faces.reserve(n_tri);
|
||||
if (track_color)
|
||||
colors.reserve(n_tri);
|
||||
for (size_t t = 0; t < n_tri; ++t) {
|
||||
const int a = vid[t * 3], b = vid[t * 3 + 1], c = vid[t * 3 + 2];
|
||||
if (a == b || b == c || a == c)
|
||||
@@ -108,6 +114,8 @@ TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts)
|
||||
if (u.cross(w).squaredNorm() < DEGENERATE_AREA_SQ)
|
||||
continue;
|
||||
faces.push_back({ a, b, c });
|
||||
if (track_color)
|
||||
colors.push_back(t < face_color->size() ? (*face_color)[t] : -1);
|
||||
}
|
||||
|
||||
for (int iter = 0; iter < opts.max_iters; ++iter) {
|
||||
@@ -166,11 +174,16 @@ TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts)
|
||||
break;
|
||||
|
||||
std::vector<std::array<int, 3>> next;
|
||||
std::vector<int> next_colors;
|
||||
next.reserve(faces.size() + splits.size() * 2);
|
||||
if (track_color)
|
||||
next_colors.reserve(next.capacity());
|
||||
for (size_t fi = 0; fi < faces.size(); ++fi) {
|
||||
const auto it = splits.find(fi);
|
||||
if (it == splits.end()) {
|
||||
next.push_back(faces[fi]);
|
||||
if (track_color)
|
||||
next_colors.push_back(colors[fi]);
|
||||
continue;
|
||||
}
|
||||
const auto &f = faces[fi];
|
||||
@@ -195,11 +208,18 @@ TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts)
|
||||
seq.insert(seq.end(), sp.mids.rbegin(), sp.mids.rend());
|
||||
seq.push_back(sp.a);
|
||||
}
|
||||
for (size_t s = 0; s + 1 < seq.size(); ++s)
|
||||
for (size_t s = 0; s + 1 < seq.size(); ++s) {
|
||||
next.push_back({ seq[s], seq[s + 1], apex });
|
||||
if (track_color)
|
||||
next_colors.push_back(colors[fi]); // every piece of a split face keeps its colour
|
||||
}
|
||||
}
|
||||
faces.swap(next);
|
||||
if (track_color)
|
||||
colors.swap(next_colors);
|
||||
}
|
||||
if (track_color)
|
||||
*face_color = std::move(colors);
|
||||
|
||||
TriSoup out;
|
||||
out.pos.reserve(faces.size() * 3);
|
||||
|
||||
@@ -43,7 +43,12 @@ struct RepairOptions
|
||||
int max_iters = 16;
|
||||
};
|
||||
|
||||
TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts = {});
|
||||
// `face_color`, when given, is read as one entry per input face and rewritten to match the output: a
|
||||
// face split to close a T-junction hands its colour to every piece, and a degenerate face dropped on
|
||||
// the way takes its entry with it. Without this the caller would have no way to keep a per-face colour
|
||||
// across this pass, which changes the triangle count.
|
||||
TriSoup resolve_t_junctions(const TriSoup &geometry, const RepairOptions &opts = {},
|
||||
std::vector<int> *face_color = nullptr);
|
||||
|
||||
} // namespace TextureBake
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -2284,12 +2284,11 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set
|
||||
//
|
||||
// The *palette* index, not the printed filament. The decimation treats any edge whose two faces
|
||||
// differ as a crease (TextureBakeDecimate.cpp), so it must only ever see where the **perceived**
|
||||
// colour changes - which is exactly what ColorResolveFn's own contract says the interleaving may
|
||||
// never be fed into. Handing it the resolved filament made every Z band boundary a crease: on an
|
||||
// upright wall that is one crease per band, so the collapse ran along those lines and left a stack
|
||||
// of horizontal slivers, each printing in a single filament. Those were the horizontal colour
|
||||
// lines in the baked result, and they also spent the triangle budget drawing a pattern the eye is
|
||||
// meant to blend away. Faces the paint excludes are skipped by the pipeline itself.
|
||||
// colour changes. A mix is one perceived colour however its components are laid down, which is why
|
||||
// it has to be the palette index here: back when this was handed a per-triangle interleave instead,
|
||||
// every band boundary read as a crease, the collapse ran along those lines and left a stack of
|
||||
// horizontal slivers, and the triangle budget went on drawing a pattern the eye is meant to blend
|
||||
// away. Faces the paint excludes are skipped by the pipeline itself.
|
||||
const TextureBake::ColorSampleFn color_sample =
|
||||
color_sampler ? TextureBake::ColorSampleFn([&color_sampler](const Vec3f &p, const Vec3f &n) {
|
||||
return color_sampler(p, n);
|
||||
@@ -2315,7 +2314,7 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set
|
||||
stats->triangles_budget = result.triangles_budget;
|
||||
stats->budget_limited = result.budget_limited;
|
||||
}
|
||||
indexed_triangle_set out = TextureBake::to_indexed_triangle_set(result.geometry);
|
||||
indexed_triangle_set out = TextureBake::to_indexed_triangle_set(result.geometry, &result.face_color);
|
||||
if (out.indices.empty())
|
||||
return mesh;
|
||||
if (flip_normals)
|
||||
@@ -2336,6 +2335,8 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set
|
||||
max_depth = std::max(max_depth, std::abs(layer.depth_mm));
|
||||
const float relief_tol = max_depth + paint_tol;
|
||||
std::vector<int> palette(out.indices.size(), -1);
|
||||
const std::vector<int> &face_mask = result.face_color;
|
||||
const bool have_face_mask = face_mask.size() == out.indices.size();
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, out.indices.size()), [&](const tbb::blocked_range<size_t> &r) {
|
||||
for (size_t i = r.begin(); i < r.end(); ++i) {
|
||||
const stl_triangle_vertex_indices &t = out.indices[i];
|
||||
@@ -2351,8 +2352,19 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set
|
||||
// reason; this path was the inconsistent one.
|
||||
Vec3f foot = centroid, base_n = Vec3f::UnitZ();
|
||||
const float d2 = painted_closest(centroid, &foot, &base_n);
|
||||
if (!all_painted && d2 >= relief_tol * relief_tol)
|
||||
// Which faces may be coloured comes from the pipeline, which recorded it on the
|
||||
// refined mesh where the paint mask is exact, and carried it through the collapse,
|
||||
// the T-junction repair and the weld. Proximity cannot answer this: a displaced face
|
||||
// is no longer where its base was, so on a part thinner than the relief depth the
|
||||
// nearest painted surface to the *opposite* face is the painted one, and the texture
|
||||
// appeared there too. Only the position to sample at still comes from the base
|
||||
// surface, for the projection reason above.
|
||||
if (have_face_mask) {
|
||||
if (face_mask[i] == TextureBake::FACE_UNPAINTED)
|
||||
continue;
|
||||
} else if (!all_painted && d2 >= relief_tol * relief_tol) {
|
||||
continue;
|
||||
}
|
||||
palette[i] = sampler(foot, base_n);
|
||||
}
|
||||
});
|
||||
@@ -2374,7 +2386,7 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set
|
||||
Vec3f normal = (b - a).cross(c - a);
|
||||
const float nl = normal.norm();
|
||||
normal = (nl > 0.f) ? Vec3f(normal / nl) : Vec3f::UnitZ();
|
||||
const int filament = color->resolve ? color->resolve(palette[i], centroid, normal) : palette[i];
|
||||
const int filament = palette[i];
|
||||
if (filament >= 0)
|
||||
out_color[i] = uint8_t(std::min(filament + 1, 255));
|
||||
}
|
||||
@@ -2831,8 +2843,7 @@ static indexed_triangle_set build_texture_displacement_in_place(
|
||||
Vec3f normal = (b - a).cross(c - a);
|
||||
const float nl = normal.norm();
|
||||
normal = (nl > 0.f) ? Vec3f(normal / nl) : Vec3f::UnitZ();
|
||||
const int filament = color->resolve ? color->resolve(triangle_palette[i], centroid, normal)
|
||||
: triangle_palette[i];
|
||||
const int filament = triangle_palette[i];
|
||||
if (filament >= 0)
|
||||
out_color[i] = uint8_t(std::min(filament + 1, 255));
|
||||
}
|
||||
|
||||
@@ -321,25 +321,6 @@ struct TextureDisplacementLayer
|
||||
}
|
||||
};
|
||||
|
||||
// How a *mixed* palette entry - one that names two filaments rather than one - is turned into real
|
||||
// per-facet paint. An MMU extrudes one filament at a time, so an intermediate colour exists only by
|
||||
// interleaving two of them finely enough that the eye does the blending.
|
||||
enum class ColorMixMode : int
|
||||
{
|
||||
// Horizontal bands: which of the two filaments a point takes depends on its height, so
|
||||
// consecutive print layers alternate. This is how filament-blend prints actually work, and on a
|
||||
// vertical-ish surface it reads as a genuinely smooth colour. On a near-horizontal surface a whole
|
||||
// layer is one band, so the blend disappears - that is what XYDither is for.
|
||||
ZBands = 0,
|
||||
// An ordered (Bayer) checkerboard across the surface, at any orientation. Independent of layer
|
||||
// height, but its cell is around the size of one facet, so a fine mix can read as texture rather
|
||||
// than as a clean blend.
|
||||
XYDither = 1,
|
||||
// Per triangle, by its orientation: bands where the surface is upright enough for consecutive
|
||||
// layers to alternate, the checkerboard where it faces up or down and a layer would be one band.
|
||||
// The default - a flat-topped part with a mix on top gets no blend at all from bands alone.
|
||||
Auto = 2,
|
||||
};
|
||||
|
||||
// Settings that apply to the whole layer stack rather than to one layer, held per ModelVolume next
|
||||
// to texture_displacement_layers and consumed by build_texture_displacement().
|
||||
@@ -406,7 +387,6 @@ struct TextureDisplacementOptions
|
||||
// image (TextureDetail::flat_colors): a texture of flat colours prints in single filaments, a
|
||||
// photograph or gradient in mixes. Off forces single filaments everywhere.
|
||||
bool color_mix_enabled = true;
|
||||
ColorMixMode color_mix_mode = ColorMixMode::Auto;
|
||||
// Majority-filter passes over the assigned colours. See TextureColorRequest::despeckle_passes -
|
||||
// this is the control for it, and 2 is enough to clear the salt-and-pepper an image with detail
|
||||
// finer than the mesh leaves behind, without eating features that are genuinely a facet wide.
|
||||
@@ -414,11 +394,9 @@ struct TextureDisplacementOptions
|
||||
|
||||
template<class Archive> void serialize(Archive &ar)
|
||||
{
|
||||
int mix_mode = int(color_mix_mode);
|
||||
ar(displace_border, smooth_enabled, smooth_strength, smooth_iterations, smooth_skip_border,
|
||||
pipeline_v2, v2_refine_mm, v2_regularize, v2_max_triangles_k,
|
||||
v2_relocate, color_mix_enabled, mix_mode, color_despeckle);
|
||||
color_mix_mode = ColorMixMode(mix_mode);
|
||||
v2_relocate, color_mix_enabled, color_despeckle);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -511,17 +489,9 @@ DecodedHeightTexture decode_height_texture(const TextureDisplacementLayer &layer
|
||||
// is. See GLGizmoTextureDisplacement::make_palette_quantizer().
|
||||
using ColorQuantizeFn = std::function<int(const Vec3f &)>;
|
||||
|
||||
// Resolves a palette index plus a surface position to the filament index that position should print
|
||||
// in. A pure entry ignores the position; a mixed one interleaves its two filaments per ColorMixMode.
|
||||
//
|
||||
// Deliberately separate from ColorQuantizeFn, and deliberately *not* used by the subdivision's colour
|
||||
// criterion: that criterion asks where the **perceived** colour changes, and must not see the
|
||||
// interleaving. Refining on every band or dither-cell boundary would spend the whole triangle budget
|
||||
// drawing a pattern the eye is supposed to blend away.
|
||||
using ColorResolveFn = std::function<int(int palette_index, const Vec3f &pos, const Vec3f &normal)>;
|
||||
|
||||
// One printable colour: either a loaded filament on its own, or a blend of two of them realised by
|
||||
// interleaving (see ColorMixMode). Plain data, so it can be captured into a background job.
|
||||
// interleaving, which the slicer does per print layer. Plain data, so it can be captured into a job.
|
||||
struct PrintableColor
|
||||
{
|
||||
Vec3f rgb = Vec3f::Zero(); // what it looks like; for a mix, the perceptual average of the two
|
||||
@@ -538,9 +508,6 @@ struct TextureColorSettings
|
||||
{
|
||||
std::vector<PrintableColor> palette;
|
||||
std::vector<PrintableColor> palette_pure; // the filaments alone, for flat-colour images
|
||||
ColorMixMode mix_mode = ColorMixMode::ZBands;
|
||||
float layer_height = 0.2f; // sizes the Z bands
|
||||
float dither_cell_mm = 0.4f; // sizes the XY dither cells
|
||||
int despeckle_passes = 2;
|
||||
|
||||
bool empty() const { return palette.empty(); }
|
||||
@@ -780,9 +747,6 @@ struct TextureColorRequest
|
||||
// made of flat colours (TextureDetail::flat_colors) is matched with this one, so a tile or a logo
|
||||
// prints in single filaments while a photograph on another layer may still use mixes.
|
||||
ColorQuantizeFn quantize_pure;
|
||||
// Palette index + position -> filament. Optional: without it a palette index is taken to be a
|
||||
// filament index directly, which is the no-mixing case.
|
||||
ColorResolveFn resolve;
|
||||
// Majority-filter passes over the *perceived* colour, before any interleaving is resolved.
|
||||
//
|
||||
// Sampling a detailed image once per triangle leaves salt-and-pepper wherever the image's own
|
||||
|
||||
@@ -404,7 +404,6 @@ std::string debug_out_path(const char *name, ...)
|
||||
}
|
||||
|
||||
namespace logging = boost::log;
|
||||
namespace src = boost::log::sources;
|
||||
namespace expr = boost::log::expressions;
|
||||
namespace keywords = boost::log::keywords;
|
||||
namespace attrs = boost::log::attributes;
|
||||
@@ -892,7 +891,6 @@ int copy_file_linux_read_write(int infile, int outfile, uintmax_t file_size)
|
||||
// and only features supported by Linux 3.10 (on our build server with CentOS 7) are kept, namely sendfile with ranges and statx() are not supported.
|
||||
bool copy_file_linux(const boost::filesystem::path &from, const boost::filesystem::path &to, boost::system::error_code &ec)
|
||||
{
|
||||
using namespace boost::filesystem;
|
||||
|
||||
struct fd_wrapper
|
||||
{
|
||||
|
||||
@@ -1587,7 +1587,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
|
||||
{
|
||||
std::vector<int> result_filaments;
|
||||
//result_filaments.reserve(conflict_filaments.size());
|
||||
std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
|
||||
std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
|
||||
conflict_filament_vector = result_filaments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -974,8 +974,8 @@ bool AMSMaterialsSetting::Show(bool show)
|
||||
|
||||
static void _collect_filament_info(const wxString& shown_name,
|
||||
const Preset& filament,
|
||||
unordered_map<wxString, wxString>& query_filament_vendors,
|
||||
unordered_map<wxString, wxString>& query_filament_types)
|
||||
std::unordered_map<wxString, wxString>& query_filament_vendors,
|
||||
std::unordered_map<wxString, wxString>& query_filament_types)
|
||||
{
|
||||
query_filament_vendors[shown_name] = filament.config.get_filament_vendor();
|
||||
query_filament_types[shown_name] = filament.config.get_filament_type();
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <wx/dcmemory.h>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
@@ -855,14 +856,14 @@ void AuxiliaryPanel::Split(const std::string &src, const std::string &separator,
|
||||
dest.clear();
|
||||
index = str.find_first_of(separator, start);
|
||||
do {
|
||||
if (index != string::npos) {
|
||||
if (index != std::string::npos) {
|
||||
substring = str.substr(start, index - start);
|
||||
dest.push_back(substring);
|
||||
start = index + separator.size();
|
||||
index = str.find(separator, start);
|
||||
if (start == string::npos) break;
|
||||
if (start == std::string::npos) break;
|
||||
}
|
||||
} while (index != string::npos);
|
||||
} while (index != std::string::npos);
|
||||
|
||||
// the last part
|
||||
substring = str.substr(start);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "slic3r/GUI/Widgets/Button.hpp"
|
||||
#include "slic3r/GUI/Widgets/ComboBox.hpp"
|
||||
#include <string>
|
||||
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/sizer.h>
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
void create_folder(wxString name = wxEmptyString);
|
||||
std::string replaceSpace(std::string s, std::string ts, std::string ns);
|
||||
void on_import_file(wxCommandEvent &event);
|
||||
void Reload(wxString aux_path, std::map<std::string, std::vector<json>> paths);
|
||||
void Reload(wxString aux_path, std::map<std::string, std::vector<nlohmann::json>> paths);
|
||||
|
||||
void update_all_panel();
|
||||
void update_all_cover();
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
class AuxiliaryModelNode;
|
||||
WX_DEFINE_ARRAY_PTR(AuxiliaryModelNode*, AuxiliaryModelNodePtrArray);
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
class AuxiliaryModelNode
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -73,10 +73,6 @@ private:
|
||||
CancelFn m_cancel_cb;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -80,10 +80,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarBind;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -97,10 +97,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarPrint;
|
||||
}
|
||||
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -99,10 +99,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarSend;
|
||||
}
|
||||
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO_SEND, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_FAIL_SEND, wxCommandEvent);
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define TOPBAR_TITLE_WIDTH 300
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
enum CUSTOM_ID
|
||||
{
|
||||
|
||||
@@ -18,8 +18,6 @@ class wxMouseCaptureLostEvent;
|
||||
class wxMouseEvent;
|
||||
class wxWindow;
|
||||
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
class CenteredTitle : public wxControl
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -218,7 +218,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
|
||||
void BackgroundSlicingProcess::process_fff()
|
||||
{
|
||||
assert(m_print == m_fff_print);
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
PresetBundle& preset_bundle = *GUI::wxGetApp().preset_bundle;
|
||||
m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor();
|
||||
// BBS: add the logic to process from an existed gcode file
|
||||
if (m_print->finished()) {
|
||||
@@ -727,7 +727,7 @@ StringObjectException BackgroundSlicingProcess::validate(std::vector<StringObjec
|
||||
assert(m_print != nullptr);
|
||||
assert(m_print == m_fff_print);
|
||||
|
||||
m_fff_print->is_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor();
|
||||
m_fff_print->is_BBL_printer() = GUI::wxGetApp().preset_bundle->is_bbl_vendor();
|
||||
return m_print->validate(warnings, collison_polygons, height_polygons);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include "CapsuleButton.hpp"
|
||||
|
||||
namespace Slic3r::GUI { struct IntEvent; }
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
#define ANIMATION_REFRESH_INTERVAL 20
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <memory>
|
||||
#include "slic3r/GUI/BBLStatusBarBind.hpp"
|
||||
#include "slic3r/GUI/Jobs/BindJob.hpp"
|
||||
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
#include "slic3r/GUI/Jobs/Worker.hpp"
|
||||
#include <utility>
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
#include "DeviceCore/DevManager.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
using Slic3r::GUI::format_wxstr;
|
||||
|
||||
#define BORDER_W 10
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
@@ -1307,7 +1307,7 @@ void CalibrationPresetPage::stripWhiteSpace(std::string& str)
|
||||
{
|
||||
if (str == "") { return; }
|
||||
|
||||
string::iterator cur_it;
|
||||
std::string::iterator cur_it;
|
||||
cur_it = str.begin();
|
||||
|
||||
while (cur_it != str.end()) {
|
||||
@@ -2597,7 +2597,7 @@ void CalibrationPresetPage::update_multi_extruder_filament_combobox(const std::s
|
||||
int ams_id_int = 0;
|
||||
try {
|
||||
if (!ams_id.empty())
|
||||
ams_id_int = stoi(ams_id.c_str());
|
||||
ams_id_int = std::stoi(ams_id.c_str());
|
||||
|
||||
} catch (...) {}
|
||||
|
||||
@@ -2685,7 +2685,7 @@ void CalibrationPresetPage::update_filament_combobox(std::string ams_id)
|
||||
int ams_id_int = 0;
|
||||
try {
|
||||
if (!ams_id.empty())
|
||||
ams_id_int = stoi(ams_id.c_str());
|
||||
ams_id_int = std::stoi(ams_id.c_str());
|
||||
|
||||
} catch (...) {}
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace GUI {
|
||||
|
||||
|
||||
using Config::Snapshot;
|
||||
using Config::SnapshotDB;
|
||||
|
||||
|
||||
// Configuration data structures extensions needed for the wizard
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include <wx/types.h>
|
||||
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
@@ -88,7 +86,7 @@ struct Bundle
|
||||
// cache or its profile JSONs, whichever is usable.
|
||||
// Returns false if not loaded. Reason for that is logged as boost::log error.
|
||||
//BBS: set BBL as default
|
||||
bool load(fs::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
|
||||
bool load(boost::filesystem::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
|
||||
|
||||
const std::string& vendor_id() const { return vendor_profile->id; }
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "slic3r/GUI/Widgets/RadioBox.hpp"
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <cstdlib>
|
||||
#include "slic3r/GUI/GUI_Utils.hpp"
|
||||
#include "slic3r/GUI/Widgets/Label.hpp"
|
||||
@@ -91,6 +91,8 @@
|
||||
#define SELECT_ALL_OPTION_COLOUR wxColour("#009688")
|
||||
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
@@ -345,7 +347,7 @@ static std::string get_curr_timestmp()
|
||||
// return timestampString;
|
||||
}
|
||||
|
||||
static void get_filament_compatible_printer(Preset* preset, vector<std::string>& printers)
|
||||
static void get_filament_compatible_printer(Preset* preset, std::vector<std::string>& printers)
|
||||
{
|
||||
auto compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset->config.option("compatible_printers"));
|
||||
if (compatible_printers == nullptr) return;
|
||||
@@ -1579,7 +1581,7 @@ void CreateFilamentPresetDialog::sort_printer_by_nozzle(std::vector<std::pair<st
|
||||
{
|
||||
std::unordered_map<std::string, float> nozzle_diameter = nozzle_diameter_map;
|
||||
std::sort(printer_name_to_filament_preset.begin(), printer_name_to_filament_preset.end(),
|
||||
[&nozzle_diameter](const std::pair<string, T> &a, const std::pair<string, T> &b) {
|
||||
[&nozzle_diameter](const std::pair<std::string, T> &a, const std::pair<std::string, T> &b) {
|
||||
size_t nozzle_index_a = a.first.find(" nozzle");
|
||||
size_t nozzle_index_b = b.first.find(" nozzle");
|
||||
if (nozzle_index_a == std::string::npos || nozzle_index_b == std::string::npos) return a.first < b.first;
|
||||
@@ -3141,7 +3143,7 @@ void CreatePrinterPresetDialog::set_current_visible_printer()
|
||||
|
||||
wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter)
|
||||
{
|
||||
std::vector<pair<float, std::string>> preset_sort;
|
||||
std::vector<std::pair<float, std::string>> preset_sort;
|
||||
|
||||
auto get_nozzle_size_for_printer_model = [this](const std::string & model_name) -> size_t {
|
||||
auto iter = m_printer_name_to_preset.find(model_name);
|
||||
@@ -4962,7 +4964,7 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_selected_filament_preset_sizer(
|
||||
|
||||
m_selected_printer->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||
wxString printer_name = m_selected_printer->GetStringSelection();
|
||||
std::unordered_map<string, std::vector<std::shared_ptr<Preset>>>::iterator filament_iter = m_printer_compatible_filament_presets.find(into_u8(printer_name));
|
||||
std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>>::iterator filament_iter = m_printer_compatible_filament_presets.find(into_u8(printer_name));
|
||||
if (m_printer_compatible_filament_presets.end() != filament_iter) {
|
||||
filament_choice_to_filament_preset.clear();
|
||||
wxArrayString filament_choices;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include "DevAxis.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -22,7 +21,7 @@ public:
|
||||
bool IsArchCoreXY() const;
|
||||
|
||||
public:
|
||||
void ParseAxis(const json &print_json);
|
||||
void ParseAxis(const nlohmann::json &print_json);
|
||||
|
||||
int Ctrl_GoHome();
|
||||
int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "DevAxis.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "DevBed.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
void DevBed::ParseV1_0(const json &print_json, DevBed *system)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -16,8 +15,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
static void ParseV1_0(const json &print_json, DevBed *system);
|
||||
static void ParseV2_0(const json &print_json, DevBed *system);
|
||||
static void ParseV1_0(const nlohmann::json &print_json, DevBed *system);
|
||||
static void ParseV2_0(const nlohmann::json &print_json, DevBed *system);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "DevFilaSystem.h"
|
||||
#include "DevConfig.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
static float string_to_float(const std::string &str_value)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
|
||||
#include "DevDefs.h"
|
||||
@@ -86,11 +85,11 @@ public:
|
||||
std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; }
|
||||
|
||||
protected:
|
||||
void ExtrusionCalibSetParse(const json &jj);
|
||||
void ExtrusionCalibSelectParse(const json &jj);
|
||||
void ExtrusionCalibGetTableParse(const json &jj);
|
||||
void ExtrusionCalibGetResultParse(const json &jj);
|
||||
void FlowrateGetResultParse(const json &jj);
|
||||
void ExtrusionCalibSetParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibSelectParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibGetTableParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibGetResultParse(const nlohmann::json &jj);
|
||||
void FlowrateGetResultParse(const nlohmann::json &jj);
|
||||
|
||||
private:
|
||||
MachineObject* m_owner{nullptr};
|
||||
@@ -119,11 +118,11 @@ private:
|
||||
bool m_calib_finished{false};
|
||||
|
||||
public:
|
||||
static void ParseCalibVersion(const json& j, DevCalib* system);
|
||||
static void ParseCalibVersion(const nlohmann::json& j, DevCalib* system);
|
||||
|
||||
static void ParseSupportNewAutoCalib(int flag, DevCalib* system);
|
||||
|
||||
static void ParseV1_0(const json& print_json, DevCalib* system, bool key_field_only);
|
||||
static void ParseV1_0(const nlohmann::json& print_json, DevCalib* system, bool key_field_only);
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
@@ -3,9 +3,11 @@
|
||||
#include "DevConfig.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -25,10 +24,10 @@ public: // getter
|
||||
|
||||
public:
|
||||
// setter
|
||||
void ParseChamber(const json &print_json);
|
||||
void ParseChamber(const nlohmann::json &print_json);
|
||||
|
||||
void ParseChamberV1_0(const json& print_json);
|
||||
void ParseChamberV2_0(const json& print_json);
|
||||
void ParseChamberV1_0(const nlohmann::json& print_json);
|
||||
void ParseChamberV2_0(const nlohmann::json& print_json);
|
||||
|
||||
// control
|
||||
int CtrlSetChamberTemp(int temp);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "DevChamber.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
int DevChamber::CtrlSetChamberTemp(int temp)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "DevConfig.h"
|
||||
#include "DevUtil.h"
|
||||
#include "json_diff.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <limits>
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
|
||||
public:
|
||||
/*Setters*/
|
||||
void ParseConfig(const json& print_json);
|
||||
void ParseConfig(const nlohmann::json& print_json);
|
||||
|
||||
void ParseChamberConfig(const json& print_json); // chamber
|
||||
void ParsePrintOptionsConfig(const json& print_json); // print options
|
||||
void ParseCalibrationConfig(const json& print_json); //cali
|
||||
void ParseChamberConfig(const nlohmann::json& print_json); // chamber
|
||||
void ParsePrintOptionsConfig(const nlohmann::json& print_json); // print options
|
||||
void ParseCalibrationConfig(const nlohmann::json& print_json); //cali
|
||||
|
||||
private:
|
||||
[[maybe_unused]] MachineObject* m_obj;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "DevConfigUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "DevCtrl.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <wx/string.h>
|
||||
@@ -15,7 +15,7 @@ class DevCtrlInfo
|
||||
{
|
||||
public:
|
||||
DevCtrlInfo() {};
|
||||
DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json, int interval_max = 3, int interval_min = 0);
|
||||
DevCtrlInfo(MachineObject* obj, int sequence_id, const nlohmann::json& req_json, int interval_max = 3, int interval_min = 0);
|
||||
|
||||
public:
|
||||
bool CheckCanUpdateData(const nlohmann::json& jj);
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
|
||||
time_t m_request_time = 0;
|
||||
int m_request_seq = 0;
|
||||
json m_request_json = json();
|
||||
nlohmann::json m_request_json = nlohmann::json();
|
||||
|
||||
// check
|
||||
int m_request_interval_max = 3;
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <optional>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include "DevDefs.h"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "DevExtruderSystem.h"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
int DevExtderSystem::CtrlRetrySwitching()
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/app.h>
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
using namespace nlohmann;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -13,7 +12,7 @@ namespace Slic3r {
|
||||
class MachineObject;
|
||||
|
||||
enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE };
|
||||
typedef std::function<void(const json &)> CommandCallBack;
|
||||
typedef std::function<void(const nlohmann::json &)> CommandCallBack;
|
||||
|
||||
enum AIR_FUN : int {
|
||||
FAN_HEAT_BREAK_0_IDX = 0,
|
||||
@@ -123,14 +122,14 @@ public:
|
||||
AirDuctData GetAirDuctData() { return m_air_duct_data; };
|
||||
|
||||
void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent
|
||||
int command_handle_response(const json &response);
|
||||
int command_handle_response(const nlohmann::json &response);
|
||||
int command_control_fan(int fan_type, int val); // Old protocol
|
||||
int command_control_fan_new(int fan_id, int val); // New protocol
|
||||
int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb);
|
||||
|
||||
void ParseV1_0(const json &print_json);
|
||||
void ParseV2_0(const json &print_json);
|
||||
void ParseV3_0(const json &print_json);
|
||||
void ParseV1_0(const nlohmann::json &print_json);
|
||||
void ParseV2_0(const nlohmann::json &print_json);
|
||||
void ParseV3_0(const nlohmann::json &print_json);
|
||||
|
||||
public:
|
||||
bool GetSupportAirduct() { return is_support_airduct; };
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "DevFilaAmsSetting.h"
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
#include "slic3r/GUI/DeviceCore/DevCtrl.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
|
||||
#include "DevFilaBlackList.h"
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info);
|
||||
|
||||
public:
|
||||
static json filaments_blacklist;
|
||||
static nlohmann::json filaments_blacklist;
|
||||
};// class DevFilaBlacklist
|
||||
|
||||
}// namespace Slic3r
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include "DevFilaSystem.h"
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId
|
||||
|
||||
@@ -161,7 +160,7 @@ DevAms::~DevAms()
|
||||
m_trays.clear();
|
||||
}
|
||||
|
||||
static unordered_map<int, wxString> s_ams_display_formats = {
|
||||
static std::unordered_map<int, wxString> s_ams_display_formats = {
|
||||
{DevAms::AMS, "AMS-%d"},
|
||||
{DevAms::AMS_LITE, "AMS Lite-%d"},
|
||||
{DevAms::N3F, "AMS 2 PRO-%d"},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "DevDefs.h"
|
||||
#include "DevFilaAmsSetting.h"
|
||||
@@ -415,9 +415,9 @@ private:
|
||||
class DevFilaSystemParser
|
||||
{
|
||||
public:
|
||||
static void ParseV1_0(const json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
|
||||
static void ParseV1_0(const nlohmann::json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
|
||||
|
||||
static void ParseAgentFilament(const json& data, MachineObject* obj, DevFilaSystem* system);
|
||||
static void ParseAgentFilament(const nlohmann::json& data, MachineObject* obj, DevFilaSystem* system);
|
||||
};
|
||||
|
||||
struct DevFilamentDryingPreset
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <string>
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
#include "DevFirmware.h"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -51,10 +49,10 @@ public:
|
||||
bool isCuttingModule() const { return product_name.Contains("Cutting Module"); }
|
||||
bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment
|
||||
bool isExtinguishSystem() const { return product_name.Contains("Extinguishing System"); }// Auto Fire Extinguishing System
|
||||
bool isWTM() const { return name.find("wtm") != string::npos; } // nozzle
|
||||
bool isWTM() const { return name.find("wtm") != std::string::npos; } // nozzle
|
||||
bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); }
|
||||
bool isHmshub() const { return product_name.find("Filament Buffer") != string::npos; }
|
||||
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; }
|
||||
bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; }
|
||||
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
#include "DevHMS.h"
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <exception>
|
||||
#include <cassert>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
DevHMS(MachineObject* obj) : m_object(obj) {}
|
||||
|
||||
public:
|
||||
void ParseHMSItems(const json& hms_json);
|
||||
void ParseHMSItems(const nlohmann::json& hms_json);
|
||||
const std::vector<DevHMSItem>& GetHMSItems() const { return m_hms_list; };
|
||||
|
||||
private:
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
bool has_read() const { return m_already_read; };
|
||||
|
||||
protected:
|
||||
friend void DevHMS::ParseHMSItems(const json& hms_json);
|
||||
friend void DevHMS::ParseHMSItems(const nlohmann::json& hms_json);
|
||||
bool parse_hms_info(unsigned attr, unsigned code);
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "DevLamp.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "DevUtil.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <mutex>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/object.h>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <limits>
|
||||
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -21,8 +20,6 @@
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/GuiColor.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
bool DevMappingUtil::is_valid_mapping_result(const MachineObject* obj, std::vector<FilamentInfo>& result, bool check_empty_slot)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "DevUtil.h"
|
||||
#include "DevUtilBackend.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
@@ -251,7 +250,7 @@ int DevNozzleMappingCtrl::CtrlGetAutoNozzleMappingV1(Slic3r::GUI::Plater* plater
|
||||
|
||||
void DevNozzleMappingCtrl::ParseAutoNozzleMapping(const json& print_jj)
|
||||
{
|
||||
if (print_jj.contains("command") && print_jj["command"].get<string>() == "get_auto_nozzle_mapping") {
|
||||
if (print_jj.contains("command") && print_jj["command"].get<std::string>() == "get_auto_nozzle_mapping") {
|
||||
if (print_jj.contains("sequence_id") && print_jj["sequence_id"] == m_sequence_id) {
|
||||
Clear();
|
||||
DevJsonValParser::ParseVal(print_jj, "result", m_result);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "DevNozzleSystem.h"
|
||||
#include "DevFirmware.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "DevNozzleRack.h"
|
||||
#include "DevExtruderSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/MsgDialog.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "slic3r/GUI/DeviceCore/DevNozzleSystem.h"
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "DevNozzleSystem.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <optional>
|
||||
#include <cmath>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
@@ -424,7 +426,7 @@ void DevNozzleSystem::ClearNozzles()
|
||||
|
||||
// ---- parsing ----------------------------------------------------------------------------------------
|
||||
|
||||
static unordered_map<string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
static std::unordered_map<std::string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
{"S", NozzleFlowType::S_FLOW},
|
||||
{"H", NozzleFlowType::H_FLOW},
|
||||
{"A", NozzleFlowType::S_FLOW},
|
||||
@@ -434,7 +436,7 @@ static unordered_map<string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
{"B", NozzleFlowType::E_FLOW}, // E3D High Flow -> nvtE3DHighFlow
|
||||
};
|
||||
|
||||
static unordered_map<string, NozzleType> _str2_nozzle_type = {
|
||||
static std::unordered_map<std::string, NozzleType> _str2_nozzle_type = {
|
||||
{"00", NozzleType::ntStainlessSteel},
|
||||
{"01", NozzleType::ntHardenedSteel},
|
||||
{"05", NozzleType::ntTungstenCarbide}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include <string>
|
||||
@@ -195,6 +195,6 @@ namespace Slic3r
|
||||
{
|
||||
public:
|
||||
static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional<int> flag_e3d);
|
||||
static void ParseV2_0(const json& device_json, DevNozzleSystem* system);
|
||||
static void ParseV2_0(const nlohmann::json& device_json, DevNozzleSystem* system);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "DevStorage.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user