com.wallstop-studios.unity-helpers 2.0.0-rc81.9 → 2.0.0
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/.editorconfig +1 -1
- package/.gitattributes +1 -1
- package/.githooks/pre-commit +31 -5
- package/.githooks/pre-push +50 -0
- package/.github/dependabot.yml +24 -2
- package/.github/scripts/check-markdown-links.ps1 +77 -0
- package/.github/scripts/check_markdown_links.py +89 -0
- package/.github/scripts/check_markdown_url_encoding.py +74 -0
- package/.github/scripts/validate_markdown_links.py +194 -0
- package/.github/workflows/csharpier-autofix.yml +152 -0
- package/.github/workflows/format-on-demand.yml +305 -0
- package/.github/workflows/lint-doc-links.yml +8 -5
- package/.github/workflows/markdown-json.yml +6 -2
- package/.github/workflows/prettier-autofix.yml +195 -0
- package/.github/workflows/update-dotnet-tools.yml +80 -0
- package/.github/workflows/yaml-format-lint.yml +41 -0
- package/.lychee.toml +4 -4
- package/.markdownlint.jsonc +21 -0
- package/.pre-commit-config.yaml +11 -3
- package/.yamllint.yaml +31 -0
- package/AGENTS.md +5 -1
- package/CHANGELOG.md +11 -0
- package/CONTRIBUTING.md +49 -0
- package/CONTRIBUTING.md.meta +7 -0
- package/EDITOR_TOOLS_GUIDE.md +4 -0
- package/Editor/AnimationEventEditor.cs +337 -160
- package/Editor/Core/Helper/AnimationEventHelpers.cs +178 -152
- package/Editor/CustomEditors/PersistentDirectoryGUI.cs +20 -11
- package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +11 -2
- package/Editor/FitTextureSizeWindow.cs +43 -19
- package/Editor/PersistentDirectorySettings.cs +64 -12
- package/Editor/PrefabChecker.cs +72 -5
- package/Editor/Sprites/AnimationCopier.cs +132 -56
- package/Editor/Sprites/AnimationCreator.cs +63 -22
- package/Editor/Sprites/AnimationViewerWindow.cs +42 -6
- package/Editor/Sprites/TexturePlatformNameHelper.cs +50 -39
- package/Editor/Sprites/TextureResizerWizard.cs +23 -1
- package/Editor/Sprites/TextureSettingsApplierWindow.cs +148 -85
- package/Editor/Tools/ImageBlurTool.cs +81 -10
- package/Editor/Utils/EditorUi.cs +1 -1
- package/Editor/Utils/ScriptableObjectSingletonCreator.cs +1 -1
- package/GETTING_STARTED.md +40 -56
- package/RANDOM_PERFORMANCE.md +12 -12
- package/README.md +395 -2407
- package/RELATIONAL_COMPONENTS.md +92 -83
- package/Runtime/AssemblyInfo.cs +2 -0
- package/Runtime/Core/Attributes/NotNullAttribute.cs +1 -3
- package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +50 -5
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +0 -1
- package/Runtime/Core/Extension/RandomExtensions.cs +68 -0
- package/Runtime/Core/Extension/WallstopStudiosLogger.cs +16 -0
- package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +4 -1
- package/Runtime/Core/Helper/ReflectionHelpers.cs +21 -10
- package/Runtime/Core/Helper/SpriteHelpers.cs +3 -1
- package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +45 -1
- package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +13 -5
- package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +1 -1
- package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +1 -1
- package/Runtime/Core/Serialization/Serializer.cs +101 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +96 -0
- package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +90 -10
- package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +13 -1
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs +114 -0
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs.meta +11 -0
- package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +16 -4
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs +241 -0
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +69 -2
- package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +89 -12
- package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +23 -1
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs +44 -0
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +16 -10
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs +243 -0
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Tags/AttributeMetadataCache.cs +1 -4
- package/Runtime/Utils/Buffers.cs +4 -4
- package/Runtime/Utils/ScriptableObjectSingleton.cs +0 -1
- package/Runtime/Utils/SetTextureImportData.cs +3 -1
- package/Runtime/Utils/TextureScale.cs +10 -2
- package/Runtime/Visuals/UGUI/EnhancedImage.cs +6 -0
- package/Runtime/Visuals/UIToolkit/LayeredImage.cs +4 -1
- package/SERIALIZATION.md +15 -0
- package/SPATIAL_TREE_2D_PERFORMANCE.md +85 -82
- package/SPATIAL_TREE_3D_PERFORMANCE.md +94 -91
- package/Samples~/DI - VContainer/README.md +232 -51
- package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +22 -4
- package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +5 -2
- package/Samples~/DI - VContainer/Scripts/Spawner.cs +113 -4
- package/Samples~/DI - Zenject/README.md +217 -53
- package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +3 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs +37 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs.meta +12 -0
- package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +74 -3
- package/Samples~/Random - PRNG/README.md +2 -1
- package/Samples~/Relational Components - Basic/README.md +3 -1
- package/Samples~/Serialization - JSON/README.md +2 -1
- package/Samples~/Spatial Structures - 2D and 3D/README.md +2 -1
- package/Samples~/UGUI - EnhancedImage/README.md +2 -1
- package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +2 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +16 -0
- package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +3 -3
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +6 -2
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs +170 -0
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +2 -1
- package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +3 -2
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs +131 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +6 -2
- package/Tests/Editor/PersistentDirectorySettingsTests.cs +59 -0
- package/Tests/Editor/PersistentDirectorySettingsTests.cs.meta +11 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs +32 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +64 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +1 -1
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +38 -0
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +1 -1
- package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +12 -12
- package/Tests/Editor/Sprites/SpriteCropperTests.cs +9 -9
- package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +3 -3
- package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +18 -0
- package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +5 -5
- package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +3 -3
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +4 -4
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +4 -4
- package/Tests/Editor/Tools/ImageBlurToolTests.cs +22 -110
- package/Tests/Editor/Utils/CommonTestBase.cs +43 -1
- package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +5 -5
- package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +66 -74
- package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +4 -15
- package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +29 -29
- package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +259 -218
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs +86 -0
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs.meta +11 -0
- package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +255 -227
- package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +5 -0
- package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +3 -0
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs +30 -0
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/JsonConverterTests.cs +8 -12
- package/Tests/Runtime/Serialization/JsonSerializationTest.cs +16 -5
- package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +12 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs +105 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs +247 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs.meta +11 -0
- package/Tests/Runtime/TestUtils/CommonTestBase.cs +88 -0
- package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMATests.cs +1 -1
- package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +1 -1
- package/Tests/Runtime/Visuals/EnhancedImageTests.cs +25 -56
- package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +1 -8
- package/package-lock.json.meta +7 -0
- package/package.json +8 -4
- package/scripts/check-eol.ps1 +4 -5
- package/scripts/lint-tests.ps1 +156 -0
- package/scripts/lint-tests.ps1.meta +7 -0
- package/scripts/normalize-eol.ps1 +6 -9
- package/.github/workflows/csharpier.yml +0 -135
|
@@ -3,7 +3,6 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
3
3
|
#if UNITY_EDITOR
|
|
4
4
|
using System;
|
|
5
5
|
using System.Collections.Generic;
|
|
6
|
-
using System.Linq;
|
|
7
6
|
using System.Reflection;
|
|
8
7
|
using UnityEditor;
|
|
9
8
|
using UnityEngine;
|
|
@@ -36,7 +35,7 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
36
35
|
/// </para>
|
|
37
36
|
/// <para>
|
|
38
37
|
/// - Uses <see cref="UnityEditor.TypeCache"/> to scan <see cref="MonoBehaviour"/> types and find
|
|
39
|
-
/// viable event handlers via <see cref="
|
|
38
|
+
/// viable event handlers via <see cref="AnimationEventHelpers"/>. In
|
|
40
39
|
/// Explicit Mode, only methods with <c>[AnimationEvent]</c> are included; it respects
|
|
41
40
|
/// <c>ignoreDerived</c> to limit inherited exposure.
|
|
42
41
|
/// </para>
|
|
@@ -116,21 +115,43 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
116
115
|
|
|
117
116
|
private static void InitializeTypeCache()
|
|
118
117
|
{
|
|
119
|
-
Dictionary<Type, IReadOnlyList<MethodInfo>> typesToMethods =
|
|
120
|
-
|
|
118
|
+
Dictionary<Type, IReadOnlyList<MethodInfo>> typesToMethods = new();
|
|
119
|
+
IEnumerable<Type> types =
|
|
120
|
+
WallstopStudios.UnityHelpers.Core.Helper.ReflectionHelpers.GetTypesDerivedFrom<MonoBehaviour>(
|
|
121
121
|
includeAbstract: false
|
|
122
|
-
)
|
|
123
|
-
.ToDictionary(
|
|
124
|
-
type => type,
|
|
125
|
-
type =>
|
|
126
|
-
(IReadOnlyList<MethodInfo>)
|
|
127
|
-
AnimationEventHelpers.GetPossibleAnimatorEventsForType(type)
|
|
128
122
|
);
|
|
129
|
-
foreach (
|
|
123
|
+
foreach (Type type in types)
|
|
130
124
|
{
|
|
131
|
-
if (
|
|
125
|
+
if (type == null)
|
|
132
126
|
{
|
|
133
|
-
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
List<MethodInfo> methods = AnimationEventHelpers.GetPossibleAnimatorEventsForType(
|
|
130
|
+
type
|
|
131
|
+
);
|
|
132
|
+
if (methods != null && methods.Count > 0)
|
|
133
|
+
{
|
|
134
|
+
typesToMethods[type] = methods;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
using (
|
|
139
|
+
Buffers<KeyValuePair<Type, IReadOnlyList<MethodInfo>>>.List.Get(
|
|
140
|
+
out List<KeyValuePair<Type, IReadOnlyList<MethodInfo>>> snapshot
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
{
|
|
144
|
+
foreach (KeyValuePair<Type, IReadOnlyList<MethodInfo>> kvp in typesToMethods)
|
|
145
|
+
{
|
|
146
|
+
snapshot.Add(kvp);
|
|
147
|
+
}
|
|
148
|
+
for (int i = 0; i < snapshot.Count; i++)
|
|
149
|
+
{
|
|
150
|
+
KeyValuePair<Type, IReadOnlyList<MethodInfo>> entry = snapshot[i];
|
|
151
|
+
if (entry.Value == null || entry.Value.Count <= 0)
|
|
152
|
+
{
|
|
153
|
+
_ = typesToMethods.Remove(entry.Key);
|
|
154
|
+
}
|
|
134
155
|
}
|
|
135
156
|
}
|
|
136
157
|
|
|
@@ -427,17 +448,18 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
427
448
|
|| _lastAnimationSearch != _animationSearchString
|
|
428
449
|
)
|
|
429
450
|
{
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
);
|
|
451
|
+
AnimationClip[] clips = _sourceAnimator.runtimeAnimatorController.animationClips;
|
|
452
|
+
_filteredClips = FilterAnimationClips(clips);
|
|
433
453
|
_lastAnimationSearch = _animationSearchString;
|
|
434
454
|
}
|
|
435
455
|
|
|
436
|
-
int
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
456
|
+
int curIndex = _filteredClips.IndexOf(_currentClip);
|
|
457
|
+
string[] names = new string[_filteredClips.Count];
|
|
458
|
+
for (int i = 0; i < _filteredClips.Count; i++)
|
|
459
|
+
{
|
|
460
|
+
names[i] = _filteredClips[i] != null ? _filteredClips[i].name : string.Empty;
|
|
461
|
+
}
|
|
462
|
+
int selectedIndex = EditorGUILayout.Popup("Animation", curIndex, names);
|
|
441
463
|
|
|
442
464
|
if (selectedIndex < 0)
|
|
443
465
|
{
|
|
@@ -449,50 +471,67 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
449
471
|
return _filteredClips[selectedIndex];
|
|
450
472
|
}
|
|
451
473
|
|
|
452
|
-
private List<AnimationClip> FilterAnimationClips(
|
|
474
|
+
private List<AnimationClip> FilterAnimationClips(AnimationClip[] clips)
|
|
453
475
|
{
|
|
454
476
|
if (
|
|
455
477
|
string.IsNullOrEmpty(_animationSearchString)
|
|
456
478
|
|| string.Equals(_animationSearchString, "*", StringComparison.Ordinal)
|
|
457
479
|
)
|
|
458
480
|
{
|
|
459
|
-
return clips;
|
|
481
|
+
return new List<AnimationClip>(clips);
|
|
460
482
|
}
|
|
461
|
-
|
|
462
|
-
List<string> searchTerms
|
|
463
|
-
.Split(" ")
|
|
464
|
-
.Select(searchPart => searchPart.ToLowerInvariant().Trim())
|
|
465
|
-
.Where(trimmed =>
|
|
466
|
-
!string.IsNullOrEmpty(trimmed)
|
|
467
|
-
&& !string.Equals(trimmed, "*", StringComparison.Ordinal)
|
|
468
|
-
)
|
|
469
|
-
.ToList();
|
|
470
|
-
|
|
471
|
-
if (searchTerms.Count == 0)
|
|
483
|
+
string[] parts = _animationSearchString.Split(' ');
|
|
484
|
+
using (Buffers<string>.List.Get(out List<string> searchTerms))
|
|
472
485
|
{
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
List<AnimationClip> filtered = new();
|
|
477
|
-
foreach (AnimationClip clip in clips)
|
|
478
|
-
{
|
|
479
|
-
bool matches = true;
|
|
480
|
-
foreach (string searchTerm in searchTerms)
|
|
486
|
+
for (int i = 0; i < parts.Length; i++)
|
|
481
487
|
{
|
|
482
|
-
|
|
488
|
+
string s = parts[i];
|
|
489
|
+
if (string.IsNullOrEmpty(s))
|
|
483
490
|
{
|
|
484
|
-
|
|
485
|
-
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
s = s.Trim();
|
|
494
|
+
if (s.Length == 0 || s == "*")
|
|
495
|
+
{
|
|
496
|
+
continue;
|
|
486
497
|
}
|
|
498
|
+
s = s.ToLowerInvariant();
|
|
499
|
+
searchTerms.Add(s);
|
|
487
500
|
}
|
|
488
501
|
|
|
489
|
-
if (
|
|
502
|
+
if (searchTerms.Count == 0)
|
|
490
503
|
{
|
|
491
|
-
|
|
504
|
+
return new List<AnimationClip>(clips);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
List<AnimationClip> filtered = new();
|
|
508
|
+
for (int ci = 0; ci < clips.Length; ci++)
|
|
509
|
+
{
|
|
510
|
+
AnimationClip clip = clips[ci];
|
|
511
|
+
if (clip == null)
|
|
512
|
+
{
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
bool matches = true;
|
|
516
|
+
string nameLower =
|
|
517
|
+
clip.name != null ? clip.name.ToLowerInvariant() : string.Empty;
|
|
518
|
+
for (int si = 0; si < searchTerms.Count; si++)
|
|
519
|
+
{
|
|
520
|
+
if (nameLower.IndexOf(searchTerms[si], StringComparison.Ordinal) < 0)
|
|
521
|
+
{
|
|
522
|
+
matches = false;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (matches || clip == _currentClip)
|
|
528
|
+
{
|
|
529
|
+
filtered.Add(clip);
|
|
530
|
+
}
|
|
492
531
|
}
|
|
493
|
-
}
|
|
494
532
|
|
|
495
|
-
|
|
533
|
+
return filtered;
|
|
534
|
+
}
|
|
496
535
|
}
|
|
497
536
|
|
|
498
537
|
private int AnimationEventComparison(AnimationEventItem lhs, AnimationEventItem rhs)
|
|
@@ -520,12 +559,25 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
520
559
|
|
|
521
560
|
private void DrawControlButtons()
|
|
522
561
|
{
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
562
|
+
bool equalLists = false;
|
|
563
|
+
if (_baseClipEvents.Count == _state.Count)
|
|
564
|
+
{
|
|
565
|
+
equalLists = true;
|
|
566
|
+
for (int i = 0; i < _baseClipEvents.Count; i++)
|
|
567
|
+
{
|
|
568
|
+
if (
|
|
569
|
+
!AnimationEventEqualityComparer.Instance.Equals(
|
|
570
|
+
_baseClipEvents[i],
|
|
571
|
+
_state[i].animationEvent
|
|
572
|
+
)
|
|
573
|
+
)
|
|
574
|
+
{
|
|
575
|
+
equalLists = false;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if (equalLists && !_frameRateChanged)
|
|
529
581
|
{
|
|
530
582
|
GUILayout.Label("No changes detected...");
|
|
531
583
|
return;
|
|
@@ -544,14 +596,21 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
544
596
|
RefreshAnimationEvents();
|
|
545
597
|
}
|
|
546
598
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
599
|
+
bool outOfOrder = false;
|
|
600
|
+
for (int i = 1; i < _state.Count; i++)
|
|
601
|
+
{
|
|
602
|
+
if (
|
|
603
|
+
AnimationEventEqualityComparer.Instance.Compare(
|
|
604
|
+
_state[i - 1].animationEvent,
|
|
605
|
+
_state[i].animationEvent
|
|
606
|
+
) > 0
|
|
553
607
|
)
|
|
554
|
-
|
|
608
|
+
{
|
|
609
|
+
outOfOrder = true;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if (outOfOrder)
|
|
555
614
|
{
|
|
556
615
|
if (GUILayout.Button("Re-Order"))
|
|
557
616
|
{
|
|
@@ -783,21 +842,38 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
783
842
|
}
|
|
784
843
|
|
|
785
844
|
AnimationEvent animEvent = item.animationEvent;
|
|
786
|
-
|
|
787
|
-
KeyValuePair<Type, IReadOnlyList<MethodInfo>> entry in lookup.OrderBy(kvp =>
|
|
788
|
-
kvp.Key.FullName
|
|
789
|
-
)
|
|
790
|
-
)
|
|
845
|
+
using (Buffers<Type>.List.Get(out List<Type> types))
|
|
791
846
|
{
|
|
792
|
-
foreach (
|
|
847
|
+
foreach (Type t in lookup.Keys)
|
|
793
848
|
{
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
849
|
+
types.Add(t);
|
|
850
|
+
}
|
|
851
|
+
types.Sort(
|
|
852
|
+
static (a, b) =>
|
|
853
|
+
string.Compare(a.FullName, b.FullName, StringComparison.Ordinal)
|
|
854
|
+
);
|
|
855
|
+
for (int ti = 0; ti < types.Count; ti++)
|
|
856
|
+
{
|
|
857
|
+
Type type = types[ti];
|
|
858
|
+
if (!lookup.TryGetValue(type, out IReadOnlyList<MethodInfo> methods))
|
|
797
859
|
{
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
for (int mi = 0; mi < methods.Count; mi++)
|
|
863
|
+
{
|
|
864
|
+
MethodInfo method = methods[mi];
|
|
865
|
+
if (
|
|
866
|
+
string.Equals(
|
|
867
|
+
method.Name,
|
|
868
|
+
animEvent.functionName,
|
|
869
|
+
StringComparison.Ordinal
|
|
870
|
+
)
|
|
871
|
+
)
|
|
872
|
+
{
|
|
873
|
+
item.selectedType = type;
|
|
874
|
+
item.selectedMethod = method;
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
801
877
|
}
|
|
802
878
|
}
|
|
803
879
|
}
|
|
@@ -818,62 +894,129 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
818
894
|
}
|
|
819
895
|
|
|
820
896
|
// Get all types, but prioritize the selected one and filter by search
|
|
821
|
-
List<Type> allTypes
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
// Apply type search filter
|
|
825
|
-
if (!string.IsNullOrEmpty(item.typeSearch))
|
|
897
|
+
List<Type> allTypes;
|
|
898
|
+
using (Buffers<Type>.List.Get(out allTypes))
|
|
899
|
+
using (Buffers<Type>.List.Get(out List<Type> filteredTypes))
|
|
826
900
|
{
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
.
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
901
|
+
foreach (Type t in lookup.Keys)
|
|
902
|
+
{
|
|
903
|
+
allTypes.Add(t);
|
|
904
|
+
}
|
|
905
|
+
allTypes.Sort(
|
|
906
|
+
static (a, b) =>
|
|
907
|
+
string.Compare(a.FullName, b.FullName, StringComparison.Ordinal)
|
|
908
|
+
);
|
|
909
|
+
for (int i = 0; i < allTypes.Count; i++)
|
|
910
|
+
{
|
|
911
|
+
filteredTypes.Add(allTypes[i]);
|
|
912
|
+
}
|
|
833
913
|
|
|
834
|
-
//
|
|
835
|
-
if (
|
|
914
|
+
// Apply type search filter
|
|
915
|
+
if (!string.IsNullOrEmpty(item.typeSearch))
|
|
836
916
|
{
|
|
837
|
-
|
|
917
|
+
string searchLower = item.typeSearch.ToLowerInvariant();
|
|
918
|
+
filteredTypes.Clear();
|
|
919
|
+
for (int i = 0; i < allTypes.Count; i++)
|
|
920
|
+
{
|
|
921
|
+
Type t = allTypes[i];
|
|
922
|
+
string full = t.FullName ?? string.Empty;
|
|
923
|
+
string low = full.ToLowerInvariant();
|
|
924
|
+
if (low.IndexOf(searchLower, StringComparison.Ordinal) >= 0)
|
|
925
|
+
{
|
|
926
|
+
filteredTypes.Add(t);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// Always include selected type even if it doesn't match search
|
|
931
|
+
if (item.selectedType != null)
|
|
932
|
+
{
|
|
933
|
+
bool present = false;
|
|
934
|
+
for (int i = 0; i < filteredTypes.Count; i++)
|
|
935
|
+
{
|
|
936
|
+
if (filteredTypes[i] == item.selectedType)
|
|
937
|
+
{
|
|
938
|
+
present = true;
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
if (!present)
|
|
943
|
+
{
|
|
944
|
+
filteredTypes.Insert(0, item.selectedType);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
838
947
|
}
|
|
839
|
-
}
|
|
840
948
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
949
|
+
// Limit to reasonable number, but show more if searching
|
|
950
|
+
int limit = string.IsNullOrEmpty(item.typeSearch) ? 50 : 200;
|
|
951
|
+
using (Buffers<Type>.List.Get(out List<Type> displayTypes))
|
|
952
|
+
{
|
|
953
|
+
int take = filteredTypes.Count > limit ? limit : filteredTypes.Count;
|
|
954
|
+
for (int i = 0; i < take; i++)
|
|
955
|
+
{
|
|
956
|
+
displayTypes.Add(filteredTypes[i]);
|
|
957
|
+
}
|
|
844
958
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
959
|
+
if (item.selectedType != null)
|
|
960
|
+
{
|
|
961
|
+
bool found = false;
|
|
962
|
+
for (int i = 0; i < displayTypes.Count; i++)
|
|
963
|
+
{
|
|
964
|
+
if (displayTypes[i] == item.selectedType)
|
|
965
|
+
{
|
|
966
|
+
found = true;
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
if (!found)
|
|
971
|
+
{
|
|
972
|
+
displayTypes.Insert(0, item.selectedType);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
849
975
|
|
|
850
|
-
|
|
976
|
+
string[] orderedTypeNames = new string[displayTypes.Count];
|
|
977
|
+
for (int i = 0; i < displayTypes.Count; i++)
|
|
978
|
+
{
|
|
979
|
+
Type t = displayTypes[i];
|
|
980
|
+
orderedTypeNames[i] =
|
|
981
|
+
t != null ? (t.FullName ?? string.Empty) : string.Empty;
|
|
982
|
+
}
|
|
851
983
|
|
|
852
|
-
|
|
984
|
+
int existingIndex = -1;
|
|
985
|
+
for (int i = 0; i < displayTypes.Count; i++)
|
|
986
|
+
{
|
|
987
|
+
if (displayTypes[i] == item.selectedType)
|
|
988
|
+
{
|
|
989
|
+
existingIndex = i;
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
853
993
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
994
|
+
EditorGUI.BeginChangeCheck();
|
|
995
|
+
int selectedTypeIndex = EditorGUILayout.Popup(
|
|
996
|
+
"TypeName",
|
|
997
|
+
existingIndex,
|
|
998
|
+
orderedTypeNames
|
|
999
|
+
);
|
|
860
1000
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
1001
|
+
if (EditorGUI.EndChangeCheck())
|
|
1002
|
+
{
|
|
1003
|
+
RecordUndo("Change Animation Event Type");
|
|
1004
|
+
item.selectedType =
|
|
1005
|
+
selectedTypeIndex < 0 ? null : displayTypes[selectedTypeIndex];
|
|
1006
|
+
item.selectedMethod = null;
|
|
1007
|
+
}
|
|
867
1008
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1009
|
+
if (filteredTypes.Count > limit)
|
|
1010
|
+
{
|
|
1011
|
+
EditorGUILayout.HelpBox(
|
|
1012
|
+
$"Showing {limit} of {filteredTypes.Count} types. Use Type Search to filter.",
|
|
1013
|
+
MessageType.Info
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
875
1016
|
|
|
876
|
-
|
|
1017
|
+
return item.selectedType != null;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
877
1020
|
}
|
|
878
1021
|
|
|
879
1022
|
private bool SelectMethods(
|
|
@@ -892,7 +1035,7 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
892
1035
|
methods = new List<MethodInfo>(0);
|
|
893
1036
|
}
|
|
894
1037
|
|
|
895
|
-
List<MethodInfo> methodsList = methods
|
|
1038
|
+
List<MethodInfo> methodsList = new(methods);
|
|
896
1039
|
|
|
897
1040
|
if (item.selectedMethod == null || !methodsList.Contains(item.selectedMethod))
|
|
898
1041
|
{
|
|
@@ -914,11 +1057,21 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
914
1057
|
}
|
|
915
1058
|
|
|
916
1059
|
EditorGUI.BeginChangeCheck();
|
|
917
|
-
int
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
methodsList
|
|
921
|
-
|
|
1060
|
+
int curIndex = -1;
|
|
1061
|
+
for (int i = 0; i < methodsList.Count; i++)
|
|
1062
|
+
{
|
|
1063
|
+
if (methodsList[i] == item.selectedMethod)
|
|
1064
|
+
{
|
|
1065
|
+
curIndex = i;
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
string[] methodNames = new string[methodsList.Count];
|
|
1070
|
+
for (int i = 0; i < methodsList.Count; i++)
|
|
1071
|
+
{
|
|
1072
|
+
methodNames[i] = methodsList[i] != null ? methodsList[i].Name : string.Empty;
|
|
1073
|
+
}
|
|
1074
|
+
int selectedMethodIndex = EditorGUILayout.Popup("MethodName", curIndex, methodNames);
|
|
922
1075
|
|
|
923
1076
|
if (EditorGUI.EndChangeCheck() && selectedMethodIndex >= 0)
|
|
924
1077
|
{
|
|
@@ -953,12 +1106,11 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
953
1106
|
else if (paramType.BaseType == typeof(Enum))
|
|
954
1107
|
{
|
|
955
1108
|
string[] enumNamesArray = Enum.GetNames(paramType);
|
|
956
|
-
List<string> enumNames = enumNamesArray.ToList();
|
|
957
1109
|
string enumName = Enum.GetName(paramType, animEvent.intParameter);
|
|
958
|
-
|
|
1110
|
+
int curIndex = Array.IndexOf(enumNamesArray, enumName);
|
|
959
1111
|
int index = EditorGUILayout.Popup(
|
|
960
1112
|
$"{paramType.Name}",
|
|
961
|
-
|
|
1113
|
+
curIndex,
|
|
962
1114
|
enumNamesArray
|
|
963
1115
|
);
|
|
964
1116
|
|
|
@@ -966,7 +1118,7 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
966
1118
|
if (checkEnded && index >= 0)
|
|
967
1119
|
{
|
|
968
1120
|
RecordUndo("Change Animation Event Parameter");
|
|
969
|
-
animEvent.intParameter = (int)Enum.Parse(paramType,
|
|
1121
|
+
animEvent.intParameter = (int)Enum.Parse(paramType, enumNamesArray[index]);
|
|
970
1122
|
}
|
|
971
1123
|
|
|
972
1124
|
item.overrideEnumValues = EditorGUILayout.Toggle(
|
|
@@ -1050,23 +1202,43 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
1050
1202
|
|
|
1051
1203
|
Dictionary<Type, List<MethodInfo>> filtered = new();
|
|
1052
1204
|
|
|
1053
|
-
List<string> methodSearchTerms =
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1205
|
+
List<string> methodSearchTerms = new();
|
|
1206
|
+
{
|
|
1207
|
+
string[] parts = item.search.Split(' ');
|
|
1208
|
+
for (int i = 0; i < parts.Length; i++)
|
|
1209
|
+
{
|
|
1210
|
+
string s = parts[i];
|
|
1211
|
+
if (string.IsNullOrEmpty(s))
|
|
1212
|
+
{
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
s = s.Trim();
|
|
1216
|
+
if (s.Length == 0 || s == "*")
|
|
1217
|
+
{
|
|
1218
|
+
continue;
|
|
1219
|
+
}
|
|
1220
|
+
methodSearchTerms.Add(s.ToLowerInvariant());
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
List<string> typeSearchTerms = new();
|
|
1225
|
+
{
|
|
1226
|
+
string[] parts = item.typeSearch.Split(' ');
|
|
1227
|
+
for (int i = 0; i < parts.Length; i++)
|
|
1228
|
+
{
|
|
1229
|
+
string s = parts[i];
|
|
1230
|
+
if (string.IsNullOrEmpty(s))
|
|
1231
|
+
{
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
s = s.Trim();
|
|
1235
|
+
if (s.Length == 0 || s == "*")
|
|
1236
|
+
{
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
typeSearchTerms.Add(s.ToLowerInvariant());
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1070
1242
|
|
|
1071
1243
|
foreach (KeyValuePair<Type, IReadOnlyList<MethodInfo>> kvp in Lookup)
|
|
1072
1244
|
{
|
|
@@ -1091,7 +1263,7 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
1091
1263
|
}
|
|
1092
1264
|
}
|
|
1093
1265
|
|
|
1094
|
-
List<MethodInfo> methodList = kvp.Value
|
|
1266
|
+
List<MethodInfo> methodList = new(kvp.Value);
|
|
1095
1267
|
|
|
1096
1268
|
// Filter by method search
|
|
1097
1269
|
if (methodSearchTerms.Count > 0)
|
|
@@ -1126,10 +1298,12 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
1126
1298
|
}
|
|
1127
1299
|
}
|
|
1128
1300
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1301
|
+
Dictionary<Type, IReadOnlyList<MethodInfo>> ro = new();
|
|
1302
|
+
foreach (KeyValuePair<Type, List<MethodInfo>> e in filtered)
|
|
1303
|
+
{
|
|
1304
|
+
ro[e.Key] = e.Value;
|
|
1305
|
+
}
|
|
1306
|
+
item.cachedLookup = lookup = ro;
|
|
1133
1307
|
item.lastSearchForCache = currentSearch;
|
|
1134
1308
|
}
|
|
1135
1309
|
else
|
|
@@ -1321,12 +1495,13 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
1321
1495
|
}
|
|
1322
1496
|
|
|
1323
1497
|
_selectedFrameIndex = MaxFrameIndex;
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
.
|
|
1498
|
+
ObjectReferenceKeyframe[] curve = AnimationUtility.GetObjectReferenceCurve(
|
|
1499
|
+
_currentClip,
|
|
1500
|
+
EditorCurveBinding.PPtrCurve("", typeof(SpriteRenderer), "m_Sprite")
|
|
1501
|
+
);
|
|
1502
|
+
_referenceCurve = new List<ObjectReferenceKeyframe>(
|
|
1503
|
+
curve ?? Array.Empty<ObjectReferenceKeyframe>()
|
|
1504
|
+
);
|
|
1330
1505
|
_referenceCurve.Sort(
|
|
1331
1506
|
(lhs, rhs) =>
|
|
1332
1507
|
{
|
|
@@ -1356,10 +1531,12 @@ namespace WallstopStudios.UnityHelpers.Editor
|
|
|
1356
1531
|
{
|
|
1357
1532
|
Undo.RecordObject(_currentClip, "Save Animation Events");
|
|
1358
1533
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1534
|
+
AnimationEvent[] arr = new AnimationEvent[_state.Count];
|
|
1535
|
+
for (int i = 0; i < _state.Count; i++)
|
|
1536
|
+
{
|
|
1537
|
+
arr[i] = _state[i].animationEvent;
|
|
1538
|
+
}
|
|
1539
|
+
AnimationUtility.SetAnimationEvents(_currentClip, arr);
|
|
1363
1540
|
|
|
1364
1541
|
// Apply frame rate changes if any
|
|
1365
1542
|
if (_frameRateChanged)
|