relative_remap in bpy.data.libraries.write() no longer working #77768
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
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#77768
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: Linux-4.15.0-101-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21
Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash:
211b6c29f7
Worked: 2.82a
Short description of error
I have a blend file with an object and material using an image texture
//textures/color.png
.I have a script, that moves the image from its initial location to a target location. The script then updates the img.filepath according to the new location, and finally saves the scene(object, material and image) to that same location.
This is done using
bpy.data.libraries.write()
. So, I end up with a blend file and thecolor.png
in the same target location.I'm passing
relative_remap=True
towrite()
, and so expect the image texture path to be//color.png
in the saved blend file.This worked perfectly in the past, even before 2.80.
As of 2.83 it no longer works and the blend is stored with an absolute image path, despite relative_remap being True.
relative_remap.zip
Exact steps for others to reproduce the error
relative_remap.blend
in Blender 2.83//color.png
Added subscriber: @MACHIN3
Added subscriber: @ostapblender
Yeah, I see the same
Added subscriber: @bigbadcat3d
Confirming
Added subscriber: @Carlosan
+1
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Confirmed'
Confirmed, checking...
Added subscriber: @ManuH
+1
Caused by
f7386b9757
So (if I read #62612 (Saving with "Remap Relative" makes ALL paths relative) correctly) this is now intended behavior.
Afaict, only relative paths now get remapped, absolute paths stay untouched.
Thanks for the info!
Changed status from 'Confirmed' to: 'Archived'
So, since this was a conscious decision in
f7386b9757
and I assume there are ways to adapt your scripts, I think we need to close this?(feel free though to comment again if issues persist)
It's a bit cumbersome to first collect all images in the scene that is to be saved, then change the paths, then save out the scene, then change the paths back to what they were before (absolute).
So I really liked the way it worked before and wish there was an option that would restore that behavior. It was a lot simpler and just worked.
Added subscribers: @ideasman42, @dr.sybren
@ideasman42, @dr.sybren ^^
@MACHIN3 : not sure if
bpy.ops.file.make_paths_relative
/bpy.ops.file.make_paths_absolute
help in your workflow?Thing is I only export some images in the file, theses ops would make all paths relative/absolute, which is overkill, as I can easily have hundreds of images, but save out only a handful.
Added subscriber: @dfelinto
@ideasman42 just wondering if
f7386b9757
was really the way to go. Because it changed the behaviour that dated back to 2.5 (alpha2) I believe. I'm yet to dig the original commit, but maybe we should just accept that the implemented behaviour was the expected, even though the tooltip never really reflected that.@dfelinto think we could make it an option to make all paths relative, or only make relative paths relative - since it seems both as useful.
I'm not so keen on adding back old behavior by default since it means you can't use absolute paths.
Changed status from 'Archived' to: 'Resolved'
This usage from Python makes sense to support.
You can now use:
bpy.data.libraries.write(path, datablocks, path_remap='RELATIVE_ALL')
for previous behavior, other options areABSOLUTE/RELATIVE/NONE
Fantastic, thank you so much!