本文整理汇总了C++中TRange::GetLowerBoundValue方法的典型用法代码示例。如果您正苦于以下问题:C++ TRange::GetLowerBoundValue方法的具体用法?C++ TRange::GetLowerBoundValue怎么用?C++ TRange::GetLowerBoundValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRange
的用法示例。
在下文中一共展示了TRange::GetLowerBoundValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPlay
FReply FSequencer::OnPlay()
{
if( PlaybackState == EMovieScenePlayerStatus::Playing ||
PlaybackState == EMovieScenePlayerStatus::Recording )
{
PlaybackState = EMovieScenePlayerStatus::Stopped;
// Update on stop (cleans up things like sounds that are playing)
RootMovieSceneInstance->Update( ScrubPosition, ScrubPosition, *this );
}
else
{
TRange<float> TimeBounds = GetTimeBounds();
if (!TimeBounds.IsEmpty())
{
float CurrentTime = GetGlobalTime();
if (CurrentTime < TimeBounds.GetLowerBoundValue() || CurrentTime >= TimeBounds.GetUpperBoundValue())
{
SetGlobalTime(TimeBounds.GetLowerBoundValue());
}
PlaybackState = EMovieScenePlayerStatus::Playing;
// Make sure Slate ticks during playback
SequencerWidget->RegisterActiveTimerForPlayback();
}
}
return FReply::Handled();
}
示例2: Walker
FSequencerSnapField::FSequencerSnapField(const ISequencer& InSequencer, ISequencerSnapCandidate& Candidate, uint32 EntityMask)
{
TSharedPtr<SSequencerTreeView> TreeView = StaticCastSharedRef<SSequencer>(InSequencer.GetSequencerWidget())->GetTreeView();
TArray<TSharedRef<FSequencerDisplayNode>> VisibleNodes;
for (const SSequencerTreeView::FCachedGeometry& Geometry : TreeView->GetAllVisibleNodes())
{
VisibleNodes.Add(Geometry.Node);
}
auto ViewRange = InSequencer.GetViewRange();
FSequencerEntityWalker Walker(ViewRange);
// Traverse the visible space, collecting snapping times as we go
FSnapGridVisitor Visitor(Candidate, EntityMask);
Walker.Traverse(Visitor, VisibleNodes);
// Add the playback range start/end bounds as potential snap candidates
TRange<float> PlaybackRange = InSequencer.GetFocusedMovieSceneSequence()->GetMovieScene()->GetPlaybackRange();
Visitor.Snaps.Add(FSequencerSnapPoint{ FSequencerSnapPoint::PlaybackRange, PlaybackRange.GetLowerBoundValue() });
Visitor.Snaps.Add(FSequencerSnapPoint{ FSequencerSnapPoint::PlaybackRange, PlaybackRange.GetUpperBoundValue() });
// Add the current time as a potential snap candidate
Visitor.Snaps.Add(FSequencerSnapPoint{ FSequencerSnapPoint::CurrentTime, InSequencer.GetGlobalTime() });
// Add the selection range bounds as a potential snap candidate
TRange<float> SelectionRange = InSequencer.GetFocusedMovieSceneSequence()->GetMovieScene()->GetSelectionRange();
Visitor.Snaps.Add(FSequencerSnapPoint{ FSequencerSnapPoint::InOutRange, SelectionRange.GetLowerBoundValue() });
Visitor.Snaps.Add(FSequencerSnapPoint{ FSequencerSnapPoint::InOutRange, SelectionRange.GetUpperBoundValue() });
// Sort
Visitor.Snaps.Sort([](const FSequencerSnapPoint& A, const FSequencerSnapPoint& B){
return A.Time < B.Time;
});
// Remove duplicates
for (int32 Index = 0; Index < Visitor.Snaps.Num(); ++Index)
{
const float CurrentTime = Visitor.Snaps[Index].Time;
int32 NumToMerge = 0;
for (int32 DuplIndex = Index + 1; DuplIndex < Visitor.Snaps.Num(); ++DuplIndex)
{
if (!FMath::IsNearlyEqual(CurrentTime, Visitor.Snaps[DuplIndex].Time))
{
break;
}
++NumToMerge;
}
if (NumToMerge)
{
Visitor.Snaps.RemoveAt(Index + 1, NumToMerge, false);
}
}
SortedSnaps = MoveTemp(Visitor.Snaps);
}
示例3: SetPlaybackRangeEnd
void FSequencerTimeSliderController::SetPlaybackRangeEnd(float NewEnd)
{
TRange<float> PlaybackRange = TimeSliderArgs.PlaybackRange.Get();
if (NewEnd >= PlaybackRange.GetLowerBoundValue())
{
TimeSliderArgs.OnPlaybackRangeChanged.ExecuteIfBound(TRange<float>(PlaybackRange.GetLowerBoundValue(), NewEnd));
}
}
示例4: Tick
void FSequencer::Tick(float InDeltaTime)
{
if (bNeedTreeRefresh)
{
// @todo - Sequencer Will be called too often
UpdateRuntimeInstances();
SequencerWidget->UpdateLayoutTree();
bNeedTreeRefresh = false;
}
float NewTime = GetGlobalTime() + InDeltaTime;
if (PlaybackState == EMovieScenePlayerStatus::Playing ||
PlaybackState == EMovieScenePlayerStatus::Recording)
{
TRange<float> TimeBounds = GetTimeBounds();
if (!TimeBounds.IsEmpty())
{
if (NewTime > TimeBounds.GetUpperBoundValue())
{
if (bLoopingEnabled)
{
NewTime -= TimeBounds.Size<float>();
}
else
{
NewTime = TimeBounds.GetUpperBoundValue();
PlaybackState = EMovieScenePlayerStatus::Stopped;
}
}
if (NewTime < TimeBounds.GetLowerBoundValue())
{
NewTime = TimeBounds.GetLowerBoundValue();
}
SetGlobalTime(NewTime);
}
else
{
// no bounds at all, stop playing
PlaybackState = EMovieScenePlayerStatus::Stopped;
}
}
// Tick all the tools we own as well
for (int32 EditorIndex = 0; EditorIndex < TrackEditors.Num(); ++EditorIndex)
{
TrackEditors[EditorIndex]->Tick(InDeltaTime);
}
}
示例5: SetClampRange
void FVisualLoggerTimeSliderController::SetClampRange(float MinValue, float MaxValue)
{
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
float LocalClampMin = TimeSliderArgs.ClampRange.Get().GetLowerBoundValue();
float LocalClampMax = TimeSliderArgs.ClampRange.Get().GetUpperBoundValue();
const float CurrentDistance = LocalClampMax - LocalClampMin;
const float ZoomDelta = (LocalViewRange.GetUpperBoundValue() - LocalViewRange.GetLowerBoundValue()) / CurrentDistance;
MaxValue = MinValue + (MaxValue - MinValue < 2 ? CurrentDistance : MaxValue - MinValue);
TimeSliderArgs.ClampRange = TRange<float>(MinValue, MaxValue);
const float LocalViewRangeMin = FMath::Clamp(LocalViewRange.GetLowerBoundValue(), MinValue, MaxValue);
const float LocalViewRangeMax = FMath::Clamp(LocalViewRange.GetUpperBoundValue(), MinValue, MaxValue);
SetTimeRange(ZoomDelta >= 1 ? MinValue : LocalViewRangeMin, ZoomDelta >= 1 ? MaxValue : LocalViewRangeMax);
}
示例6: OnPaintTimeSlider
int32 FSequencerTimeSliderController::OnPaintTimeSlider( bool bMirrorLabels, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const bool bEnabled = bParentEnabled;
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
const float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
const float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
const float LocalSequenceLength = LocalViewRangeMax-LocalViewRangeMin;
FVector2D Scale = FVector2D(1.0f,1.0f);
if ( LocalSequenceLength > 0)
{
FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );
const float MajorTickHeight = 9.0f;
FDrawTickArgs Args;
Args.AllottedGeometry = AllottedGeometry;
Args.bMirrorLabels = bMirrorLabels;
Args.bOnlyDrawMajorTicks = false;
Args.TickColor = FLinearColor::White;
Args.ClippingRect = MyClippingRect;
Args.DrawEffects = DrawEffects;
Args.StartLayer = LayerId;
Args.TickOffset = bMirrorLabels ? 0.0f : FMath::Abs( AllottedGeometry.Size.Y - MajorTickHeight );
Args.MajorTickHeight = MajorTickHeight;
DrawTicks( OutDrawElements, RangeToScreen, Args );
const float HandleSize = 13.0f;
float HalfSize = FMath::TruncToFloat(HandleSize/2.0f);
// Draw the scrub handle
const float XPos = RangeToScreen.InputToLocalX( TimeSliderArgs.ScrubPosition.Get() );
// Should draw above the text
const int32 ArrowLayer = LayerId + 2;
FPaintGeometry MyGeometry = AllottedGeometry.ToPaintGeometry( FVector2D( XPos-HalfSize, 0 ), FVector2D( HandleSize, AllottedGeometry.Size.Y ) );
FLinearColor ScrubColor = InWidgetStyle.GetColorAndOpacityTint();
// @todo Sequencer this color should be specified in the style
ScrubColor.A = ScrubColor.A*0.5f;
ScrubColor.B *= 0.1f;
ScrubColor.G *= 0.2f;
FSlateDrawElement::MakeBox(
OutDrawElements,
ArrowLayer,
MyGeometry,
bMirrorLabels ? ScrubHandleUp : ScrubHandleDown,
MyClippingRect,
DrawEffects,
ScrubColor
);
return ArrowLayer;
}
return LayerId;
}
示例7: Update
void FSubMovieSceneTrackInstance::Update( float Position, float LastPosition, const TArray<UObject*>& RuntimeObjects, class IMovieScenePlayer& Player )
{
const TArray<UMovieSceneSection*>& AllSections = SubMovieSceneTrack->GetAllSections();
TArray<UMovieSceneSection*> TraversedSections = MovieSceneHelpers::GetTraversedSections( AllSections, Position, LastPosition );
for( int32 SectionIndex = 0; SectionIndex < TraversedSections.Num(); ++SectionIndex )
{
USubMovieSceneSection* Section = CastChecked<USubMovieSceneSection>( TraversedSections[SectionIndex] );
TSharedPtr<FMovieSceneSequenceInstance> Instance = SubMovieSceneInstances.FindRef( Section );
FMovieSceneSequenceInstance* InstancePtr = Instance.Get();
if( InstancePtr )
{
TRange<float> TimeRange = InstancePtr->GetMovieSceneTimeRange();
// Position for the movie scene needs to be in local space
float LocalDelta = TimeRange.GetLowerBoundValue() - Section->GetStartTime();
float LocalPosition = Position + LocalDelta;
InstancePtr->Update(LocalPosition, LastPosition + LocalDelta, Player);
}
}
}
示例8: HorizontalScrollBar_OnUserScrolled
void FVisualLoggerTimeSliderController::HorizontalScrollBar_OnUserScrolled(float ScrollOffset)
{
if (!TimeSliderArgs.ViewRange.IsBound())
{
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
float LocalClampMin = TimeSliderArgs.ClampRange.Get().GetLowerBoundValue();
float LocalClampMax = TimeSliderArgs.ClampRange.Get().GetUpperBoundValue();
float InThumbSizeFraction = (LocalViewRangeMax - LocalViewRangeMin) / (LocalClampMax - LocalClampMin);
float NewViewOutputMin = LocalClampMin + ScrollOffset * (LocalClampMax - LocalClampMin);
// The output is not bound to a delegate so we'll manage the value ourselves
float NewViewOutputMax = FMath::Min<float>(NewViewOutputMin + (LocalViewRangeMax - LocalViewRangeMin), LocalClampMax);
NewViewOutputMin = NewViewOutputMax - (LocalViewRangeMax - LocalViewRangeMin);
float InOffsetFraction = (NewViewOutputMin - LocalClampMin) / (LocalClampMax - LocalClampMin);
//if (InOffsetFraction + InThumbSizeFraction <= 1)
{
TimeSliderArgs.ViewRange.Set(TRange<float>(NewViewOutputMin, NewViewOutputMax));
Scrollbar->SetState(InOffsetFraction, InThumbSizeFraction);
}
}
}
示例9: OnStepToBeginning
FReply FSequencer::OnStepToBeginning()
{
PlaybackState = EMovieScenePlayerStatus::Stopped;
TRange<float> TimeBounds = GetTimeBounds();
if (!TimeBounds.IsEmpty())
{
SetGlobalTime(TimeBounds.GetLowerBoundValue());
}
return FReply::Handled();
}
示例10: OnPaintSectionView
int32 FSequencerTimeSliderController::OnPaintSectionView( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, bool bEnabled, bool bDisplayTickLines, bool bDisplayScrubPosition ) const
{
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
float LocalScrubPosition = TimeSliderArgs.ScrubPosition.Get();
float ViewRange = LocalViewRange.Size<float>();
float PixelsPerInput = ViewRange > 0 ? AllottedGeometry.Size.X / ViewRange : 0;
float LinePos = (LocalScrubPosition - LocalViewRange.GetLowerBoundValue()) * PixelsPerInput;
FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );
if( bDisplayTickLines )
{
// Draw major tick lines in the section area
FDrawTickArgs Args;
Args.AllottedGeometry = AllottedGeometry;
Args.bMirrorLabels = false;
Args.bOnlyDrawMajorTicks = true;
Args.TickColor = FLinearColor( 0.3f, 0.3f, 0.3f, 0.3f );
Args.ClippingRect = MyClippingRect;
Args.DrawEffects = DrawEffects;
// Draw major ticks under sections
Args.StartLayer = LayerId-1;
// Draw the tick the entire height of the section area
Args.TickOffset = 0.0f;
Args.MajorTickHeight = AllottedGeometry.Size.Y;
DrawTicks( OutDrawElements, RangeToScreen, Args );
}
if( bDisplayScrubPosition )
{
// Draw a line for the scrub position
TArray<FVector2D> LinePoints;
LinePoints.AddUninitialized(2);
LinePoints[0] = FVector2D( 1.0f, 0.0f );
LinePoints[1] = FVector2D( 1.0f, FMath::RoundToFloat( AllottedGeometry.Size.Y ) );
FSlateDrawElement::MakeLines(
OutDrawElements,
LayerId+1,
AllottedGeometry.ToPaintGeometry( FVector2D(LinePos, 0.0f ), FVector2D(1.0f,1.0f) ),
LinePoints,
MyClippingRect,
DrawEffects,
FLinearColor::White,
false
);
}
return LayerId;
}
示例11: DrawPlaybackRange
int32 FSequencerTimeSliderController::DrawPlaybackRange(const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FScrubRangeToScreen& RangeToScreen, const FPaintPlaybackRangeArgs& Args) const
{
if (!TimeSliderArgs.PlaybackRange.IsSet())
{
return LayerId;
}
TRange<float> PlaybackRange = TimeSliderArgs.PlaybackRange.Get();
float PlaybackRangeL = RangeToScreen.InputToLocalX(PlaybackRange.GetLowerBoundValue()) - 1;
float PlaybackRangeR = RangeToScreen.InputToLocalX(PlaybackRange.GetUpperBoundValue()) + 1;
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId+1,
AllottedGeometry.ToPaintGeometry(FVector2D(PlaybackRangeL, 0.f), FVector2D(Args.BrushWidth, AllottedGeometry.Size.Y)),
Args.StartBrush,
MyClippingRect,
ESlateDrawEffect::None,
FColor(32, 128, 32) // 120, 75, 50 (HSV)
);
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId+1,
AllottedGeometry.ToPaintGeometry(FVector2D(PlaybackRangeR - Args.BrushWidth, 0.f), FVector2D(Args.BrushWidth, AllottedGeometry.Size.Y)),
Args.EndBrush,
MyClippingRect,
ESlateDrawEffect::None,
FColor(128, 32, 32) // 0, 75, 50 (HSV)
);
// Black tint for excluded regions
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId+1,
AllottedGeometry.ToPaintGeometry(FVector2D(0.f, 0.f), FVector2D(PlaybackRangeL, AllottedGeometry.Size.Y)),
FEditorStyle::GetBrush("WhiteBrush"),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::Black.CopyWithNewOpacity(0.2f)
);
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId+1,
AllottedGeometry.ToPaintGeometry(FVector2D(PlaybackRangeR, 0.f), FVector2D(AllottedGeometry.Size.X - PlaybackRangeR, AllottedGeometry.Size.Y)),
FEditorStyle::GetBrush("WhiteBrush"),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::Black.CopyWithNewOpacity(0.2f)
);
return LayerId + 1;
}
示例12: PanByDelta
void FSequencerTimeSliderController::PanByDelta( float InDelta )
{
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get().GetAnimationTarget();
float CurrentMin = LocalViewRange.GetLowerBoundValue();
float CurrentMax = LocalViewRange.GetUpperBoundValue();
// Adjust the delta to be a percentage of the current range
InDelta *= ScrubConstants::ScrollPanFraction * (CurrentMax - CurrentMin);
SetViewRange(CurrentMin + InDelta, CurrentMax + InDelta, EViewRangeInterpolation::Animated);
}
示例13: if
TOptional<float> FGroupedKeyCollection::FindFirstKeyInRange(const TRange<float>& InRange, EFindKeyDirection Direction) const
{
// @todo: linear search may be slow where there are lots of keys
bool bWithinRange = false;
if (Direction == EFindKeyDirection::Backwards)
{
for (int32 Index = Groups.Num() - 1; Index >= 0; --Index)
{
if (Groups[Index].RepresentativeTime < InRange.GetUpperBoundValue())
{
// Just entered the range
return Groups[Index].RepresentativeTime;
}
else if (InRange.HasLowerBound() && Groups[Index].RepresentativeTime < InRange.GetLowerBoundValue())
{
// No longer inside the range
return TOptional<float>();
}
}
}
else
{
for (int32 Index = 0; Index < Groups.Num(); ++Index)
{
if (Groups[Index].RepresentativeTime > InRange.GetLowerBoundValue())
{
// Just entered the range
return Groups[Index].RepresentativeTime;
}
else if (InRange.HasUpperBound() && Groups[Index].RepresentativeTime > InRange.GetUpperBoundValue())
{
// No longer inside the range
return TOptional<float>();
}
}
}
return TOptional<float>();
}
示例14: HitTestPlaybackStart
bool FSequencerTimeSliderController::HitTestPlaybackStart(const FScrubRangeToScreen& RangeToScreen, const TRange<float>& PlaybackRange, float LocalHitPositionX, float ScrubPosition) const
{
static float BrushSizeInStateUnits = 6.f, DragToleranceSlateUnits = 2.f;
float LocalPlaybackStartPos = RangeToScreen.InputToLocalX(PlaybackRange.GetLowerBoundValue());
// We favor hit testing the scrub bar over hit testing the playback range bounds
if (FMath::IsNearlyEqual(LocalPlaybackStartPos, RangeToScreen.InputToLocalX(ScrubPosition), ScrubHandleSize/2.f))
{
return false;
}
// Hit test against the brush region to the right of the playback start position, +/- DragToleranceSlateUnits
return LocalHitPositionX >= LocalPlaybackStartPos - DragToleranceSlateUnits &&
LocalHitPositionX <= LocalPlaybackStartPos + BrushSizeInStateUnits + DragToleranceSlateUnits;
}
示例15: Initialize
void ULevelSequencePlayer::Initialize(ULevelSequence* InLevelSequence, UWorld* InWorld, const FLevelSequencePlaybackSettings& Settings)
{
LevelSequence = InLevelSequence;
World = InWorld;
PlaybackSettings = Settings;
if (UMovieScene* MovieScene = LevelSequence->GetMovieScene())
{
TRange<float> PlaybackRange = MovieScene->GetPlaybackRange();
SetPlaybackRange(PlaybackRange.GetLowerBoundValue(), PlaybackRange.GetUpperBoundValue());
}
// Ensure everything is set up, ready for playback
Stop();
}