fix(preset): filament_id auch generieren wenn sie vom Parent geerbt wurde (== base_id)
This commit is contained in:
@@ -642,8 +642,12 @@ void Preset::save(DynamicPrintConfig* parent_config)
|
||||
// Generate a unique filament_id for user filament presets that don't have one yet.
|
||||
// Inherited presets (e.g. "My PLA" inheriting "Generic PLA @System") previously had
|
||||
// no filament_id which caused AMS sync to fall back to the parent's Generic ID.
|
||||
if (this->is_user() && this->filament_id.empty() && !this->name.empty() &&
|
||||
this->type == Preset::TYPE_FILAMENT) {
|
||||
// Also generate a new ID if filament_id is inherited from the parent (== base_id).
|
||||
// This happens when a user preset is saved for the first time without having its own ID.
|
||||
bool needs_unique_filament_id = this->is_user() && !this->name.empty() &&
|
||||
this->type == Preset::TYPE_FILAMENT &&
|
||||
(this->filament_id.empty() || (!this->base_id.empty() && this->filament_id == this->base_id));
|
||||
if (needs_unique_filament_id) {
|
||||
boost::uuids::detail::md5 hash;
|
||||
boost::uuids::detail::md5::digest_type digest;
|
||||
hash.process_bytes(this->name.data(), this->name.size());
|
||||
|
||||
Reference in New Issue
Block a user