Add color-coding for merged and ignored layers.
This commit is contained in:
parent
02e0c89562
commit
ec8e131829
|
@ -1,6 +1,52 @@
|
||||||
-- New commands to be executed via Aseprite menus / keyboard shortcuts
|
-- New commands to be executed via Aseprite menus / keyboard shortcuts
|
||||||
local sprt = require "abase-sprite"
|
local sprt = require "abase-sprite"
|
||||||
|
|
||||||
|
local BASE_COLOR = Color {
|
||||||
|
r = 0,
|
||||||
|
g = 0,
|
||||||
|
b = 0,
|
||||||
|
a = 0
|
||||||
|
}
|
||||||
|
local IGNORE_COLOR = Color {
|
||||||
|
gray = 100
|
||||||
|
}
|
||||||
|
local IGNORE_SUBCOLOR = Color {
|
||||||
|
gray = 150
|
||||||
|
}
|
||||||
|
local MERGE_COLOR = Color {
|
||||||
|
r = 200,
|
||||||
|
g = 200,
|
||||||
|
b = 0
|
||||||
|
}
|
||||||
|
local MERGE_SUBCOLOR = Color {
|
||||||
|
r = 200,
|
||||||
|
g = 200,
|
||||||
|
b = 128
|
||||||
|
}
|
||||||
|
|
||||||
|
-- set the color of a layer and its sublayers
|
||||||
|
local function setColor(layer, subColor)
|
||||||
|
if (layer.properties(extKey).ignored) then
|
||||||
|
layer.color = IGNORE_COLOR
|
||||||
|
subColor = IGNORE_SUBCOLOR
|
||||||
|
elseif subColor == IGNORE_SUBCOLOR then
|
||||||
|
layer.color = subColor
|
||||||
|
elseif (layer.properties(extKey).exportedAsSprite) then
|
||||||
|
layer.color = MERGE_COLOR
|
||||||
|
subColor = MERGE_SUBCOLOR
|
||||||
|
elseif subColor == MERGE_SUBCOLOR then
|
||||||
|
layer.color = subColor
|
||||||
|
else
|
||||||
|
layer.color = BASE_COLOR
|
||||||
|
end
|
||||||
|
|
||||||
|
if (layer.isGroup) then
|
||||||
|
for i, sublayer in ipairs(layer.layers) do
|
||||||
|
setColor(sublayer, subColor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function ExportSpritesheetAdvanced()
|
local function ExportSpritesheetAdvanced()
|
||||||
if not app.sprite then
|
if not app.sprite then
|
||||||
return app.alert "Must have a sprite open to export."
|
return app.alert "Must have a sprite open to export."
|
||||||
|
@ -26,6 +72,7 @@ local function ToggleIgnore()
|
||||||
else
|
else
|
||||||
layer.properties(extKey).ignored = true
|
layer.properties(extKey).ignored = true
|
||||||
end
|
end
|
||||||
|
setColor(layer)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ToggleExportAsSprite()
|
local function ToggleExportAsSprite()
|
||||||
|
@ -35,6 +82,7 @@ local function ToggleExportAsSprite()
|
||||||
else
|
else
|
||||||
layer.properties(extKey).exportedAsSprite = true
|
layer.properties(extKey).exportedAsSprite = true
|
||||||
end
|
end
|
||||||
|
setColor(layer)
|
||||||
end
|
end
|
||||||
|
|
||||||
local export = {
|
local export = {
|
||||||
|
|
|
@ -19,7 +19,8 @@ To install, go to Aseprite's Settings -> Extensions -> Add Extension, and select
|
||||||
|
|
||||||
## Additional Notes
|
## Additional Notes
|
||||||
|
|
||||||
* Toggling the advanced export settings on a layer will modify the layer colors. (This may be configurable in a future update)
|
* Toggling the advanced export settings on a layer will modify the layer colors. If you are using layer colors for other purposes, this extension will not work well for you. (This may be configurable in a future update)
|
||||||
|
* Ignored layers always take precedence over merging; if a sublayer in a group is ignored, it will not be merged into the final sprite.
|
||||||
|
|
||||||
|
|
||||||
## Copyright Notice
|
## Copyright Notice
|
||||||
|
|
Loading…
Reference in New Issue
Block a user