MAXScript

Unwrella 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.

Some of the previously available properties have been deprecated to simplify usage of the plug-in. Those properties can still be used without causing an error but they will no longer affect the plug-in operation.

Properties

The properties for Unwrella 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 Unwrella.

Unwrella.combine : Boolean

If this option is enabled all objects that share the instance of the modifier will be unwrapped together into the same uv space so that they don’t overlap each other. If it is disabled each object is handled individually without considering other objects that share the same modifier instance.

Unwrella.unwrap_mode : Integer

Unwrap mode used by Unwrella: 0 - Standard unwrap mode optimized for organic shapes, 1 - Unwrap mode for hard surface shapes, 2 - Pack existing uv data without unwrapping, 3 - Projection unwrap for directional area optimization.

Unwrap Options

Unwrella.stretch : Float

The amount of stretching allowed. 0 means no stretching is allowed, 1 means any amount of stretching can be used.

Unwrella.keep_seams : Boolean

If True the unwrapping process will retain already existing seams as long as the given constraints allow. If False all already existing seams are discarded and Unwrella places new seams autonomously.

Unwrella.source_channel : Integer

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

Unwrella.map_channel : Integer

Destination map slot. This is where the generated UV map will be stored.

Unwrella.use_ridges : Boolean

If True the unwrapping process will automatically add seams to edges at ridges between mesh faces.

Unwrella.ridge_angle : Float

Defines the angle used for the automatic ridge seams.

Unwrella.use_grooves : Boolean

If True the unwrapping process will automatically add seams to edges at grooves between mesh faces.

Unwrella.groove_angle : Float

Defines the angle used for the automatic groove seams.

UV Sheet

Unwrella.width : Integer

Texture width of the UV and the baked map.

Unwrella.height : Integer

Texture height of the UV and the baked map.

Unwrella.padding : Float

Distance between charts in the texture.

Projection Unwrap

Unwrella.camera : Object

The object that is used to determine view location and direction. Does not have to be an actual 3ds Max camera, any object works.

Unwrella.camera_fov : Float

The view angle of the camera object.

Unwrella.camera_orthogonal : Boolean

When set to true an orthogonal projection ignoring the view angle is used.

Unwrella.camera_extend : Float

The tolerance angle for which backfacing polygons are included in the projection unwrap.

UV Packing Engine

Unwrella.packmode : Integer

Specifies tha packing engine used.

0: Classic

1: Efficient

2: High Quality

Unwrella.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.

Unwrella.prerotate : Boolean

Determines if each chart should be indivdiually rotated into an optimized base rotation. Prerotation is independent of the rotation setting below.

Unwrella.rotation : Integer

Determines the angle steps that each chart gets rotated by to place it better into the UV map. The values 0 to 3 correspond to the buttons in the user interface. A higher value allows for more fine grained rotation steps.

Unwrella.full_rotation : Boolean

With this option enabled rotations will allow counterparts for each rotation steps that are rotated by 180 degrees. This can improve the quality of pack results but has a notable performance impact.

UV Tiles

Unwrella.uvtile_x : Integer

The number of horizontal tiles along the U coordinate.

Unwrella.uvtile_y : Integer

The number of vertical tiles along the V coordinate.

Unwrella.create_materialid : Boolean

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

Unwrella.distribute_materialid : Boolean

This defines how UV charts are distributed across the tiles. If the value is True charts are distributed by Material ID and each id gets its own tile. If False charts are distributed automatically based on the number of provided tiles and the sizes of individual charts.

Options

Unwrella.preview : Boolean

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

Unwrella.viewport_seams : Boolean

Seams are rendered in the viewport.

Unwrella.color_fill_charts : Boolean

Charts in the UV preview will be filled with color.

Unwrella.color_draw_edges : Boolean

Edges and seams of charts will be drawn in the UV preview.

Unwrella.color_background : fRGBA color

The background color used in the UV preview.

Unwrella.color_edges : fRGBA color

The line color for normal edges used in the UV preview.

Unwrella.color_charts : fRGBA color

The fill color for charts used in the UV preview.

Unwrella.color_seams : fRGBA color

The line color for chart seams used in the UV preview.

Results

Unwrella.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.

Unwrella.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 Unwrella correspond to the buttons and informational outputs of the UI.

<bool> Unwrella.unwrap()

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

Example Script

This example creates a sphere, applies the modifier to it and unwraps it with a very small amount of stretching.

s = Sphere()
u = Unwrella()
addModifier s u
u.stretch = 0.005
u.padding = 1
u.width = 1024
u.height = 1024
u.high_quality = true
u.preview = false
u.keep_seams = false
u.polygonal = true
u.unwrap()
if not u.success then print u.error