Skip to content

Commit

Permalink
feat: Show events of the AnimationClip
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarianZ committed Jun 5, 2023
1 parent d8557af commit 7a82f70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Editor/Scripts/Node/AnimationClipPlayableNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ protected override void AppendNodeDescription(StringBuilder descBuilder)
.Append("AverageAngularSpeed: ").AppendLine(clip.averageAngularSpeed.ToString("F3"))
.Append("AverageDuration: ").AppendLine(clip.averageDuration.ToString("F3"))
.Append("IsHumanMotion: ").AppendLine(clip.isHumanMotion.ToString());

// Event
descBuilder.AppendLine(LINE);
var events = clip.events;
descBuilder.AppendLine(
events.Length == 0
? "No Event"
: (events.Length == 1 ? "1 Event:" : $"{events.Length.ToString()} Events:")
);
for (int i = 0; i < events.Length; i++)
{
var evt = events[i];
var evtPosition = evt.time / clip.length * 100;
descBuilder.AppendLine($" #{(i + 1).ToString()} {evtPosition.ToString("F2")}% {evt.functionName}");
}
}
}
}
4 changes: 2 additions & 2 deletions Editor/Scripts/Node/PlayableNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override void AppendNodeDescription(StringBuilder descBuilder)
descBuilder.AppendLine(
inputCount == 0
? "No Input"
: (inputCount == 1 ? "1 Input:" : $"{inputCount} Inputs:")
: (inputCount == 1 ? "1 Input:" : $"{inputCount.ToString()} Inputs:")
);
AppendInputPortDescription(descBuilder);

Expand All @@ -178,7 +178,7 @@ protected override void AppendNodeDescription(StringBuilder descBuilder)
descBuilder.AppendLine(
playableOutputCount == 0
? "No Output"
: (playableOutputCount == 1 ? "1 Output" : $"{playableOutputCount} Outputs")
: (playableOutputCount == 1 ? "1 Output" : $"{playableOutputCount.ToString()} Outputs")
);
}

Expand Down

0 comments on commit 7a82f70

Please sign in to comment.