com.wallstop-studios.unity-helpers 2.0.0-rc73.1 → 2.0.0-rc73.11
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.
- package/Editor/AnimationCopier.cs +58 -50
- package/Editor/AnimationCreator.cs +24 -24
- package/Editor/AnimationEventEditor.cs +11 -23
- package/Editor/FitTextureSizeWindow.cs +9 -9
- package/Editor/PrefabChecker.cs +12 -18
- package/Editor/SpriteAtlasGenerator.cs +47 -66
- package/Editor/SpriteCropper.cs +157 -131
- package/Editor/SpriteSettingsApplier.cs +5 -3
- package/Editor/Utils/GUIIndentScope.cs +20 -0
- package/Editor/Utils/GUIIndentScope.cs.meta +3 -0
- package/Runtime/Core/DataStructure/Circle.cs +1 -1
- package/Runtime/Core/DataStructure/QuadTree.cs +4 -4
- package/Runtime/Core/Extension/ColorExtensions.cs +5 -5
- package/Runtime/Core/Extension/IEnumerableExtensions.cs +1 -1
- package/Runtime/Core/Extension/UnityExtensions.cs +14 -14
- package/Runtime/Core/Helper/Helpers.cs +9 -9
- package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs +31 -8
- package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +2 -2
- package/Runtime/Core/Helper/PathHelper.cs +15 -0
- package/Runtime/Core/Helper/PathHelper.cs.meta +3 -0
- package/Runtime/Core/Random/DotNetRandom.cs +1 -1
- package/Runtime/Core/Random/SplitMix64.cs +1 -1
- package/Runtime/Core/Random/SquirrelRandom.cs +7 -7
- package/Runtime/Core/Random/ThreadLocalRandom.cs +1 -1
- package/Runtime/Core/Random/WyRandom.cs +1 -1
- package/Runtime/Tags/AttributeEffect.cs +1 -0
- package/Runtime/Tags/EffectHandler.cs +1 -1
- package/Runtime/UI/LayeredImage.cs +309 -161
- package/Runtime/Utils/AnimatorEnumStateMachine.cs +1 -1
- package/Runtime/Utils/SetTextureImportData.cs +1 -1
- package/Runtime/Utils/TextureScale.cs +4 -4
- package/Styles/Elements/Progress/ArcedProgressBar.cs +345 -0
- package/Styles/Elements/Progress/ArcedProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/CircularProgressBar.cs +307 -0
- package/Styles/Elements/Progress/CircularProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/GlitchProgressBar.cs +416 -0
- package/Styles/Elements/Progress/GlitchProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/LiquidProgressBar.cs +632 -0
- package/Styles/Elements/Progress/LiquidProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/MarchingAntsProgressBar.cs +722 -0
- package/Styles/Elements/Progress/MarchingAntsProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/RegularProgressBar.cs +405 -0
- package/Styles/Elements/Progress/RegularProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress/WigglyProgressBar.cs +837 -0
- package/Styles/Elements/Progress/WigglyProgressBar.cs.meta +3 -0
- package/Styles/Elements/Progress.meta +3 -0
- package/Styles/Elements.meta +3 -0
- package/Styles/USS/ArcedProgressBar.uss +19 -0
- package/Styles/USS/ArcedProgressBar.uss.meta +3 -0
- package/Styles/USS/CirclularProgressBar.uss +18 -0
- package/Styles/USS/CirclularProgressBar.uss.meta +3 -0
- package/Styles/USS/RegularProgressBar.uss +33 -0
- package/Styles/USS/RegularProgressBar.uss.meta +3 -0
- package/Styles/USS/WigglyProgressBar.uss +17 -0
- package/Styles/USS/WigglyProgressBar.uss.meta +3 -0
- package/Styles/USS.meta +3 -0
- package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef +17 -0
- package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef.meta +7 -0
- package/Styles.meta +3 -0
- package/package.json +11 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
using UnityEditor;
|
|
10
10
|
using UnityEngine;
|
|
11
11
|
using Core.Extension;
|
|
12
|
+
using Core.Helper;
|
|
12
13
|
|
|
13
14
|
public sealed class AnimationCopierWindow : EditorWindow
|
|
14
15
|
{
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
public string DestinationRelativePath { get; set; }
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
[MenuItem("Tools/Wallstop Studios/Unity Helpers/Animation Copier
|
|
62
|
+
[MenuItem("Tools/Wallstop Studios/Unity Helpers/Animation Copier", priority = -2)]
|
|
62
63
|
public static void ShowWindow()
|
|
63
64
|
{
|
|
64
65
|
GetWindow<AnimationCopierWindow>("Animation Copier");
|
|
@@ -185,7 +186,7 @@
|
|
|
185
186
|
if (newRelPath != null)
|
|
186
187
|
{
|
|
187
188
|
relativePath = newRelPath;
|
|
188
|
-
fullPath = selectedPath.
|
|
189
|
+
fullPath = selectedPath.SanitizePath();
|
|
189
190
|
EditorPrefs.SetString(prefKey, relativePath);
|
|
190
191
|
this.Log($"{label} set to: {relativePath}");
|
|
191
192
|
ValidatePaths();
|
|
@@ -436,7 +437,10 @@
|
|
|
436
437
|
string sourceRelPath = AssetDatabase.GUIDToAssetPath(guid);
|
|
437
438
|
if (
|
|
438
439
|
string.IsNullOrWhiteSpace(sourceRelPath)
|
|
439
|
-
|| !sourceRelPath.StartsWith(
|
|
440
|
+
|| !sourceRelPath.StartsWith(
|
|
441
|
+
_animationSourcePathRelative,
|
|
442
|
+
StringComparison.OrdinalIgnoreCase
|
|
443
|
+
)
|
|
440
444
|
)
|
|
441
445
|
{
|
|
442
446
|
continue;
|
|
@@ -460,7 +464,7 @@
|
|
|
460
464
|
FileName = Path.GetFileName(sourceRelPath),
|
|
461
465
|
RelativeDirectory = GetRelativeSubPath(
|
|
462
466
|
_animationSourcePathRelative,
|
|
463
|
-
directoryName.
|
|
467
|
+
directoryName.SanitizePath()
|
|
464
468
|
),
|
|
465
469
|
Hash = CalculateFileHash(sourceFullPath),
|
|
466
470
|
};
|
|
@@ -469,7 +473,7 @@
|
|
|
469
473
|
fileInfo.RelativeDirectory,
|
|
470
474
|
fileInfo.FileName
|
|
471
475
|
)
|
|
472
|
-
.
|
|
476
|
+
.SanitizePath();
|
|
473
477
|
_sourceAnimations.Add(fileInfo);
|
|
474
478
|
|
|
475
479
|
EditorUtility.DisplayProgressBar(
|
|
@@ -505,7 +509,10 @@
|
|
|
505
509
|
else
|
|
506
510
|
{
|
|
507
511
|
string destHash = CalculateFileHash(destFullPath);
|
|
508
|
-
if (
|
|
512
|
+
if (
|
|
513
|
+
string.IsNullOrWhiteSpace(sourceInfo.Hash)
|
|
514
|
+
|| string.IsNullOrWhiteSpace(destHash)
|
|
515
|
+
)
|
|
509
516
|
{
|
|
510
517
|
this.LogWarn(
|
|
511
518
|
$"Could not compare '{sourceInfo.FileName}' due to hashing error. Treating as 'Changed'."
|
|
@@ -593,8 +600,32 @@
|
|
|
593
600
|
|
|
594
601
|
int successCount = 0;
|
|
595
602
|
int errorCount = 0;
|
|
596
|
-
|
|
603
|
+
foreach (AnimationFileInfo animInfo in animationsToCopy)
|
|
604
|
+
{
|
|
605
|
+
string destinationAssetPath = animInfo.DestinationRelativePath;
|
|
606
|
+
string destDirectory = Path.GetDirectoryName(destinationAssetPath).SanitizePath();
|
|
607
|
+
|
|
608
|
+
if (
|
|
609
|
+
string.IsNullOrWhiteSpace(destDirectory)
|
|
610
|
+
|| AssetDatabase.IsValidFolder(destDirectory)
|
|
611
|
+
)
|
|
612
|
+
{
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
597
615
|
|
|
616
|
+
try
|
|
617
|
+
{
|
|
618
|
+
EnsureDirectoryExists(destDirectory);
|
|
619
|
+
}
|
|
620
|
+
catch (Exception ex)
|
|
621
|
+
{
|
|
622
|
+
this.LogError(
|
|
623
|
+
$"Failed to create destination directory '{destDirectory}' for animation '{animInfo.FileName}'. Error: {ex.Message}. Skipping."
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
AssetDatabase.StartAssetEditing();
|
|
598
629
|
try
|
|
599
630
|
{
|
|
600
631
|
for (int i = 0; i < animationsToCopy.Count; i++)
|
|
@@ -615,27 +646,6 @@
|
|
|
615
646
|
|
|
616
647
|
string sourceAssetPath = animInfo.RelativePath;
|
|
617
648
|
string destinationAssetPath = animInfo.DestinationRelativePath;
|
|
618
|
-
string destDirectory = Path.GetDirectoryName(destinationAssetPath);
|
|
619
|
-
|
|
620
|
-
if (
|
|
621
|
-
!string.IsNullOrEmpty(destDirectory)
|
|
622
|
-
&& !AssetDatabase.IsValidFolder(destDirectory)
|
|
623
|
-
)
|
|
624
|
-
{
|
|
625
|
-
try
|
|
626
|
-
{
|
|
627
|
-
EnsureDirectoryExists(destDirectory);
|
|
628
|
-
}
|
|
629
|
-
catch (Exception ex)
|
|
630
|
-
{
|
|
631
|
-
this.LogError(
|
|
632
|
-
$"Failed to create destination directory '{destDirectory}' for animation '{animInfo.FileName}'. Error: {ex.Message}. Skipping."
|
|
633
|
-
);
|
|
634
|
-
errorCount++;
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
649
|
bool copySuccessful = AssetDatabase.CopyAsset(
|
|
640
650
|
sourceAssetPath,
|
|
641
651
|
destinationAssetPath
|
|
@@ -784,7 +794,7 @@
|
|
|
784
794
|
return null;
|
|
785
795
|
}
|
|
786
796
|
|
|
787
|
-
fullPath = fullPath.
|
|
797
|
+
fullPath = fullPath.SanitizePath();
|
|
788
798
|
if (
|
|
789
799
|
fullPath.EndsWith("/Assets", StringComparison.OrdinalIgnoreCase)
|
|
790
800
|
&& Path.GetFileName(fullPath).Equals("Assets", StringComparison.OrdinalIgnoreCase)
|
|
@@ -793,7 +803,7 @@
|
|
|
793
803
|
return "Assets";
|
|
794
804
|
}
|
|
795
805
|
|
|
796
|
-
string assetsPath = Application.dataPath.
|
|
806
|
+
string assetsPath = Application.dataPath.SanitizePath();
|
|
797
807
|
if (fullPath.StartsWith(assetsPath, StringComparison.OrdinalIgnoreCase))
|
|
798
808
|
{
|
|
799
809
|
if (fullPath.Length == assetsPath.Length)
|
|
@@ -828,7 +838,7 @@
|
|
|
828
838
|
|
|
829
839
|
if (relativePath.Equals("Assets", StringComparison.OrdinalIgnoreCase))
|
|
830
840
|
{
|
|
831
|
-
return Application.dataPath.
|
|
841
|
+
return Application.dataPath.SanitizePath();
|
|
832
842
|
}
|
|
833
843
|
|
|
834
844
|
if (relativePath.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase))
|
|
@@ -837,7 +847,7 @@
|
|
|
837
847
|
0,
|
|
838
848
|
Application.dataPath.Length - "Assets".Length
|
|
839
849
|
);
|
|
840
|
-
return (projectRoot + relativePath).
|
|
850
|
+
return (projectRoot + relativePath).SanitizePath();
|
|
841
851
|
}
|
|
842
852
|
return null;
|
|
843
853
|
}
|
|
@@ -866,28 +876,28 @@
|
|
|
866
876
|
return string.Empty;
|
|
867
877
|
}
|
|
868
878
|
|
|
869
|
-
private
|
|
879
|
+
private string CalculateFileHash(string filePath)
|
|
870
880
|
{
|
|
871
881
|
try
|
|
872
882
|
{
|
|
873
|
-
using
|
|
874
|
-
using
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
return BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant();
|
|
878
|
-
}
|
|
883
|
+
using MD5 md5 = MD5.Create();
|
|
884
|
+
using FileStream stream = File.OpenRead(filePath);
|
|
885
|
+
byte[] hashBytes = md5.ComputeHash(stream);
|
|
886
|
+
return BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant();
|
|
879
887
|
}
|
|
880
888
|
catch (IOException ioEx)
|
|
881
889
|
{
|
|
882
|
-
|
|
883
|
-
$"[AnimationCopierWindow] IO Error calculating hash for {filePath}
|
|
890
|
+
this.LogError(
|
|
891
|
+
$"[AnimationCopierWindow] IO Error calculating hash for {filePath}.",
|
|
892
|
+
ioEx
|
|
884
893
|
);
|
|
885
894
|
return string.Empty;
|
|
886
895
|
}
|
|
887
896
|
catch (Exception ex)
|
|
888
897
|
{
|
|
889
|
-
|
|
890
|
-
$"[AnimationCopierWindow] Error calculating hash for {filePath}
|
|
898
|
+
this.LogError(
|
|
899
|
+
$"[AnimationCopierWindow] Error calculating hash for {filePath}.",
|
|
900
|
+
ex
|
|
891
901
|
);
|
|
892
902
|
return string.Empty;
|
|
893
903
|
}
|
|
@@ -899,6 +909,7 @@
|
|
|
899
909
|
{
|
|
900
910
|
return;
|
|
901
911
|
}
|
|
912
|
+
|
|
902
913
|
if (!relativeDirectoryPath.StartsWith("Assets/"))
|
|
903
914
|
{
|
|
904
915
|
if (relativeDirectoryPath.Equals("Assets", StringComparison.OrdinalIgnoreCase))
|
|
@@ -920,17 +931,15 @@
|
|
|
920
931
|
return;
|
|
921
932
|
}
|
|
922
933
|
|
|
923
|
-
string parentPath = Path.GetDirectoryName(relativeDirectoryPath)
|
|
924
|
-
?.Replace(Path.DirectorySeparatorChar, '/');
|
|
925
|
-
|
|
934
|
+
string parentPath = Path.GetDirectoryName(relativeDirectoryPath).SanitizePath();
|
|
926
935
|
if (
|
|
927
|
-
string.
|
|
936
|
+
string.IsNullOrWhiteSpace(parentPath)
|
|
928
937
|
|| parentPath.Equals("Assets", StringComparison.OrdinalIgnoreCase)
|
|
929
938
|
)
|
|
930
939
|
{
|
|
931
940
|
string folderNameToCreate = Path.GetFileName(relativeDirectoryPath);
|
|
932
941
|
if (
|
|
933
|
-
!string.
|
|
942
|
+
!string.IsNullOrWhiteSpace(folderNameToCreate)
|
|
934
943
|
&& !AssetDatabase.IsValidFolder(relativeDirectoryPath)
|
|
935
944
|
)
|
|
936
945
|
{
|
|
@@ -940,10 +949,9 @@
|
|
|
940
949
|
}
|
|
941
950
|
|
|
942
951
|
EnsureDirectoryExists(parentPath);
|
|
943
|
-
|
|
944
952
|
string currentFolderName = Path.GetFileName(relativeDirectoryPath);
|
|
945
953
|
if (
|
|
946
|
-
!string.
|
|
954
|
+
!string.IsNullOrWhiteSpace(currentFolderName)
|
|
947
955
|
&& !AssetDatabase.IsValidFolder(relativeDirectoryPath)
|
|
948
956
|
)
|
|
949
957
|
{
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
using System.IO;
|
|
8
8
|
using System.Linq;
|
|
9
9
|
using System.Text.RegularExpressions;
|
|
10
|
+
using Core.Helper;
|
|
10
11
|
using UnityEditor;
|
|
11
12
|
using UnityEngine;
|
|
13
|
+
using Utils;
|
|
12
14
|
using Object = UnityEngine.Object;
|
|
13
15
|
|
|
14
16
|
[Serializable]
|
|
@@ -25,6 +27,8 @@
|
|
|
25
27
|
|
|
26
28
|
public sealed class AnimationCreatorWindow : EditorWindow
|
|
27
29
|
{
|
|
30
|
+
private static readonly char[] WhiteSpaceSplitters = { ' ', '\t', '\n', '\r' };
|
|
31
|
+
|
|
28
32
|
private SerializedObject _serializedObject;
|
|
29
33
|
private SerializedProperty _animationDataProp;
|
|
30
34
|
private SerializedProperty _animationSourcesProp;
|
|
@@ -87,7 +91,7 @@
|
|
|
87
91
|
else if (
|
|
88
92
|
_animationSourcesProp.arraySize == 0
|
|
89
93
|
|| _animationSourcesProp.FindPropertyRelative("Array.size").intValue == 0
|
|
90
|
-
|| animationSources.TrueForAll(
|
|
94
|
+
|| animationSources.TrueForAll(Objects.Null)
|
|
91
95
|
)
|
|
92
96
|
{
|
|
93
97
|
EditorGUILayout.HelpBox(
|
|
@@ -136,7 +140,7 @@
|
|
|
136
140
|
return;
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
absolutePath = absolutePath.
|
|
143
|
+
absolutePath = absolutePath.SanitizePath();
|
|
140
144
|
if (absolutePath.StartsWith(Application.dataPath, StringComparison.OrdinalIgnoreCase))
|
|
141
145
|
{
|
|
142
146
|
string relativePath =
|
|
@@ -205,10 +209,7 @@
|
|
|
205
209
|
int listSize = _animationDataProp.arraySize;
|
|
206
210
|
string[] searchTerms = string.IsNullOrWhiteSpace(_searchString)
|
|
207
211
|
? Array.Empty<string>()
|
|
208
|
-
: _searchString.Split(
|
|
209
|
-
new[] { ' ', '\t', '\n', '\r' },
|
|
210
|
-
StringSplitOptions.RemoveEmptyEntries
|
|
211
|
-
);
|
|
212
|
+
: _searchString.Split(WhiteSpaceSplitters, StringSplitOptions.RemoveEmptyEntries);
|
|
212
213
|
|
|
213
214
|
List<int> matchingIndices = new();
|
|
214
215
|
for (int i = 0; i < listSize; ++i)
|
|
@@ -245,7 +246,7 @@
|
|
|
245
246
|
|
|
246
247
|
if (_animationDataIsExpanded)
|
|
247
248
|
{
|
|
248
|
-
|
|
249
|
+
using GUIIndentScope indent = new();
|
|
249
250
|
if (matchCount > 0)
|
|
250
251
|
{
|
|
251
252
|
foreach (int index in matchingIndices)
|
|
@@ -273,8 +274,6 @@
|
|
|
273
274
|
MessageType.Info
|
|
274
275
|
);
|
|
275
276
|
}
|
|
276
|
-
|
|
277
|
-
EditorGUI.indentLevel--;
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
279
|
|
|
@@ -338,6 +337,13 @@
|
|
|
338
337
|
}
|
|
339
338
|
}
|
|
340
339
|
|
|
340
|
+
if (GUILayout.Button("Create new Animation Data"))
|
|
341
|
+
{
|
|
342
|
+
animationData.Add(new AnimationData());
|
|
343
|
+
_serializedObject.Update();
|
|
344
|
+
Repaint();
|
|
345
|
+
}
|
|
346
|
+
|
|
341
347
|
if (_filteredSprites.Count == 0)
|
|
342
348
|
{
|
|
343
349
|
EditorGUILayout.HelpBox(
|
|
@@ -439,14 +445,14 @@
|
|
|
439
445
|
}
|
|
440
446
|
|
|
441
447
|
EditorGUILayout.Space();
|
|
442
|
-
using (new EditorGUI.DisabledScope(animationData
|
|
448
|
+
using (new EditorGUI.DisabledScope(animationData is not { Count: > 0 }))
|
|
443
449
|
{
|
|
444
450
|
if (GUILayout.Button("Create Animations"))
|
|
445
451
|
{
|
|
446
452
|
CreateAnimations();
|
|
447
453
|
}
|
|
448
454
|
}
|
|
449
|
-
if (animationData
|
|
455
|
+
if (animationData is not { Count: > 0 })
|
|
450
456
|
{
|
|
451
457
|
EditorGUILayout.HelpBox(
|
|
452
458
|
"Add Animation Data entries before creating.",
|
|
@@ -457,7 +463,7 @@
|
|
|
457
463
|
|
|
458
464
|
private void CreateAnimations()
|
|
459
465
|
{
|
|
460
|
-
if (animationData is not { Count:
|
|
466
|
+
if (animationData is not { Count: > 0 })
|
|
461
467
|
{
|
|
462
468
|
this.LogError($"No animation data to create.");
|
|
463
469
|
return;
|
|
@@ -532,7 +538,7 @@
|
|
|
532
538
|
}
|
|
533
539
|
|
|
534
540
|
List<Sprite> frames = data.frames;
|
|
535
|
-
if (frames is not { Count:
|
|
541
|
+
if (frames is not { Count: > 0 })
|
|
536
542
|
{
|
|
537
543
|
this.LogWarn(
|
|
538
544
|
$"Ignoring animation '{animationName}' because it has no frames."
|
|
@@ -596,7 +602,7 @@
|
|
|
596
602
|
|
|
597
603
|
string firstFramePath = AssetDatabase.GetAssetPath(validFrames[0]);
|
|
598
604
|
string assetPath =
|
|
599
|
-
Path.GetDirectoryName(firstFramePath)
|
|
605
|
+
Path.GetDirectoryName(firstFramePath).SanitizePath() ?? "Assets";
|
|
600
606
|
if (!assetPath.EndsWith("/"))
|
|
601
607
|
{
|
|
602
608
|
assetPath += "/";
|
|
@@ -659,7 +665,7 @@
|
|
|
659
665
|
_matchedSpriteCount = 0;
|
|
660
666
|
_unmatchedSpriteCount = 0;
|
|
661
667
|
|
|
662
|
-
if (animationSources is not { Count:
|
|
668
|
+
if (animationSources is not { Count: > 0 } || _compiledRegex == null)
|
|
663
669
|
{
|
|
664
670
|
if (_compiledRegex == null && !string.IsNullOrWhiteSpace(spriteNameRegex))
|
|
665
671
|
{
|
|
@@ -667,7 +673,7 @@
|
|
|
667
673
|
$"Cannot find sprites, regex pattern '{spriteNameRegex}' is invalid."
|
|
668
674
|
);
|
|
669
675
|
}
|
|
670
|
-
else if (animationSources is not { Count:
|
|
676
|
+
else if (animationSources is not { Count: > 0 })
|
|
671
677
|
{
|
|
672
678
|
this.LogWarn($"Cannot find sprites, no animation sources specified.");
|
|
673
679
|
}
|
|
@@ -675,13 +681,8 @@
|
|
|
675
681
|
}
|
|
676
682
|
|
|
677
683
|
List<string> searchPaths = new();
|
|
678
|
-
foreach (Object source in animationSources)
|
|
684
|
+
foreach (Object source in animationSources.Where(Objects.NotNull))
|
|
679
685
|
{
|
|
680
|
-
if (source == null)
|
|
681
|
-
{
|
|
682
|
-
continue;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
686
|
string path = AssetDatabase.GetAssetPath(source);
|
|
686
687
|
if (!string.IsNullOrWhiteSpace(path) && AssetDatabase.IsValidFolder(path))
|
|
687
688
|
{
|
|
@@ -781,8 +782,7 @@
|
|
|
781
782
|
}
|
|
782
783
|
|
|
783
784
|
string assetPath = AssetDatabase.GetAssetPath(sprite);
|
|
784
|
-
string directoryPath =
|
|
785
|
-
Path.GetDirectoryName(assetPath)?.Replace("\\", "/") ?? "";
|
|
785
|
+
string directoryPath = Path.GetDirectoryName(assetPath).SanitizePath() ?? "";
|
|
786
786
|
string frameName = sprite.name;
|
|
787
787
|
|
|
788
788
|
int splitIndex = frameName.LastIndexOf('_');
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
using UnityEngine;
|
|
10
10
|
using Core.Attributes;
|
|
11
11
|
using Core.Helper;
|
|
12
|
+
using Utils;
|
|
12
13
|
using WallstopStudios.UnityHelpers.Utils;
|
|
13
14
|
|
|
14
15
|
// https://gist.githubusercontent.com/yujen/5e1cd78e2a341260b38029de08a449da/raw/ac60c1002e0e14375de5b2b0a167af00df3f74b4/SeniaAnimationEventEditor.cs
|
|
@@ -172,16 +173,15 @@
|
|
|
172
173
|
|
|
173
174
|
DrawSpritePreview(item);
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
RenderAnimationEventItem(item, frame, frameRate);
|
|
177
|
-
|
|
178
|
-
if (i != stateCopy.Count - 1)
|
|
176
|
+
using (new GUIIndentScope())
|
|
179
177
|
{
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
RenderAnimationEventItem(item, frame, frameRate);
|
|
179
|
+
if (i != stateCopy.Count - 1)
|
|
180
|
+
{
|
|
181
|
+
DrawGuiLine(height: 3, color: new Color(0f, 1f, 0.3f, 1f));
|
|
182
|
+
EditorGUILayout.Space();
|
|
183
|
+
}
|
|
182
184
|
}
|
|
183
|
-
|
|
184
|
-
EditorGUI.indentLevel--;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
EditorGUILayout.EndScrollView();
|
|
@@ -320,8 +320,7 @@
|
|
|
320
320
|
private void RenderAnimationEventItem(AnimationEventItem item, int frame, float frameRate)
|
|
321
321
|
{
|
|
322
322
|
int index = _state.IndexOf(item);
|
|
323
|
-
|
|
324
|
-
try
|
|
323
|
+
using (new GUIHorizontalScope())
|
|
325
324
|
{
|
|
326
325
|
if (
|
|
327
326
|
1 <= index
|
|
@@ -369,10 +368,6 @@
|
|
|
369
368
|
return;
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
|
-
finally
|
|
373
|
-
{
|
|
374
|
-
EditorGUILayout.EndHorizontal();
|
|
375
|
-
}
|
|
376
371
|
|
|
377
372
|
IReadOnlyDictionary<Type, IReadOnlyList<MethodInfo>> lookup = FilterLookup(item);
|
|
378
373
|
|
|
@@ -541,7 +536,7 @@
|
|
|
541
536
|
ParameterInfo[] arrayParameterInfo = item.selectedMethod.GetParameters();
|
|
542
537
|
if (arrayParameterInfo.Length == 1)
|
|
543
538
|
{
|
|
544
|
-
|
|
539
|
+
using GUIIndentScope indent = new();
|
|
545
540
|
|
|
546
541
|
Type paramType = arrayParameterInfo[0].ParameterType;
|
|
547
542
|
if (paramType == typeof(int))
|
|
@@ -602,8 +597,6 @@
|
|
|
602
597
|
true
|
|
603
598
|
);
|
|
604
599
|
}
|
|
605
|
-
|
|
606
|
-
EditorGUI.indentLevel--;
|
|
607
600
|
}
|
|
608
601
|
}
|
|
609
602
|
|
|
@@ -686,8 +679,7 @@
|
|
|
686
679
|
}
|
|
687
680
|
else if (!item.isTextureReadable && !string.IsNullOrEmpty(spriteName))
|
|
688
681
|
{
|
|
689
|
-
|
|
690
|
-
try
|
|
682
|
+
using (new GUIHorizontalScope())
|
|
691
683
|
{
|
|
692
684
|
GUILayout.Label($"Sprite '{spriteName}' required \"Read/Write\" enabled");
|
|
693
685
|
if (item.sprite != null && GUILayout.Button("Fix"))
|
|
@@ -711,10 +703,6 @@
|
|
|
711
703
|
EditorUtility.SetDirty(item.sprite);
|
|
712
704
|
}
|
|
713
705
|
}
|
|
714
|
-
finally
|
|
715
|
-
{
|
|
716
|
-
EditorGUILayout.EndHorizontal();
|
|
717
|
-
}
|
|
718
706
|
}
|
|
719
707
|
else if (item.isInvalidTextureRect && !string.IsNullOrEmpty(spriteName))
|
|
720
708
|
{
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
nameof(_textureSourcePaths)
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
if (_textureSourcePaths
|
|
43
|
+
if (_textureSourcePaths is { Count: > 0 })
|
|
44
44
|
{
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
@@ -336,6 +336,14 @@
|
|
|
336
336
|
_ = updatedImporters.Remove(textureImporter);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
+
}
|
|
340
|
+
finally
|
|
341
|
+
{
|
|
342
|
+
if (applyChanges)
|
|
343
|
+
{
|
|
344
|
+
AssetDatabase.StopAssetEditing();
|
|
345
|
+
}
|
|
346
|
+
EditorUtility.ClearProgressBar();
|
|
339
347
|
|
|
340
348
|
if (applyChanges)
|
|
341
349
|
{
|
|
@@ -356,14 +364,6 @@
|
|
|
356
364
|
}
|
|
357
365
|
}
|
|
358
366
|
}
|
|
359
|
-
finally
|
|
360
|
-
{
|
|
361
|
-
if (applyChanges)
|
|
362
|
-
{
|
|
363
|
-
AssetDatabase.StopAssetEditing();
|
|
364
|
-
}
|
|
365
|
-
EditorUtility.ClearProgressBar();
|
|
366
|
-
}
|
|
367
367
|
return changedCount;
|
|
368
368
|
}
|
|
369
369
|
}
|
package/Editor/PrefabChecker.cs
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
using Core.Attributes;
|
|
13
13
|
using Core.Extension;
|
|
14
14
|
using Core.Helper;
|
|
15
|
+
using Utils;
|
|
15
16
|
using WallstopStudios.UnityHelpers.Utils;
|
|
16
17
|
using Object = UnityEngine.Object;
|
|
17
18
|
|
|
@@ -148,23 +149,16 @@
|
|
|
148
149
|
GUI.enabled = wasEnabled && _checkNullObjectReferences;
|
|
149
150
|
try
|
|
150
151
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
true
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
finally
|
|
165
|
-
{
|
|
166
|
-
EditorGUI.indentLevel--;
|
|
167
|
-
}
|
|
152
|
+
using GUIIndentScope indent = new();
|
|
153
|
+
DrawAndAlign(
|
|
154
|
+
new GUIContent(
|
|
155
|
+
"Only if [ValidateAssignment]",
|
|
156
|
+
"Only report null object references if the field has the [ValidateAssignment] attribute."
|
|
157
|
+
),
|
|
158
|
+
() => _onlyCheckNullObjectsWithAttribute,
|
|
159
|
+
v => _onlyCheckNullObjectsWithAttribute = v,
|
|
160
|
+
true
|
|
161
|
+
);
|
|
168
162
|
}
|
|
169
163
|
finally
|
|
170
164
|
{
|
|
@@ -374,7 +368,7 @@
|
|
|
374
368
|
|
|
375
369
|
private void RunChecks()
|
|
376
370
|
{
|
|
377
|
-
if (_assetPaths
|
|
371
|
+
if (_assetPaths is not { Count: > 0 })
|
|
378
372
|
{
|
|
379
373
|
this.LogError($"No asset paths specified. Add folders containing prefabs.");
|
|
380
374
|
return;
|