Skip to content

Commit 1746775

Browse files
committed
feat: Improve UI
1 parent 0138f14 commit 1746775

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

Editor/Scripts/Node/AnimationClipPlayableNode.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Text;
2+
using UnityEditor.UIElements;
3+
using UnityEngine;
24
using UnityEngine.Animations;
35
using UnityEngine.Playables;
46
using UnityEngine.UIElements;
@@ -10,21 +12,6 @@ namespace GBG.PlayableGraphMonitor.Editor.Node
1012
{
1113
public sealed class AnimationClipPlayableNode : PlayableNode
1214
{
13-
public override string title
14-
{
15-
get => _mainTitle;
16-
set
17-
{
18-
_mainTitle = value;
19-
var clipPlayable = (AnimationClipPlayable)Playable;
20-
var clip = clipPlayable.GetAnimationClip();
21-
var clipName = clip ? clip.name : "None";
22-
base.title = $"{_mainTitle}\n({clipName})";
23-
}
24-
}
25-
26-
private string _mainTitle;
27-
2815
private readonly ProgressBar _progressBar;
2916

3017

@@ -34,9 +21,21 @@ public AnimationClipPlayableNode(Playable playable) : base(playable)
3421
var titleLabel = titleContainer.Q<Label>(name: "title-label");
3522
titleLabel.style.maxWidth = 220;
3623

24+
var banner = mainContainer.Q("divider");
25+
banner.style.height = StyleKeyword.Auto;
26+
3727
_progressBar = new ProgressBar();
38-
// insert between title and port container
39-
titleContainer.parent.Insert(1, _progressBar);
28+
banner.Add(_progressBar);
29+
30+
var clipField = new ObjectField()
31+
{
32+
objectType = typeof(Motion),
33+
value = ((AnimationClipPlayable)Playable).GetAnimationClip(),
34+
};
35+
// clipField.SetEnabled(false);
36+
var clipFieldSelector = clipField.Q(className: "unity-object-field__selector");
37+
clipFieldSelector.SetEnabled(false);
38+
banner.Add(clipField);
4039
}
4140

4241
public override void Update()

0 commit comments

Comments
 (0)