ScriptSpot

Forum topic · General Scripting

MaxScript for Unwrap UVW

By mambrus · 2023-06-13

Description

Hello everyone,

I am trying to automate my UV Unwrapping - but the script is not working properly.

Background:

I have several Objects with the exact same mesh - but after manipulating these models (scaling) I want to automate the pelt-mapping of the uvs.

Since all object have a copy of the same mesh, I simply tried to apply the "edit seams" of my pelt mapping and perform a "quick-peel", but the first step "applying edit seams" does not work.

Here is what I do:

for i in selection do (
--enter Unwrap modifier
i.modifiers[#Unwrap_UVW]

-- faces subobjectLevel
subobjectLevel = 3

--select all faces
i.modifiers[#Unwrap_UVW].unwrap6.selectFacesByNode #{1..57} i

--do planar mapping to clean up uv mapping
i.modifiers[#Unwrap_UVW].mappingMode 1
--and leave planar mapping mode again
i.modifiers[#Unwrap_UVW].mappingMode 0

--activate "edit seams"
-- missing ?? ... I dont know if I am missing out on this somehow?

--select seams
i.modifiers[#Unwrap_UVW].unwrap6.setPeltSelectedSeamsByNode #{18, 29, 37, 39..40, 46..47, 49, 51..52, 86, 88} i

--do quick peel
i.modifiers[#unwrap_uvw].LSCMInteractive 1

--flip uvs
actionMan.executeAction 2077580866 "40032" -- Unwrap UVW: Mirror Vertical

--rotate uvs
-- do manually

subobjectLevel = 0
)

--------------------
as a result I get a quick peel of the object but without any edited seams
thanks for your help