com.wallstop-studios.unity-helpers 2.0.0-rc76.7 → 2.0.0-rc76.8

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.
@@ -45,11 +45,6 @@
45
45
  LoadAtlasConfigs();
46
46
  }
47
47
 
48
- private void OnFocus()
49
- {
50
- LoadAtlasConfigs();
51
- }
52
-
53
48
  private void OnProjectChange()
54
49
  {
55
50
  LoadAtlasConfigs();
@@ -68,6 +63,10 @@
68
63
  foreach (string guid in guids)
69
64
  {
70
65
  string path = AssetDatabase.GUIDToAssetPath(guid);
66
+ if (string.IsNullOrWhiteSpace(path))
67
+ {
68
+ continue;
69
+ }
71
70
  ScriptableSpriteAtlas config = AssetDatabase.LoadAssetAtPath<ScriptableSpriteAtlas>(
72
71
  path
73
72
  );
@@ -78,9 +77,9 @@
78
77
  {
79
78
  _scanResultsCache[config] = cachedResult;
80
79
  }
81
- else if (!_scanResultsCache.ContainsKey(config))
80
+ else
82
81
  {
83
- _scanResultsCache[config] = new ScanResult();
82
+ _scanResultsCache.TryAdd(config, _ => new ScanResult());
84
83
  }
85
84
  _serializedConfigs.TryAdd(config, newConfig => new SerializedObject(newConfig));
86
85
  _foldoutStates.TryAdd(config, true);
@@ -1179,28 +1179,35 @@ namespace WallstopStudios.UnityHelpers.Editor.Sprites
1179
1179
 
1180
1180
  private void AddAnimationDefinition()
1181
1181
  {
1182
- AnimationDefinition newDef = new();
1182
+ AnimationDefinition newDefinition = new();
1183
1183
  if (_selectedSpriteSheet != null)
1184
1184
  {
1185
- newDef.Name = $"{_selectedSpriteSheet.name}_Anim_{_animationDefinitions.Count}";
1185
+ newDefinition.Name =
1186
+ $"{_selectedSpriteSheet.name}_Anim_{_animationDefinitions.Count}";
1186
1187
  }
1187
1188
  if (0 < _availableSprites.Count)
1188
1189
  {
1189
1190
  if (0 < _animationDefinitions.Count)
1190
1191
  {
1191
1192
  int nextStartIndex = _animationDefinitions[^1].EndSpriteIndex + 1;
1192
- if (_availableSprites.Count - 1 <= nextStartIndex)
1193
+ if (_availableSprites.Count - 1 < nextStartIndex)
1193
1194
  {
1194
1195
  nextStartIndex = 0;
1195
1196
  }
1196
- newDef.StartSpriteIndex = nextStartIndex;
1197
+ newDefinition.StartSpriteIndex = nextStartIndex;
1197
1198
  }
1198
1199
 
1199
- newDef.EndSpriteIndex = _availableSprites.Count - 1;
1200
+ newDefinition.EndSpriteIndex = _availableSprites.Count - 1;
1200
1201
  }
1201
- newDef.FrameRateCurve = AnimationCurve.Constant(0, 1, newDef.DefaultFrameRate);
1202
- _animationDefinitions.Add(newDef);
1203
- UpdateSpritesForDefinition(newDef);
1202
+ newDefinition.FrameRateCurve = AnimationCurve.Constant(
1203
+ 0,
1204
+ 1,
1205
+ newDefinition.DefaultFrameRate
1206
+ );
1207
+ _animationDefinitions.Add(newDefinition);
1208
+ _currentPreviewAnimDefIndex = _animationDefinitions.Count - 1;
1209
+ StartOrUpdateCurrentPreview(newDefinition);
1210
+ UpdateSpritesForDefinition(newDefinition);
1204
1211
  _animationDefinitionsListView.Rebuild();
1205
1212
  }
1206
1213
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc76.7",
3
+ "version": "2.0.0-rc76.8",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -81,5 +81,6 @@
81
81
 
82
82
 
83
83
 
84
+
84
85
 
85
86