Skip to content

Commit 40dcd31

Browse files
committed
fix a pattern bug; update with ui
1 parent f1d6782 commit 40dcd31

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

additional_file_formats/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .mzd import readMZD_to_bpymesh, readMZD_to_meshio
22
from .bgeo import readbgeo_to_meshio
33

4-
additional_format_loader = {'.bgeo': readbgeo_to_meshio, '.mzd': readMZD_to_meshio}
4+
additional_format_loader = {'bgeo': readbgeo_to_meshio, 'mzd': readMZD_to_meshio}
55

66
__all__ = [
77
readMZD_to_bpymesh, readMZD_to_meshio, readbgeo_to_meshio, additional_format_loader

simloader/importer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ def create_obj(fileseq, use_relaitve, transform_matrix=Matrix([[1, 0, 0, 0], [0,
146146
meshio_mesh = None
147147
enabled = True
148148
try:
149-
if fileseq.extension() in additional_file_formats.additional_format_loader:
150-
meshio_mesh = additional_file_formats.additional_format_loader[fileseq.extension()](filepath)
149+
ext = fileseq.extension().split('.')[-1]
150+
if ext in additional_file_formats.additional_format_loader:
151+
meshio_mesh = additional_file_formats.additional_format_loader[ext](filepath)
151152
else:
152153
meshio_mesh = meshio.read(filepath)
153154
except Exception as e:
@@ -224,8 +225,9 @@ def update_obj(scene, depsgraph=None):
224225
else:
225226
filepath = fs[current_frame % len(fs)]
226227
try:
227-
if fs.extension() in additional_file_formats.additional_format_loader:
228-
meshio_mesh = additional_file_formats.additional_format_loader[fs.extension()](filepath)
228+
ext = fs.extension().split('.')[-1]
229+
if ext in additional_file_formats.additional_format_loader:
230+
meshio_mesh = additional_file_formats.additional_format_loader[ext](filepath)
229231
else:
230232
meshio_mesh = meshio.read(filepath)
231233
except Exception as e:

simloader/panels.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ def filter_items(self, context, data, property):
2222

2323
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
2424
if item:
25-
layout.prop(item, "name", text='Name ', emboss=False)
25+
row = layout.row()
26+
row.prop(item, "name", text='Name ', emboss=False)
2627
if item in bpy.context.selected_objects:
27-
layout.label(text="selected")
28+
layout.label(text="Selected",icon = "CHECKMARK")
29+
else:
30+
layout.label(text="Not-Selected",icon = "X")
31+
if item.SIMLOADER.enabled:
32+
row.prop(item.SIMLOADER, "enabled", text = "ENABLED", icon="PLAY")
33+
else:
34+
row.prop(item.SIMLOADER, "enabled", text = "DISABLED", icon="PAUSE")
2835
else:
2936
# actually, I guess this line of code won't be executed?
3037
layout.label(text="", translate=False, icon_value=icon)
@@ -146,8 +153,6 @@ def draw(self, context):
146153
if obj.SIMLOADER.use_advance:
147154
col1.label(text='Script')
148155
col2.prop_search(obj.SIMLOADER, 'script_name', bpy.data, 'texts', text="")
149-
col1.label(text='Enabled')
150-
col2.prop(obj.SIMLOADER, 'enabled', text="")
151156

152157

153158
class SIMLOADER_Import(bpy.types.Panel):

0 commit comments

Comments
 (0)