← All ideas
  • Published 6 Nov 2024

Ensure Absolute Paths on read_homefile()

So, i'm developing Custom Templates add-on.

Now, when opening a "template" (wm.read_homefile), we know for sure that relative paths for external resources will not work anymore (since there isn't any path for the project yet).

At the same time, users might have templates using external resources, and those paths might be relative.
I'm working to automate the process of make all of them absolute at file-level, but i was thinking that this operator, could do the work for me, and it would make much more sense.


Proposal

Update bpy.ops.wm.read_homefile , adding a new parameter like "ensure_absolute_paths" (or whatever naming you like).
When passing it true, the operator could use the original filepath to transform, on-the-run, all the paths of this project, from relative to absolute, without having to actually change anything in the original .blend file.

This is because we know for sure that external resources with relative paths will not work on a, just-opened, template/homefile.

Having this done directly on the data, when opening, instead of having to actually update the template files, would be really cool for the use case of my add-on.

Basically i'd like the operator to be able to run some kind of Make Paths Absolute but faking the "current project path" behind the scenes using the filepath of the read_homefile.

Makes sense, right?

0%

Development Status: Open

Upvote 0 Downvote 0
Francesco-Bellini
6 Nov 2024

0 Comments