fix(out_base): update 3D variant aspect matching logic#820
Conversation
|
This is WIP. It already fixes some issues with the default selection. However, I try to match when a Key is listed in the variant expression (abc,Key,def) to select a slot configuration. For some reason "j8_clm" would match a variant not containing that key at all ( Digging a bit deeper. |
|
I figured it out, I had to prefix the variant key in the footprint text fields |
72a9e7d to
93fa508
Compare
|
@set-soft I did not find your review, I modified to have less changes. |
| break | ||
| if not matched and default is not None: | ||
| self.apply_list_of_3D_models(enable, slots, m, '_default_') | ||
| self.apply_list_of_3D_models(enable, default, m, '_default_') |
There was a problem hiding this comment.
I wrote "I think technically there can be even less" and explained why I prefer to keep the other changes as well.
| if matched: | ||
| matched_gi = var == variant_name | ||
| if matched_gi: | ||
| matched = True |
There was a problem hiding this comment.
Once we have a match the loop ends, why we need two "match" variables?
My fault, reviews must be approved, they doesn't become visible until I confirm them.
But when we have a match the loop ends. Both |
- Correct logic to select default 3D slot selection (added `any_matched`); - Renamed `default` to `default_slots` for clarity.
It helps with readability, code analysis and future changes (for instance checking/using or warning about multiple matches). Anyway, updated. |
|
Thanks! |
|
@mdeweerd : the above patch removes the need of a flag and addresses your concern. |
|
@set-soft Thanks In terms of code optimisation/DRY coding, we could have just one By setting it after the loop when slots is not None.
|
Sure, the above patch does it, also moves the search to a function |
any_matched)defaulttodefault_slotsfor clarity.