MaxScript
Unwrella includes an interface to MAXScript, allowing you to control the plug-in through scripts. This can be used to automate modifier setup, batch-process objects, and integrate Unwrella into production pipelines.
Some previously available properties have been deprecated to simplify the plug-in. These properties can still be used without causing errors, but they no longer affect the plug-in operation.
Properties
The properties for Unwrella instances correspond to the options available in the user interface. They allow you to retrieve and set the values used by Unwrella.
General
Unwrella.combine : BooleanIf this option is enabled, all objects that share the same modifier instance are unwrapped together into the same UV space, so they do not overlap each other.
If disabled, each object is handled individually, without considering other objects that share the same modifier instance.
Unwrella.unwrap_mode : IntegerUnwrap mode used by Unwrella:
0— Standard unwrap mode optimized for organic shapes1— Unwrap mode for hard-surface shapes2— Pack existing UV data without unwrapping3— Projection unwrap for directional area optimization
Unwrap Options
Unwrella.stretch : FloatThe amount of stretching allowed.
0means no stretching is allowed1means any amount of stretching can be used
Unwrella.keep_seams : BooleanIf True, the unwrapping process retains existing seams as long as the current constraints allow.
If False, all existing seams are discarded and Unwrella places new seams automatically.
Unwrella.source_channel : IntegerDefines the map channel from which existing seams are taken when keep_seams is True.
This property has no effect when keep_seams is False.
Unwrella.map_channel : IntegerDestination map slot. This is where the generated UV map will be stored.
Unwrella.use_ridges : BooleanIf True, the unwrapping process automatically adds seams to edges at ridges between mesh faces.
Unwrella.ridge_angle : FloatDefines the angle used for automatic ridge seams.
Unwrella.use_grooves : BooleanIf True, the unwrapping process automatically adds seams to edges at grooves between mesh faces.
Unwrella.groove_angle : FloatDefines the angle used for automatic groove seams.
UV Sheet
Unwrella.width : IntegerTexture width of the UV and the baked map.
Unwrella.height : IntegerTexture height of the UV and the baked map.
Unwrella.padding : FloatDistance between charts in the texture.
Projection Unwrap
Unwrella.camera : ObjectThe object used to determine the view location and direction.
This does not need to be an actual 3ds Max camera; any object can be used.
Unwrella.camera_fov : FloatThe view angle of the camera object.
Unwrella.camera_orthogonal : BooleanWhen set to True, an orthogonal projection is used and the view angle is ignored.
Unwrella.camera_extend : FloatThe tolerance angle for which backfacing polygons are included in the projection unwrap.
UV Packing Engine
Unwrella.packmode : IntegerSpecifies the packing engine used.
0— Classic1— Efficient2— High Quality
Unwrella.rescale : BooleanIf this is True, the individual 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 : BooleanDetermines if each chart should be individually rotated into an optimized base rotation.
Pre-rotation is independent of the rotation setting below.
Unwrella.rotation : IntegerDetermines 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 : BooleanWith this option enabled, rotations also allow counterparts for each rotation step that are rotated by 180 degrees.
This can improve the quality of packing results, but has a notable performance impact.
UV Tiles
Unwrella.uvtile_x : IntegerThe number of horizontal tiles along the U coordinate.
Unwrella.uvtile_y : IntegerThe number of vertical tiles along the V coordinate.
Unwrella.create_materialid : BooleanIf this is True, each face receives a material ID depending on the tile it is unwrapped into.
This overwrites any material IDs that might already exist on the object.
Unwrella.distribute_materialid : BooleanThis 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 the individual charts.
Options
Unwrella.preview : BooleanA UV template will be rendered as a preview of the unwrapped map.
Unwrella.viewport_seams : BooleanSeams are rendered in the viewport.
Unwrella.color_fill_charts : BooleanCharts in the UV preview will be filled with color.
Unwrella.color_draw_edges : BooleanEdges and seams of charts will be drawn in the UV preview.
Unwrella.color_background : fRGBA colorThe background color used in the UV preview.
Unwrella.color_edges : fRGBA colorThe line color for normal edges used in the UV preview.
Unwrella.color_charts : fRGBA colorThe fill color for charts used in the UV preview.
Unwrella.color_seams : fRGBA colorThe line color for chart seams used in the UV preview.
Results
Unwrella.success : BooleanIf True, the last executed unwrapping process finished successfully.
If False, it finished with an error.
Unwrella.error : StringIf any of the methods encountered an error and returned False, this property contains the error message.
Methods
The methods for Unwrella correspond to the buttons and informational outputs of the user interface.
<bool> Unwrella.unwrap()Unwraps with the current modifier settings.
Due to the way the plug-in works, this method cannot directly detect whether unwrapping succeeded or whether an error occurred.
After calling unwrap(), call the success property to retrieve the result. If success returns False, use the error property 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