mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-24 03:40:14 +00:00
Fix UnlinkCel command to support layer groups
This commit is contained in:
parent
47eeb4f564
commit
19b31ff31a
@ -16,7 +16,6 @@
|
|||||||
#include "app/modules/gui.h"
|
#include "app/modules/gui.h"
|
||||||
#include "app/transaction.h"
|
#include "app/transaction.h"
|
||||||
#include "app/ui/status_bar.h"
|
#include "app/ui/status_bar.h"
|
||||||
#include "app/ui/timeline.h"
|
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
@ -53,22 +52,16 @@ void UnlinkCelCommand::onExecute(Context* context)
|
|||||||
{
|
{
|
||||||
Transaction transaction(writer.context(), "Unlink Cel");
|
Transaction transaction(writer.context(), "Unlink Cel");
|
||||||
|
|
||||||
// TODO the range of selected frames should be in doc::Site.
|
const Site* site = writer.site();
|
||||||
auto range = App::instance()->timeline()->range();
|
if (site->inTimeline() &&
|
||||||
if (range.enabled()) {
|
!site->selectedLayers().empty()) {
|
||||||
Sprite* sprite = writer.sprite();
|
for (Layer* layer : site->selectedLayers()) {
|
||||||
|
|
||||||
for (LayerIndex layerIdx = range.layerBegin(); layerIdx <= range.layerEnd(); ++layerIdx) {
|
|
||||||
Layer* layer = sprite->indexToLayer(layerIdx);
|
|
||||||
if (!layer->isImage())
|
if (!layer->isImage())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LayerImage* layerImage = static_cast<LayerImage*>(layer);
|
LayerImage* layerImage = static_cast<LayerImage*>(layer);
|
||||||
|
|
||||||
for (frame_t frame = range.frameEnd(),
|
for (frame_t frame : site->selectedFrames().reversed()) {
|
||||||
begin = range.frameBegin()-1;
|
|
||||||
frame != begin;
|
|
||||||
--frame) {
|
|
||||||
Cel* cel = layerImage->cel(frame);
|
Cel* cel = layerImage->cel(frame);
|
||||||
if (cel && cel->links()) {
|
if (cel && cel->links()) {
|
||||||
if (layerImage->isEditable())
|
if (layerImage->isEditable())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user