[Closed] Sub Array selection
So I’m working on a script that finds turbosmooths in a scene and displays them in a multi list box in order to change properties to one or several objects on the fly. My problem is that when an object has more then one turbosmooth on it it shows the object twice in the listbox, and will only effect the first mod in the stack when changing properties.
mods = #()
-- local count = string
for i = 1 to objects.count do
(
ar = for m in objects[i].modifiers where classOf m == turbosmooth collect objects[i]
join mods ar
)
mods
This is the code I’m using to find objects with the specific modifier, it’s set up to be in a function in order to be passed whatever mod I want. What I would LIKE it to do is create a sub array containing both modifiers on the single object, so that I can then reference each specific mod when changing the properties.
because you are looking in all scene nodes i suggest you to use getclassinstances function (see help for details):
all_turbos = getclassinstances turbosmooth astrackviewpick:on
every element of this list is trackviewpick (see help). in your case it will have:
<trackviewpick >.name – the modifier’s name
<trackviewpick >.anim – the modifier itself
<trackviewpick >.client – derived object of node that this modifier applied
to get the real node you can use refs.dependentnodes
that’s all that you need