Skip to content

Commit 43071ac

Browse files
committed
Update (not working atm)
1 parent 3c83537 commit 43071ac

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

bseq/importer.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def create_meshio_obj(filepath):
181181
"Meshio Loading Error" + str(e),
182182
icon="ERROR")
183183

184+
# Do I need this for multi-loading?
184185
if filepath.endswith(".obj"):
185186
bpy.ops.import_scene.obj(filepath=filepath)
186187
obj = bpy.context.selected_objects[0]
@@ -201,24 +202,27 @@ def create_obj(fileseq, use_relative, root_path, transform_matrix=Matrix([[1, 0,
201202
current_frame = bpy.context.scene.frame_current
202203
filepath = fileseq[current_frame % len(fileseq)]
203204

204-
if fileseq.extension() == '.obj':
205-
create_meshio_obj(filepath)
206-
return
207-
208-
meshio_mesh = None
209-
enabled = True
210-
try:
211-
meshio_mesh = meshio.read(filepath)
212-
except Exception as e:
213-
show_message_box("Error when reading: " + filepath + ",\n" + traceback.format_exc(),
214-
"Meshio Loading Error" + str(e),
215-
icon="ERROR")
205+
if filepath.endswith(".obj"):
206+
bpy.ops.import_scene.obj(filepath=filepath)
207+
object = bpy.context.selected_objects[-1]
208+
object.name = fileseq.basename() + "@" + fileseq.extension()
216209
enabled = False
210+
else:
211+
meshio_mesh = None
212+
enabled = True
213+
try:
214+
meshio_mesh = meshio.read(filepath)
215+
except Exception as e:
216+
show_message_box("Error when reading: " + filepath + ",\n" + traceback.format_exc(),
217+
"Meshio Loading Error" + str(e),
218+
icon="ERROR")
219+
enabled = False
220+
221+
name = fileseq.basename() + "@" + fileseq.extension()
222+
mesh = bpy.data.meshes.new(name)
223+
object = bpy.data.objects.new(name, mesh)
217224

218225
# create the object
219-
name = fileseq.basename() + "@" + fileseq.extension()
220-
mesh = bpy.data.meshes.new(name)
221-
object = bpy.data.objects.new(name, mesh)
222226
object.BSEQ.use_relative = use_relative
223227
if use_relative:
224228
if root_path != "":

0 commit comments

Comments
 (0)