If I open Blender's file browser (in my particular case, it would be the one invoked by "Save image" in the Blender render window, "Image" menu), the filename text field will contain a value that, on the first time, is "untitled" by default.
If I save with another name, the next time that window is invoked, it will contain the last name I used.
So, I assume, Blender stores that value somewhere, even when that specific file browser is not open.
Would it be possible to read that value using python, possibly without having to invoke the file browser?
If so, would it be possible to change that value from script?
Thanks!
$\begingroup$
$\endgroup$
7
-
$\begingroup$ This doesn't address your questions, so FWIW: If the OS is Windows, the value is stored in recent-files.txt in: Users\Username\AppData\Roaming\Blender Foundation\Blender\"Blender version number"\config, but you can't change the filename here. If using another OS there are possibly differences in the file path or folder names. But, if all you want to do is rename the last saved file, in the File Open dialog either right click on the file and select Rename from the menu that will open, or select the file and press F2 and change the filename. Continued... $\endgroup$– curious_1Commented Apr 1 at 0:52
-
$\begingroup$ If you then want to open the renamed file, either double click the renamed file, or select the file and click the Open button. $\endgroup$– curious_1Commented Apr 1 at 0:53
-
$\begingroup$ Thanks, that applies to the .blend files, but what I'm trying to do is reading a value that, I believe, is stored within a blender session. It's the default file name that fills the text field when you want to save a rendering (alt S hotkey from the image editor). It's "untitled" if you haven't saved a rendering yet, otherwise it's the last saved rendering's name. And no, I'm not asking how to rename a file: my scope is to read that parameter's text value and, possibly, re-write it, but within Blender's Python. Thanks! $\endgroup$– EtordCommented Apr 1 at 9:34
-
1$\begingroup$ I don't know how much it will help in this case, but if you are going to do much with Blender Python it is helpful: in Edit->Preferences->Interface, in the Display section turn on Python Tooltips. In the image you added to your question, when you hover over the filename it will show the associated Python code below the filename tooltip. You might then possibly find something usable in the Blender Python API. $\endgroup$– curious_1Commented Apr 1 at 11:18
-
1$\begingroup$ That's actually a good idea: the area is associated with bpy.data.screens["temp.001"].params.filename. I already got the same info by copying the absolute data path but, unfortunately, I found no way to access that value. Thanks for your help, once again! $\endgroup$– EtordCommented Apr 3 at 15:36
|
Show 2 more comments