[Closed] Multilistbox items gathering problems
Hello Folks !!
I try to make a script to convert basic materials of max in vraymtl.
The script works when i convert all materials.
I want to make a way to select the material, you want to convert by it’s name.
So i have a multilistbox that store all scenematerials like items.
Multilistbox matlist "Material list" height:10 items:(for mat in scenematerials where classof mat != vraymtl collect mat.name)
I want to select several items in the list and get names (strings) of the selected items in a array to compare them to the name of scenematerials. When an items name an a scenematerials name match i convert the material in vraymtl.
So, step by step, it gives:
- The multilistbox gather material namse in scenematerials.
- I select several items in the multilistbox, according to the materials i want to convert.
- I pressed a button to convert the selected materials in vraymtl.
The converting part of the script works perfectly. But i didn’t find a way to convert only selected material names in a multilistbox.
Someone has a solution for me.
Or a way to understand the working of the multilistbox.
Thanks a lot for your help. I will post the script when i finish it.
The selection property of the MultiListBox control contains the indices to the selected items. So if you want to acces to the selected materials, you have to do something like this:
for i in matList.selection do (
-- Do whatever you want with [b][i]sceneMaterials[i][/i][/b]
)
Hope it helps.
Hello HalfVector !
How are you ?
It’s a pleasure to see you again.
I’ll test your code.
Thanks a lot for your help
I’m having the problem “how to fill a dropdownlist”, too.
I’m experimenting with “rolloutCreator” and I am not able to fill this dropDownList
texRes = #(256,512,1024,2048,4096)
mapRes.addControl #dropDownList #MapResControl "" paramStr:("items:(for res in texRes collect res) align:#left width:80 height:18 selection:2)
Hello nomed
If you try to put “as string” after “…collect res”. I think dropdownlist use strings array as items.
Like this :
texRes = #(256,512,1024,2048,4096)
mapRes.addControl #dropDownList #MapResControl "" paramStr:("items:(for res in texRes collect (res as string)) align:#left width:80 height:18 selection:2)
Hope that help you
I’am not a maxscript master. (not yet )