/*======================================= Batch exclude/include lights on objects ========================================*/ @version 2.2 @warnings @script generic c1; c6; obj_names; lightnames; generic { obj = Mesh(); while(obj) { obj_names += obj.name; objID += obj.id; obj = obj.next(); } lights = Light(); while(lights) { lightnames += lights.name; lightID += lights.id; lights = lights.next(); } reqbegin("Include/Exclude Lights by Steve Hurley 5/5/01"); reqsize(485,350); c1 = ctllistbox("Objects",175,240,"objects_count","objects_name"); ctlposition(c1,30,35); c2 = ctlchoice("",2,@"Include","Exclude"@); ctlposition(c2,295,288); c3 = ctlbutton("Select All Objects",110,"all_objects"); ctlposition(c3,72,8); c4 = ctlbutton("Select All Lights",100,"all_lights"); ctlposition(c4,310,8); c6 = ctllistbox("Lights",175,240,"lights_count","lights_name"); ctlposition(c6,260,35); return if !reqpost(); sel_objs = getvalue(c1); sel_lights = getvalue(c6); light_switch = getvalue(c2); reqend(); if(!sel_objs) error("no objects were selected"); if(!sel_lights) error("no lights were selected"); foreach(p,sel_objs) { SelectItem(objID[p]); foreach(q,sel_lights) { if(light_switch == 2) ExcludeLight(lightID[q]); else IncludeLight(lightID[q]); } } } all_objects { setvalue(c1,obj_names); } all_lights { setvalue(c6,lightnames); } objects_count { return(obj_names.size()); } objects_name: index { return(obj_names[index]); } lights_count { return(lightnames.size()); } lights_name: index { return(lightnames[index]); }