macroScript ChannelCleaner category:"Titus_Scripts" buttonText:"ChannelCleaner" toolTip:"Cleans channels in several ways" Icon:#("UVWUnwrapView" ,19) ( rollout ChCleaner_Rollout "Channel Cleaner" width:200 height:210 ( groupBox grp1 "Select mode" pos:[5,5] width:190 height:90 spinner spn1 "Channel: " pos:[20,50] width:75 height:16 enabled:false type:#integer scale:1 range:[0,99,0] fieldWidth:25 spinner spn2 "From:" pos:[110,50] width:75 height:16 enabled:false type:#integer scale:1 range:[0,98,0] fieldWidth:25 spinner spn3 "To:" pos:[110,70] width:75 height:16 enabled:false type:#integer scale:1 range:[1,99,1] fieldWidth:25 checkbox chk2 "Convert to Poly" pos:[15,140] width:105 height:21 enabled:true checkbox chk3 "Clean Vertex Alpha" pos:[15,120] width:110 height:21 enabled:true checkbox chk4 "Clean Vertex Illum" pos:[15,100] width:105 height:21 enabled:true button btn1 "Clean selected" pos:[5,165] width:190 height:35 button btn2 "Info" pos:[155,100] width:40 height:58 tooltip: "Open channel info tool" radioButtons rdo1 "" pos:[30,25] width:100 height:30 labels:#("Clean one", "Clean Batch") columns:2 default:0 tooltip:"Press LMB to select cleaning mode, Or Press RMB to disable" on rdo1 changed stat do ( if rdo1.state==1 do ( spn1.enabled = true spn2.enabled = false spn3.enabled = false ) if rdo1.state==2 do ( spn1.enabled = false spn2.enabled = true spn3.enabled = true ) ) on rdo1 rightClick do ( rdo1.state = 0 spn1.enabled = false spn2.enabled = false spn3.enabled = false ) on spn2 changed val do ( if val >= spn3.value do spn2.value = spn3.value-1 ) on spn3 changed val do ( if val <= spn2.value do spn3.value = spn2.value+1 ) on btn2 pressed do ( macros.run "Tools" "Channel_Info" ) on btn1 pressed do ( for o in $selection do ( if classof o.baseObject == editable_poly or classof o.baseObject == Editable_mesh then ( if rdo1.state == 1 do (channelInfo.ClearChannel o spn1.value) if rdo1.state == 2 do (for i = spn3.value to spn2.value by -1 do channelInfo.ClearChannel o i) if chk3.state==true do (channelInfo.ClearChannel o -2) if chk4.state==true do (channelInfo.ClearChannel o -1) if chk2.state==true do (convertToPoly o) ) else ( continue ) ) ) ) createdialog ChCleaner_Rollout )