[MAXScript] Get Event by index or key
Hi there,

I'm trying to get some attributes from a tyFlow event with maxscript.
Before reaching these attributes, I have to get the event itself, and the only way I found is to use the event's name in tyFlow object's attributes. For instance, to get an Export Particles tyCache Filename :

myEvent = $tyFlow001.Event_006
myFilename = myEvent.Export_Particles.tycacheFilename

This method supposes that I know the event's name, which is not always the case.
Is there any way to get an array of all the events and use an index or key to get the wanted event ? It would be useful for iterating over the events without having to know there names.

For example with the array's usage, to get the Bend modifier from Box001 object :
boxModifiers = $Box001.modifiers
bendModifierByKey = boxModifiers ["Bend"]
bendModifierByIndex = boxModifiers [1] -- if the Bend modifier is in first position

The equivalent of this feature in tyFlow would be :
myEvents = $tyFlow001.events
n = $tyFlow001.numEvents
eventByKey = myEvents["Global Export"]
latestEvent = myEvents [n]

The feature could help a lot for iterating over events proceduraly.

Iterating through events can be done with subanim methods:

obj = $tyFlow001.baseobject

names = getsubanimnames obj

for name in names do
    anim = getsubanim obj name
    if (iskindof anim tyEvent) then --check if subanim is 'tyEvent' class member
        print (anim.name) --it is, so print it's name. We can then either access by name, or directly through the subanim
Nice to know, thanks !

Forum Jump: