Comments (1)
It's been a long time, I forgot I made this post, but I did end up fixing this, atleast for top left ONLY (selectAllOrder is completely ignored). This will force the order to top left down no matter what. Obviously, this isn't optimal, but it gets the job done.
Just change OrderBoxes to the following and compile.:
public static List<Rectangle> OrderBoxes(List<Rectangle> boxes, Enums.SelectAllOrder selectAllOrder, Size spriteSheetSize)
{
List<List<Rectangle>> listsOfBoxes = new List<List<Rectangle>>();
bool found = false;
List<Rectangle> returnedOrder = boxes.OrderBy(w => w.Y + w.Height).ToList();
foreach (Rectangle box in returnedOrder)
{
foreach (Rectangle compareBox in returnedOrder)
{
// Find a rect on the same Y axis.
if (box.Top < compareBox.Bottom && box.Bottom > compareBox.Top)
{
found = false;
// Look for a list containing the matched rect.
foreach (List<Rectangle> groupedList in listsOfBoxes)
{
// Add our rect to a list we found.
if (groupedList.Contains(compareBox))
{
groupedList.Add(box);
found = true;
break;
}
}
// No list was found, create a new list and put the rect in it.
if (found == false)
{
List<Rectangle> newList = new List<Rectangle>();
listsOfBoxes.Add(newList);
newList.Add(box);
}
// We found a rect, stop searching for others.
break;
}
}
}
// Begin to sort all of the lists by the X axis and dump into a single list.
List<Rectangle> properOrder = new List<Rectangle>();
foreach (List<Rectangle> groupedList in listsOfBoxes)
{
List<Rectangle> orderedList = groupedList.OrderBy(w => w.X).ToList();
properOrder.AddRange(orderedList);
}
return properOrder;
}
from alferd-spritesheet-unpacker.
Related Issues (20)
- Sprites are not being auto selected
- Crashes when input is a dds file and used nconvert HOT 1
- Feature request: Create folder when exporting if it doesn't exists
- Separate image even though there's no space between them
- Ability to undo
- Bug: Splitting something can leave 2 of the splitted images with 0 width/height
- Export Error
- Feature request: transparent border with customizable width around each exported sprite
- захватывает не все пиксели спрайта
- System Exception if there is whitespace in the export path.
- Sprite parts disappearing
- System.Exception error on export
- Feature request
- How do you download and use it?
- The Sprites Have White With Black Outlines
- Export in Json format
- Quick Guide and FAQ links are dead! - Please include guide within ASU.zip!
- Spritesheet Transparency recognition failure
- UI issues: 4k and 16x16 pixie art
- Crashed when dropping non-pixel related
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alferd-spritesheet-unpacker.