Fusion “Change Strings” Script – Batch Change Names, Expressions, Filepaths

Page 1 – Manual

Change Strings can batch change most strings, meaning text, in Blackmagicdesign Fusion and Fusion inside DaVinci Resolve. These are Tool/Node names, expressions, and filepaths. Simply write the text you want to replace (or delete) into the designated Search for and Replace with Text fields. Make sure you have all the tools selected on which you want the search and replace operation to be performed and press OK.

Change Strings is my first attempt at teaching myself scripting, and the programming language Lua, for Fusion.

This page serves as an in depth manual of the script as well as the download page.

A video detailing this script will be published once I know there aren’t any big issues left.

Change Strings supports an unlimited number of find and replace operations in the same session and is even capable to switch patterns around, all thanks to the Pattern Breaker (more about this in the Advanced Settings section here). Another great feature is, that Change Strings will respect your large and lower case letters even with case sensitivity disabled.

You can download this script in the Downloads area on the next page.

I created this script for my own personal use, but after putting more and more functionality into it, I decided to make it publicly available for free. That said, I can not guarantee full support for this and you always have to use it at your own risk. Although I haven’t had any actual issues with this yet, I can’t guarantee that it doesn’t break anything. I will be mentioning the limitations of this script in this manual as well, this might make it look like this script is full of bugs, but I can assure you, that you won’t experience these limitations in 99% of cases.

I have plans for future changes, like a Quick Selection feature, support for Modifier Expressions, and making many of the Console messages optional. But please feel free to comment on features or changes you would like to see.

Change Strings Main Window

Change Strings Main WIndow

About Button

The About Button will open a new window with some information about the script and some advanced settings. Jump to the About window explanation by clicking here.

Search for and Replace with Text field

( Jump down to removing numbers ↧ )

As the names suggest, these are the text fields where the user (you) can write in all the searches you want the script to perform. You can separate different searches by using a space between words (or patterns). Users of Houdini might be familiar with this type of list-separation.

It is important to understand how Change Strings works to take full advantage of its features.

General Search Behavior

Let’s say we have this set of nodes in our flow and want to perform a very simple Search and Replace Operation.

Node Flow in Fusion

First, we decide to get rid of the long names. We want to change all “Element” into a simple “E”. Change Strings will simply search for every tool that has “Element” in its name and change it to “E”.

Change Strings Element to E search and replace operation

Easy enough. This will result in this:

Change Strings changed node flow

But let’s do a more interesting example. We want to change all “Merge” into “Combine” and the first Merge7 should be called “Combine_A” and the second “Combine_B”. For this, we will put this into Change Strings (I have colored the different Searches to more easily show the concept):

Multiple Searches in Change Strings

I have separated the different searches with empty spaces in between the different patterns. As you can see, Change Strings will use the first Search for Input and replace it with the first Replace with Input, then it will use the second inputs and so forth. Notice that “7” and “7_1” are two completely different patterns for the Search and Replace operation which we can use for our advantage. But, we need to make sure, that it changes “7_1” before changing “7”. Otherwise, it would change “Merge7_1” to “Combine_A_1” before searching for “7_1”.

(Sounds more complicated than it is. If you’ve ever used a Search and Replace tool in another software, you will understand this.)

This results in these names:

Results of Multiple Searches in Change Strings

You may be wondering what happens if you search for more patterns than you want to replace. And yes, this is possible as well. Let us assume we want to change “Text” to “Heading” and we want both “Blue” and “Red” to be called “Background”. This is what we would need to put into Change Strings:

Multiple Searches in Change Strings with less Replace inputs

As you can see, if there are more Search for Inputs than Replace with Inputs available, Change Strings will simply use the last available Replace with Input. This would result in these node names:

It’s important to note, that Fusion can not have two nodes with the same name. This is why the second “Background_E_1” has gotten an additional “1”. This is the default Fusion renaming behavior. We could use Change Strings to replace “11” with “2” but in this case it would be easier to just rename it ourselves.

Also, if you put in more Replace with Inputs than there are Search for Inputs, then Change Strings will simply ignore the Inputs that don’t have a corresponding Search Input.

Advanced Searches

Change Strings was written in Lua, this means that we have access to additional search shortcuts that are built into the programming language. Some are not supported and break the script, but these are the ones that are:

%aletters (Using this will most likely have you run into the Max Replace Limit, learn more here )
%ddigits (Very useful for removing the digits Fusion creates by copying nodes, a mini-tutorial is right below)
%llower case letters (uppercase are not yet supported)
%ppunctuation characters (Like “, . ; : _”)
%sspace characters (The recommended way of removing only a space would be to type a space into the Search for field. But this is handy if you want to search for a pattern that contains a space character)

If you use these, remember they can sometimes cause Change Strings to fail, which seem to be Lua specific problems. Also searching and replacing “%”-characters and single dots (“.”) can be problematic because Lua expects these to be shortcodes. Once I’ve turned the Search and Replace Operation into reusable functions, I might be able to tackle all the special cases someone could use these Advances Search patterns.

The most useful is definitely “%d” as shown in the mini tutorial below:

Removing the numbers from nodes that are copied

( Jump up to About Button ↥ )

( Jump down to Replace in Settings ↧ )

Everyone using Fusion knows that when you copy a node, Fusion will append a number to the name. This is important so that each node has a unique name, but it can be annoying to remove them, especially if you start to copy copies. Let’s look at the following (horrific) example. I use the Advanced Searches to remove the digits. These are our nodes:

Copying nodes append more and more numbers to the node names

We simply search for “%d” and will replace it with nothing which will give use this:

Much better!

Switch Button

Switch Button

This button will switch the Inputs from the Search for or Replace with fields.

Replace in Settings

Replace in: Names, Expressions, Filepaths

Names

Checking this will make Change Strings search and (if it finds) replace the patterns in all the names of the currently selected nodes. This includes pipe routers but excludes Modifier names, as those are “not selected” when you are selecting a node. I will look into this at some point.

Remember that Fusion does not support spaces in tool/node names. They are not changed to “_” either. Many other characters like “#, *, ~” are not supported in tool names as well.

Expressions

Checking this will make Change Strings search and (if it finds) replace the patterns in all the Expressions of the currently selected nodes. This excludes Modifier Expressions or the Expression Modifier, as those are “not selected” when you are selecting a node. I will look into this at some point.

Expressions are the most likely place where you could be confronted with the Max Replace Limit, which is explained here.

Filepaths

Checking this will make Change Strings search and (if it finds) replace the patterns in all the Filepaths of the currently selected Loaders and Savers.

It will remember the previous Loader settings such as TrimIn or Hold last frame. While the Search and Replace Operation of Change Strings has some advantages (like not converting everything lowercase) it does not support Proxy files yet. Change Paths is a great script that supports these.

Once I have integrated a QuickSelect feature, I might also update the script to support Proxy filenames. But in its current state (meaning that it only runs on selected nodes) it’s not the best way to change Filepaths yet. On the other hand, this is also an advantage for the cases in which you only want to change some Loaders or Savers.

Settings

Settings of Change Strings: Be case sensitive and Remember Inputs

Be Case Sensitive

Enabling this will force Change Strings to only replace patterns that have the same capital and lower letters as your Search for Inputs.

Disabling this means that Change Strings will ignore capital or lowercase letters in its search, but as mentioned before, it will not convert everything lowercase and the replacement will keep its correct upper case letters.

This is achieved by temporarily converting the string and the search lowercase, then searching for the location of where it is found, cutting out this pattern in the original string, and finally using this pattern to replace it with the desired new string. This is repeated until either the search string is not found again or the Max Limit is reached. Usually, the Pattern Breaker will ensure that the Max Limit is not reached. (Learn about the Max Limit here)

Remember Inputs

Enabling this will save your current settings and inputs in Change Strings, but only if you let it run by pressing the (now properly named) OK and Save Button.

Change Strings in Fusion Standalone will, by default, save all the data locally into the current composition file. This means, if you have not yet saved your project, it will prompt you to do so. Also, you will keep your settings even if you open the composition on a different computer.

You can change this behavior to save the settings globally into the Fusion Preferences file. This means you will keep your Change Strings inputs even if you switch compositions. Of course, you can always switch back to locally saving. (Jump down to Advanced Settings)

Change Strings in DaVinci Resolve will always save its settings into the Fusion Preferences file. There is currently no way of changing this. (Why is explained here)

If you open your .comp or Fusion Settings file in a Text Editor, you will be able to see the Data that Change Strings has written. It’s located in:

Prefs = {
Comp = {

ChangeStrings = {}

Usually at the end of the file.

You can delete these settings manually if you don’t want anybody to know you’ve used my script. Just make sure you’ve not accidentally deleted or left too many “}” as this will corrupt your comp file until you’ve manually fixed this.

OK and Cancel Button

OK

This should be self-explanatory. OK will run the script on all selected nodes. If you have Remember Inputs checked, then this button will change into OK and Save and run the script, and once it’s finished, it will save the composition so it can save the Change Strings settings as well.

Cancel

This will simply close the window and not save any Inputs, even if Remember Inputs is selected. If you want to save them you can let the script run without having any nodes selected.

About Window

Change Strings About Window

The About Window features some (very necessary) self-promotion as well as a little help. But most importantly, this is where you can change the mysterious Advanced Settings you’ve heard about. This is the Pattern Breaker, Max Replace Limit, and Force Resolve/Global mode. You see how reluctant I am to give you access to these settings, due to the additional Show Advanced Settings Checkbox you have to conquer beforehand.

Pattern Breaker

What is the Pattern Breaker?

The Pattern Breaker is a very important and integral part of this script. It ensure that Change Strings only runs as often as it has to and that you can replace several different versions of a pattern in the same string. For example, imagine you have a node that is called “Pear_APPLE_pear” and you want to change it to “PEAR_APPLE_PEAR”. You could enable Be Case Sensitive and Search for “Pear pear”. But that requires you to type in both variants of “Pear”.

If we were to disable Be Case Sensitive and only Search for “pear” then Change Strings would only find the first “Pear” over and over due to the way it searches and replaces in this mode (more about this here ). This would eventually be stopped by the Max Replace Limit but it still wouldn’t replace beyond the first “Pear”.

This is where the Pattern Breaker comes into play. Instead of replacing the first “Pear” with “PEAR”, it uses “PEïèëAR”. So now our node is called “PEïèëAR_APPLE_pear”. Change Strings will repeat this operation and now it will find the second “pear” and again replace it with “PEïèëAR”. After this, our node is called “PEïèëAR_APPLE_PEïèëAR”. It will repeat this operation again but realize that it can’t find any more variations of the pattern “Pear” and stop the loop.

Once it’s certain the pattern is nowhere to be found (or the Max Limit is reached) it will remove the Pattern Breaker to reveal the desired name/expression/filepath.

This also is the reason why Change Strings can switch patters around without breaking a sweat (or falling into an endless loop).

There are of course fringe cases where the Pattern Breaker is not enough. For example. If your node is called “Pear_ar” and you want to replace “Pear” with “PEAR” and “ar” with “BB”. This would eventually lead to the name “PEBB_BB”. In this case, enabling Be Case Sensitive would give you the desired result, but I hope you understand what happened if you run into this issue.

Changing the Pattern Breaker

The default Pattern Breaker is “ïèë”. Which I chose because it’s very difficult to type on most keyboards and as far as I know not a word. But if you really need to change it, then I want to give you the ability to do so.

You can type any string into the designated field and hit the OK (Saves the composition) Button.

Do not add spaces or special characters like ‘#’ into this field. This would stop this script from working on names since those do not support those characters. If you’ve decided to change the Pattern Breaker, see if it would theoretically work as a node name, then you can use it as a Pattern Breaker.

Note that by default, in Fusion Standalone, this will only be saved in the current composition file. If you find yourself needing the pattern “ïèë” a lot and want to be able to switch between local and global saving, then you need to change this in the script itself.

Change Strings in DaVinci Resolve only works in global mode. Changing anything in the script is not necessary (but of course possible).

For this you can simply click on Script>Edit>ChangeStrings, in Fusion Standalone.

Script>Edit>ChangeStrings

This will open a Text Editor in which you can change all “ïèë” to whatever you want to use. There is a level of redundancy built into this to make sure that there is always a Pattern Breaker, so make sure you replace it everywhere.

If you need to edit the Script and are using DaVinci Resolve, then you need to manually locate the script in your file browser and open it in a Text Editor.

Max Replace Limit

What is the Max Replace Limit?

It stands for Maximum Replace Limit in case you didn’t notice. Whenever you run Change Strings, not in Case Sensitive mode, it will repeat the search until it can’t find the string anymore. This can (in fringe cases) lead to endless loops. That’s why there is an upper limit to how often it can try to replace a pattern. You can see it count in the console.

This means if you have an Expression that is “aaaaaaaaaaaaaaaah” and you want it to be angrier like “AAAAAAAAAAAAAAAAh” without enabling Case sensitive mode, then Change Strings would always find another “a” in the Expression and run until it reaches the Max Limit.

Changing Max Replace Limit

If for some reason, you find that Change Strings wasn’t able to complete its job due to reaching the Max Replace Limit, then you can increase the value in the designated field. But this could theoretically only happen if you have more than 15 variations of the same word. (For example, “VerryyLoooongWoooord_VErryyLoooongWoooord..this sixteen times“)

Or if you use the shortcodes “%d” or “%a” and have for more than 15 numbers or letters in a single search.

Note that by default, in Fusion Standalone, this will only be saved in the current composition file. If you find yourself exceeding the default value of 15 a lot and want to be able to switch between local and global saving, then you need to change this in the script itself. See Changing the Pattern Breaker to learn how.

Change Strings in DaVinci Resolve only works in global mode. Changing anything in the script is not necessary (but of course possible).

Force Resolve Global Mode

Fusion Standalone

This Checkbox is only visible for Fusion Standalone users. As long as this is enabled, Change Strings will save its Inputs not into the current composition file but into the global Fusion Preferences. This means, that you will keep the inputs of Change Strings even if you switch between compositions.

Note, that this is also a global setting. Disabling this will disable this for every composition, and the other way around.

There is no harm in only enabling this if you need to. As I believe, that saving these settings into the composition file is usually preferred.

DaVinci Resolve

In DaVinci Resolve, local saving to the composition is not supported because it does not save Fusion compositions. You can export them, yes. But internally I can’t save the preferences to any composition file. This is why currently Change Strings will always save its settings globally and there is no way of changing this through the UI. The script would need to be rewritten. But let’s be honest, it does not limit Change Strings actual job, finding and replacing text.

This should explain everything, but of course, If you have any questions or request, drop a comment down below!

On the next page is the Download link, Changelog and some more background information

Quickly share this!

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top