PDA

View Full Version : call Pack UVs from MXS?


EricChadwick
06-16-2006, 08:31 PM
I'm using output from the Macro Recorder, and it works for the most part. Only problem is it doesn't seem to be able to call the Pack UVs function.

As you can see, I'm totally inexperienced with MXS, but I am starting to take some first steps...


/*

This tool:
1. Copies the selected object.
2. Collapses to Editable Mesh.
3. Adds UVWMap set to 99.
4. Copies UV 1 to UV 99.
5. Sets the whole mesh to material ID 1.
6. Adds UVWUnwrap set to 99.
7. Selects all the faces.
8. Does a Recursive Pack.

*/

macroScript UV99_Prep
category:"Eric"
toolTip:"Prep uv 99"
buttonText:"uv99"
(
maxOps.cloneNodes $ cloneType:#copy newNodes:&nnl
select nnl -- select clone
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Mapping].mapChannel = 99
macros.run "Tools" "Channel_Info"
channelInfo.Update ()
channelInfo.CopyChannel $ 3 1
channelInfo.PasteChannel $ 3 99
channelInfo.NameChannel $ 3 99 "-none-"
macros.run "Modifiers" "Material_ID"
$.modifiers[#Material].materialID = 1
macros.run "Modifier Stack" "Convert_to_Mesh"
modPanel.addModToSelection (Unwrap_UVW ()) ui:on
$.modifiers[#unwrap_uvw].unwrap.setMapChannel 99
subobjectLevel = 3
modPanel.setCurrentObject $.modifiers[#Unwrap_UVW]
subobjectLevel = 3
actionMan.executeAction 0 "40021" -- Selection: Select All
max select all
actionMan.executeAction 2077580866 "40074" -- All Commands: Pack
subobjectLevel = 3
)


Thanks for any help.

Light
06-17-2006, 12:53 AM
Hey Eric,

How are you doing?

You can use pack fn to do that. For example this can be used to pack UVs with default settings:

selection[1].modifiers[1].pack 1 0.02 true false false

This is the syntax:

pack method(0-1) spacing(float) normalize(boolean) rotate(boolean) fillHoles(boolean)




Light

Bobo
06-17-2006, 01:44 AM
I'm using output from the Macro Recorder, and it works for the most part. Only problem is it doesn't seem to be able to call the Pack UVs function.


Eric, a friendly advice: don't use the MacroRecorder. It is like using Babelfish to translate an important business contract - it will not work and might cause more problems than it solves ;)
Learn scripting instead...

EricChadwick
06-19-2006, 03:56 PM
Hi Light, thanks for the snippet!

Thanks Bobo, yeah I've heard this before. I'll be diving into the Learning MXS section of the ref file soon.

CGTalk Moderation
06-19-2006, 03:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.