Skip to content

Commit fb17c40

Browse files
committed
[3D Model Variants][Modified] The code to by more clear
To address concerns in #820
1 parent af72057 commit fb17c40

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

kibot/out_base.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ def apply_3D_variant_aspect(self, board, enable=False):
727727
if extra_debug:
728728
logger.debug("- Processing module " + m.GetReference())
729729
default = None
730-
matched = False
731730
# Look for text objects
732731
for gi in m.GraphicalItems():
733732
if gi.GetClass() in ['MTEXT', 'PCB_TEXT']:
@@ -746,10 +745,9 @@ def apply_3D_variant_aspect(self, board, enable=False):
746745
if self.extra_debug:
747746
logger.debug('- Found defaults: {}'.format(slots))
748747
else:
749-
matched = var == variant_name
750-
if matched:
751-
self.apply_list_of_3D_models(enable, slots, m, var)
752-
break
748+
if var == variant_name:
749+
self.apply_list_of_3D_models(enable, slots, m, var)
750+
break
753751
else:
754752
# Try with the variant specific pattern
755753
match = field_regex_sp.match(text)
@@ -758,14 +756,14 @@ def apply_3D_variant_aspect(self, board, enable=False):
758756
logger.debug(f" - Variant specific: {text}")
759757
var = match.group(1)
760758
slots = match.group(2).split(',') if match.group(2) else []
761-
762759
# Do the match
763-
matched = self.variant.matches_variant(var)
764-
if matched:
760+
if self.variant.matches_variant(var):
765761
self.apply_list_of_3D_models(enable, slots, m, var)
766762
break
767-
if not matched and default is not None:
768-
self.apply_list_of_3D_models(enable, default, m, '_default_')
763+
else:
764+
# No match found
765+
if default is not None:
766+
self.apply_list_of_3D_models(enable, default, m, '_default_')
769767

770768
def create_3D_highlight_file(self):
771769
if self._highlight_3D_file:

0 commit comments

Comments
 (0)