Problem manipulating UV coords with maxscript
Hey everyone,
I've been working on script which moves UVW map coordinates by specific Y offset. The goal is, that for each object matching criteria (e.g. $*a*) will move all faces of UV by -2 on Y axis.
This is what I tried :
_objs = $Sphere* _yOffset = -2 for _o in _objs where superClassOf _o == GeometryClass do ( PolyOp.SetFaceSelection _o #none --deselect all faces ConvertToPoly _o _unwrap = Unwrap_UVW() AddModifier _o _unwrap _unwrap.SelectFaces #{1..(PolyOp.GetNumFaces _o)} --select all faces _unwrap.MoveSelected [0, _yOffset, 0] --move by offset CollapseStack _o )
But there are some problems:
When executed, the script will only work if the object(s) is selected.
If the object(s) is(are) not selected the Unwrap modifier is added but the faces are either not selected or the UV coords are not moved.
Is there something I'm doing wrong?
Thanks.
Comments
Unwrap only works if the object it is applied to is the currently selected object and the unwrap modifier is the active modifier in the stack. For what you want to a better suited modifier is UVWXform which has no such limitations:
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters
Thank you, this works
Thank you, this works perfectly.