I am trying to create spinners to set the value of Morpher targets, however, num is returning as undefined
`
mf_mod = $.Morpher -- get selected model
channels = #{} -- empty bitArray
for i=1 to 100 do channels[i] = WM3_MC_HasData mf_mod i
channels = channels as array
listNames = for num in channels collect WM3_MC_GetName mf_mod num--get target names
fn create_spinners = (
rci = rolloutCreator "myRollout" "My Rollout"
rci.begin()
for num in channels do (
rci.addControl #spinner listNames[num] listNames[num]
rci.addHandler rci_name #changed paramStr:"val" codeStr:("WM3_MC_SetValue mf_mod num val")
)
createDialog(rci.end())
)
create_spinners()
`
I can see multiple problems with this piece of code:
(
fn create_spinners channelData =
(
local rci = rolloutCreator "myRollout" "My Rollout"
rci.begin()
rci.str += "\tlocal mf_mod = modPanel.getCurrentObject()\n\n"
for item in channelData do
rci.addControl #spinner ("spn" + item.channel) item.name paramStr:("controller:mf_mod[" + item.channel + "]")
createDialog (rci.end())
)
local mf_mod = modPanel.getCurrentObject()
if not isKindOf mf_mod Morpher then messageBox "Select morpher modifier" else
(
local channelData = for channel = 1 to 100 where WM3_MC_HasData mf_mod channel collect
dataPair channel:(channel as string) name:(WM3_MC_GetName mf_mod channel)
create_spinners channelData
)
)