fix(build): restore ImageMap GCode.hpp, merge ZAA by-value/skirt signatures

This commit is contained in:
thysson2701
2026-07-21 21:33:24 +02:00
parent 2405572fee
commit c73261ca6b
2 changed files with 91 additions and 4 deletions

View File

@@ -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;

View File

@@ -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 <array>
#include <cstdint>
#include <memory>
#include <map>
#include <optional>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <cfloat>
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<float> sample_x_mm;
std::vector<float> sample_y_mm;
std::vector<float> sample_weight;
std::vector<float> sample_component_weights;
std::vector<std::vector<uint32_t>> buckets;
std::vector<float> 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<Vec2f, 3> 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<GCodeUVTextureTriangleMetadata> triangles;
std::vector<std::vector<uint32_t>> z_bins;
std::vector<uint32_t> fallback_triangle_indices;
float min_z { 0.f };
float max_z { 0.f };
float z_bin_step_mm { 1.f };
};
struct GCodeUVTextureTriangleCache {
std::vector<GCodeUVTextureVolumeMetadata> 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<ObjectID> m_objsWithBrim; // indicates the objs with brim
@@ -498,6 +575,12 @@ private:
ExtrusionQualityEstimator m_extrusion_quality_estimator;
std::map<std::tuple<const PrintObject*, unsigned int, std::string>, VertexColorOverhangWeightField> m_vertex_color_overhang_weight_field_cache;
std::map<const PrintObject*, GCodeUVTextureTriangleCache> m_uv_texture_triangle_cache;
std::map<std::string, GCodeGenericMixCandidateSet> m_generic_solver_mix_candidate_cache;
std::map<const PrintObject*, bool> m_top_surface_coloring_shell_infill_object_cache;
bool m_warned_texture_mapping_filament_count_mismatch { false };
std::set<unsigned int> 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<size_t> ids);
// ORCA: Add support for role based fan speed control
std::array<bool, ExtrusionRole::erCount> m_is_role_based_fan_on;
std::array<int, ExtrusionRole::erCount> 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<SmallAreaInfillFlowCompensator> m_small_area_infill_flow_compensator;
// Heights (print_z) at which the skirt has already been extruded.
std::vector<coordf_t> m_skirt_done;
std::vector<coordf_t> m_skirt_done;
// Heights (print_z) at which each grouped skirt has already been extruded.
std::vector<std::vector<coordf_t>> 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<PreferredSeamPoint> 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);