mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-26 12:35:33 +00:00
Fix get_cels_in_range() when range type != DocumentRange::kCels
This commit is contained in:
parent
bbb72de545
commit
77c2fb57a7
@ -101,8 +101,12 @@ bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
|
||||
DocumentRange range = App::instance()->getMainWindow()->getTimeline()->range();
|
||||
if (range.enabled()) {
|
||||
for (Cel* cel : get_cels_in_range(writer.sprite(), range))
|
||||
api.setCelPosition(writer.sprite(), cel, cel->x()+deltaX, cel->y()+deltaY);
|
||||
for (Cel* cel : get_cels_in_range(writer.sprite(), range)) {
|
||||
Layer* layer = cel->layer();
|
||||
ASSERT(layer);
|
||||
if (layer && layer->isMoveable() && !layer->isBackground())
|
||||
api.setCelPosition(writer.sprite(), cel, cel->x()+deltaX, cel->y()+deltaY);
|
||||
}
|
||||
}
|
||||
else if (m_cel) {
|
||||
api.setCelPosition(writer.sprite(), m_cel, m_celNewX, m_celNewY);
|
||||
|
@ -31,17 +31,32 @@ namespace app {
|
||||
using namespace raster;
|
||||
|
||||
// TODO the DocumentRange should be "iteratable" to replace this function
|
||||
CelList get_cels_in_range(Sprite* sprite, const DocumentRange& range)
|
||||
CelList get_cels_in_range(Sprite* sprite, const DocumentRange& inrange)
|
||||
{
|
||||
DocumentRange range = inrange;
|
||||
CelList cels;
|
||||
|
||||
switch (range.type()) {
|
||||
case DocumentRange::kNone:
|
||||
return cels;
|
||||
case DocumentRange::kCels:
|
||||
break;
|
||||
case DocumentRange::kFrames:
|
||||
range.startRange(LayerIndex(0), inrange.frameBegin(), DocumentRange::kCels);
|
||||
range.endRange(LayerIndex(sprite->countLayers()-1), inrange.frameEnd());
|
||||
break;
|
||||
case DocumentRange::kLayers:
|
||||
range.startRange(inrange.layerBegin(), FrameNumber(0), DocumentRange::kCels);
|
||||
range.endRange(inrange.layerEnd(), sprite->lastFrame());
|
||||
break;
|
||||
}
|
||||
|
||||
for (LayerIndex layerIdx = range.layerBegin(); layerIdx <= range.layerEnd(); ++layerIdx) {
|
||||
Layer* layer = sprite->indexToLayer(layerIdx);
|
||||
if (!layer->isImage())
|
||||
if (!layer || !layer->isImage())
|
||||
continue;
|
||||
|
||||
LayerImage* layerImage = static_cast<LayerImage*>(layer);
|
||||
|
||||
for (FrameNumber frame = range.frameEnd(),
|
||||
begin = range.frameBegin().previous();
|
||||
frame != begin;
|
||||
|
Loading…
x
Reference in New Issue
Block a user