View Full Version : Material Names as array for dropdown box
11-08-2005, 10:39 AM
im trying to get a list of the submaterials for a dropdown box for my script.
So far ive got the following
myMaterialList = ($.material.materialList as array)
dropdownlist myMaterialName items:myMaterialList
when it trys to load it gives the following error
" Unable to convert: Material #25:Standard to type: String"
obviously myMaterialList outputs "Material #25:Standard"
Is it possible to remove the ':Standard' form the end of the material in all values in the array, via a loop.
11-08-2005, 11:02 AM
You need to build a new array of materials by querying the materials names from your material array in a for loop
11-08-2005, 11:24 AM
sweet, thanks again :)
11-08-2005, 12:02 PM
ok ive got the following
myMaterialListName = #("Material #25", "Material #25")
dropdownlist myMaterialName width:80 height:40 pos:[5,245] items:myMaterialListName
but they dont show in the list, also ill need to be able to update the list, i tryed the following.
but it doesnt allow me to update them.
EDIT: ok ive noticed it doesnt work the first time i load the script, but the scond time i load it it works as the array is in memory. So basically i need to get the dropdownlistbox to update... How do i do that?
11-08-2005, 12:55 PM
So you need to build you list of strings when the rollout opens. So define a function that builds the list, and then call it when the rollout opens:
rollout myrollout "rollout"
...collect material names...
on myrollout opens do collectmatnames()
You can then call this whenever the list might change (ie new materials added, etc)
11-09-2005, 12:39 AM
ok when i use the following
dropdownlist myMaterialName "" width:80 height:40 pos:[5,245]
i get the following error
>> MAXScript Rollout Handler Exception: -- Unknown property: "items" in undefined <<
Basically it seems as tho its not able to use the .items part :|
11-09-2005, 12:15 PM
Are you tring to change the items from outside the rollout? if so you will need to specify the rollout:
Oh, and my code above should read open, not opens.
If this doesn't help, maybe you should post some more code to look at.
11-09-2005, 12:30 PM
Cool, that works well!
just need the extra myrollout. bit on there.
I was doing it from within a function.
11-09-2005, 12:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.