Update
This commit is contained in:
parent
18afa49b78
commit
46531eea42
@ -181,6 +181,7 @@ struct CUT5_API FTrackData
|
||||
Ar << TrackData.ClipData;
|
||||
Ar << TrackData.DeviceTrack;
|
||||
Ar << TrackData.IsMute;
|
||||
Ar << TrackData.bIsEdit;
|
||||
return Ar;
|
||||
};
|
||||
|
||||
@ -192,6 +193,8 @@ struct CUT5_API FTrackData
|
||||
FDeviceTrack DeviceTrack = FDeviceTrack("None", ETrackType::VideoTrack);
|
||||
TArray<FClipData> ClipData;
|
||||
|
||||
bool bIsEdit = false;
|
||||
|
||||
bool IsMute = false;
|
||||
};
|
||||
struct CUT5_API FCursorData
|
||||
@ -766,6 +769,7 @@ struct CUT5_API FTimelineInfo
|
||||
FString CurrentOpenFullPath = "";
|
||||
FTimelineInfo::ETimelineType CurrentOpenType = ETimelineType::Main;
|
||||
|
||||
|
||||
friend FArchive& operator<<(FArchive& Ar, FTimelineInfo& TimelineInfo)
|
||||
{
|
||||
Ar << TimelineInfo.CurrentOpenFullPath;
|
||||
|
@ -120,6 +120,31 @@ void DragDropOperator::CloseCursorDecorator()
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropOperator::OnUpdateVideoTrack(const FClipData& VideoClipData)
|
||||
{
|
||||
SCutTimeline* Timeline = SavedMainInterface->GetCutTimeline();
|
||||
FTrackData* ProjectorTrack = Timeline->GetTrackDataByType(ETrackType::ProjectorTrack);
|
||||
|
||||
if (ProjectorTrack->bIsEdit == false)
|
||||
{
|
||||
ProjectorTrack->ClipData.Empty();
|
||||
FClipData NewClipData;
|
||||
NewClipData.ClipStartFrame = VideoClipData.ClipStartFrame;
|
||||
NewClipData.ClipEndFrame = VideoClipData.ClipEndFrame;
|
||||
NewClipData.ClipGuid = FGuid::NewGuid();
|
||||
NewClipData.ClipType = ETrackType::ProjectorTrack;
|
||||
NewClipData.PresetType = EPresetType::EnableProjector;
|
||||
|
||||
FPresetsCustomData CustomPresetData;
|
||||
CustomPresetData.PresetCustomType = FPresetsCustomData::EPresetCustomType::None;
|
||||
|
||||
NewClipData.PresetsCustomData = CustomPresetData;
|
||||
|
||||
ProjectorTrack->ClipData.Add(NewClipData);
|
||||
Timeline->RenderGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
|
||||
{
|
||||
@ -425,11 +450,20 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv
|
||||
{
|
||||
TSharedPtr<STimelineClip> TimelineClip = StaticCastSharedPtr<STimelineClip>(DragDropOperation.DraggingWidget);
|
||||
TimelineClip->UpdatePosition(Body->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / FGlobalData::DefaultTimeTickSpace);
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::VideoTrack)
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
|
||||
}
|
||||
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::DragRight)
|
||||
{
|
||||
TSharedPtr<STimelineClip> TimelineClip = StaticCastSharedPtr<STimelineClip>(DragDropOperation.DraggingWidget);
|
||||
TimelineClip->UpdateLength(Body->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / FGlobalData::DefaultTimeTickSpace);
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::VideoTrack)
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
}
|
||||
if (DragDropOperation.DragType == FClip2ClipDragDropOperation::EDragType::Move)
|
||||
{
|
||||
@ -779,14 +813,8 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
NewClipData.MoviePath = ClipDragOperation.TimelinePropertyData->MoviePath;
|
||||
NewClipData.ClipEndFrame = NewClipData.ClipStartFrame + ClipDragOperation.TimelinePropertyData->MovieFrameLength;
|
||||
NewClipData.VideoEndFrame = ClipDragOperation.TimelinePropertyData->MovieFrameLength;
|
||||
|
||||
NewClipData.MovieBrushes = FFFMPEGUtils::GetMovieBrush(&NewClipData);
|
||||
|
||||
// if (TrackHead->TrackData.TrackType == ETrackType::LightArrayTrack)
|
||||
// {
|
||||
// NewClipData.ClipType = ETrackType::LightArrayTrack;
|
||||
// NewClipData.LightArrayData = FFFMPEGUtils::GetVideoFrameLightArray(ClipDragOperation.TimelinePropertyData->MoviePath, FGlobalData::LightArrayX, FGlobalData::LightArrayY);
|
||||
// }
|
||||
if (TrackHead->TrackData.TrackType == ETrackType::PlayerTrack)
|
||||
{
|
||||
NewClipData.ClipType = ETrackType::PlayerTrack;
|
||||
@ -818,7 +846,10 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
if (FUtils::DetectDragTypeCanDrop(NewClipData, TrackHead->TrackData.TrackType))
|
||||
{
|
||||
TrackHead->TrackData.ClipData.Add(NewClipData);
|
||||
|
||||
if (NewClipData.ClipType == ETrackType::VideoTrack)
|
||||
{
|
||||
OnUpdateVideoTrack(NewClipData);
|
||||
}
|
||||
|
||||
|
||||
UpdateClipProcess(TrackHead->MainWidgetInterface, NewClipData);
|
||||
@ -896,9 +927,10 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
||||
TimelineClip->ClipData->ClipEndFrame += NewPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (TimelineClip->ClipData->ClipType == ETrackType::VideoTrack)
|
||||
{
|
||||
OnUpdateVideoTrack(*TimelineClip->ClipData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
TSharedPtr<SWidget> CurrentShowDragDropWidget;
|
||||
TSharedPtr<SWindow> CurrentShowDragDropWindow;
|
||||
int32 LastFrame = 0;
|
||||
|
||||
void OnUpdateVideoTrack(const FClipData& VideoClipData);
|
||||
};
|
||||
|
||||
|
||||
|
@ -763,43 +763,6 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
||||
FColor(45, 214, 153, 255), true, DownSample * 1.2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// int32 NeedDrawCount = ClipData->GetLength() * FGlobalData::DefaultTimeTickSpace;
|
||||
// float DownSample = 4;
|
||||
// // Draw Audio Waveform
|
||||
//
|
||||
//
|
||||
// const float RangeStart = MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().LocalToAbsolute(FVector2D(0, 0)).X;
|
||||
// const float RangeEnd = MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().LocalToAbsolute(FVector2D(MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().GetLocalSize().X, 0)).X;
|
||||
// const float CurrentStartRange = AllottedGeometry.LocalToAbsolute(FVector2D(0, 0)).X;
|
||||
// const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X;
|
||||
//
|
||||
// const int32 StartOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS)
|
||||
// * ClipData->VideoStartFrame
|
||||
// * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
||||
//
|
||||
// const int32 EndOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS)
|
||||
// * ClipData->VideoEndFrame
|
||||
// * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
||||
//
|
||||
// const int32 Interval = (EndOffset - StartOffset) / NeedDrawCount;
|
||||
// for (int32 i = 0; i < NeedDrawCount / DownSample; i++)
|
||||
// {
|
||||
// const int32 CurrentIndex = (StartOffset * DownSample) + (i * (Interval * DownSample * 4));
|
||||
// if (CurrentIndex >= ClipData->ResourcePropertyDataPtr->AudioData.Num())
|
||||
// continue;
|
||||
//
|
||||
// float NewFloat = *reinterpret_cast<float*>(&ClipData->ResourcePropertyDataPtr->AudioData[CurrentIndex]);
|
||||
// float Y = FMath::GetMappedRangeValueClamped(FVector2D(1.0, 0.0), FVector2D(0.0, AllottedGeometry.GetLocalSize().Y),
|
||||
// FMath::Abs(NewFloat));
|
||||
// TArray<FVector2D> NewLoc;
|
||||
// NewLoc.Add(FVector2D(i * DownSample, AllottedGeometry.GetLocalSize().Y));
|
||||
// NewLoc.Add(FVector2D(i * DownSample, Y));
|
||||
// FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 6, AllottedGeometry.ToPaintGeometry(), NewLoc, ESlateDrawEffect::None,
|
||||
// FColor(45, 214, 153, 255), true, DownSample * 1.2);
|
||||
// }
|
||||
if (ClipData->ClipType == ETrackType::AudioTrack || ClipData->ClipType == ETrackType::AudioTrackR)
|
||||
{
|
||||
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 5, AllottedGeometry.ToPaintGeometry(),
|
||||
@ -810,7 +773,6 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
||||
FSlateDrawElement::MakeBox(OutDrawElements, LayerId + 5, AllottedGeometry.ToPaintGeometry(),
|
||||
&Brush, ESlateDrawEffect::None, FColor(123, 152, 199, 255));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user