本文整理汇总了C++中TRange类的典型用法代码示例。如果您正苦于以下问题:C++ TRange类的具体用法?C++ TRange怎么用?C++ TRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TRange类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:25,代码来源:TimeSliderController.cpp
示例2: 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);
}
}
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:28,代码来源:SubMovieSceneTrackInstance.cpp
示例3: 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;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:60,代码来源:TimeSliderController.cpp
示例4: GetTimeBounds
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();
}
开发者ID:johndpope,项目名称:UE4,代码行数:28,代码来源:Sequencer.cpp
示例5: print
void print(TRange range)
{
for(int i = 0; !range.IsEmpty() && i < 77; range.Pop(), ++i)
{
putchar(48 + range.Front());
}
puts("");
}
开发者ID:hirthwork,项目名称:range,代码行数:8,代码来源:main.cpp
示例6: toVector
std::vector<value_type_t> toVector() {
std::vector<value_type_t> v;
while (range_.ok()) {
typename TRange::iter_t i = range_.take();
if (i != range_.end())
v.push_back(*i);
}
return v;
}
开发者ID:nikitoz,项目名称:cpp_linq,代码行数:9,代码来源:yal.hpp
示例7: to
T to() {
T t;
while (range_.ok()) {
typename TRange::iter_t i = range_.take();
if (i != range_.end())
t.push_back(*i);
}
return t;
}
开发者ID:nikitoz,项目名称:cpp_linq,代码行数:9,代码来源:yal.hpp
示例8: SetPlaybackRangeStart
void FSequencerTimeSliderController::SetPlaybackRangeStart(float NewStart)
{
TRange<float> PlaybackRange = TimeSliderArgs.PlaybackRange.Get();
if (NewStart <= PlaybackRange.GetUpperBoundValue())
{
TimeSliderArgs.OnPlaybackRangeChanged.ExecuteIfBound(TRange<float>(NewStart, PlaybackRange.GetUpperBoundValue()));
}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:9,代码来源:TimeSliderController.cpp
示例9: SetPlaybackRangeEnd
void FSequencerTimeSliderController::SetPlaybackRangeEnd(float NewEnd)
{
TRange<float> PlaybackRange = TimeSliderArgs.PlaybackRange.Get();
if (NewEnd >= PlaybackRange.GetLowerBoundValue())
{
TimeSliderArgs.OnPlaybackRangeChanged.ExecuteIfBound(TRange<float>(PlaybackRange.GetLowerBoundValue(), NewEnd));
}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:9,代码来源:TimeSliderController.cpp
示例10: ITERATE
ITERATE ( TRanges, it, m_Ranges ) {
if ( it != m_Ranges.begin() ) {
out << ',';
}
TRange range = it->second.GetTotalRange();
out << it->first.AsString();
if ( range != TRange::GetWhole() ) {
out << "(" << range.GetFrom() << "-" << range.GetTo() << ")";
}
}
开发者ID:swuecho,项目名称:igblast,代码行数:10,代码来源:id_range.cpp
示例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;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:54,代码来源:TimeSliderController.cpp
示例12: 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;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:54,代码来源:TimeSliderController.cpp
示例13: 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);
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:12,代码来源:TimeSliderController.cpp
示例14: GetKeyHandles
void UMovieSceneActorReferenceSection::GetKeyHandles(TSet<FKeyHandle>& OutKeyHandles, TRange<float> TimeRange) const
{
if (!TimeRange.Overlaps(GetRange()))
{
return;
}
for ( auto It( ActorGuidIndexCurve.GetKeyHandleIterator() ); It; ++It )
{
float Time = ActorGuidIndexCurve.GetKeyTime( It.Key() );
if (TimeRange.Contains(Time))
{
OutKeyHandles.Add(It.Key());
}
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:16,代码来源:MovieSceneActorReferenceSection.cpp
示例15: 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);
}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:16,代码来源:TimeSliderController.cpp
示例16: 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();
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:16,代码来源:LevelSequencePlayer.cpp
示例17: OnMouseWheel
FReply FSequencerTimeSliderController::OnMouseWheel( TSharedRef<SWidget> WidgetOwner, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if ( TimeSliderArgs.AllowZoom )
{
const float ZoomDelta = -0.1f * MouseEvent.GetWheelDelta();
{
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
const float OutputViewSize = LocalViewRangeMax - LocalViewRangeMin;
const float OutputChange = OutputViewSize * ZoomDelta;
float NewViewOutputMin = LocalViewRangeMin - (OutputChange * 0.5f);
float NewViewOutputMax = LocalViewRangeMax + (OutputChange * 0.5f);
if( FMath::Abs( OutputChange ) > 0.01f && NewViewOutputMin < NewViewOutputMax )
{
TOptional<float> LocalClampMin = TimeSliderArgs.ClampMin.Get();
TOptional<float> LocalClampMax = TimeSliderArgs.ClampMax.Get();
// Clamp the range if clamp values are set
if ( LocalClampMin.IsSet() && NewViewOutputMin < LocalClampMin.GetValue() )
{
NewViewOutputMin = LocalClampMin.GetValue();
}
if ( LocalClampMax.IsSet() && NewViewOutputMax > LocalClampMax.GetValue() )
{
NewViewOutputMax = LocalClampMax.GetValue();
}
TimeSliderArgs.OnViewRangeChanged.ExecuteIfBound(TRange<float>(NewViewOutputMin, NewViewOutputMax));
if( !TimeSliderArgs.ViewRange.IsBound() )
{
// The output is not bound to a delegate so we'll manage the value ourselves
TimeSliderArgs.ViewRange.Set( TRange<float>( NewViewOutputMin, NewViewOutputMax ) );
}
}
}
return FReply::Handled();
}
return FReply::Unhandled();
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:47,代码来源:TimeSliderController.cpp
示例18: ShouldEvaluateIfOverlapping
bool FMovieSceneCinematicShotTrackInstance::ShouldEvaluateIfOverlapping(const TArray<UMovieSceneSection*>& TraversedSections, UMovieSceneSection* Section) const
{
// Check with this shot's exclusive upper bound for when shots are adjacent to each other but on different rows.
TRange<float> ThisSectionWithExclusiveUpper = TRange<float>(Section->GetRange().GetLowerBoundValue(), Section->GetRange().GetUpperBoundValue());
// Only evaluate the top most row on overlapping cinematic shot sections. Disregard overlap priority.
const bool bShouldRemove = TraversedSections.ContainsByPredicate([=](UMovieSceneSection* OtherSection){
if (Section->GetRowIndex() > OtherSection->GetRowIndex() &&
ThisSectionWithExclusiveUpper.Overlaps(OtherSection->GetRange()))
{
return true;
}
return false;
});
return bShouldRemove;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:17,代码来源:MovieSceneCinematicShotTrackInstance.cpp
示例19: OverlapsWithSections
const UMovieSceneSection* UMovieSceneSection::OverlapsWithSections(const TArray<UMovieSceneSection*>& Sections, int32 TrackDelta, float TimeDelta) const
{
int32 NewTrackIndex = RowIndex + TrackDelta;
TRange<float> NewSectionRange = TRange<float>(StartTime + TimeDelta, EndTime + TimeDelta);
for (int32 SectionIndex = 0; SectionIndex < Sections.Num(); ++SectionIndex)
{
const UMovieSceneSection* InSection = Sections[SectionIndex];
if (this != InSection && InSection->GetRowIndex() == NewTrackIndex)
{
if (NewSectionRange.Overlaps(InSection->GetRange()))
{
return InSection;
}
}
}
return NULL;
}
开发者ID:johndpope,项目名称:UE4,代码行数:17,代码来源:MovieSceneSection.cpp
示例20: AddNewShot
void UMovieSceneShotTrack::AddNewShot(FGuid CameraHandle, UMovieScene& ShotMovieScene, const TRange<float>& TimeRange, const FText& ShotName, int32 ShotNumber )
{
Modify();
FName UniqueShotName = MakeUniqueObjectName( this, UMovieSceneShotSection::StaticClass(), *ShotName.ToString() );
UMovieSceneShotSection* NewSection = NewObject<UMovieSceneShotSection>( this, UniqueShotName, RF_Transactional );
NewSection->SetMovieScene( &ShotMovieScene );
NewSection->SetStartTime( TimeRange.GetLowerBoundValue() );
NewSection->SetEndTime( TimeRange.GetUpperBoundValue() );
NewSection->SetCameraGuid( CameraHandle );
NewSection->SetShotNameAndNumber( ShotName , ShotNumber );
SubMovieSceneSections.Add( NewSection );
// When a new shot is added, sort all shots to ensure they are in the correct order
SortShots();
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:18,代码来源:MovieSceneShotTrack.cpp
注:本文中的TRange类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论