自动铺轨道,动态指针
This commit is contained in:
parent
991260947f
commit
d36af0d372
@ -14,7 +14,7 @@ public class Cut5 : ModuleRules
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" , "FFMPEGMedia", "FFMPEGMediaFactory", "SchUtils"});
|
||||
PrivateDependencyModuleNames.AddRange(new string[] {"ApplicationCore", "FFMPEGMedia", "FFMPEGMediaFactory",
|
||||
"Slate", "SlateCore", "UMG", "OpenCV", "DesktopPlatform", "PortAudioPlugin", "SchUtils"});
|
||||
"Slate", "SlateCore", "UMG", "OpenCV", "DesktopPlatform", "PortAudioPlugin", "SchUtils", "Renderer", "RenderCore", "RHI"});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,11 @@ FVideoThumbnailThread::FVideoThumbnailThread(const FString& MoviePath, TFunction
|
||||
this->BrushCount = BrushCount;
|
||||
this->ClipData = ClipData;
|
||||
|
||||
bMissionStart = true;
|
||||
if (ClipData.MovieBrushesPath.Num() == 0)
|
||||
{
|
||||
bMissionStart = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint32 FVideoThumbnailThread::Run()
|
||||
|
@ -134,17 +134,27 @@ void DragDropOperator::OnUpdateVideoTrack(const FClipData& VideoClipData)
|
||||
NewClipData.ClipGuid = FGuid::NewGuid();
|
||||
NewClipData.ClipType = ETrackType::ProjectorTrack;
|
||||
NewClipData.PresetType = EPresetType::EnableProjector;
|
||||
NewClipData.BindTrackGuid = ProjectorTrack->DeviceTrack.Guid;
|
||||
|
||||
FPresetsCustomData CustomPresetData;
|
||||
CustomPresetData.PresetCustomType = FPresetsCustomData::EPresetCustomType::None;
|
||||
|
||||
NewClipData.PresetsCustomData = CustomPresetData;
|
||||
|
||||
|
||||
|
||||
ProjectorTrack->ClipData.Add(NewClipData);
|
||||
Timeline->RenderGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropOperator::OnUpdateProjectorTrack(const FClipData& ProjectorClipData)
|
||||
{
|
||||
SCutTimeline* Timeline = SavedMainInterface->GetCutTimeline();
|
||||
FTrackData* ProjectorTrack = Timeline->GetTrackDataByType(ETrackType::ProjectorTrack);
|
||||
ProjectorTrack->bIsEdit = true;
|
||||
}
|
||||
|
||||
|
||||
void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
|
||||
{
|
||||
@ -454,6 +464,10 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::ProjectorTrack)
|
||||
{
|
||||
OnUpdateProjectorTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
|
||||
}
|
||||
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::DragRight)
|
||||
@ -464,6 +478,10 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::ProjectorTrack)
|
||||
{
|
||||
OnUpdateProjectorTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
}
|
||||
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::Move)
|
||||
{
|
||||
@ -850,7 +868,10 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
{
|
||||
OnUpdateVideoTrack(NewClipData);
|
||||
}
|
||||
|
||||
if (NewClipData.ClipType == ETrackType::ProjectorTrack)
|
||||
{
|
||||
OnUpdateProjectorTrack(NewClipData);
|
||||
}
|
||||
|
||||
UpdateClipProcess(TrackHead->MainWidgetInterface, NewClipData);
|
||||
|
||||
@ -931,6 +952,10 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::ProjectorTrack)
|
||||
{
|
||||
OnUpdateProjectorTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
int32 LastFrame = 0;
|
||||
|
||||
void OnUpdateVideoTrack(const FClipData& VideoClipData);
|
||||
void OnUpdateProjectorTrack(const FClipData& ProjectorClipData);
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,25 +69,25 @@ float SCutTimeline::UpdateTimelineLength()
|
||||
|
||||
void SCutTimeline::UpdateZoom(float ZoomValue)
|
||||
{
|
||||
const float OriginTickBoxOffset = LastSliderOffset;
|
||||
FGlobalData::DefaultTimeTickSpace = FMath::GetMappedRangeValueClamped(FVector2D(0, 1.0), FVector2D(GetCachedGeometry().GetLocalSize().X / FGlobalData::TrackLength, 15.0), ZoomValue);
|
||||
UpdateTimelineLength();
|
||||
const float TickBoxOffset = TickScrollBox->GetScrollOffsetOfEnd();
|
||||
LastSliderOffset = TickBoxOffset;
|
||||
const float NewTickBoxOffset = TickBoxOffset - OriginTickBoxOffset;
|
||||
|
||||
if (NewTickBoxOffset != 0.0f)
|
||||
{
|
||||
// GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString::Printf(TEXT("NewTickBoxOffset: %f"), NewTickBoxOffset));
|
||||
}
|
||||
|
||||
const float Scalar = NewTickBoxOffset / TrackBodyHScrollBox->GetScrollOffsetOfEnd();
|
||||
|
||||
TrackBodyHScrollBox->SetScrollOffset(TrackBodyHScrollBox->GetScrollOffset() + (TrackBodyHScrollBox->GetScrollOffset() * Scalar));
|
||||
TickScrollBox->SetScrollOffset(TrackBodyHScrollBox->GetScrollOffset() + (TrackBodyHScrollBox->GetScrollOffset() * Scalar));
|
||||
UpdateCursorPosition(GetCursorPosition(), false);
|
||||
|
||||
const float CursorOffset = (TimelineTick->TickCursor->GetCachedGeometry().Position.X + TimelineTick->TickCursor->GetRenderTransform()->GetTranslation().X) - LastSliderOffset;
|
||||
|
||||
TrackBodyHScrollBox->SetScrollOffset(TrackBodyHScrollBox->GetScrollOffset() + CursorOffset);
|
||||
TickScrollBox->SetScrollOffset(TrackBodyHScrollBox->GetScrollOffset() + CursorOffset);
|
||||
|
||||
//
|
||||
UpdateCursorPosition(GetCursorPosition(), false);
|
||||
RenderGroup();
|
||||
|
||||
ENQUEUE_RENDER_COMMAND(FMyCommand)(
|
||||
[this](FRHICommandListImmediate& RHICmdList)
|
||||
{
|
||||
LastSliderOffset = (TimelineTick->TickCursor->GetCachedGeometry().Position.X + TimelineTick->TickCursor->GetRenderTransform()->GetTranslation().X);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void SCutTimeline::UpdateCursorPosition(int32 Frame, bool NeedSeek)
|
||||
@ -242,7 +242,21 @@ void SCutTimeline::Construct(const FArguments& InArgs)
|
||||
UpdateZoom(ChangedValue);
|
||||
})
|
||||
]
|
||||
|
||||
]
|
||||
+ SHorizontalBox::Slot()
|
||||
[
|
||||
SNew(SBox)
|
||||
.WidthOverride(200)
|
||||
[
|
||||
SNew(SSlider)
|
||||
.MaxValue(1.0)
|
||||
.MinValue(0.0)
|
||||
.OnValueChanged_Lambda([this](float ChangedValue)
|
||||
{
|
||||
TrackBodyHScrollBox->SetScrollOffset(ChangedValue * TrackBodyHScrollBox->GetScrollOffsetOfEnd());
|
||||
TickScrollBox->SetScrollOffset(TrackBodyHScrollBox->GetScrollOffset());
|
||||
})
|
||||
]
|
||||
]
|
||||
// + SHorizontalBox::Slot()
|
||||
// .SizeParam(FAuto())
|
||||
@ -472,6 +486,11 @@ void SCutTimeline::Tick(const FGeometry& AllottedGeometry, const double InCurren
|
||||
}
|
||||
}
|
||||
|
||||
if (bNeedUpdateOffsetInNextTick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float ScrollBoxOffset = TrackBodyHScrollBox->GetScrollOffset();
|
||||
float TickBoxOffset = TickScrollBox->GetScrollOffset();
|
||||
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
virtual FReply OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
|
||||
float UpdateTimelineLength();
|
||||
void UpdateZoom(float ZoomValue);
|
||||
bool bNeedUpdateOffsetInNextTick = false;
|
||||
float LastSliderOffset = 0.0f;
|
||||
void UpdateCursorPosition(int32 Frame, bool NeedSeek = true);
|
||||
int32 GetCursorPosition() const;
|
||||
|
@ -272,11 +272,18 @@ void STimelineClip::Construct(const FArguments& InArgs)
|
||||
{
|
||||
if (!MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThumbnailThreadGuid(ClipData->ClipGuid)))
|
||||
{
|
||||
FVideoThumbnailThread* ThumbnailThread = new FVideoThumbnailThread(ClipData->MoviePath, [this](const FString& PicPath)
|
||||
FClipData& Clip = *ClipData;
|
||||
FVideoThumbnailThread* ThumbnailThread = new FVideoThumbnailThread(ClipData->MoviePath, [this, &Clip](const FString& PicPath)
|
||||
{
|
||||
ClipData->MovieBrushesPath.Add(PicPath);
|
||||
if (this == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Clip.MovieBrushesPath.Add(PicPath);
|
||||
const FSlateDynamicImageBrush Brush = FSlateDynamicImageBrush(*ToFullPath(PicPath), FVector2f(0, 0));
|
||||
ClipData->MovieBrushes.Add(Brush);
|
||||
Clip.MovieBrushes.Add(Brush);
|
||||
|
||||
|
||||
}, ClipData->MovieBrushNum, *ClipData);
|
||||
|
||||
FRunnableThread::Create(ThumbnailThread, TEXT("VideoThumbnailThread"));
|
||||
@ -849,10 +856,16 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
||||
|
||||
if (ClipData->PresetType == EPresetType::EnableProjector)
|
||||
{
|
||||
const FSlateBrush Brush;
|
||||
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 8, AllottedGeometry.ToPaintGeometry(),
|
||||
&Brush, ESlateDrawEffect::None, FColor(0, 100, 0, 255));
|
||||
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 9, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("开启\n投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
|
||||
}
|
||||
if (ClipData->PresetType == EPresetType::DisableProjector)
|
||||
{
|
||||
const FSlateBrush Brush;
|
||||
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 8, AllottedGeometry.ToPaintGeometry(),
|
||||
&Brush, ESlateDrawEffect::None, FColor(100, 0, 0, 255));
|
||||
FSlateDrawElement::MakeText(OutDrawElements, LayerId + 9, AllottedGeometry.ToPaintGeometry(), FText::FromString(TEXT("关闭\n投影仪")), FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("NormalText").Font, ESlateDrawEffect::None, FLinearColor::White);
|
||||
}
|
||||
if (ClipData->bIsCycle == true)
|
||||
@ -906,7 +919,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
||||
|
||||
|
||||
if (ClipData->PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::None
|
||||
&& ClipData->ClipType != ETrackType::AudioTrackR && ClipData->ClipType != ETrackType::AudioTrack)
|
||||
&& ClipData->ClipType != ETrackType::AudioTrackR && ClipData->ClipType != ETrackType::AudioTrack && ClipData->ClipType != ETrackType::ProjectorTrack)
|
||||
{
|
||||
const FSlateBrush Brush;
|
||||
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 4, AllottedGeometry.ToPaintGeometry(),
|
||||
|
Loading…
Reference in New Issue
Block a user