bpy.ops.wm.save_as_mainfile does not work as expected on MacOS when run from script #67118
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#67118
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: MacOS
Blender Version
Blender 2.8 Candidate Release (didn't try 2.79 but I suspect the same problem)
Short description of error
On MacOS the operator
bpy.ops.wm.save_as_mainfile(copy=True, filepath=path, relative_remap=True, compress=True)
saves the current blend scene as a copy but does find external assets when run from a script however saving through the interface using "File > Save Copy... > " does work as intended (I was under the impression that the interface is just running this operator under the hood which is why I am surprised to see different results)Exact steps for others to reproduce the error
You should see a similar messages in the system console:
Info: Total files 1 | Changed 1 | Failed 0
Added subscriber: @haiku
Added subscriber: @lichtwerk
Still unsure if this is related to
BAT
or plain blender?That message you see is from
BAT
...If you dont use BAT but just run the script you posted, if you then open the file just saved through the script, are the images showing up? (so the paths are still correct?)
If this is the case, then we might have to dig in BAT instead, no?
btw., #62612 might be related... (still not sure though why these would actually report as "not existing"...)
Sorry I must have been running BAT trace after saving, however I still believe the issue is plain blender.
I just tried running the script with a variety of save locations (No BAT) and here's the result:
/var/folders/94/tdrqyvln2_bfkdxctp3ktdr40000gn/T/file_saved_through_script.blend
and when opened in blender the cube was missing it's texture (showed as pink)/var/folders/94/tdrqyvln2_bfkdxctp3ktdr40000gn/T/gm-temp-dir-6fzcf_08/file_saved_through_script.blend
(pink cube again)/tmp/file_saved_through_script.blend
(pink cube again)/Applications/file_saved_through_script.blend
This time the cube had it's texture/Users/<user name>/file_saved_through_script.blend
cube had it's texture/Users/<user name>/Desktop/file_saved_through_script.blend
cube had it's textureThe cube texture was located on the desktop so it looks to me like the paths are correctly re-mapped so long as your saving the file to a location with the same root as the texture. I'm guessing the
/Applications
folder maps to the/Users/<user name>/Applications
folder? I'm not used to MacOS so I may be wrong on that.I need to be able to save the current blender scene (that may contain relative and absolute paths) as a copy to to some arbitary location in a way that BAT will then be able to pack that copy for distribution.
Added subscriber: @Mets
Looks like this no longer needs information.
I tested it but... Blender actually just closed for me when running the script, with no message in the console. Is that... what's supposed to happen? It also does not save a file in the path I specified.
Win10 v1607, GTX 1070,
79ce2054d4
@Mets - Blender shouldn't close, how are you running the script and which line of the script is causing blender to close for you? I was just using blender's internal text editor to run it btw, I didn't try running the script as a command line argument or anything.
Welp, today it works fine... Same build, same file, same path. I don't know why it was doing that yesterday... Oh well, I guess what matters is I can't reproduce.
@Mets What OS were you using?
Windoze, mentioned in my first comment.
@Mets Ah I see, I only get the bug on Mac so that makes sense.
Added subscriber: @robbott
I cannot reproduce this on OSX 10.14.6 . Are you still able to reproduce this on the latest version ?
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 560X OpenGL Engine ATI Technologies Inc. 4.1 ATI-2.11.20
2.90 (sub 0), branch: master, commit date: 2020-05-09 15:17, hash:
633fee72d5
Added subscriber: @mont29
Changed status from 'Needs Developer To Reproduce' to: 'Resolved'
Cannot reproduce that with current blender either (on linux), so for now will consider it fixed, feel free to reopen if you can still reproduce.