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