How to find referenced event relationship

I am trying to get the dependencies between Banks and export them. But first I need to get the references between Events.

I used studio.project.model.Event.findInstances() to get all the Events. and then found out that there are reference relationships that get stored in ManagedObject:Event.references. But the object type in there is ManagedObject:EventSound, not ManagedObject:Event.

ManagedObject:EventSound doesn’t seem to include any information about the Event itself.

How do I get the relationship between Events?


Also, is getting the association between them and manually loading the .bank file where the referenced Event is located the best way to handle this?

Does FMOD already have a way to find the Bank it depends on and load it?

Well, once again, I’m missing key information.
The ManagedObject:EventSound object has an event member, which stores the Event itself.

So now only the second question remains.

I’m not sure if this is exactly what you’re getting at, but by default building your banks in FMOD Studio will automatically include referenced events. You can disable this for your Studio Project in Preferences → Build. For more information, I would recommend reading over the Studio documentation on Including Referenced Events in Banks, and the API documentation on Bank Loading

Yes, I have been informed of this. But this means that if an Event is referenced by an Event in more than one Bank file, it will be copied multiple times to each Bank, resulting in a larger .bank file.

I refer to the documentation and in this case it is recommended to put the referenced Event in a separate Bank file.

But then the dependencies between the Events should have to be documented.

I realized I missed a detail.

ManagedObject:EventSound.event gets the name of the referenced Event itself, not the name of the referrer, although it does add members as the number of references increases, which didn’t solve my problem.

I found that when selecting an Event, choosing Find References … - In Events in the context menu it is possible to get the list of references.

What should be the correct way to get it?

I believe the simplest way of retrieving all Event referencing a given Event referencedEvent is to get the audioTrack that the Event Instrument playing referencedEvent is on, and get the referencing event from there. For example:

//iterate over all references
referencedEvent.references.forEach(function(event){
	event.audioTrack.event //the referencing event
})

This should work regardless of the type of sheet the Event Instrument is on.

1 Like