From d84ac149d1094268c527e0c19846e0e66b532f02 Mon Sep 17 00:00:00 2001 From: yw4z Date: Wed, 6 May 2026 13:42:25 +0300 Subject: [PATCH] Fix filamanent / printer selection stucks on loading (#13492) * Update re3D rPP.json * add vector type check --------- Co-authored-by: SoftFever --- .../profiles/re3D/filament/re3D rPP.json | 4 +- scripts/orca_extra_profile_check.py | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/resources/profiles/re3D/filament/re3D rPP.json b/resources/profiles/re3D/filament/re3D rPP.json index 673dd9fffe..420b795366 100644 --- a/resources/profiles/re3D/filament/re3D rPP.json +++ b/resources/profiles/re3D/filament/re3D rPP.json @@ -6,7 +6,9 @@ "from": "system", "instantiation": "true", "inherits": "fdm_filament_pet", - "filament_type": "PP", + "filament_type": [ + "PP" + ], "nozzle_temperature_initial_layer": [ "185" ], diff --git a/scripts/orca_extra_profile_check.py b/scripts/orca_extra_profile_check.py index 00664d309d..7ccc5a1a7f 100644 --- a/scripts/orca_extra_profile_check.py +++ b/scripts/orca_extra_profile_check.py @@ -360,6 +360,50 @@ CONFLICT_KEYS = [ ['extruder_clearance_radius', 'extruder_clearance_max_radius'], ] +VECTOR_KEYS = { + "filament_type", +} + +def check_vector_type_keys(profiles_dir, vendor_name): + """ + Check that properties expected to be vectors (JSON arrays) are not stored as scalars. + For example, `filament_type` must be a list like ["PA-CF"], not a string "PA-CF". + + Parameters: + profiles_dir (Path): Base profiles directory + vendor_name (str): Vendor name + + Returns: + int: Number of errors found + """ + error_count = 0 + vendor_path = profiles_dir / vendor_name + + if not vendor_path.exists(): + return 0 + + for file_path in vendor_path.rglob("*.json"): + try: + with open(file_path, "r", encoding="UTF-8") as fp: + data = json.load(fp) + except Exception as e: + print_error(f"Error processing {file_path.relative_to(profiles_dir)}: {e}") + error_count += 1 + continue + + if not isinstance(data, dict): + continue + + for key in VECTOR_KEYS: + if key in data and not isinstance(data[key], list): + print_error( + f"'{key}' must be an array in {file_path.relative_to(profiles_dir)}, " + f"got {type(data[key]).__name__}: {data[key]!r}" + ) + error_count += 1 + + return error_count + def check_conflict_keys(profiles_dir, vendor_name): """ Check for keys that could not be specified at the same time, @@ -448,6 +492,8 @@ def main(): errors_found += new_errors warnings_found += new_warnings + errors_found += check_vector_type_keys(profiles_dir, vendor_name) + errors_found += check_filament_id(vendor_name, vendor_path / "filament") checked_vendor_count += 1