https://gist.github.com/p2or/af5bc4fae39b16f8d505
This tool work very fine but exist a tool that import also multiple objs in separate collections, each for every single file?
Thanks.
https://gist.github.com/p2or/af5bc4fae39b16f8d505
This tool work very fine but exist a tool that import also multiple objs in separate collections, each for every single file?
Thanks.
Download the add-on for Blender 2.92+ from How to batch import Wavefront OBJ files? and replace its execute method (starting at line 160) by the following lines of code:
def execute(self, context):
# get the folder
folder = (os.path.dirname(self.filepath))
# get the collection
main_coll = context.scene.collection
# iterate through the selected files
for i in self.files:
# create collection based on filename
coll = bpy.data.collections.new(i.name.rsplit(".", 1)[0])
main_coll.children.link(coll)
layer_coll = context.view_layer.layer_collection.children.get(coll.name)
context.view_layer.active_layer_collection = layer_coll
# generate full path to file
path_to_file = os.path.join(folder, i.name)
# call obj operator and assign ui values
bpy.ops.import_scene.obj(
filepath = path_to_file,
axis_forward = self.axis_forward_setting,
axis_up = self.axis_up_setting,
use_edges = self.edges_setting,
use_smooth_groups = self.smooth_groups_setting,
use_split_objects = self.split_objects_setting,
use_split_groups = self.split_groups_setting,
use_groups_as_vgroups = self.groups_as_vgroups_setting,
use_image_search = self.image_search_setting,
split_mode = self.split_mode_setting,
global_clamp_size = self.clamp_size_setting)
return {'FINISHED'}
Result (one collection per file):