IO: Option to import each 3DS file on a new collection #105232
@ -1781,7 +1781,7 @@ def load(operator, context, files=None, directory="", filepath="", constrain_siz
|
|||||||
# Load each selected file
|
# Load each selected file
|
||||||
for file in files:
|
for file in files:
|
||||||
# Create new collections if activated (collection name = 3ds file name)
|
# Create new collections if activated (collection name = 3ds file name)
|
||||||
NRGSille marked this conversation as resolved
|
|||||||
if new_collection:
|
if use_collection:
|
||||||
RobLop marked this conversation as resolved
Outdated
Sebastian Sille
commented
Looks better if we- use it without suffix. Can be achieved with Looks better if we- use it without suffix. Can be achieved with `file.name.split(".")[0]`
RobLop
commented
Ok, achieved with Path().stem (modern way). Ok, achieved with Path().stem (modern way).
|
|||||||
collection = bpy.data.collections.new(Path(file.name).stem)
|
collection = bpy.data.collections.new(Path(file.name).stem)
|
||||||
bpy.context.scene.collection.children.link(collection)
|
bpy.context.scene.collection.children.link(collection)
|
||||||
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[collection.name]
|
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[collection.name]
|
||||||
RobLop marked this conversation as resolved
Outdated
Sebastian Sille
commented
Here is a little error, it must be Here is a little error, it must be `os.path.join(directory, file.name)`
RobLop
commented
Ok, corrected with the Path(). Ok, corrected with the Path().
|
|||||||
|
Loading…
Reference in New Issue
Block a user
found a little error in line 1784 (below) must be replaced with
if use_collection:
Yes, I forgot this fix.