clean up comments

This commit is contained in:
SoftFever
2026-08-23 22:43:41 +08:00
parent 7934814077
commit 2b1499a087
33 changed files with 127 additions and 193 deletions

View File

@@ -37,7 +37,7 @@ DynamicPrintConfig mixed_config(bool sublayer_on, const char *ratios = "0.6,0.4"
return config;
}
// Total sub-layer groups and per-layer DRR resolutions across the whole tool ordering.
// Total sub-layer groups and per-layer mixed-filament resolutions across the whole tool ordering.
void count_mixed(ToolOrdering &to, size_t &groups, size_t &resolutions)
{
groups = resolutions = 0;
@@ -139,9 +139,8 @@ TEST_CASE("Whole-layer mixing emits only the nominal layer height", "[MixedFilam
TEST_CASE("By-object prints without mixed filaments keep their used-filament set", "[MixedFilament]")
{
// Regression guard for the mixed gate: with no mixed slot the by-object bookkeeping must
// be untouched by this change. Object 2 prints with filament 2, so both filaments are used
// and no mixed filament is reported.
// With no mixed slot the by-object bookkeeping stays plain: object 2 prints with filament 2,
// so both filaments are used and no mixed filament is reported.
DynamicPrintConfig config = multifilament_config(2, {{"print_sequence", "by object"}});
const std::vector<std::vector<ConfigBase::SetDeserializeItem>> overrides{ {}, { {"extruder", "2"} } };

View File

@@ -501,10 +501,8 @@ SCENARIO("Nozzle-group metadata .3mf round-trip", "[3mf][MultiNozzle]") {
// A mixed-color filament occupies an ordinary filament slot, and painting with it stores an
// ordinary extruder state a project saved by BambuStudio encodes filament 5 of a 5-slot setup
// as paint state 5, with the mix described by the parallel filament_mixed_* project arrays. This
// pins both halves of that contract at the .3mf layer: the project keys and the painted states
// must come back exactly as written.
// ordinary extruder state: a project saved by BambuStudio encodes filament 5 of a 5-slot setup
// as paint state 5, with the mix described by the parallel filament_mixed_* project arrays.
SCENARIO("Mixed-color filament setup and painting round-trip through a .3mf", "[3mf][MixedFilament]") {
GIVEN("a painted model whose project config describes a mixed filament in the last slot") {
Model model;

View File

@@ -101,10 +101,9 @@ TEST_CASE("check_mixed_filament_type_consistency flags mismatched component type
TEST_CASE("a support-flagged component reads as its own filament type for the consistency check", "[FilamentMixer]")
{
// Sidebar::update_mixed_filament_list and Sidebar::has_broken_mixed_filament derive each
// component's type through DynamicPrintConfig::get_filament_type, which folds the
// filament_is_support flag into the type — so toggling that flag alone changes the verdict
// and Plater::on_config_change has to refresh the mixed list on filament_is_support too.
// The sidebar derives each component's type through DynamicPrintConfig::get_filament_type,
// which folds filament_is_support into the type, so toggling that flag alone flips the
// verdict and the mixed filament list has to be refreshed on filament_is_support too.
DynamicPrintConfig plain_pla;
plain_pla.set_key_value("filament_type", new ConfigOptionStrings({"PLA"}));
plain_pla.set_key_value("filament_is_support", new ConfigOptionBools({false}));
@@ -193,8 +192,8 @@ TEST_CASE("blend_color_multi weights components", "[FilamentMixer]")
}
SECTION("Mixing a color with itself stays close to that color") {
// The mixer is a degree-4 polynomial fit of pigment behaviour, so a round trip through
// it is near-identity rather than exact (the model documents a mean Delta-E around 2).
// The mixer is a degree-4 polynomial fit of pigment behaviour, so mixing a color with
// itself lands near it rather than exactly on it; allow a small per-channel drift.
std::string mixed = blend_color_multi({"#123456", "#123456"}, {1, 1});
REQUIRE(mixed.size() == 7);
auto comp = [](const std::string &hex, int i) {

View File

@@ -614,12 +614,10 @@ TEST_CASE("set_num_filaments keeps mixed-color arrays in step with the filament
}
}
// A mix is described by 1-based indices into the project's filament list. Orca's per-printer
// preset memory rebuilds that list from the selected printer's snapshot (filament_%02u /
// filament_colors) at startup and on every printer selection, so the mixed arrays must be stored
// in the SAME per-printer snapshot: kept globally (as BambuStudio does — its filament list is a
// single global snapshot too) they end up indexing a list they were never saved against, and used
// to be reset on every printer selection instead, losing the mixes over an app restart.
// A mix is described by 1-based indices into the project's filament list, which Orca rebuilds
// from the selected printer's snapshot (filament_%02u / filament_colors) at startup and on every
// printer selection. Held anywhere but that same per-printer snapshot, the mixed arrays end up
// indexing a filament list they were never saved against.
TEST_CASE("Mixed-color filament metadata is snapshotted per printer, with its filament list", "[Preset][Bundle][FilamentMixer]")
{
PresetBundle bundle;
@@ -674,10 +672,9 @@ TEST_CASE("A multi-point gradient curve survives the app-config snapshot", "[Pre
}
// A multi-tool printer sizes the filament list from its nozzle count. Mixed-color slots are extra
// virtual filaments at the tail of that list with no nozzle of their own, so the sync has to add
// them on top. Sizing to the nozzle count alone truncates them — and because that sync runs right
// after a project is loaded, it silently drops the project's mixes and then lets the filament-count
// change strip every painted facet above the new count.
// virtual filaments at the tail of that list with no nozzle of their own, so the count has to
// allow for them: sizing to the nozzle count alone drops the project's mixes and strips every
// painted facet above the new count.
TEST_CASE("Sizing the filament list to a multi-tool nozzle count keeps mixed slots", "[Preset][Bundle][FilamentMixer]")
{
// The 5-slot layout of a 4-tool project carrying one mix of filaments 2 and 3.

View File

@@ -99,7 +99,7 @@ TEST_CASE("Extruder states above 17 are encoded in a second nibble", "[TriangleS
}
// Model.cpp writes these hex strings into the 3MF for colored mesh imports; the selector must
// decode exactly the states that table assigns to them.
// decode exactly the states CONST_FILAMENTS assigns to them.
TEST_CASE("Extruder states match the CONST_FILAMENTS hex encoding", "[TriangleSelector]")
{
struct Case { const char *hex; int state; };

View File

@@ -140,8 +140,8 @@ TEST_CASE("recompute_mixed_slot_colors honours the configured ratios and is idem
// --- mixed_gradient_ramp / sample_gradient_ramp -----------------------------------------
//
// The ramp is what every mixed filament swatch is drawn from, so these pin the three things
// a plain two-endpoint fade got wrong: the reserved ratio band, the component order, and the
// custom curve.
// a plain fade between two endpoint colours cannot express: the reserved ratio band, the
// component order, and the custom curve.
namespace {
@@ -169,7 +169,7 @@ TEST_CASE("mixed_gradient_ramp runs bottom to top and never reaches a pure compo
REQUIRE(ramp.size() == 16);
// Neither end is the pure component colour - the slicer clamps the blend to
// [kGradientMinRatio, kGradientMaxRatio], which is exactly what a two-endpoint fade missed.
// [kGradientMinRatio, kGradientMaxRatio], which a fade between the pure colours would ignore.
REQUIRE(ramp.front() != wxColour(255, 0, 0));
REQUIRE(ramp.back() != wxColour(0, 0, 255));
@@ -188,7 +188,7 @@ TEST_CASE("mixed_gradient_ramp follows the range's direction rather than the com
REQUIRE(falling.size() == 16);
// "0.1,0.9" starts blue-heavy at the bottom; "0.9,0.1" starts red-heavy. Reversing the
// range must reverse the ramp, which HSV-sorted endpoint colours could not express.
// range must reverse the ramp, which endpoint colours ordered by HSV cannot express.
REQUIRE(int(rising.front().Blue()) > int(rising.front().Red()));
REQUIRE(int(falling.front().Red()) > int(falling.front().Blue()));
require_same_rgb(rising.front(), falling.back());