Hi,
I would need to link multilistbox material and multilistbox obj from scene. On the material editor I would use checkboxes so that more “IDs” could be marked but on the object I would use radiobuttons so that only one group could be selected.
struct my code
(
struct MyFunctionsStruct
(
fn RMa =
(
— defining range
sc = 0
for m in matarrayoptiA do sc = sc + m[2]
— random function in range--- defining the hit in range for o in selection do ( r = random 0.0 sc trg = true tmpm = undefined s = 0 for m in matarrayoptiA do ( s = s + m[2] -- greater limit if r <= s then ( if trg then ( --print m[1].name tmpm = m[1] ) trg = false ) ) -- end for matarray try ( o.material = tmpm o.material.showInViewport = true ) catch() ) -- end for selection ) ,
(
global MyFn = MyFunctionsStruct()
try(DestroyDialog ::main)catch()rollout main “Layer Seting” width:250 height:200
multiListBox lbxSelOBJ1 “Sel OBJ Group 1” pos:[10,7] width:180 height:12
radiobuttons rdo_obj1 “Group ID” pos:[220,20] labels:#(“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”) columns:1
multiListBox lbxSelOBJ2 “Sel OBJ Group 1” pos:[10,7] width:180 height:12
radiobuttons rdo_obj2 “Group ID” pos:[220,20] labels:#(“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”) columns:1
multiListBox lbxSelOBJ3 “Sel OBJ Group 1” pos:[10,7] width:180 height:12
radiobuttons rdo_obj3 “Group ID” pos:[220,20] labels:#(“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”) columns:1rollout VDopti “Layers Mats V1” width:330 height:600
listbox lbx1opti1 “” height:10 pos:[8,40] width:180
checkbox chk_1 “” pos:[255,40] checked:true
checkbox chk_2 “” pos:[255,60] checked:true
checkbox chk_3 “” pos:[255,80] checked:true
checkbox chk_4 “” pos:[255,100] checked:true
checkbox chk_5 “” pos:[255,120] checked:true
checkbox chk_6 “” pos:[255,140] checked:true
checkbox chk_7 “” pos:[255,160] checked:true
checkbox chk_8 “” pos:[255,180] checked:true
checkbox chk_9 “” pos:[255,200] checked:true
button rnopti1 “Randomize Materials 1” width:180 height:32 pos:[8,200])
my idea was such a function
on rnopti1 pressed do MyFunctionstruct.RMa()
if chk_1.checked = rdo_obj1 “1” and rdo_obj2 “1” and rdo_obj1 “2” do add material for all obj.name in “multilistbox” lbxSelOBJ1,lbxSelOBJ2,lbxSelOBJ3
any idea how to do it? well thank you