Message 1 of 1
morpher floater with rollouts

Not applicable
10-09-2008
04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Greetings, I've been trying to do something that should be simple but as with any code it can turn into more than what you expected. Anyway in the maxscript help file there is a great example of how to use progressbars to control the morpher. However I'd like to just use part of the code but I'm having some troubles. The examples uses progress bars and I'd like to use sliders instead and got that working. The problem I'm having is in making it in a floating UI with rollouts. Right now its stuck in a floater UI with no rollouts.
I really just want the code the says "read the modifier with the morpher & build a slider with that" on a rollout in a floating UI.
Anyway in case someone has thoughts here's the code so far:
(
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
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 +="slider mf_slider_"+ i as string
txt +=" value:"+ (WM3_MC_GetValue mf_morpher_mod i) as string
txt +=" width:150 height:18 across:2 align:#left\n"
txt +="edittext mf_label_"+i as string
txt +=" align:#right text:\""+i as string+": "
txt +=(WM3_MC_GetName mf_morpher_mod i) +"\"\n"
txt +="on mf_slider_"+i as string+" changed 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*40)
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
Thanks....
I really just want the code the says "read the modifier with the morpher & build a slider with that" on a rollout in a floating UI.
Anyway in case someone has thoughts here's the code so far:
(
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
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 +="slider mf_slider_"+ i as string
txt +=" value:"+ (WM3_MC_GetValue mf_morpher_mod i) as string
txt +=" width:150 height:18 across:2 align:#left\n"
txt +="edittext mf_label_"+i as string
txt +=" align:#right text:\""+i as string+": "
txt +=(WM3_MC_GetName mf_morpher_mod i) +"\"\n"
txt +="on mf_slider_"+i as string+" changed 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*40)
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
Thanks....