mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
Avoid pausing on terminators if there isn't whitespace after
This is mostly to handle cases of mentioning file extensions etc in dialogue, e.g. you don't want a pause in the middle of ".txt"
This commit is contained in:
parent
737f289460
commit
47adb4e976
@ -425,10 +425,17 @@ FString UTypewriterTextWidget::CalculateSegments(FString* OutCurrentRunName)
|
||||
IsSentenceTerminator(Result[Result.Len() - 1]) &&
|
||||
CurrentLetterIndex < MaxLetterIndex - 1) // Don't pause on the last letter, that's the end pause's job
|
||||
{
|
||||
// Look ahead to make sure we only pause on LAST sentence terminator in a chain of them
|
||||
if (LettersLeft == Segment.Text.Len() || !IsSentenceTerminator(Segment.Text[LettersLeft]))
|
||||
// Look ahead to make sure we only pause on LAST sentence terminator in a chain of them,
|
||||
// and also optionally not if there isn't whitespace after (e.g. to not pause on ".txt")
|
||||
if (LettersLeft < Segment.Text.Len())
|
||||
{
|
||||
if (IsSentenceTerminator(Segment.Text[LettersLeft]) ||
|
||||
(!bPauseOnlyIfWhitespaceFollowsSentenceTerminator || FText::IsWhitespace(Segment.Text[LettersLeft])))
|
||||
{
|
||||
PauseTime = PauseTimeAtSentenceTerminators;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Segment.RunInfo.Name.IsEmpty())
|
||||
{
|
||||
|
@ -92,6 +92,11 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Typewriter")
|
||||
FString ClauseTerminators = ",;:";
|
||||
|
||||
/// If true (default), only pauses at sentence terminators if there's whitespace following them.
|
||||
/// This prevents pausing on strings like ".txt"
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Typewriter")
|
||||
bool bPauseOnlyIfWhitespaceFollowsSentenceTerminator = true;
|
||||
|
||||
/// If set > 0, splits a single PlayLine into multiple segments of this number of lines maximum
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Typewriter")
|
||||
int MaxNumberOfLines = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user