Filepath template proposal

Hi,

I would like to try to implement a template system for the filepath where the render is saved after a render.

I think it is not a big task, let me know if I am wrong, and here is my simple idea :

  • Being able to put token like “[scene]” or “[camera]” and when the file is saved, it just replaces the tokens with the right name
  • With a right click on the textfield, see the tokens that are available to the user, and insert the token by clicking on it in the right click drop down menu.

Would that be ok ?

Cheers !

10 Likes

I think this is a great idea, this type of system is always very useful in any software I’ve seen it used. Houdini calls these “filename expressions” because over the years it has evolved into its own miniature expression language. Perhaps there are some things there that can inspire you. One of the cool things you can do with it in Houdini is to access specific data for a given scene- the ‘unparsed’ filename is stored with the file itself, so you can bake out a simulation cache with a tokenized filename, then save a copy of the scene with a different filename and don’t have to worry about your previous cache being overwritten (or go through the work of updating all of your file references and things of that nature).

The shorter the tokens are, the better in my opinion. Houdini uses $X (where X is a single letter representing that particular token), I’ve seen other software use %X or @X, etc.

2 Likes

this could even be a (or part of) GSoC project :thinking:

It’s not the right place for general feature requests but CSoC projects will be discussed in Blender Development, soon

2 Likes

I like the idea! it might be a good idea to post it on right click select (if you haven’t already) with a mockup image, and see if there is some good user feedback to consider. I like scene and camera as options though!

1 Like

I don’t think OP is requesting a feature- I believe he is signaling his intent to develop said feature.

2 Likes

Thanks for your feedback, yes I would like to try to develop it.

I have seen how Houdini handles this kind of things, and it is really powerfull, but I would like to start with a much simpler approch (and maybe go further if it goes well).

For the GSoC, I prefer to let real developpers with bigger project to have it, I am just a hobbyist :slight_smile:

3 Likes

:heart_eyes: sounds great, welcome @thornydre would you like to develop an add-on or direct for Blender?

You’ll find more information right here:
https://wiki.blender.org/wiki/Main_Page

https://wiki.blender.org/wiki/Developer_Intro

1 Like

Actually I hadn’t thought about an addon, but I would like to try to develop it directly in Blender’s code, and if I cannot manage to do it I might switch to an addon as I am a lot more familiar with Python scripting.

Thaks a lot for the links :smiley: I’ll have a look :slight_smile:

1 Like

this would make more sense to be directly in Blender. If you need more help building blender don’t forget to join #blender-coders channel on blender.chat.

1 Like

Hey,

I tried a first step with the Blender code, in the file “image.c”, I added this line to the function “do_makepicstring” :
string = BLI_str_replaceN(string, "[camera]", "toto");

When I print the string inside this functions I get the correct result (the path with “[camera]” replaced by “toto”), but when the file is saved in “COM_OutputFileOperation.cpp”, it still prints out the path without the change. Am I missing something here ?

Thanks !

1 Like

What is wrong with the output node in the compositor? You can set any file name variations there and save different image versions and dozen combinations. However, I like your idea.

1 Like

OP’s proposal could, if implemented, be easily extended to work with any filesystem access, which means you could potentially use it to save and load files, etc.

2 Likes

Funny enough I already posted a very similar proposal at rightclickselect a few weeks ago:

6 Likes

If it were me doing these same experiments I think I would start by playing around with BLI_filename_make_safe() and BLI_path_make_safe() in blender\source\blender\blenlib\intern\path_util.c as those two are called fairly reliably all over.

Making your changes there would have the benefit of being able to use an otherwise “invalid” character as a delimiter and so would never be something used in a real path, like “greater than” and “less than” characters (or ?:|*). And I’d consider testure’s advice about using short tokens as it’s best not to hardcode English for something like that in a multilingual program.

1 Like

Hello everyone! Is there any progress with this feature?
I’ve been looking everywhere for some info about it and found out that Blender can’t do that rn.

I’ve created a proposal, as I can see there was similar before.

Idk maybe people don’t understand the importance of this, but it’s really a must have feature. You might have 20+ iterations of the same project and it’s a pain to manually rename your outputs everytime, especially when you have to rename it in the compositors file output node. Also this feature would allow to bypass the compositor by just having something like that in output “//render/$prj/$pass/$pass” - which will result you having all your passes in a separate folder.

Thanks

3 Likes

Oh yeah, i feel your pain!
I am working on a project where i have to output around 20 separate passes as exr files from the compositor. With every iteration on the shot i have to spend a few minutes monkey renaming my filepathes.
Output variable tokens would have been a great GSOC project, no?

3 Likes

I haven’t really worked more on that, I am really really new in developing for Blender, but your messages give me some motivation to keep working on it, so I’ll try to push this one as far as I can, hopefully I will succeed in making something that works, at least a proof of concept :slight_smile:
Cheers !

6 Likes

Really nice to hear that!

Hey,

I tried to put my code inside BLI_filename_make_safe() but it does seems to be called during the render path process, so I tried to add it, but it doesn’t seem to work, do you have any idea why ?

Thanks a lot for your help :slight_smile:

Cheers !

Well actually when I try to modify the COM_OutputFileOperation.cpp file, it doesn’t seem to be considered when I build again, do I have to do something special to make it work ?