Browse Source

Fix preset option packing

master
Starbeamrainbowlabs 10 months ago
parent
commit
92328ae39c
Signed by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com> GPG Key ID: 1BE5172E637709C2
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      SpritePacker/SpritePacker.cs

+ 4
- 7
SpritePacker/SpritePacker.cs View File

@@ -7,6 +7,7 @@ using System.Configuration;
7 7
 using System.Drawing.Text;
8 8
 using System.Drawing.Imaging;
9 9
 using System.Text;
10
+using System.Linq;
10 11
 
11 12
 namespace SpritePacker
12 13
 {
@@ -80,14 +81,10 @@ namespace SpritePacker
80 81
 		{
81 82
 			sortBySize();
82 83
 
83
-			List<Sprite> arrangedSprites = new List<Sprite>();
84
-			foreach(Sprite cspr in sprites)
84
+			List<Sprite> arrangedSprites = sprites.Where((Sprite spr) => spr.Placed).ToList();
85
+			List<Sprite> spritesToPack = sprites.Where((Sprite spr) => !spr.Placed).ToList();
86
+			foreach(Sprite cspr in spritesToPack)
85 87
 			{
86
-				if (cspr.Placed) {
87
-					if(Verbose) Console.WriteLine($"Skipping placement of {cspr} as it has been preset");
88
-					continue;
89
-				}
90
-
91 88
 				if(Verbose) Console.WriteLine("Attempting to place {0}.", cspr);
92 89
 				Point scanLines = Point.Empty;
93 90
 				Point nextScanLines = new Point(int.MaxValue, int.MaxValue);

Loading…
Cancel
Save