Fix #104576: FBX export of Edit Mode Objects while Blender is not in Edit Mode can fail. #104633
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#104633
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender-addons:fix_inactive_edit_mode_objects_pr"
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?
All Objects to be exported are now checked for not being in Edit Mode
prior to exporting.
In the rare case that an Object is found to be in Edit Mode, it is
temporarily added to the current view layer, temporarily set as active
and then set to Object Mode.
If an Object cannot be set to Object mode for some reason, an error is
reported to the Operator and exporting is aborted.
db02c47f63
toe50f57e105
Code LGTM, besides minor point noted below.
@ -3497,0 +3500,4 @@
for obj in tuple(ctx_objects):
if not ensure_object_not_in_edit_mode(context, obj):
operator.report({'ERROR'}, "%s could not be set out of Edit Mode, so cannot be exported" % obj.name)
return ret
Should rather return
{'CANCELLED'}
(same below), since nothing happened.I chose returning
{'FINISHED'}
because if the Operator is run from Edit mode, the current mode is changed to Object mode (it would normally be changed back to the original mode at the end of the operator though this does not guarantee the same state as when starting). Similarly,ensure_object_not_in_edit_mode
may have changed the mode of other Objects before finding an Object which could not be set out of Edit mode.Even if I were to keep track of all Objects whose mode was changed, there's no guarantee that their original modes can be restored. Notably, Objects whose
hide_viewport
is True can exit Edit mode, but cannot enter it.Another case is where multiple Objects are in multi-editing Edit mode at the start of the Operator. Changing to Object mode will affect all Objects in multi-editing regardless of their selection state, but changing back to Edit mode afterwards will only open selected Objects into Edit mode.
Returning
{'FINISHED'}
pushes an undo step so that the state from before the operator was called can be returned to easily.If the potential changes to the modes of Objects are not considered important then I would agree with returning
{'CANCELLED'}
.Yes, I think mode changes are not enough to justify a
FINISHED
return here.The current situation is not fully ideal, but not very common either imho. If we wanted to be strict and bullet-proofed, I would just forbid export when any exported object is in Edit mode, but think it's more user-friendly to try to switch back to Object mode as much as we can. And accept that in some very rare, weird cases we will fail to do so and user will have to fix their scene manually before exporting.
Also, I think this should be rebased against 3.6.
e50f57e105
to8fff063ff7
Fix #104576: FBX export of Edit Mode Objects while Blender is not in Edit Mode can fail.to Fix #104576: FBX export of Edit Mode Objects while Blender is not in Edit Mode can fail.Rebased on 3.6 and set that as the new target branch, and changed those two returns to
{'CANCELLED'}
.