FBX: Enable the Collection exporter feature #105273
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#105273
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "deadpin/blender-addons:fbx-collectionexport"
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?
This enables FBX to be used as a Collection exporter[0].
To enable this, two changes were made:
export_scene.fbx
operator was configured on the File Handlercollection
property was added to the export OperatorThis
collection
property is akin to the specialfilepath
anddirectory
properties in that this is how Blender will communicate withthe addon.
Because FBX already has a
use_active_collection
property, a smalllayout change is included to not draw this property when used as a
Collection exporter as that would introduce confusion. It also makes
sense to only draw
use_selection
anduse_visible
while in the filebrowser in the same way. Feedback was received about this during
development and indeed these toggles will be skipped during processing
anyhow.
An additional discussion point to consider is if we want this new
collection
property drawn when usingFile
->Export
to allow theuser to control which exact collection to export as opposed to just the
"Active Collection". This isn't included in the patch currently.
[0] To test, go to
Collection Properties
->Exporters
->Add
andselect FBX after applying this patch.
FBX: Enable the Collection export featureto FBX: Enable the Collection exporter feature@ -3614,0 +3613,4 @@
source_collection = context.view_layer.active_layer_collection.collection
elif collection:
if collection in bpy.data.collections:
source_collection = bpy.data.collections[collection]
Might want to consider whether performing a Collection export from a Collection linked from another file should be supported because a linked Collection can have the same name as a Collection local to the current file (or presumably another Collection linked from another different file).
Currently, exporting from a linked Collection appears to work, but doesn't seem too useful because the Collection's children, export settings and export file path cannot be changed due to being linked from another file.
I don't know if there is a guarantee that
bpy.data.collections[collection]
will always return a Collection from the current file in preference to a linked Collection with the same name, but it seems like that might be the case from a quick test using the Python Console. So, exporting from a linked Collection with the same name as a local Collection would export the local Collection instead.If exporting from a linked Collection should not be supported,
bpy.data.collections[(collection, None)]
can be used to only get a Collection local to the current file.Otherwise, to get specific Collections, which could have the same name, linked from different libraries would require
bpy.data.collections[(collection, library_filepath)]
wherelibrary_filepath
is the value ofmy_collection.library.filepath
orNone
(whenmy_collection.library is None
due to the Collection being local to the current file).I don't know enough about how library linked data-blocks are used and supported by different parts of Blender to say if any changes are needed here.
Hmm, how did you arrive in this state? If you link in a Collection from foo.blend which has an exporter set you shouldn't see anything in the UI as it's not intended to be exportable in the current file. Are you seeing otherwise?
I'll make the change to use the
None
argument to make it more explicit.Other than a note about library linked Collections where I don't know if changes are needed, looks good to me.
I was initially concerned that exporting as .fbx through File>Export>FBX with the Active Collection option enabled might then result in subsequent Collection exports using the same Active Collection value, however that does not appear to be the case, so all good there.
(Replying here because I can't upload images in review comments)
Disable
Instance Collections
when linking so that the Collection is linked directly instead of as an instance.Ok, I see, thanks for that explanation. It's the same when using lib overrides and making the instance local as well. I'll have to follow up on this a bit in general. It's actually mentioned in blender/blender#115690 as part of future design work, but until now I didn't know the set of steps to hit what Brecht was hinting at.
As far as these changes to FBX goes. How are you feeling about them? Are they ok to commit?
One change requested upon having another look through.
Everything else looks good to me.
@ -560,1 +565,4 @@
# Are we inside the File browser
is_file_browser = context.space_data.type == 'FILE_BROWSER'
export_main(layout, self)
The
batch_mode
anduse_batch_own_dir
properties drawn inexport_main()
should also only be drawn whenis_file_browser
because the new code inexport_fbx_bin.py
is only run whenbatch_mode == 'OFF'
(the default value).Changing the
batch_mode
to anything else I don't think makes sense for a Collection exporter.