A really slick feature that could be done is to get an exported list of all event names in an FMOD Studio project (or bank file). This could then be fed into a code generator (written by the user) to turn all events into constants in the code for a game. Is this already a thing?
Building the master bank automatically generates a “.strings.bank” file that contains the name, path, and GUID of every event in the project, as well as each bank’s folder path. If you load this file in the FMOD Engine, you can get the list of events in each bank, then get the path of each event from its event description.
Hey Joseph, thank you for the reply. I think that is something I can work with! I will give this a go this week and report back.
Thought about this more. The problem your approach brings is that we need code that integrates with the FMOD API just to get a list of strings. This means running the game twice: once to read the bank file and generate the constant, then once again after using the newly-generated constant in the code. What I am imagining is just writing a python or golang script that I can run independently on the side to read a simple file of event names and generate the code needed for whatever game I am using. Sure I could make my side script integrate with the FMOD API, but that is a lot of work to do something fairly simple.
We are reluctant to allow users to access the content of FMOD Studio banks without using the FMOD API.
Does the “Export GUIDs header” example script that is included in every installation of FMOD Studio suit your needs? You can find it in the “FMOD Examples” submenu of FMOD Studio’s “Scripts” menu.
This might do the trick. I could probably make a script to read this in. Are we able to modify or write our own FMOD Studio scripts?
Of course. As mentioned in the Scripting chapter of the FMOD Studio User Manual, FMOD Studio can load user-created scripts from .js files from its system scripts directory, built-in scripts directory, and project scripts directory. If you want to edit or modify any of our example scripts to better suit your personal workflow, you’ll find them in the built-in scripts directory.
Awesome. This is exactly what I needed. Thank you.
This has worked great. I have created a const generator using FMOD Studio scripting. Is there a way to use the script to open up a “choose a file” Windows dialog box by chance?
There is no way to open an operating system file picker dialog from an FMOD Studio script at this time.
Ok, put that on the feature request list then. I did come up with a workaround at least. It involves creating an additional file next to the root of your FMOD Studio project. Ideally, I would like to be able to open a dialog and pass in an optional parameter that specifies which directory the folder picker should start in. That way, whenever the user selects a file, I can snag the directory they chose and store it away so future runs of the script open up in the last place the user saved the file. Here is what I came up with for now. Thanks for the help.
I’m glad to hear you were able to get it working.
I’ll add the feature you suggested to our feature/improvement tracker.
After some investigation, I’ve dicovered that it is possible to open an operating system file picker dialog from an FMOD Studio script, by calling for a
PathLineEdit widgetType and clicking the “Browse…” button in the dialog that appears. For an example of creating dialogs, see the Batch Rename example script included with FMOD Studio.
Oh wow this is perfect. It supports “directories only” and also lets me pre-populate the text box. Thank you for finding this!