mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 12:44:53 +00:00
Combination of CLI args results in jumbled layer order (fix #1644)
- The order is fixed because we now iterate a LayerList (a std::vector) instead of a SelectedLayers (a std::set) - This can be an issue each time we iterate over a std::set (and SelectedLayers is a std::set) because it depends on the specific STL impl details (which vary depending on msvc/clang/gcc compiler). - This fix iterates over layers, no matter if are visible or not (SelectedLayers::toLayerList() returns only browseable layers)
This commit is contained in:
parent
0c86d9bb5c
commit
f6bb446031
@ -540,7 +540,7 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
|
||||
filter_layers(doc->sprite()->allLayers(), cof, filteredLayers);
|
||||
|
||||
if (cof.splitLayers) {
|
||||
for (Layer* layer : filteredLayers) {
|
||||
for (Layer* layer : filteredLayers.toAllLayersList()) {
|
||||
SelectedLayers oneLayer;
|
||||
oneLayer.insert(layer);
|
||||
|
||||
|
@ -58,6 +58,26 @@ bool SelectedLayers::hasSameParent() const
|
||||
return true;
|
||||
}
|
||||
|
||||
LayerList SelectedLayers::toAllLayersList() const
|
||||
{
|
||||
LayerList output;
|
||||
|
||||
if (empty())
|
||||
return output;
|
||||
|
||||
ASSERT(*begin());
|
||||
ASSERT((*begin())->sprite());
|
||||
|
||||
for (Layer* layer = (*begin())->sprite()->firstLayer();
|
||||
layer != nullptr;
|
||||
layer = layer->getNext()) {
|
||||
if (contains(layer))
|
||||
output.push_back(layer);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
LayerList SelectedLayers::toLayerList() const
|
||||
{
|
||||
LayerList output;
|
||||
|
@ -39,6 +39,7 @@ namespace doc {
|
||||
bool contains(Layer* layer) const;
|
||||
bool hasSameParent() const;
|
||||
LayerList toLayerList() const;
|
||||
LayerList toAllLayersList() const;
|
||||
|
||||
void removeChildrenIfParentIsSelected();
|
||||
void expandCollapsedGroups();
|
||||
|
@ -215,6 +215,14 @@ LayerImage* Sprite::backgroundLayer() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Layer* Sprite::firstLayer() const
|
||||
{
|
||||
Layer* layer = root()->firstLayer();
|
||||
while (layer->isGroup())
|
||||
layer = static_cast<LayerGroup*>(layer)->firstLayer();
|
||||
return layer;
|
||||
}
|
||||
|
||||
Layer* Sprite::firstBrowsableLayer() const
|
||||
{
|
||||
Layer* layer = root()->firstLayer();
|
||||
|
@ -104,6 +104,7 @@ namespace doc {
|
||||
LayerGroup* root() const { return m_root; }
|
||||
LayerImage* backgroundLayer() const;
|
||||
Layer* firstBrowsableLayer() const;
|
||||
Layer* firstLayer() const;
|
||||
layer_t allLayersCount() const;
|
||||
bool hasVisibleReferenceLayers() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user