From c73261ca6b5a0b86d80ba54be1ebd96e990814b5 Mon Sep 17 00:00:00 2001 From: thysson2701 Date: Tue, 21 Jul 2026 21:33:24 +0200 Subject: [PATCH] fix(build): restore ImageMap GCode.hpp, merge ZAA by-value/skirt signatures --- src/libslic3r/GCode.cpp | 2 +- src/libslic3r/GCode.hpp | 93 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index a2ee8abd80d..7b65767db78 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -5231,7 +5231,7 @@ LayerResult GCode::process_layer( const Point& offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift; std::string skirt_gcode = generate_skirt(print, instance_to_print.print_object.object_skirt(), offset, - instance_to_print.print_object.config().skirt_start_angle, layer_tools, + instance_to_print.print_object.config().skirt_start_angle.value, layer_tools, *skirt_layer, extruder_id); if (!skirt_gcode.empty()) skirt_generated_for_current_print_z = true; diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 9fa221f34ca..cbb150c0db1 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -21,6 +21,7 @@ #include "GCode/ThumbnailData.hpp" #include "libslic3r/ObjectID.hpp" #include "GCode/ExtrusionProcessor.hpp" +#include "ColorSolver.hpp" #include "GCode/PressureEqualizer.hpp" #include "GCode/SmallAreaInfillFlowCompensator.hpp" @@ -29,21 +30,85 @@ #include "GCode/TimelapsePosPicker.hpp" +#include +#include #include #include +#include #include #include +#include +#include #include namespace Slic3r { // Forward declarations. class GCode; +class ModelVolume; namespace CustomGCode{ struct Item; } struct PrintInstance; class ConstPrintObjectPtrsAdaptor; +using GCodeGenericMixCandidateSet = ColorSolverCandidateSet; + +struct VertexColorOverhangWeightField { + float min_x_mm { 0.f }; + float min_y_mm { 0.f }; + float bucket_width_mm { 1.f }; + float bucket_height_mm { 1.f }; + int bucket_width { 0 }; + int bucket_height { 0 }; + size_t component_count { 0 }; + std::vector sample_x_mm; + std::vector sample_y_mm; + std::vector sample_weight; + std::vector sample_component_weights; + std::vector> buckets; + std::vector fallback_weights; + bool raw_component_weights_from_texture { false }; + bool binary_dithered { false }; + + bool empty() const + { + return bucket_width <= 0 || + bucket_height <= 0 || + component_count == 0 || + sample_x_mm.empty() || + sample_y_mm.size() != sample_x_mm.size() || + sample_weight.size() != sample_x_mm.size() || + sample_component_weights.size() != sample_x_mm.size() * component_count; + } +}; + +struct GCodeUVTextureTriangleMetadata { + const ModelVolume *volume { nullptr }; + Vec3d p0; + Vec3d p1; + Vec3d p2; + std::array uv; + float min_z { 0.f }; + float max_z { 0.f }; + float max_uv_edge_texel { 0.f }; + float max_world_edge_mm { 0.f }; + double area_mm2 { 0.0 }; +}; + +struct GCodeUVTextureVolumeMetadata { + const ModelVolume *volume { nullptr }; + std::vector triangles; + std::vector> z_bins; + std::vector fallback_triangle_indices; + float min_z { 0.f }; + float max_z { 0.f }; + float z_bin_step_mm { 1.f }; +}; + +struct GCodeUVTextureTriangleCache { + std::vector volumes; +}; + class OozePrevention { public: bool enable; @@ -130,6 +195,7 @@ private: // Postprocesses gcode: rotates and moves G1 extrusions and returns result std::string post_process_wipe_tower_moves(const WipeTower::ToolChangeResult& tcr, const Vec2f& translation, float angle) const; + Vec2f offset_for_extruder(int extruder_id) const; // Left / right edges of the wipe tower, for the planning of wipe moves. const float m_left; const float m_right; @@ -239,8 +305,10 @@ public: bool enable_cooling_markers() const { return m_enable_cooling_markers; } std::string extrusion_role_to_string_for_parser(const ExtrusionRole &); - // Calculate the interpolated value for the current layer between start_value and end_value - float interpolate_value_across_layers(float start_value, float end_value) const; + // Calculate the interpolated value for the current layer between start_value and end_value. + // Step will create equal layers steps from first to last value. + // Step = 0 means gradual interpolation finishing at last value. + float interpolate_value_across_layers(float start_value, float end_value, float step = 0.0f) const; // For Perl bindings, to be used exclusively by unit tests. unsigned int layer_count() const { return m_layer_count; } @@ -342,6 +410,14 @@ private: const LayerTools &layer_tools, const Layer& layer, unsigned int extruder_id); + std::string generate_object_skirt_group(const Print &print, + const PrintObject &object, + const LayerTools &layer_tools, + const Layer& layer, + unsigned int extruder_id); + std::string generate_object_brim(const Print &print, + const PrintObject &object, + bool first_layer); LayerResult process_layer( const Print &print, @@ -489,6 +565,7 @@ private: std::string extrude_support(const ExtrusionEntityCollection& support_fills, const ExtrusionRole support_extrusion_role); // BBS + bool object_has_top_surface_coloring_shell_infill(const PrintObject &object); LiftType to_lift_type(ZHopType z_hop_types); std::set m_objsWithBrim; // indicates the objs with brim @@ -498,6 +575,12 @@ private: ExtrusionQualityEstimator m_extrusion_quality_estimator; + std::map, VertexColorOverhangWeightField> m_vertex_color_overhang_weight_field_cache; + std::map m_uv_texture_triangle_cache; + std::map m_generic_solver_mix_candidate_cache; + std::map m_top_surface_coloring_shell_infill_object_cache; + bool m_warned_texture_mapping_filament_count_mismatch { false }; + std::set m_warned_texture_mapping_color_match_zone_ids; /* Origin of print coordinates expressed in unscaled G-code coordinates. This affects the input arguments supplied to the extrude*() and travel_to() @@ -557,6 +640,7 @@ private: std::string _encode_label_ids_to_base64(std::vector ids); // ORCA: Add support for role based fan speed control std::array m_is_role_based_fan_on; + std::array m_role_based_fan_marker_layer; // Markers for the Pressure Equalizer to recognize the extrusion type. // The Pressure Equalizer removes the markers from the final G-code. bool m_enable_extrusion_role_markers; @@ -607,7 +691,9 @@ private: std::unique_ptr m_small_area_infill_flow_compensator; // Heights (print_z) at which the skirt has already been extruded. - std::vector m_skirt_done; + std::vector m_skirt_done; + // Heights (print_z) at which each grouped skirt has already been extruded. + std::vector> m_skirt_group_done; // Has the brim been extruded already? Brim is being extruded only for the first object of a multi-object print. bool m_brim_done; // Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed. @@ -649,6 +735,7 @@ private: double calc_max_volumetric_speed(const double layer_height, const double line_width, const std::string co_str); std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1); + std::optional texture_mapping_seam_hiding_hint(const ExtrusionLoop &loop); bool _needSAFC(const ExtrusionPath &path); void print_machine_envelope(GCodeOutputStream& file, Print& print); void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);