时间轴润色(FIXME)
This commit is contained in:
parent
c85a308d44
commit
38116b2319
@ -834,6 +834,9 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
|||||||
TrackHead->TrackData.ClipData.Add(NewClipData);
|
TrackHead->TrackData.ClipData.Add(NewClipData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UpdateClipProcess(TrackHead->MainWidgetInterface, NewClipData);
|
||||||
|
|
||||||
if (NewClipData.ClipType == ETrackType::AudioTrack)
|
if (NewClipData.ClipType == ETrackType::AudioTrack)
|
||||||
{
|
{
|
||||||
if (TrackHead->TrackData.TrackType == ETrackType::AudioTrack)
|
if (TrackHead->TrackData.TrackType == ETrackType::AudioTrack)
|
||||||
@ -861,9 +864,6 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UpdateClipProcess(TrackHead->MainWidgetInterface, NewClipData);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
SavedMainInterface->GetCutTimeline()->RenderGroup();
|
SavedMainInterface->GetCutTimeline()->RenderGroup();
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
|||||||
const FSlateBrush Brush;
|
const FSlateBrush Brush;
|
||||||
|
|
||||||
|
|
||||||
int32 NeedDrawCount = ClipData->GetLength() * FGlobalData::DefaultTimeTickSpace;
|
|
||||||
float DownSample = 4;
|
float DownSample = 4;
|
||||||
// Draw Audio Waveform
|
// Draw Audio Waveform
|
||||||
|
|
||||||
@ -617,10 +617,16 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
|||||||
const float RangeEnd = MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().LocalToAbsolute(FVector2D(MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().GetLocalSize().X, 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 CurrentStartRange = AllottedGeometry.LocalToAbsolute(FVector2D(0, 0)).X;
|
||||||
const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X;
|
const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X;
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::SanitizeFloat(RangeStart));
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::SanitizeFloat(RangeEnd));
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::White, FString::SanitizeFloat(CurrentStartRange));
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::SanitizeFloat(CurrentEndRange));
|
const int32 CropStartFrameOffset = ((CurrentStartRange * -1) + RangeStart > 0 ? (CurrentStartRange * -1) + RangeStart : 0) / FGlobalData::DefaultTimeTickSpace;
|
||||||
|
const int32 CropEndFrameOffset = (RangeEnd - CurrentEndRange > 0 ?
|
||||||
|
(RangeEnd - RangeStart) + CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace : CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + (RangeEnd - RangeStart))
|
||||||
|
/ FGlobalData::DefaultTimeTickSpace;
|
||||||
|
|
||||||
|
int32 NeedDrawCount = (CropEndFrameOffset - CropStartFrameOffset) * FGlobalData::DefaultTimeTickSpace;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -632,7 +638,19 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
|||||||
* ClipData->VideoEndFrame
|
* ClipData->VideoEndFrame
|
||||||
* FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
* FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
||||||
|
|
||||||
const int32 Interval = (EndOffset - StartOffset) / NeedDrawCount;
|
const int32 CropStartDataOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS)
|
||||||
|
* CropStartFrameOffset * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
||||||
|
|
||||||
|
const int32 CropEndDataOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS)
|
||||||
|
* CropEndFrameOffset * FUtils::GetFormatSampleBytesNum(ClipData->ResourcePropertyDataPtr->SampleFormat) * 2 / DownSample;
|
||||||
|
|
||||||
|
const int32 Interval = ((EndOffset + CropEndDataOffset) - (StartOffset + CropStartDataOffset)) / NeedDrawCount;
|
||||||
|
|
||||||
|
|
||||||
|
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(NeedDrawCount));
|
||||||
|
GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(Interval));
|
||||||
|
|
||||||
|
|
||||||
for (int32 i = 0; i < NeedDrawCount / DownSample; i++)
|
for (int32 i = 0; i < NeedDrawCount / DownSample; i++)
|
||||||
{
|
{
|
||||||
const int32 CurrentIndex = (StartOffset * DownSample) + (i * (Interval * DownSample * 4));
|
const int32 CurrentIndex = (StartOffset * DownSample) + (i * (Interval * DownSample * 4));
|
||||||
@ -643,8 +661,8 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe
|
|||||||
float Y = FMath::GetMappedRangeValueClamped(FVector2D(1.0, 0.0), FVector2D(0.0, AllottedGeometry.GetLocalSize().Y),
|
float Y = FMath::GetMappedRangeValueClamped(FVector2D(1.0, 0.0), FVector2D(0.0, AllottedGeometry.GetLocalSize().Y),
|
||||||
FMath::Abs(NewFloat));
|
FMath::Abs(NewFloat));
|
||||||
TArray<FVector2D> NewLoc;
|
TArray<FVector2D> NewLoc;
|
||||||
NewLoc.Add(FVector2D(i * DownSample, AllottedGeometry.GetLocalSize().Y));
|
NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i) * DownSample, AllottedGeometry.GetLocalSize().Y));
|
||||||
NewLoc.Add(FVector2D(i * DownSample, Y));
|
NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i) * DownSample, Y));
|
||||||
FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 6, AllottedGeometry.ToPaintGeometry(), NewLoc, ESlateDrawEffect::None,
|
FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 6, AllottedGeometry.ToPaintGeometry(), NewLoc, ESlateDrawEffect::None,
|
||||||
FColor(45, 214, 153, 255), true, DownSample * 1.2);
|
FColor(45, 214, 153, 255), true, DownSample * 1.2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user