com.wallstop-studios.unity-helpers 2.0.0-rc75.9 → 2.0.0-rc76
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/CustomDrawers/IntDropdownDrawer.cs +46 -0
- package/Editor/CustomDrawers/IntDropdownDrawer.cs.meta +3 -0
- package/Editor/{StringInListeDrawer.cs → CustomDrawers/StringInListeDrawer.cs} +2 -2
- package/Editor/{WShowIfPropertyDrawer.cs → CustomDrawers/WShowIfPropertyDrawer.cs} +3 -3
- package/Editor/CustomDrawers.meta +3 -0
- package/Editor/Sprites/AnimationViewerWindow.cs +1521 -0
- package/Editor/Sprites/AnimationViewerWindow.cs.meta +3 -0
- package/Editor/Sprites/ProjectAnimationSettings.cs +50 -0
- package/Editor/Sprites/ProjectAnimationSettings.cs.meta +3 -0
- package/Editor/Sprites/ScriptableSpriteAtlas.cs +4 -2
- package/Editor/Styles/AnimationViewer.uss +116 -0
- package/Editor/Styles/AnimationViewer.uss.meta +3 -0
- package/Editor/Styles/AnimationViewer.uxml +57 -0
- package/Editor/Styles/AnimationViewer.uxml.meta +3 -0
- package/Editor/Styles.meta +3 -0
- package/Editor/UI.meta +3 -0
- package/Runtime/Core/Attributes/IntDropdownAttribute.cs +14 -0
- package/Runtime/Core/Attributes/IntDropdownAttribute.cs.meta +3 -0
- package/Runtime/UI/LayeredImage.cs +193 -98
- package/Runtime/UI/MultiFileSelectorElement.cs +322 -0
- package/Runtime/UI/MultiFileSelectorElement.cs.meta +3 -0
- package/package.json +2 -1
- package/Editor/AnimatorControllerCopier.cs +0 -156
- package/Editor/AnimatorControllerCopier.cs.meta +0 -3
- /package/Editor/{StringInListeDrawer.cs.meta → CustomDrawers/StringInListeDrawer.cs.meta} +0 -0
- /package/Editor/{WShowIfPropertyDrawer.cs.meta → CustomDrawers/WShowIfPropertyDrawer.cs.meta} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Editor.Sprites
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
public sealed class ProjectAnimationSettings : ScriptableObject
|
|
7
|
+
{
|
|
8
|
+
public string lastAnimationPath = "Assets";
|
|
9
|
+
|
|
10
|
+
private static ProjectAnimationSettings _instance;
|
|
11
|
+
private const string SettingsPath = "Assets/Editor/ProjectAnimationSettings.asset";
|
|
12
|
+
|
|
13
|
+
public static ProjectAnimationSettings Instance
|
|
14
|
+
{
|
|
15
|
+
get
|
|
16
|
+
{
|
|
17
|
+
if (_instance != null)
|
|
18
|
+
{
|
|
19
|
+
return _instance;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_instance = UnityEditor.AssetDatabase.LoadAssetAtPath<ProjectAnimationSettings>(
|
|
23
|
+
SettingsPath
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (_instance != null)
|
|
27
|
+
{
|
|
28
|
+
return _instance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_instance = CreateInstance<ProjectAnimationSettings>();
|
|
32
|
+
if (!UnityEditor.AssetDatabase.IsValidFolder("Assets/Editor"))
|
|
33
|
+
{
|
|
34
|
+
UnityEditor.AssetDatabase.CreateFolder("Assets", "Editor");
|
|
35
|
+
}
|
|
36
|
+
UnityEditor.AssetDatabase.CreateAsset(_instance, SettingsPath);
|
|
37
|
+
UnityEditor.AssetDatabase.SaveAssets();
|
|
38
|
+
UnityEditor.AssetDatabase.Refresh();
|
|
39
|
+
Debug.Log("Created ProjectAnimationSettings at: " + SettingsPath);
|
|
40
|
+
return _instance;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public void Save()
|
|
45
|
+
{
|
|
46
|
+
UnityEditor.EditorUtility.SetDirty(this);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
#endif
|
|
50
|
+
}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
[Header("Output Atlas Settings")]
|
|
46
46
|
[Tooltip("Directory where the .spriteatlas asset will be saved. Relative to Assets/.")]
|
|
47
|
-
public string outputSpriteAtlasDirectory = "Assets/Sprites/
|
|
47
|
+
public string outputSpriteAtlasDirectory = "Assets/Sprites/Atlases";
|
|
48
48
|
public string outputSpriteAtlasName = "MyNewAtlas";
|
|
49
49
|
|
|
50
50
|
public string FullOutputPath
|
|
@@ -69,12 +69,14 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
[Header("Packing Settings")]
|
|
72
|
-
|
|
72
|
+
[IntDropdown(32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384)]
|
|
73
|
+
public int maxTextureSize = 8192;
|
|
73
74
|
|
|
74
75
|
[Tooltip("Allow Unity to rotate sprites to fit them better.")]
|
|
75
76
|
public bool enableRotation = true;
|
|
76
77
|
|
|
77
78
|
[Tooltip("Padding in pixels between sprites in the atlas.")]
|
|
79
|
+
[IntDropdown(0, 2, 4, 8, 16, 32)]
|
|
78
80
|
public int padding = 4;
|
|
79
81
|
|
|
80
82
|
[Tooltip(
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
* {
|
|
2
|
+
--unity-selection-color: rgba(144, 238, 144, 0.3);
|
|
3
|
+
transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.frame-item {
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
align-items: center;
|
|
9
|
+
padding: 5px;
|
|
10
|
+
margin-bottom: 5px;
|
|
11
|
+
border-width: 1px;
|
|
12
|
+
border-color: rgb(70, 70, 70);
|
|
13
|
+
background-color: rgb(55, 55, 55);
|
|
14
|
+
min-height: 60px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.frame-item:hover {
|
|
18
|
+
background-color: rgb(65, 65, 65);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.frame-item-dragged {
|
|
22
|
+
opacity: 0.5;
|
|
23
|
+
border-width: 2px;
|
|
24
|
+
border-color: yellow;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.frame-image {
|
|
28
|
+
width: 50px;
|
|
29
|
+
height: 50px;
|
|
30
|
+
margin-right: 10px;
|
|
31
|
+
border-width: 1px;
|
|
32
|
+
border-color: rgb(30, 30, 30);
|
|
33
|
+
background-color: rgb(45, 45, 45);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.frame-info {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
flex-grow: 1;
|
|
39
|
+
margin-right: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.frame-index-field {
|
|
43
|
+
flex-shrink: 1;
|
|
44
|
+
flex-grow: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.frame-index-field > .unity-text-element {
|
|
48
|
+
min-width: 0;
|
|
49
|
+
width: auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.frame-index-field > #unity-text-input {
|
|
53
|
+
width: 30px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.drop-placeholder {
|
|
57
|
+
height: 10px;
|
|
58
|
+
background-color: #4A90E2;
|
|
59
|
+
margin-top: 2px;
|
|
60
|
+
margin-bottom: 2px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.animation-preview-element {
|
|
64
|
+
width: 256px;
|
|
65
|
+
height: 256px;
|
|
66
|
+
min-width: 256px;
|
|
67
|
+
min-height: 256px;
|
|
68
|
+
background-color: rgb(60, 60, 60);
|
|
69
|
+
border-width: 1px;
|
|
70
|
+
border-color: rgb(30, 30, 30);
|
|
71
|
+
margin-bottom: 10px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.loaded-clip-item {
|
|
75
|
+
flex-direction: row;
|
|
76
|
+
align-items: center;
|
|
77
|
+
padding: 3px 5px;
|
|
78
|
+
margin-bottom: 2px;
|
|
79
|
+
background-color: rgb(60, 60, 60);
|
|
80
|
+
border-radius: 3px;
|
|
81
|
+
border-width: 1px;
|
|
82
|
+
border-color: transparent;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.loaded-clip-item:hover {
|
|
86
|
+
background-color: rgb(10, 10, 10);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.loaded-clip-item--active {
|
|
90
|
+
background-color: rgb(50, 90, 130);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.loaded-clip-item--active:hover {
|
|
94
|
+
background-color: rgb(50, 90, 130);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.loaded-clip-item Label {
|
|
98
|
+
flex-grow: 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.loaded-clip-item Button {
|
|
102
|
+
width: 20px;
|
|
103
|
+
height: 20px;
|
|
104
|
+
min-width: 20px;
|
|
105
|
+
padding: 0;
|
|
106
|
+
margin-left: 5px;
|
|
107
|
+
font-size: 10px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.animation-preview-container {
|
|
111
|
+
width: 256px;
|
|
112
|
+
height: 256px;
|
|
113
|
+
min-width: 150px;
|
|
114
|
+
min-height: 150px;
|
|
115
|
+
align-self: center;
|
|
116
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
|
|
2
|
+
<ui:VisualElement name="main-container" style="flex-grow: 1;">
|
|
3
|
+
<!-- Toolbar Area -->
|
|
4
|
+
<ui:VisualElement name="toolbar"
|
|
5
|
+
style="flex-direction: column; padding: 5px; border-bottom-width: 1px; border-bottom-color: rgb(40,40,40);">
|
|
6
|
+
<!-- Clip Management Toolbar -->
|
|
7
|
+
<ui:VisualElement name="clip-management-toolbar" style="flex-direction: row; margin-bottom: 5px;">
|
|
8
|
+
<uie:ObjectField label="Add Clip:" name="addAnimationClipField"
|
|
9
|
+
style="flex-grow: 1; margin-right: 5px;" />
|
|
10
|
+
<ui:Button text="Browse Add..." name="browseAndAddButton" style="margin-right: 10px;" />
|
|
11
|
+
</ui:VisualElement>
|
|
12
|
+
<!-- FPS and Save Toolbar -->
|
|
13
|
+
<ui:VisualElement name="fps-toolbar" style="flex-direction: row;">
|
|
14
|
+
<ui:Label text="Preview FPS:" style="margin-right: 5px; align-self: center;" />
|
|
15
|
+
<ui:FloatField name="fpsField" value="12.0" style="width: 50px; margin-right: 10px;" />
|
|
16
|
+
<ui:Button text="Apply Preview FPS" name="applyFpsButton" /> <!-- Name updated to match C# -->
|
|
17
|
+
<ui:Button text="Save Active Clip" name="saveClipButton" style="margin-left: auto;" />
|
|
18
|
+
</ui:VisualElement>
|
|
19
|
+
</ui:VisualElement>
|
|
20
|
+
|
|
21
|
+
<!-- Main Content Area -->
|
|
22
|
+
<ui:VisualElement name="content-area" style="flex-grow: 1; flex-direction: row;">
|
|
23
|
+
<!-- Left Panel: Loaded Clips List & Preview -->
|
|
24
|
+
<ui:VisualElement name="left-panel"
|
|
25
|
+
style="width: 300px; min-width:200px; padding: 10px; border-right-width: 1px; border-right-color: rgb(40,40,40); flex-direction: column;">
|
|
26
|
+
<ui:Label text="Loaded Animation Clips"
|
|
27
|
+
style="font-size: 14px; -unity-font-style: bold; margin-bottom: 5px;" />
|
|
28
|
+
<ui:ScrollView name="loadedClipsScrollView" mode="Vertical"
|
|
29
|
+
style="min-height: 100px; max-height: 200px; margin-bottom:10px; border-width:1px; border-color:rgb(30,30,30);">
|
|
30
|
+
<ui:VisualElement name="loadedClipsContainer" />
|
|
31
|
+
<!-- Container for dynamically added clip items -->
|
|
32
|
+
</ui:ScrollView>
|
|
33
|
+
|
|
34
|
+
<ui:Label text="Animation Preview" name="previewTitle"
|
|
35
|
+
style="font-size: 14px; -unity-font-style: bold; margin-bottom: 10px;" />
|
|
36
|
+
<!-- This is the HOST for the LayeredImage created in C# -->
|
|
37
|
+
<ui:VisualElement name="preview-panel"
|
|
38
|
+
style="flex-grow:1; align-items: center; justify-content: center;">
|
|
39
|
+
<!-- The LayeredImage VisualElement will be added here by C# -->
|
|
40
|
+
<!-- The class 'animation-preview-container' will be applied to this 'preview-panel' from C# -->
|
|
41
|
+
</ui:VisualElement>
|
|
42
|
+
<ui:Label text="Detected FPS Info (Active Clip):" name="fpsDebugLabel"
|
|
43
|
+
style="margin-top: 10px; white-space: normal; font-size: 10px; color: grey;" />
|
|
44
|
+
</ui:VisualElement>
|
|
45
|
+
|
|
46
|
+
<!-- Right Panel: Frames of the Active Clip -->
|
|
47
|
+
<ui:VisualElement name="frames-panel" style="flex-grow: 1; padding: 10px;">
|
|
48
|
+
<ui:Label text="Frames (Active Clip):" name="framesPanelTitle"
|
|
49
|
+
style="font-size: 14px; -unity-font-style: bold; margin-bottom: 10px;" />
|
|
50
|
+
<ui:ScrollView name="framesScrollView" mode="Vertical" style="flex-grow: 1;">
|
|
51
|
+
<!-- Container for dynamically added frame items -->
|
|
52
|
+
<ui:VisualElement name="framesContainer" style="flex-direction: column;" />
|
|
53
|
+
</ui:ScrollView>
|
|
54
|
+
</ui:VisualElement>
|
|
55
|
+
</ui:VisualElement>
|
|
56
|
+
</ui:VisualElement>
|
|
57
|
+
</ui:UXML>
|
package/Editor/UI.meta
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Core.Attributes
|
|
2
|
+
{
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
public sealed class IntDropdownAttribute : PropertyAttribute
|
|
6
|
+
{
|
|
7
|
+
public int[] Options { get; }
|
|
8
|
+
|
|
9
|
+
public IntDropdownAttribute(params int[] options)
|
|
10
|
+
{
|
|
11
|
+
Options = options;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|