Skip to content

Commit

Permalink
Allow grouping controls, triggers and morphs
Browse files Browse the repository at this point in the history
  • Loading branch information
acidbubbles committed Sep 16, 2022
1 parent 469410e commit 05b3d80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/AtomAnimations/Animatables/Base/AnimationTargetBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace VamTimeline
{
public abstract class AnimationTargetBase<TAnimatableRef> : IDisposable where TAnimatableRef : AnimatableRefBase
{
public AnimatableRefBase animatableRefBase => animatableRef;
public TAnimatableRef animatableRef { get; }
public UnityEvent onAnimationKeyframesDirty { get; } = new UnityEvent();
public UnityEvent onAnimationKeyframesRebuilt { get; } = new UnityEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public interface IAtomAnimationTarget : IDisposable
bool collapsed { get; set; }
string group { get; set; }
IAtomAnimationClip clip { get; set; }
AnimatableRefBase animatableRefBase { get; }

void Validate(float animationLength);

Expand Down
22 changes: 7 additions & 15 deletions src/AtomAnimations/Animations/AtomAnimationClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,21 +614,13 @@ public void DirtyAll()

public IEnumerable<IAtomAnimationTargetsList> GetTargetGroups()
{
yield return targetTriggers;
foreach (var group in targetControllers.GroupBy(t => t.group ?? t.animatableRef.groupKey))
{
var first = group.First();
yield return new AtomAnimationTargetsList<FreeControllerV3AnimationTarget>(group) { label = first.group ?? first.animatableRef.groupLabel };
}
foreach (var target in targetFloatParams)
{
target.animatableRef.EnsureAvailable();
}
foreach (var group in targetFloatParams.GroupBy(t => t.group ?? t.animatableRef.groupKey))
{
var first = group.First();
yield return new AtomAnimationTargetsList<JSONStorableFloatAnimationTarget>(group) { label = first.group ?? first.animatableRef.groupLabel };
}
return GetAllTargets()
.GroupBy(t => t.group ?? t.animatableRefBase.groupKey)
.Select(group =>
{
var first = group.First();
return (IAtomAnimationTargetsList) new AtomAnimationTargetsList<IAtomAnimationTarget>(group) { label = first.group ?? first.animatableRefBase.groupLabel };
});
}

public void Validate()
Expand Down

0 comments on commit 05b3d80

Please sign in to comment.