FMOD Scripting: Is it possible to edit the color of events/folders

I am slowly trying to learn scripting for FMOD, and was wondering if there is a way to modify the color of an event? I’d love to make a script that got the color of e.g. the “oldest” parent folder, and applied that to all its children (kind of how colors work in Wwise)

Hi,

Here is a script that will assign the color of the current selected object to all of its children:

Set Children Colour

//Menu item to select in Studio
studio.menu.addMenuItem({
    name: "Set Children Color",
    execute: function() { SetChildrenColor(); }
})


//Function to set the child objects color to the current selected object color 
function SetChildrenColor() {
    var currentSelection = studio.window.browserCurrent(); 
    if (currentSelection == null)
    {
        alert("Please select an object");
        return; 
    }

    if (currentSelection.items.length == 0)
    {
        alert("Current object has no child Items"); 
        return; 
    }
    else 
    {
        for (var i = 0; i < currentSelection.items.length; i++) {
            FindBaseChild(currentSelection.items[i], currentSelection);             
        }
    }
}

//Recursive function to find children
function FindBaseChild(child, parent)
{
    if (child.items.length == 0)
    {
        child.color = parent.color; 
        return; 
    }
    else 
    {
        child.color = parent.color;
        for (var i = 0; i < child.items.length; i++) {
            FindBaseChild(child.items[i], child);
        }
    }  
}

Hope this helps!

1 Like

Wow thank you Connor, super helpful!!

I just made me own little variation to it, so it only colors “uncolored” children (my first FMOD scripting, yay): FMOD - Color Children From Parent - YouTube

//Menu item to select in Studio
studio.menu.addMenuItem({
    name: "Color Uncolored Children",
    keySequence: "Ctrl+Shift+J",
    execute: function() { ColorUncoloredChildren(); }
})


//Function to set the child objects color to the current selected object color 
function ColorUncoloredChildren() {
    var currentSelection = studio.window.browserCurrent(); 
    if (currentSelection == null)
    {
        alert("Please select an object");
        return; 
    }

    if (currentSelection.items.length == 0)
    {
        alert("Current object has no child Items"); 
        return; 
    }
    else 
    {
        for (var i = 0; i < currentSelection.items.length; i++) {
            FindBaseChild(currentSelection.items[i], currentSelection);             
        }
    }
}

//Recursive function to find children
function FindBaseChild(child, parent)
{
    //alert(parent.color);
    if (child.color == "Default")
    {
        if (child.items.length == 0) {
            child.color = parent.color;
            return;
        }
        else {
            child.color = parent.color;
            for (var i = 0; i < child.items.length; i++) {
                FindBaseChild(child.items[i], child);
            }
        }  
    } 
}
1 Like

Hi @Connor_FMOD . I tried expanding the script to make it work on parameterpresets, effect presets etc. I have some of it working now, but I am stuck with the asset browser and mixer where I get this error:

image

It seems like items.length does not work for MixerGroup or EncodableAsset enities which is what I see in these windows. Any ideas for how to work with this?

This is where I get the error:

Thank you!

Hi,

The structure for a Mixer group is a bit different from that of a Folder. To see a Mixer groups structure, open the console window found on the FMOD Toolbar -> Window -> Console or Ctrl-0 in Studio. While having a Mixer group selected use the command studio.window.browserCurrent().dump() in the console. This will display all available variables and functions attached to the currently selected item. The Mixer group variable you are looking for is input, use the same for loop but change items for input.

Keep in mind when changing the color of a Mixer Input you will have to access its event. To do so when looping through the browerCurrent().input check if input.event != null if true then use input.event.color = "new Color"

If you have any troubles I can share my code!

Hope this helps