MAXScript

UV-Packer includes an interface to MAXScript, allowing you to control the plugin through your scripts in order to automate the use of the modifier even further and allow for convenient batch processing of objects.

Properties

The properties for UV-Packer instances correspond to the options that are adjustable in the user interface and allow you to retrieve and set all values that are used by UV-Packer.

UVPacker.channel : Integer

Target map slot. This is where the generated UV map will be stored. If the option for a separate source channel is not used this is also the channel where the input charts are taken from.

UVPacker.padding : Integer

Distance between charts in the texture.

UVPacker.width : Integer

Texture width of the UV and the baked map.

UVPacker.height : Integer

Texture height of the UV and the baked map.

UVPacker.use_source : Boolean

If True the input UV charts are not taken from the target map channel but from the one specified by source_channel.

UVPacker.source_channel : Integer

Defines the map channel from which the existing charts area taken when use_source is True. Has no effect when use_source is False.

UVPacker.rescale : Boolean

If this is True the indivudial charts are rescaled depending on the amount of mesh surface they cover. If this is False the relative sizes of the UV charts stay as they were before packing.

UVPacker.use_uvtiles : Boolean

If True the unwrapped charts will be distributed across multiple tiles beyond the 0.0 - 1.0 coordinate range. If False all charts will be placed within the 0.0 - 1.0 range.

UVPacker.uvtile_columns : Integer

The number of horizontal tiles along the U coordinate.

UVPacker.uvtile_maxtiles : Integer

The maximum number of tiles to be used. If more charts exist they will be grouped together automativally.

UVPacker.create_materialid : Boolean

If this is True each face will receive a material ID depending on the tile it’s packed into. This overwrites any material IDs that might already exist on the object.

UVPacker.show_preview : Boolean

A UV template will be rendered as a preview of the unwrapped map.

UVPacker.show_activity : Boolean

Enables or disables the activity window that’s shown while the plug-in is working.

UVPacker.success : Boolean

If True the last executed unwrapping process finished successfully. If False it finished with an error. This property is read-only, setting it has no effect.

UVPacker.error : String

If any of the methods encountered an error (and returned False) this property contains the error message. This property is read-only, setting it has no effect.

Methods

The methods for UV-Packer correspond to the buttons and informational outputs of the UI.

<bool> UVPacker.pack()

Packs with the current modifier settings. Due to the way the plug-in works this method can unfortunately not detect if packing the uv charts succeeded or an error occured! Call the property success after calling pack() to retrieve the result. If success returns False you can use the property error to retrieve the error message.

<bool> UVPacker.rotate_cw()

Rotates the generated UV map 90 degrees to the right.

<bool> UVPacker.rotate_ccw()

Rotates the generated UV map 90 degrees to the left.

<bool> UVPacker.flip_h()

Flips the packed UV map left to right.

<bool> UVPacker.flip_v()

Flips the packed UV map upside down.

Example Script

This example iterates through all selected objects, takes the UV data in map channel 1 as input, packs it and stores the results in map channel 2.

for obj in selection do
(
  p = UVPacker()
  addmodifier obj p
  p.show_preview = false
  p.use_source = true
  p.source_channel = 1
  p.channel = 2
  p.pack()
)