其实可以用这个方法创建按钮,效果会不错。
macroscript MorpherFloater category:"HowTo"
(
global mf_float, mf_morpher_mod
on isEnabled return
selection.count == 1 and (try($.morpher)catch(undefined)) != undefined
on execute do
(
mf_morpher_mod = $.modifiers[#morpher]
used_channels = #()
txt ="rollout mf_main \"Morpher Floater\" (\n"
for i = 1 to 100 do
(
if WM3_MC_HasData mf_morpher_mod i then
(
append used_channels i
txt +="progressbar mf_slider_"+ i as string
txt +=" value:"+ (WM3_MC_GetValue mf_morpher_mod i) as string
txt +=" width:100 height:18 across:3 align:#left\n"
txt +="edittext mf_label_"+i as string
txt +=" text:\""+i as string+": "
txt +=(WM3_MC_GetName mf_morpher_mod i) +"\"\n"
txt += "button theButton_"+i as string + "\n"
txt +="toolTip:\""+"sdfgsdf"+"\""+"\n"
txt +="on mf_slider_"+i as string+" clicked val do (\n"
txt +="WM3_MC_SetValue mf_morpher_mod "
txt += i as string+" (val as float) \n"
txt +="SliderTime +=0)\n"
)
)--end i loop
txt +=")\n"
createDialog (execute txt) 340 (used_channels.count*50)
txt ="fn mf_update_slider = (\n"
for i in used_channels do
(
txt +="mf_main.mf_slider_"+i as string
txt +=".value = WM3_MC_GetValue mf_morpher_mod "+i as string+" \n"
)--end i loop
txt +=")\n"
global mf_update_slider = execute txt
registertimecallback mf_update_slider
deleteAllChangeHandlers id:#morpher_floater
when parameters mf_morpher_mod changes \
HandleAt:#RedrawViews \
id:#morpher_floater do mf_update_slider()
)--end if
)--end script