[Closed] Bug in Custom Attributes and DropdownLists
Hello all-
I’m new to MaxScript and am seeing what appears to be a bug in Max 9.0.
It appears that droplist boxes do not reflect their correct values.
I pasted the following snippet of code from the help into a script:
weaponDataCA = attributes weaponData
(
parameters main rollout:params
(
hitPoints type:#float ui:hits default:10
cost type:#float ui:cost default:100
sound type:#string
)
rollout params “Weapon Parameters”
(
spinner hits “Hit Points” type:#float
spinner cost “Cost” type:#float
dropdownlist sound_dd “Sound” items:#(“boom”, “sparkle”, “zap”, “fizzle”)
on sound_dd selected i do sound = sound_dd.items[i]
)
)
and when I do something like:
custAttributes.add $box01 weaponDataCA
the attributes show up correctly on the object (in the Modifier tab) – BUT – if I change the drop list to a different value, then tab over to a different pane and then return to Modifiers, it comes back as the first one in the list. Even if I save it and reload it, it still shows the wrong value.
The really weird thing is, when I export the scene as a Collada (.DAE) file and then inspect the contents of the DAE, the right values are in there. Max seems to simultaneously know and not know about the values.
HELP!
Thanks a million,
Andrew
the ‘sound’ parameter hasn’t been linked to a ui control. Adding the blue text below should fix your problem.
weaponDataCA = attributes weaponData
(
parameters main rollout:params
(
hitPoints type:#float ui:hits default:10
cost type:#float ui:cost default:100
sound type:#string ui:sound_dd
)
rollout params “Weapon Parameters”
(
spinner hits “Hit Points” type:#float
spinner cost “Cost” type:#float
dropdownlist sound_dd “Sound” items:#(“boom”, “sparkle”, “zap”, “fizzle”)
on sound_dd selected i do sound = sound_dd.items[i]
)
)
You’ll have to update the dropdownlist selection manually each time the “params” rollout is being opened. The orange line below should take care of this.
Martijn
weaponDataCA = attributes weaponData
(
parameters main rollout:params
(
hitPoints type:#float ui:hits default:10
cost type:#float ui:cost default:100
sound type:#string
)
rollout params “Weapon Parameters”
(
spinner hits “Hit Points” type:#float
spinner cost “Cost” type:#float
dropdownlist sound_dd “Sound” items:#(“boom”, “sparkle”, “zap”, “fizzle”)
on sound_dd selected i do sound = sound_dd.items[i]
on params open do sound_dd.selection = findItem sound_dd.items sound
)
)