I have lots of events need to be moved into different buses or routing groups, but i can’t find a way to do this from Javascript.
Please help me!!! Thank you so much!
Hi,
Using the .dump()
(FMOD Studio | Scripting API Reference - ManagedRelationship.dump) function on an event in the Mixer window (FMOD Studio | Mixing - Anotomy of the Mixer) you can see its output is set to output: (ManagedObject:MixerMaster)
which is what we want to change.
I have created a script which will assign a selection of events to a chosen group:
Example script
// Adding menu option
studio.menu.addMenuItem({
name: "Set Group",
execute: function() {setGroup();}
})
function setGroup() {
var busPath = studio.system.getText("Group Path", "path");
var bus = studio.project.lookup(busPath);
if (bus == null) {
alert("Invalid bus path");
return;
}
var events = studio.window.browserSelection();
if (events.length == 0) {
alert("Failed to find events");
return;
}
for (i = 0; i < events.length; i++) {
if (events[i] == null) {
alert("Event invalid");
return;
}
else {
events[i].output = bus;
}
}
alert("Assigned group");
}
hope this helps!
Brilliant! Thank you so much!
Sorry, it seems that this cannot work, it still stays in the previous bus, not the bus i want to assigned. When i dump an event which is assigned to a bank already, i cannot see a output property, For example:
(ManagedObject:Event):
id: "{bc929a1e-6a19-40c5-bf15-130fd12264fc}",
entity: "Event",
isValid: true,
relationships: (ManagedRelationshipMap:Event),
properties: (ManagedPropertyMap:Event),
isOfType: <function>,
isOfExactType: <function>,
nullify: <function>,
name: "BGM_Room",
isDefault: false,
note: undefined,
outputFormat: 1,
uiMarkerTracksVisible: true,
uiMaxMarkerTracksVisible: 8,
selectables: [],
folder: (ManagedObject:EventFolder),
items: [],
uiLastParameterSelection: (ManagedObject:Timeline),
mixer: (ManagedObject:EventMixer),
masterTrack: (ManagedObject:MasterTrack),
mixerInput: (ManagedObject:MixerInput),
automatableProperties: (ManagedObject:EventAutomatableProperties),
markerTracks: [(ManagedObject:MarkerTrack)],
groupTracks: [(ManagedObject:GroupTrack)],
returnTracks: [],
timeline: (ManagedObject:Timeline),
parameters: [(ManagedObject:ParameterProxy)],
tags: [],
userProperties: [],
references: [],
banks: [(ManagedObject:Bank)],
defaultEvent: null,
clonedEvents: [],
isPlaying: <function>,
isPaused: <function>,
isStopping: <function>,
isRecording: <function>,
play: <function>,
togglePause: <function>,
stopImmediate: <function>,
stopNonImmediate: <function>,
returnToStart: <function>,
keyOff: <function>,
toggleRecording: <function>,
getPath: <function>,
get3DAttributes: <function>,
set3DAttributes: <function>,
getCursorPosition: <function>,
setCursorPosition: <function>,
getPlayheadPosition: <function>,
getParameterPresets: <function>,
addGameParameter: <function>,
addGroupTrack: <function>,
addReturnTrack: <function>,
addMarkerTrack: <function>,
addTagToEvent: <function>,
getItem: <function>,
dump: <function>,
document: <function>,
But I found another way to achieve this! Thank you very much!!!
I should have mentioned you need to have the mixer window open for the script to work. Good to hear you found an alternative solution.