Notifications
Clear all

[Closed] flaten selected model uvs one by one

hey guys im tryin to make a small script that will go through each selected model an apply a uv flatten i did a sudo version for one selection at time

i need to incorporate a selection increment

any help would be much apprecated

=============
try(DestroyDialog RL_Test)catch()
Rollout RL_Test “Quick UV”
(
button btn_ok “Ok”
on btn_ok pressed do
(
modPanel.addModToSelection (Unwrap_UVW ()) ui:on
subobjectLevel = 3
actionMan.executeAction 0 “40021”
subobjectLevel = 3
actionMan.executeAction 2077580866 “40047”
macros.run “Modifier Stack” “Convert_to_Mesh”
)
)
CreateDialog RL_Test

2 Replies

See if this works:


(
    
    try destroydialog ::RO_QUICK_UV_FLATTEN catch()
    
    rollout RO_QUICK_UV_FLATTEN "Quick UV" width:148 height:184
    (
        spinner  spn1 "Polygon Angle:"     pos:[ 8,  8] fieldwidth:48 range:[0,180,45]
        spinner  spn2 "Spacing:"           pos:[39, 32] fieldwidth:48 range:[0,1,0.02]
        checkbox chk1 "Normalize Clusters" pos:[ 8, 64] checked:true
        checkbox chk2 "Rotate Clusters"    pos:[ 8, 80] checked:true
        checkbox chk3 "Fill Holes"         pos:[ 8, 96] checked:true
        checkbox chk4 "Convert To Mesh"    pos:[ 8,120] checked:true
        
        button   btn1 "Process Selection"  pos:[ 8,144] width:132 height:32
        
        on btn1 pressed do with undo off
        (
            setwaitcursor()
            
            angleThreshold = spn1.value
            normalList     = #([1,0,0], [-1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1])
            spacing        = spn2.value
            normalize      = chk1.checked
            layOutType     = 0
            rotateClusters = chk2.checked
            fillHoles      = chk3.checked
            
            max modify mode
            nodes = selection as array
            
            for j in nodes do
            (
                uvw = unwrap_uvw()
                addmodifier j uvw
                select j
                uvw.flattenMap angleThreshold normalList spacing normalize layOutType rotateClusters fillHoles 
            )
            
            if chk4.checked do converttomesh nodes
            
            setarrowcursor()
        )
        
    )
    
    createdialog RO_QUICK_UV_FLATTEN
    
)

OH man ill try this out thanks really appreciate it, worked like a charm