@@ -189,26 +189,26 @@ def create_meshio_obj(filepath):
189
189
"Meshio Loading Error" + str (e ),
190
190
icon = "ERROR" )
191
191
192
- # Do I need this for multi-loading?
193
- if filepath .endswith (".obj" ):
194
- # Save all current objects
195
- objs = set (bpy .context .scene .objects )
196
- # Reload the object
197
- bpy .ops .import_scene .obj (filepath = filepath )
198
- # Substract all previous items from the current items and print their names
199
- imported_objs = set (bpy .context .scene .objects ) - objs
200
-
201
- # Check if the imported object worked correctly
202
- if len (imported_objs ) == 1 :
203
- obj = imported_objs .pop ()
204
- else :
205
- show_message_box ("Error when reading: " + filepath + ",\n " + traceback .format_exc (),
206
- "obj. Loading Error in create_meshio_obj" ,
207
- icon = "ERROR" )
208
- return
192
+ # if filepath.endswith(".obj"):
193
+ # # Save all current objects
194
+ # objs = set(bpy.context.scene.objects)
195
+ # # Reload the object
196
+ # bpy.ops.import_scene.obj(filepath=filepath)
197
+ # # Substract all previous items from the current items and print their names
198
+ # imported_objs = set(bpy.context.scene.objects) - objs
199
+
200
+ # # Check if the imported object worked correctly
201
+ # if len(imported_objs) == 1:
202
+ # obj = imported_objs.pop()
203
+ # else:
204
+ # show_message_box("Error when reading: " + filepath + ",\n" + traceback.format_exc(),
205
+ # "obj. Loading Error in create_meshio_obj",
206
+ # icon="ERROR")
207
+ # return
209
208
210
- obj .name = os .path .basename (filepath )
211
- return
209
+ # obj.name = os.path.basename(filepath)
210
+ # return
211
+
212
212
# create the object
213
213
name = os .path .basename (filepath )
214
214
mesh = bpy .data .meshes .new (name )
@@ -225,50 +225,50 @@ def create_obj(fileseq, root_path, transform_matrix=Matrix([[1, 0, 0, 0], [0, 1,
225
225
filepath = fileseq [current_frame % len (fileseq )]
226
226
227
227
#.obj sequences have to be handled differently
228
- is_obj_seq = filepath .endswith (".obj" )
229
- if is_obj_seq and bpy .context .scene .BSEQ .use_blender_obj_import :
230
-
231
- # Save all current objects
232
- objs = set (bpy .context .scene .objects )
233
- # Reload the object
234
- bpy .ops .import_scene .obj (filepath = filepath )
235
- # Substract all previous items from the current items and print their names
236
- imported_objs = set (bpy .context .scene .objects ) - objs
237
-
238
- # Check if the imported object worked correctly
239
- if len (imported_objs ) == 1 :
240
- tmp_obj = imported_objs .pop ()
241
- else :
242
- show_message_box ("Error when reading: " + filepath + ",\n " + traceback .format_exc (),
243
- "obj. Loading Error in create_obj" ,
244
- icon = "ERROR" )
245
- return
246
-
247
- name = fileseq .basename () + "@" + fileseq .extension ()
248
-
249
- # Create object with empty mesh
250
- object = bpy .data .objects .new (name , bpy .data .meshes .new (name ))
251
- object .data = tmp_obj .data
228
+ # is_obj_seq = filepath.endswith(".obj")
229
+ # if is_obj_seq and bpy.context.scene.BSEQ.use_blender_obj_import:
230
+
231
+ # # Save all current objects
232
+ # objs = set(bpy.context.scene.objects)
233
+ # # Reload the object
234
+ # bpy.ops.import_scene.obj(filepath=filepath)
235
+ # # Substract all previous items from the current items and print their names
236
+ # imported_objs = set(bpy.context.scene.objects) - objs
237
+
238
+ # # Check if the imported object worked correctly
239
+ # if len(imported_objs) == 1:
240
+ # tmp_obj = imported_objs.pop()
241
+ # else:
242
+ # show_message_box("Error when reading: " + filepath + ",\n" + traceback.format_exc(),
243
+ # "obj. Loading Error in create_obj",
244
+ # icon="ERROR")
245
+ # return
246
+
247
+ # name = fileseq.basename() + "@" + fileseq.extension()
248
+
249
+ # # Create object with empty mesh
250
+ # object = bpy.data.objects.new(name, bpy.data.meshes.new(name))
251
+ # object.data = tmp_obj.data
252
252
253
- # Delete tmp_obj with data
254
- bpy .data .objects .remove (tmp_obj , do_unlink = True )
253
+ # # Delete tmp_obj with data
254
+ # bpy.data.objects.remove(tmp_obj, do_unlink=True)
255
255
256
- enabled = True
256
+ # enabled = True
257
257
258
- else :
259
- meshio_mesh = None
260
- enabled = True
261
- try :
262
- meshio_mesh = meshio .read (filepath )
263
- except Exception as e :
264
- show_message_box ("Error when reading: " + filepath + ",\n " + traceback .format_exc (),
265
- "Meshio Loading Error" + str (e ),
266
- icon = "ERROR" )
267
- enabled = False
268
-
269
- name = fileseq .basename () + "@" + fileseq .extension ()
270
- mesh = bpy .data .meshes .new (name )
271
- object = bpy .data .objects .new (name , mesh )
258
+ # else:
259
+ meshio_mesh = None
260
+ enabled = True
261
+ try :
262
+ meshio_mesh = meshio .read (filepath )
263
+ except Exception as e :
264
+ show_message_box ("Error when reading: " + filepath + ",\n " + traceback .format_exc (),
265
+ "Meshio Loading Error" + str (e ),
266
+ icon = "ERROR" )
267
+ enabled = False
268
+
269
+ name = fileseq .basename () + "@" + fileseq .extension ()
270
+ mesh = bpy .data .meshes .new (name )
271
+ object = bpy .data .objects .new (name , mesh )
272
272
273
273
# create the object
274
274
if bpy .path .is_subdir (filepath , bpy .path .abspath ("//" )):
@@ -321,48 +321,48 @@ def update_obj(scene, depsgraph=None):
321
321
pattern = bpy .path .native_pathsep (pattern )
322
322
fs = fileseq .FileSequence (pattern )
323
323
324
- if pattern .endswith (".obj" ) and scene .BSEQ .use_blender_obj_import :
325
- filepath = fs [current_frame % len (fs )]
324
+ # if pattern.endswith(".obj") and scene.BSEQ.use_blender_obj_import:
325
+ # filepath = fs[current_frame % len(fs)]
326
326
327
- # Save all current objects
328
- objs = set (scene .objects )
327
+ # # Save all current objects
328
+ # objs = set(scene.objects)
329
329
330
- # Reload the object
331
- bpy .ops .import_scene .obj (filepath = filepath )
330
+ # # Reload the object
331
+ # bpy.ops.import_scene.obj(filepath=filepath)
332
332
333
- # Substract all previous items from the current items and print their names
334
- imported_objs = set (scene .objects ) - objs
333
+ # # Substract all previous items from the current items and print their names
334
+ # imported_objs = set(scene.objects) - objs
335
335
336
- # Check if the imported object worked correctly
337
- if len (imported_objs ) == 1 :
338
- new_tmp_obj = imported_objs .pop ()
339
- else :
340
- show_message_box ("Error when reading: " + filepath + ",\n " + traceback .format_exc (),
341
- "obj. Loading Error in update_obj" ,
342
- icon = "ERROR" )
343
- continue
336
+ # # Check if the imported object worked correctly
337
+ # if len(imported_objs) == 1:
338
+ # new_tmp_obj = imported_objs.pop()
339
+ # else:
340
+ # show_message_box("Error when reading: " + filepath + ",\n" + traceback.format_exc(),
341
+ # "obj. Loading Error in update_obj",
342
+ # icon="ERROR")
343
+ # continue
344
344
345
- # Copy the data except for material
346
- if obj .data .materials :
347
- # assign to 1st material slot
348
- new_tmp_obj .data .materials [0 ] = obj .data .materials [0 ]
349
- else :
350
- # no slots
351
- new_tmp_obj .data .materials .append (obj .data .materials [0 ])
345
+ # # Copy the data except for material
346
+ # if obj.data.materials:
347
+ # # assign to 1st material slot
348
+ # new_tmp_obj.data.materials[0] = obj.data.materials[0]
349
+ # else:
350
+ # # no slots
351
+ # new_tmp_obj.data.materials.append(obj.data.materials[0])
352
352
353
- obj .data = new_tmp_obj .data
353
+ # obj.data = new_tmp_obj.data
354
354
355
- # Delete the temporary object with the data
356
- bpy .data .objects .remove (new_tmp_obj , do_unlink = True )
355
+ # # Delete the temporary object with the data
356
+ # bpy.data.objects.remove(new_tmp_obj, do_unlink=True)
357
357
358
- # purge old meshes
359
- bpy .ops .outliner .orphans_purge (do_recursive = True )
358
+ # # purge old meshes
359
+ # bpy.ops.outliner.orphans_purge(do_recursive=True)
360
360
361
- apply_transformation (meshio_mesh , obj , depsgraph )
361
+ # apply_transformation(meshio_mesh, obj, depsgraph)
362
362
363
- end_time = time .perf_counter ()
364
- obj .BSEQ .last_benchmark = (end_time - start_time ) * 1000
365
- continue
363
+ # end_time = time.perf_counter()
364
+ # obj.BSEQ.last_benchmark = (end_time - start_time) * 1000
365
+ # continue
366
366
367
367
if obj .BSEQ .use_advance and obj .BSEQ .script_name :
368
368
script = bpy .data .texts [obj .BSEQ .script_name ]
0 commit comments