com.wallstop-studios.unity-helpers 2.0.0-rc60 → 2.0.0-rc61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,6 +61,11 @@
61
61
  [WShowIf(nameof(applyFilterMode))]
62
62
  public FilterMode filterMode = FilterMode.Point;
63
63
 
64
+ public bool applyCrunchCompression;
65
+
66
+ [WShowIf(nameof(applyCrunchCompression))]
67
+ public bool useCrunchCompression;
68
+
64
69
  public string name = string.Empty;
65
70
  }
66
71
 
@@ -87,7 +92,7 @@
87
92
 
88
93
  private void OnWizardCreate()
89
94
  {
90
- HashSet<string> uniqueDirectories = new();
95
+ HashSet<string> uniqueDirectories = new(StringComparer.OrdinalIgnoreCase);
91
96
  foreach (
92
97
  string assetPath in directories
93
98
  .Where(Objects.NotNull)
@@ -101,14 +106,19 @@
101
106
  }
102
107
  }
103
108
 
104
- HashSet<string> processedSpritePaths = new();
109
+ HashSet<string> processedSpritePaths = new(StringComparer.OrdinalIgnoreCase);
105
110
  Queue<string> directoriesToCheck = new(uniqueDirectories);
106
111
  int spriteCount = 0;
107
112
  while (directoriesToCheck.TryDequeue(out string directoryPath))
108
113
  {
109
114
  foreach (string fullFilePath in Directory.EnumerateFiles(directoryPath))
110
115
  {
111
- if (!spriteFileExtensions.Contains(Path.GetExtension(fullFilePath)))
116
+ if (
117
+ !spriteFileExtensions.Contains(
118
+ Path.GetExtension(fullFilePath),
119
+ StringComparer.OrdinalIgnoreCase
120
+ )
121
+ )
112
122
  {
113
123
  continue;
114
124
  }
@@ -150,7 +160,7 @@
150
160
  string filePath in sprites
151
161
  .Where(Objects.NotNull)
152
162
  .Select(AssetDatabase.GetAssetPath)
153
- .Where(Objects.NotNull)
163
+ .Where(path => !string.IsNullOrWhiteSpace(path))
154
164
  )
155
165
  {
156
166
  if (
@@ -171,26 +181,27 @@
171
181
 
172
182
  private bool TryUpdateTextureSettings(string filePath)
173
183
  {
174
- bool changed = false;
175
184
  if (string.IsNullOrWhiteSpace(filePath))
176
185
  {
177
- return changed;
186
+ return false;
178
187
  }
179
188
 
180
189
  TextureImporter textureImporter = AssetImporter.GetAtPath(filePath) as TextureImporter;
181
190
  if (textureImporter == null)
182
191
  {
183
- return changed;
192
+ return false;
184
193
  }
185
194
 
186
195
  SpriteSettings spriteData = spriteSettings.Find(settings =>
187
- string.IsNullOrWhiteSpace(settings.name) || filePath.Contains(settings.name)
196
+ string.IsNullOrWhiteSpace(settings.name)
197
+ || filePath.Contains(settings.name, StringComparison.OrdinalIgnoreCase)
188
198
  );
189
199
  if (spriteData == null)
190
200
  {
191
- return changed;
201
+ return false;
192
202
  }
193
203
 
204
+ bool changed = false;
194
205
  if (spriteData.applyPixelsPerUnit)
195
206
  {
196
207
  // ReSharper disable once CompareOfFloatsByEqualityOperator
@@ -210,6 +221,12 @@
210
221
  textureImporter.mipmapEnabled = spriteData.generateMipMaps;
211
222
  }
212
223
 
224
+ if (spriteData.applyCrunchCompression)
225
+ {
226
+ changed |= textureImporter.crunchedCompression != spriteData.useCrunchCompression;
227
+ textureImporter.crunchedCompression = spriteData.useCrunchCompression;
228
+ }
229
+
213
230
  bool changedSettings = false;
214
231
  TextureImporterSettings settings = new();
215
232
  textureImporter.ReadTextureSettings(settings);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "WallstopStudios.UnityHelpers.Editor",
3
- "rootNamespace": "",
3
+ "rootNamespace": "UnityHelpers",
4
4
  "references": [
5
5
  "WallstopStudios.UnityHelpers"
6
6
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc60",
3
+ "version": "2.0.0-rc61",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},