Skip to content

Sort

Sort
Utility

Sort takes one batch and gives back the same frames in a new order. Order matters in more places than it seems: the cells of a sprite sheet, the playback order of an animation, the {index} Export Batch writes into file names, the frames Split hands out one by one, and the rows of an Export Data file. At its defaults Sort puts frames in natural name order, so frame2 comes before frame10.

A library of 24 material swatches in a shuffled order, darks and lights mixed, beside the same swatches sorted by lightness, running from the darkest woods at the top left to the palest stone and snow at the bottom right

Sort copies no pixels. Every frame leaves exactly as it arrived, with its name, tags, swatch and place on its sheet, and a mask batch stays a mask batch. Only the order changes. Search the node palette for “sort”, “reorder”, “reverse”, “shuffle”, “frames” or “sequence”.

Image Folder 1 walk/ batch (x12) 12 files Sort 1 image (x12) image Number in Name Sprite Sheet 1 batch (x12) image Grid
Twelve walk-cycle frames put in the order of the number in their names, then laid out on a Grid sprite sheet in that order.
  1. Wire a batch into Sort: a folder of renders, frames cut by Trim Sheet or Separate, images gathered by Collect.
  2. Wire Sort into whatever reads the order: Sprite Sheet, Export Batch, Split, or the Preview with the Playback Bar on.
  3. The node starts on Sort By Name, A to Z. The Order list at the bottom of the panel shows every frame in its new order with its key value beside its name.
  4. Pick another key or flip the direction, and the list and the Preview follow.

Sort By picks what puts the frames in order:

GroupKeyWhat it reads
NameNameThe frame’s name, in natural order: walk_2 before walk_10.
Number in NameThe last run of digits in the name, as a number. Names with no number go after the numbered ones.
TagThe value of a tag you name, compared naturally. The Tag row lists the tags the incoming frames carry, and you can type one that is not there yet.
SizeWidth, Height, AreaThe frame’s size in pixels.
Content AreaThe size of the frame’s non-transparent part: a sprite’s real size inside its padding.
ColorLightnessHow light the frame is.
HueIts place on the color wheel (see Hue and Color Families).
ChromaHow vivid it is.
Near ColorHow close it is to the color in the Color row, red at first.
LikenessSimilar ToHow much the frame looks like a reference frame (see Similar To).
OrderSheet PositionWhere the frame was cut from its sheet, in reading order (see Sheet Position).
Current OrderThe order the frames arrive in. Flipped, it reverses the batch.
RandomA shuffle. The same Seed gives the same order every time on this node; a duplicated Sort shuffles differently. When frames arrive or leave, the frames that stay keep their order.

The direction buttons say which way the key runs in the picture’s own words: A to Z, 1 to 9, Small to Large, Dark to Light, Dull to Vivid, Near to Far, Top to Bottom or First to Last, and their reverses. Hue has its ramp instead, and Random has no direction. Frames with equal keys keep the order they arrived in.

The color keys measure each frame once and remember the result, so changing the direction, Then By or a hand move never measures again. Measure picks which color is read: Average, the mean color, or Dominant, the most common one. The average of a red and green check is brown; its dominant color is red or green. Both are weighted by alpha, so a sprite’s transparent background never counts, and colors are measured the way the eye sees them whatever the document’s working space.

The Sort panel under Sort By Hue: the hue ramp with a tick for every frame, Then By Lightness, Color Families on at 12, and the Order list below

Under Sort By Hue, the direction buttons give way to a hue ramp: a strip of the color wheel with a tick for each frame at its hue.

  • Auto Start (on) starts the ramp at the widest empty gap among the frames’ hues, so a family of reds is never cut in two between the start and the end.
  • Turn it off to set Start in degrees, or drag the start marker on the ramp.
  • Reverse runs the ramp the other way around the wheel.
  • Grays, whites and blacks have no meaningful hue. They go after the colored frames, darkest first, and a line under the ramp counts them.

Two frames almost never share a hue exactly, so a second key alone would rarely change anything under Hue. Color Families splits the wheel into equal slices, reds, oranges, yellows and so on, and Then By orders the frames inside each slice. The number beside the switch sets how many families, 2 to 64, 12 at first. Hue in 12 families, then by Lightness Dark to Light, is the classic way to lay out a palette or a library of swatches: the colors run around the wheel, and each family runs from dark to light. Choosing a Then By while Sort By is Hue turns Color Families on.

A material library ordered by likeness to a mossy wood swatch, from other mossy and green surfaces first to smooth pale veneers last

Similar To orders the frames by how much each one looks like a reference frame, the most alike first with Near to Far. Right-click a frame in the Order list and choose Compare to This Frame to make it the reference; the list marks it with a target. With none picked, the first incoming frame is the reference.

The reference always leads, follows its frame through a re-sort or an upstream rename, and is compared with frames of any shape: each frame is fitted into the same small square first. Only what you can see counts: the color hidden under transparent pixels is ignored, so a sprite saved by two apps with different colors behind it is the same picture, and a fully transparent frame is still sorted, as an empty picture. If the reference leaves the batch, Sort compares with the first frame and says so, with a Clear button.

Sheet Position orders frames by where they were cut from their sheet, the way you read a page: the top row left to right, then the next row. It reads the place a Trim Sheet gives each frame, which every node that edits the frames keeps.

Row Tolerance decides when two frames share a row, comparing the vertical centers of their places as a share of the typical frame height (50% at first). Raise it when crops of one row have tops a few pixels apart and the order jumps between rows. Frames from different sheets stay grouped by sheet, and frames that were not cut from a sheet go after the placed ones.

Then By is an optional second key that orders the frames the first key leaves tied: Sort By Tag, then by Name, puts the frames of each pose in name order. It has its own direction, and its own Tag row, so “by category, then by index” can read two different tags. Outside Hue with Color Families, Then By only breaks exact ties.

The Sort node's Order list with a frame being dragged to a new place and two moved frames marked with pins

The Order list shows every frame in its output order: a thumbnail, the name and the key value (#10, 512 x 256, L 62, Hue 212, Dist 0.21, Row 2, 3). Its header counts the frames and how many you moved.

Drag a frame up or down to move it. The move is pinned: the frame stays right after the frame above the line. Every frame you have not moved keeps following the key, including frames that arrive later. Click, Shift-click and Ctrl-click (Cmd on macOS) select several frames to drag together.

  • A moved frame carries a pin. Right-click for Move to Start, Move to End, Unpin and Unpin All. Move to End keeps the frame last, before any failed frames, even as frames arrive or leave; a frame you drag below it is pinned after it and stays there.
  • Each move is one undo step, and moving a frame again replaces its earlier move.
  • Moves follow their frames, not their names, so renaming a frame upstream keeps its move. A move whose frame has left the batch falls back to key order, and a line says how many, with an Unpin All button.

For a completely hand-made order, set Sort By to Current Order and drag.

A frame that failed upstream, such as a file that did not load, goes last with the error glyph on its row. A frame that was not baked (a material whose eye is closed in Model Maps) goes last with them. A frame with no value for the key (no such tag, no place on a sheet, a fully transparent frame under a color key) goes after the frames that have one and before the failed frames, and a line in the panel counts them.

  • Late in the chain. Every re-sort cooks every frame of every node downstream again, so sorting just before the node that needs the order keeps a key change cheap.
  • Sorting before a packed sheet changes nothing on Tight. Sprite Sheet’s Pack Mode Tight, and Export Batch’s sheet on Tight, place the largest frames first whatever order they arrive in. Set Pack Mode to Grid to get the sheet in your order, row by row.
  • Two batches pair by position. Merge or Layer with a batch on each input pairs the first frame of one with the first of the other. Sort one batch and not the other and the frames pair up wrong without a warning, so sort once before the batch branches.

Sort takes a library of texture sets as well as a batch of images, and the library leaves on the same kind of pin. The size keys read each set’s size. The color and likeness keys read one map of each set, chosen by Measure Map (Base Color at first); a set without that map is measured on its Base Color, else its first map.

A single image is not a batch: the panel reads One image: nothing to sort. and the image passes through.

Pins

ImagePixels or Texture
InputOptional
ImagePixels or Texture
Output

Sort

Sort ByChoice
Default: Name Range: Name / Number in Name / Tag / Width / Height / Area / Content Area / Lightness / Hue / Chroma / Near Color / Similar To / Sheet Position / Current Order / Random

What puts the frames in order.

  • Name: natural order, so frame2 comes before frame10.
  • Number in Name: the last number in each name.
  • Tag: the value of a tag you name.
  • Width, Height, Area, Content Area: the frame's size; Content Area counts only its non-transparent bounds.
  • Lightness, Hue, Chroma, Near Color: the frame's color.
  • Similar To: how much each frame looks like a frame you pick.
  • Sheet Position: where the frame was cut from its sheet, row by row.
  • Current Order: the order the frames arrive in.
  • Random: a shuffle you can repeat with the Seed.
TagText
Sort By = Tag

The tag whose value orders the frames, compared naturally. Frames without it go after the tagged frames

DirectionChoice
Default: The first button (A to Z, Small to Large, Dark to Light...) Range: Two buttons in the key's own words, such as A to Z or Z to A
Sort By = Name, Number in Name, Tag, Width, Height, Area, Content Area, Lightness, Chroma, Near Color, Similar To, Sheet Position or Current Order

Which way the key runs, in the key's own words: A to Z, 1 to 9, Small to Large, Dark to Light, Dull to Vivid, Near to Far, Top to Bottom or First to Last, or the reverse

Auto StartToggle
Default: true
Sort By = Hue

Start the hue ramp at the widest empty gap among the frames' hues, so no family of colors is cut in two. Off uses Start

StartNumber
Default: 0 Range: 0–360
Sort By = Hue

The hue the ramp starts from, in degrees. Used while Auto Start is off

ReverseToggle
Default: false
Sort By = Hue

Run the hue ramp the other way around the color wheel

MeasureChoice
Default: Average Range: Average / Dominant
Sort By or Then By is Lightness, Hue, Chroma or Near Color

Which color of a frame a color key reads.

  • Average: the mean color, weighted by alpha, so a transparent background never counts.
  • Dominant: the most common color, for textures of several colors whose average would be a muddy mix.
ColorColor (RGB)
Default: rgb(255, 0, 0)
Sort By or Then By is Near Color

The color Near Color measures each frame's distance to

Reference FrameText
Sort By or Then By is Similar To

The frame Similar To compares every frame with. Right-click a frame in the Order list to pick it; empty compares with the first frame

Row ToleranceNumber
Default: 50 Range: 0–100
Sort By or Then By is Sheet Position

How far apart two frames' centers can sit and still share a row, as a share of the typical frame height. Raise it for crops whose tops are a few pixels apart

SeedInteger
Default: 0 Range: 0–2147483647
Sort By or Then By is Random

Picks the shuffle. The same seed repeats the same order on this node; a duplicated Sort shuffles differently. When frames arrive or leave, the frames that stay keep their order

Then By

Then ByChoice
Default: None Range: None / Name / Number in Name / Tag / Width / Height / Area / Content Area / Lightness / Hue / Chroma / Near Color / Similar To / Sheet Position / Random

A second key that orders frames the first key leaves tied, or, under Hue with Color Families on, the frames inside each family

TagText
Then By = Tag

The tag Then By reads, compared naturally. Frames without it go after the tagged frames among their ties

DirectionChoice
Default: The first button (A to Z, Small to Large, Dark to Light...) Range: Two buttons in the key's own words, such as A to Z or Z to A
Then By = Name, Number in Name, Tag, Width, Height, Area, Content Area, Lightness, Hue, Chroma, Near Color, Similar To or Sheet Position

Which way Then By's key runs, in the key's own words

Color FamiliesToggle
Default: false
Sort By is Hue and Then By is set

Splits the hue ramp into equal families of similar colors; Then By orders the frames inside each family. 12 families, then Dark to Light, lays out a palette

Family CountInteger
Default: 12 Range: 2–64
Sort By is Hue and Then By is set

How many equal families the hue ramp is split into, across the hues this batch actually uses

Texture Set

Measure MapChoice
Default: Base Color Range: Base Color / Normal / Roughness / Metallic / Ambient Occlusion / Height / Opacity / Emissive
Texture sets wired, with a color or likeness key

Which map of each texture set the color and likeness keys read. A set without it is measured on its Base Color, else its first map

  • Sort By Number in Name fixes rendered sequences whose names were not zero-padded.
  • Hue in 12 Color Families, then Lightness Dark to Light, lays out a swatch library the way a color chart does.
  • Put Sort right before Sprite Sheet on Pack Mode Grid; on Tight the order is ignored.
  • For an animation, check the result with the Playback Bar before exporting.