Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
105 lines (69 sloc) 2.41 KB

Range

This class is used to represent the range of selected objects in the timeline.

Timeline Example

It can be:

  • A list of layers
  • A list of frames
  • A list of cels

Or a combination of those.

Range.type

local type = app.range.type

Returns a RangeType.

Range.isEmpty

local booleanResult = app.range.isEmpty

Returns true if the range is empty, i.e. there is no selected range in the timeline (a thick border in the timeline), only the active cel in the sprite editor.

This is the same as asking for app.range.type == RangeType.EMPTY.

Note that if the range is empty, you can still use Range.layers to get the active layer (the Range.layers property will be an array of one element, just the active layer). The same is true for Range.frame and app.activeFrame, Range.cel and app.activeCel, etc.

Range.sprite

Sprite to which this range is pointing to.

Range.layers

Returns an array of selected layers.

Range.frames

Returns an array of selected frames.

Range.cels

Returns an array of selected cels.

Range.images

Returns an array of selected images (images from linked cels are counted just one time in this array).

Range.editableImages

Returns an array of selected images in the range that are in unlocked layers (editable).

Range.colors

local selectedColors = app.range.colors
app.range.colors = { ... }

Gets or sets the array of selected palette entries in the color bar. Each element of the array is an integer (the palette index)

Example to select the colors with index 0 and 3 in the color bar:

app.range.colors = { 0, 3 }

Range:contains()

local hasLayer = app.range:contains(layer)
local hasFrame = app.range:contains(frame)
local hasCel = app.range:contains(cel)

Returns true if the given object (layer/frame/cel) is inside the selected range.

Range:containsColor()

local hasColor = app.range:containsColor(colorIndex)

Returns true if the given color index is selected in the color bar.

You can’t perform that action at this time.