From 48070c2e5a149a0ab65306d52c410985cf86c0fc Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 21 Apr 2022 16:13:59 -0300 Subject: [PATCH] Made the 3D models selection more robuts - Now we reject "slots" that aren't numbers - Now we tollerate "empty slots" --- kibot/out_base_3d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kibot/out_base_3d.py b/kibot/out_base_3d.py index 78aee174..7395d276 100644 --- a/kibot/out_base_3d.py +++ b/kibot/out_base_3d.py @@ -182,7 +182,7 @@ class Base3DOptions(VariantOptions): def apply_list_of_models(self, enable, slots, m, var): # Disable the unused models adding bogus text to the end - slots = [int(v) for v in slots] + slots = [int(v) for v in slots if v] models = m.Models() m_objs = [] # Extract the models, we get a copy @@ -205,8 +205,8 @@ class Base3DOptions(VariantOptions): """ Disable/Enable the 3D models that aren't for this variant. This mechanism uses the MTEXT attributes. """ # The magic text is %variant:slot1,slot2...% - field_regex = re.compile(r'\%([^:]+):(.*)\%') # Generic (by name) - field_regex_sp = re.compile(r'\$([^:]*):(.*)\$') # Variant specific + field_regex = re.compile(r'\%([^:]+):([\d,]*)\%') # Generic (by name) + field_regex_sp = re.compile(r'\$([^:]*):([\d,]*)\$') # Variant specific self.extra_debug = extra_debug = GS.debug_level > 3 if extra_debug: logger.debug("{} 3D models that aren't for this variant".format('Enable' if enable else 'Disable'))