[Closed] Creation spinner according to morptargets
Im trying to creat a MorpherFloater
and i want to crate spinner according to the amount of morptargets in my morpher…
anybody know how to do this?
Check out “How To … Enhance the Morpher Modifier With Floating Controls” in the MAXScript Reference. It does not use spinners, but adding them is trivial.
I have done that but i cant get it to work…
here is what i have so far…
Rollout MFloater "MorpherFloater"
(
Local mf_morpher_mod = $Box01.morpher
local used_channels = #()
for i = 1 to 100 do
(
if WM3_MC_HasData mf_morpher_mod i then
(
append used_channels i
txt +="spinner mf_spinner_"+ i as string
)
)
txt +=")
"
)
Createdialog MFloater 100 (used_channels.count*24)
No you have not. You did not add spinners to the existing script, you tried to extract some code from it and forgot half of it
Here is a start – it is missing sanity checks so make sure you have one object with a morpher selected when you run it:
(
global MFloater --has to be global to be able to close it via the same script
try(destroyDialog MFloater)catch() --try to close if already open
global mf_morpher_mod = $.morpher --get the morpher from the current selection - needs checking!
local used_channels = #()
local txt = "Rollout MFloater \"MorpherFloater\"
(
" --the rollout def. MUST be in a string!
for i = 1 to 100 do
(
if WM3_MC_HasData mf_morpher_mod i then
(
append used_channels i
txt +="spinner mf_spinner_"+ i as string + " \"" + (WM3_MC_GetName mf_morpher_mod i) + ":\"" --adding name
txt +=" range:[0,100," + (WM3_MC_GetValue mf_morpher_mod i) as string + "] fieldwidth:45
" --adding the value and range
txt +="on mf_spinner_"+ i as string + " changed val do(
" --adding event handler
txt +="WM3_MC_SetValue mf_morpher_mod " + i as string + " val
"
txt +="SliderTime += 0)
"
)
)
txt +=")
"
execute txt --EXECUTE THE STRING! Otherwise no rollout will exist!
Createdialog MFloater 140 (used_channels.count*24) --made it a bit wider
)
thanks alot Bobo…
but I just found out myself. =)
but you answerd anoter question so…
so here si what i have for now… with some of yours modifications of corese
plugin modifier MFloater
name:"Morpher Floater"
classID:#(685325,452281)
version:1
(
Rollout M_Floater "Morpher Floater"
(
label l1 "Klikk to open"
label l2 "Morpher Floater"
Button MFL "MorpherFloater" pos:[35,50]
on MFL pressed do
(
global MFloater --has to be global to be able to close it via the same script
try(destroyDialog MFloater)catch() --try to close if already open
global mf_morpher_mod = $.morpher --get the morpher from the current selection - needs checking!
local used_channels = #()
local txt ="Rollout MFloater \"Morpher Floater\" (
"
for i = 1 to 100 do
(
if WM3_MC_HasData $Box01.morpher i then
(
append used_channels i
txt +="spinner mf_spinner_"+ i as string + " \"" + (WM3_MC_GetName mf_morpher_mod i) + ":\"" --adding name
txt +=" range:[0,100," + (WM3_MC_GetValue mf_morpher_mod i) as string + "] fieldwidth:45
" --adding the value and range
txt +="on mf_spinner_"+ i as string + " changed val do(
" --adding event handler
txt +="WM3_MC_SetValue mf_morpher_mod " + i as string + " val
"
txt +="SliderTime += 0)
"
-- and so on..
)
)
txt +=")
"
execute txt
createDialog MFloater 180 ((used_channels.count*24)+50)
)
)
)