0.9.0-beta.27Beta

Released

Added

  • Agents can export a frame's parts as game sprites. A new tool, export_sprites, exports every direct child of a frame, component, instance or group in one call: packed into one atlas PNG, each part trimmed to its pixels, or one PNG per part, either on the frame's canvas so the layers line up when stacked or cropped to each part. A manifest always comes with it: TexturePacker's JSON Hash by default, which PixiJS, Phaser and Unity importers read as it is, or a JSON Array, or a Spine atlas. It gives each sprite's name, pixel rect, untrimmed size and pivot, and each part's place in the frame. Costume variants that share part names share one atlas, keyed Red/Head and Blue/Head. Layers named _…, hidden layers and masks are left out, and two parts with the same name are refused, with their ids, rather than numbered. The files land in the project's exports/ folder, written whole or not at all, and the same document always gives the same bytes. Agents need the render permission, as for export_image; it works in view only. An agent with the edit permission can store a frame's settings, for the next export and for the CLI, with edit_document's spriteExport. The Inspector, menu and Dev Mode come later. (#318)
  • A pivot on any layer. A layer can turn about a point you choose instead of its centre: set it in the Inspector's new Pivot row, under Rotation (X and Y in percent of the layer, or one of nine points from its menu), or drag its ring on the canvas, where it snaps to the layer's corners and edges, to its neighbours' pivots and to their path points, so a forearm's pivot lands on the upper arm's elbow; Shift turns snapping off and a double-click on the ring removes it. Every way of rotating then turns the layer about it: the Rotation field, the rotate knob, Rotate 90° and agents, which all land it in the same place. A layer without a pivot rotates exactly as before. An instance uses its main component's pivot until you give it its own. Dev Mode shows it under the Box, as transform-origin in the CSS and in get_dev_spec, and agents set it with edit_document's pivot ({x, y} or a point such as "bottom"). A sprite export writes it into the manifest. (#317)
  • Export sprites from the Inspector and the File menu. A frame, component, instance or group with layers in it now has a Sprites section after Export: atlas or files, the frame's size or each part's, scales 1× to 4×, the manifest, the pivot origin for Unity and more options, saved on the frame as one undo step so the next export, an agent and the CLI use them. It lists the parts with their sizes, warns about two parts with one name (and turns the button off), a part cut by the frame's edge and default names, with Select them. Export 7 sprites… asks for a folder once and remembers it for that document on this PC, never in the file; after that it reads Export again to Art, with Change folder… beside it. File › Export › Sprites… does the same, and Dev Mode has a Sprites section with Export… and Copy manifest. The files are byte for byte what export_sprites and the CLI write. (#318)
  • The CLI exports sprites for a build script. polyform export game.poly --frame Hero --sprites exports one frame with its stored settings or the flags given (--atlas or --files, --canvas, --scale 1,2, --manifest, --pivot-origin), and --all-sprites --out assets/sprites exports every frame that has sprite settings, one folder each. It exits 0 when written, 1 on an error and 2 when refused (duplicate names, an atlas too big), and then writes nothing. Files in the folder that it didn't write, such as Unity's .meta files, are left alone. (#318)

Fixed

  • A rotation linked to a variable turns about the pivot. A layer with a pivot whose rotation is linked to a variable used to turn about its centre when the variable's mode changed, so a rig's joint came apart. It now turns about its pivot, as every other way of rotating does, and switching back puts it exactly where it was. Undoing Apply Variable on such a layer puts back its position too. (F-375, #327)
  • A CLI export prints only its own lines. Every polyform export (and every other CLI command that opens a file) also printed Electron's "No handler registered for 'crash:context'" error with two lines of stack, which a build script that treats any output on stderr as a failure would stop on. It is gone; stderr carries only the CLI's own progress line and messages. (F-374, #326)
  • The Scale tool's label stays in view. While you drag with the Scale tool or hold K, the label by the pointer ("×1.50 · 600 × 480") used to run under the Inspector near the canvas's right edge, and under the bottom bar near the bottom. It now moves to the other side of the pointer where it wouldn't fit, and stays inside the canvas even when the pointer leaves it. (F-372, #324)