动态游标裁剪
This commit is contained in:
parent
0c76c49108
commit
778bea5c66
@ -44,8 +44,7 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
|
||||
FSlateApplication::Get().PushMenu(AsShared(), FWidgetPath(), MenuContent.ToSharedRef(), FSlateApplication::Get().GetCursorPos(), FPopupTransitionEffect::ContextMenu);
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
MainWidgetInterface->SelectClip(ClipData->ClipGuid);
|
||||
|
||||
// if (ClipData->PresetType != EPresetType::NotAPresets)
|
||||
// {
|
||||
// for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
|
||||
@ -95,6 +94,18 @@ FReply STimelineClip::OnBorderMouseButtonDown(const FGeometry& Geometry, const F
|
||||
return SCompoundWidget::OnMouseButtonDown(Geometry, PointerEvent);
|
||||
}
|
||||
|
||||
FReply STimelineClip::OnBorderMouseButtonUp(const FGeometry& Geometry, const FPointerEvent& PointerEvent)
|
||||
{
|
||||
MainWidgetInterface->SelectClip(ClipData->ClipGuid);
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
FReply STimelineClip::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||||
{
|
||||
|
||||
return FReply::Handled();
|
||||
}
|
||||
|
||||
void STimelineClip::Construct(const FArguments& InArgs)
|
||||
{
|
||||
CommandList = InArgs._CommandList;
|
||||
@ -118,6 +129,7 @@ void STimelineClip::Construct(const FArguments& InArgs)
|
||||
.ColorAndOpacity(ClipData->ClipColors[0])
|
||||
.BorderBackgroundColor(ClipData->ClipColors[0])
|
||||
.OnMouseButtonDown(this, &STimelineClip::OnBorderMouseButtonDown)
|
||||
.OnMouseButtonUp(this, &STimelineClip::OnBorderMouseButtonUp)
|
||||
]
|
||||
|
||||
|
||||
@ -334,11 +346,22 @@ void STimelineClip::UpdatePosition(int32 StartFrame)
|
||||
const int32 NewPosX = StartFrame * FGlobalData::DefaultTimeTickSpace;
|
||||
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(NewPosX));
|
||||
SetRenderTransform(FSlateRenderTransform(FVector2D(NewPosX, 0)));
|
||||
ClipDataBox->SetWidthOverride((ClipData->ClipEndFrame - StartFrame) * FGlobalData::DefaultTimeTickSpace * 10);
|
||||
ClipDataBox->SetWidthOverride((ClipData->ClipEndFrame - StartFrame) * FGlobalData::DefaultTimeTickSpace);
|
||||
if (ClipData->ClipType == ETrackType::VideoTrack)
|
||||
{
|
||||
ClipData->VideoStartFrame += StartFrame - ClipData->ClipStartFrame;
|
||||
}
|
||||
if (ClipData->PresetType == EPresetType::Gradient)
|
||||
{
|
||||
for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
|
||||
{
|
||||
if (ClipData->Cursors[i].CursorFrameOffset > ClipData->ClipEndFrame - StartFrame)
|
||||
{
|
||||
ClipData->Cursors[i].CursorFrameOffset = ClipData->ClipEndFrame - StartFrame;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
ClipData->ClipStartFrame = StartFrame;
|
||||
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(ClipData->ClipStartFrame));
|
||||
}
|
||||
@ -351,6 +374,17 @@ void STimelineClip::UpdateLength(int32 EndFrame)
|
||||
ClipData->VideoEndFrame += EndFrame - ClipData->ClipEndFrame;
|
||||
}
|
||||
ClipData->ClipEndFrame = EndFrame;
|
||||
if (ClipData->PresetType == EPresetType::Gradient)
|
||||
{
|
||||
for (int32 i = 0; i < ClipData->Cursors.Num(); i++)
|
||||
{
|
||||
if (ClipData->Cursors[i].CursorFrameOffset > ClipData->ClipEndFrame - ClipData->ClipStartFrame)
|
||||
{
|
||||
ClipData->Cursors[i].CursorFrameOffset = ClipData->ClipEndFrame - ClipData->ClipStartFrame;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(ClipData->ClipEndFrame));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
SLATE_END_ARGS()
|
||||
|
||||
FReply OnBorderMouseButtonDown(const FGeometry& Geometry, const FPointerEvent& PointerEvent);
|
||||
FReply OnBorderMouseButtonUp(const FGeometry& Geometry, const FPointerEvent& PointerEvent);
|
||||
virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
|
||||
/** Constructs this widget with InArgs */
|
||||
void Construct(const FArguments& InArgs);
|
||||
FClipData* ClipData;
|
||||
|
Loading…
Reference in New Issue
Block a user