← All ideas
  • Published 11 Feb 2020

Global Variables (e.g. for File Names)

What I miss greatly in Blender are "global variables" (as they're called in Houdini) to make my everyday life much easier, especially when it comes to keeping file names of render pictures etc. up-to-date without having to manually update the file names over and over again which can be quite error-prone.

This chapter of Houdini's documentation says it all I guess.

In short, it would be awesome if instead of specifying the output file names (of rendered images, caches, movies etc.) by hand, one could just use global variables like $BLENDNAME (= the blend file's name) or $F (= the current frame) to automatically control and update all filenames in your scenes.

If you e.g. would like to render your images to //render/name_the_blendfile_v01/image_beautyrender_v01.exr without having to always remember updating this file name as soon as the corresponding blend file gets up-versioned, one would just use a simple "expression" there, which automatically replaces the global variables with the right text, i.e. //render/$BLENDNAME_$VER/image_$SCENE_$VER.$F4.exr . This would automatically keep the output file names updated to be in sync with the name and version of the blend file, the scene inside the blend file where it's coming from etc. And finally the $F4 would be replaced with the current frame in 4-digits including leading zeros. This has to be done only once and from then on you can concentrate on your real work.

Even a few basic variables would be of great help. What would also help would be support for simple custom variables that the user can specify in each blend file. So e.g. you could create a custom variable like $MY_CUSTOM_VAR and give it a value of "v01". And from now on instead of updating all the possible locations where you used "v01" to keep track of the version you're working with, you could just enter $MY_CUSTOM_VAR once and then globally up-version the whole blend file by simply setting the variable to something like "v02".

100%

Development Status: Open

Upvote 59 Downvote 0

Duplicates

steffen.duenner
11 Feb 2020

17 Comments

gwetell

Why is this not a thing yet?

5
chadd

Yes! this would be a wonderful "quality of life" improvement. One of the few things I miss from Maya.

4
p.coenen

Hi, I agree with the need for variables. I terribly miss environment variables. Such as $ASSETS so on my computer I will be able to set it to something like C:/AnyFolder/otherfolder/ASSETS

But in another studio, they might have

$ASSETS="/Root/somefolder/someotherfolder/ASSETS"

In the ideal, we should have a panel in the preferences named environment variables. That will set these variables at the file level or at the preference level (so all files will be able to use it without to declare it. And so a studio setup will be very easy to put in place.

Even if I can do python I don't think it is a good solution it has to be in a panel so it's easy to set and change in a standard way.

The first implementation in a config file would be OK if the pannel stuff is a problem...

For people that work on large projects, it's so important...

3
Lee-Henshall

This is an essential feature. There are addons that make this possible but it should be a core/native behaviour.

2
danyargici

Could you point me to any addons that enable this, it's infuriating that it's still not a thing. Thanks!

Lee-Henshall

github.com/p2or/blender-loom

The addon I use use is called "Loom"

Make sure you use the Loom specific "render animation" in the "render" menu.

This works really well for local batch rendering but if you want to use distributed rendering then I suggest you look into "Flamenco" render farm solution. It is excellent. It needs a little bit of manual setup of custom render jobs by editing a java script file to edit the file path variables.

danyargici

Perfect, thanks! Would be great if environment variables were expanded in all text fields throughout Blender though!

1
hcederblad

Since there was a while since last comments on this idea, I just wanted to check if this has been implemented after that. I totally wish for the same thing as OP does.

2
steffen.duenner Author

This just came in. You can now at least add "<UDIM>" or "<UVTILE>" to your filename when saving UDIMs.

developer.blender.org/rB180b66ae8a1

Now imagine if you could also add something like "<BLENDFILE>" or "<BLENDNAME>" or other variables to be available. Maybe today's commit can be seen as the start of a welcome new feature.

2
FloTasser

The functionality of using automatically replaced text for the render output is the only thing I miss from C4D. When you're in the trenches and deal with your animation, when you have hundreds or thousands of frames, it would make life so much easier to automatically rename the folder to the time and date you started rendering, or split it up in folders by passes. Houdini is also doing this really well. Should we crowd fund this? :D

2
isochrom1

I agree, it could become huge when you think of "everything nodes" project. Even if python can help a lot a more extended path/filename convention for render and composite node outputs was really nice. $CURRENT_CAMERA & $BLEND_FILE_NAME would help a lot .

1
steffen.duenner Author

Hopefully, this will help in the near future: projects.blender.org/blender/blender/issues/133001

nunoalexconceicao

I would like to add that besides global variables, we need a similar system that houdini also has that is the possibility to customize texture path, or geometry caches inputs using strings that links to any kind of properties, like geometry nodes attribs, custom attributes, etc. This would allow for a robust asset management dealing with many similar assets and variations. For example if there are like dozens of geometries that only differ in the textures, they could all share a shader that links dynamically to different textures by just changing one folder name on the path according to the asset name.

steffen.duenner Author

Just installed Octane for Blender and they offer exactly this functionality inside Blender ibb.co/HC6f76G

Josephbburg

I think you can use #### characters to represent numerical digits. I'm willing to bet it's possible to do some or all of the rest with Python, but it probably needs UI work to make it easier to do.

steffen.duenner Author

* @Josephbburg * Thanks for your reply ."####" might work, but it's the least of the "problems". Not everyone wants to have a degree in Python coding to automate such simple tasks like auto-updating file names.

1