Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Rotate UVW's
  RSS 2.0 ATOM  

Rotate UVW's
Rate this thread
 
42294
 
Permlink of this thread  
avatar
  • Total Posts: 199
  • Joined: 30 June 2008 12:56 PM

I’m trying to rotate selected Faces by 45 degree increments using maxscript, but getting quirky results.
The usual workflow is add unwrap UVW, select face, enable angle snap, select rotate then rotate the selection in the editor.

I have shorcuts for the Flip Vertical and Flip Horizontal, these work without having to open the editor, is it possible to do the same with rotate ?

tia



Replies: 1
/userdata/avatar/avatar_14884.gif

obj.unwrap_uvw.unwrap2.rotateSelected float_angle point3_axis
obj.unwrap_uvw.unwrap2.rotateSelectedCenter float_angle

float_angle: is based on radians so you may want to call (degToRad 45.0) to convert the angles from degrees to radians.

point3_axis: is user defined center in uv space, if you don’t want to use the selection center.

-Eric

EDIT: you may need to enable Constant Update to see the changes without opening the edit dialog. obj.unwrap_uvw.unwrap.setConstantUpdate true

Author: PiXeL_MoNKeY

Replied: 26 April 2010 06:32 AM  
avatar

Here is code I just wrote very recently to add an Unwrap, select all the faces, and do a quick planar map, and I didn’t have to have the Edit window open.

modPanel.addModToSelection (Unwrap_UVW ())  before:(obj.modifiers.count)
 modPanel
.setCurrentObject obj.modifiers[#Unwrap_UVW] node:obj
 
obj.unwrap_uvw.unwrap.setMapChannel 99
 
--obj.unwrap_uvw.unwrap.setMapChannel 99

subObjectLevel 
3

--Select All Faces
actionMan
.executeAction 0 "40021"

--Planar map to reset face breaks if need be
 obj
.Unwrap_UVW.planarMap() 
 
--Flatten Mapping
 obj
.Unwrap_UVW.flattenMap 45.0 #() 0.00 true 0 true true

subObjectLevel 0
 
--Collapse the stack  (Use Collapse toto preserve the stack)
maxOps
.CollapseNodeto  obj ( obj.modifiers.count) true


Replies: 0