I have some code which requires opening and closing blend files. The code has to save a temporary copy of the open file before opening other files and doing stuff to them. After the code is finished it reloads the temporary save of the original file.
The problem is, if the user goes to save their file (after the code has been carried out) it will save to the temporary location, of course they could change the save location manually but that would insert an unnecessary amount of entropy into this process.
I could also simply save the open file before the code was run, but I would like to avoid forcing that on the user. All that's holding me back is not being able to change the file's internal save location after all is finished.
If I could write to bpy.data.filepath
(rather than only read it) problem would be solved. Anyone know of a way to set this value without actually saving the file with: bpy.ops.wm.save_as_mainfile()
?
As it stands I've developed a complicated method of working around this, but involves renaming and copying files. If I have to use it I will but hoping someone might know a slimmer solution here.
Also I'm aware there is a similar thread "Clear saved filepath" but I was hoping to explore this further. I just want to know is there something I'm missing with setting the blend file's save path.
EXPLANATION OF HOW IT'S DIFFERENT FROM "CLEAR SAVED FILEPATH": Let's see, that thread doesn't solve the problem. The end.