IO: Option to import each 3DS file on a new collection #105232
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#105232
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch ":roblop-patch-new-collection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Following my initial commit (#105227), I suggest a enhancement to have an option to include each 3DS file on a new collection (the name of the collection = name of 3DS file).
Importing a 3DS file can result in a lot of objects and it's a mess in the outliner and this commit solve this issue.
@ -107,6 +107,12 @@ class Import3DS(bpy.types.Operator, ImportHelper):
description="Read the 3D cursor location",
default=False,
)
new_collection: BoolProperty(
In style guide we have all boolean options to begin with "use", therefore this boolean has to be "use_collection"
@ -108,2 +108,4 @@
default=False,
)
new_collection: BoolProperty(
name="New collection",
This looks better if we simply call it "Collection"
@ -109,1 +109,4 @@
)
new_collection: BoolProperty(
name="New collection",
description="Include on a new collection",
Would rename this to "Create a new collection"
@ -110,0 +110,4 @@
new_collection: BoolProperty(
name="New collection",
description="Include on a new collection",
default=True,
Default should be False to make it optional by default
I think it's better to make it True by default otherwise it create a mess on the active collection after the importation of multiple 3DS files.
It depends on what the user wants, it may be useful for multiple files but the common use of all importers is to add a model to the current collection, thats why I think it should be false by default to match with the other IO scripts
@ -168,6 +174,9 @@ class MAX3DS_PT_import_include(bpy.types.Panel):
layrow = layout.row(align=True)
layrow.prop(operator, "use_cursor")
layrow.label(text="", icon='PIVOT_CURSOR' if operator.use_cursor else 'CURSOR')
layrow = layout.row(align=True)
This looks better if we move it up before "use_cursor" (so it looks more the same like the exporter)
@ -169,2 +175,4 @@
layrow.prop(operator, "use_cursor")
layrow.label(text="", icon='PIVOT_CURSOR' if operator.use_cursor else 'CURSOR')
layrow = layout.row(align=True)
layrow.prop(operator, "new_collection")
call it "use_collection" to match with style guide
@ -1773,3 +1773,3 @@
def load(operator, context, files=None, directory="", filepath="", constrain_size=0.0, use_scene_unit=False,
use_image_search=True, object_filter=None, use_world_matrix=False, use_keyframes=True,
use_apply_transform=True, global_matrix=None, use_cursor=False, use_center_pivot=False):
use_apply_transform=True, global_matrix=None, use_cursor=False, use_center_pivot=False, new_collection=True):
Set default to False
@ -1778,0 +1781,4 @@
for file in files:
# Create new collections if activated (collection name = 3ds file name)
if new_collection:
collection = bpy.data.collections.new(file.name)
Looks better if we- use it without suffix. Can be achieved with
file.name.split(".")[0]
Ok, achieved with Path().stem (modern way).
@ -1778,1 +1784,4 @@
collection = bpy.data.collections.new(file.name)
bpy.context.scene.collection.children.link(collection)
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[collection.name]
load_3ds(os.path.join(directory, f.name), context, CONSTRAIN=constrain_size, UNITS=use_scene_unit,
Here is a little error, it must be
os.path.join(directory, file.name)
Ok, corrected with the Path().
@ -167,2 +173,4 @@
layrow.label(text="", icon='ANIM' if operator.use_keyframes else 'DECORATE_DRIVER')
layrow = layout.row(align=True)
layrow.prop(operator, "use_collection")
layrow.label(text="", icon='OUTLINER_COLLECTION' if operator.new_collection else 'COLLECTION_NEW')
one last fix to make, replace this with:
layrow.label(text="", icon='OUTLINER_COLLECTION' if operator.use_collection else 'GROUP')
the GROUP icon looks better because it is the inverse of the collection icon ;)
@ -1779,0 +1780,4 @@
# Load each selected file
for file in files:
# Create new collections if activated (collection name = 3ds file name)
found a little error in line 1784 (below) must be replaced with
if use_collection:
Yes, I forgot this fix.
@RobLop Thanks for this contribution, we can merge this.
I will also add this to the manual and realease notes^^