diff --git a/Source/Cut5/Utils/Utils.cpp b/Source/Cut5/Utils/Utils.cpp index 8d29ca6..ab15f7a 100644 --- a/Source/Cut5/Utils/Utils.cpp +++ b/Source/Cut5/Utils/Utils.cpp @@ -308,9 +308,6 @@ void FUtils::CreateDefaultTimelineSave(const FString& SavedPath, const FTimeline MemoryWriter << ClipLength; MemoryWriter << AllClips; FFileHelper::SaveArrayToFile(SavedData, *SavedPath); - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("CreateDefaultTimelineSave %s"), *SavedPath)); - // FFileHelper::LoadFileToArray(SavedData, *FPaths::Combine(FPaths::ProjectSavedDir(), Type == FTimelineInfo::ETimelineType::Main ? TEXT("Default.sav") : TEXT("DefaultFX.sav"))); - } TArray FUtils::TrackEncodeVideo(const FTrackData& TrackData, const FString& ExportPath) @@ -367,7 +364,6 @@ TArray FUtils::TrackEncodeVideo(const FTrackData& TrackData, c FString OutputFile = "\"" + FPaths::ConvertRelativePathToFull(ExportPath + FString::FromInt(i) + TEXT(".mp4")) + "\""; - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("OutputFile %s"), *OutputFile)); int32 StartFrame = (TempClipData.VideoStartFrame) % static_cast(FGlobalData::GlobalFPS);; int32 EndFrame = (TempClipData.VideoEndFrame) % static_cast(FGlobalData::GlobalFPS); @@ -988,7 +984,6 @@ FString FUtils::GetMsFromString(FString TimeString) // 将FTimespan对象转换为毫秒 int64 Milliseconds = Timespan.GetTotalMilliseconds(); - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("%s -> %s"), *TimeString, *FString::FromInt(Milliseconds))); return FString::FromInt(Milliseconds); } diff --git a/Source/Cut5/Utils/Utils.h b/Source/Cut5/Utils/Utils.h index 460044d..c30b2d3 100644 --- a/Source/Cut5/Utils/Utils.h +++ b/Source/Cut5/Utils/Utils.h @@ -37,7 +37,6 @@ public: static FEncodeVideoInfo CombineAudio(const FEncodeVideoInfo& LeftEncodeData, const FEncodeVideoInfo& RightEncodeData, const FString& ExportPath); static FString CurtainFullPath(const FString& GroupName) { - // GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FGlobalData::BasePath); return FPaths::Combine(FGlobalData::BasePath, FGlobalData::CurrentProjectName, TEXT("Curtain"), GroupName + TEXT(".bin")); }; static FString GroupFullPath(const FString& GroupName) diff --git a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp index 664b936..3271314 100644 --- a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp +++ b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp @@ -205,10 +205,7 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv const FVector2D CurrentPosition = Timeline->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()); const FVector2D ScrollStartPosition = ClipSelectDragDrop->ScrollStartPosition; const FVector2D ScrollEndPosition = Timeline->TrackBodyScrollBox->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()) + Timeline->TrackBodyScrollBox->GetScrollOffset(); - - - - // GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::Printf(TEXT("StartPosition:%s"), *ScrollStartPosition.ToString())); + if (StartPosition.X < CurrentPosition.X && StartPosition.Y < CurrentPosition.Y) { @@ -335,8 +332,6 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv { if (Local < 1.0 && Local >= 0) { - - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Local: %f"), Local)); ColorBar->ColorPtr->R = (ColorBar->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / ColorBar->GetCachedGeometry().Size.X) * 360.0; ColorBar->OnColorCallback.ExecuteIfBound(ColorBar->ColorPtr->R); } @@ -347,8 +342,6 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv { if (Local < 1.0 && Local >= 0) { - - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Local: %f"), Local)); ColorBar->ColorPtr->G = (ColorBar->GetCachedGeometry().AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition()).X / ColorBar->GetCachedGeometry().Size.X) * 360.0; ColorBar->OnColorCallback.ExecuteIfBound(ColorBar->ColorPtr->G); } @@ -476,8 +469,6 @@ void DragDropOperator::OnDragOver(const FGeometry& MyGeometry, const FDragDropEv { if (TimelineClip == Clip) continue;; - - // GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Red, FString::Printf(TEXT("ClipStartFrame:%d, LoopClipFrame:%d"), TimelineClip->ClipData->ClipStartFrame + NewPos, Clip->ClipData->ClipStartFrame)); if ((TimelineClip->ClipData->ClipStartFrame + NewPos) == Clip->ClipData->ClipEndFrame) { diff --git a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp index a2fdc04..a5051f6 100644 --- a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp +++ b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp @@ -38,7 +38,6 @@ void SEffectPreset::Construct(const FArguments& InArgs) { TArray Data; FString LoadPath = FUtils::GetResourcesPath(TEXT("Presets/") + PresetPath, true); - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Cyan, LoadPath); FFileHelper::LoadFileToArray(Data, *LoadPath); FMemoryReader MemoryReader(Data); @@ -75,7 +74,6 @@ void SEffectPreset::Construct(const FArguments& InArgs) .OnClicked_Lambda([this]() { MainInterface->UpdateProperties(this); - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Cyan, TEXT("Clicked")); return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton); }) ] diff --git a/Source/Cut5/Widgets/SCutMainWindow.cpp b/Source/Cut5/Widgets/SCutMainWindow.cpp index 5eb190b..1645c79 100644 --- a/Source/Cut5/Widgets/SCutMainWindow.cpp +++ b/Source/Cut5/Widgets/SCutMainWindow.cpp @@ -718,20 +718,8 @@ void SCutMainWindow::Tick(const FGeometry& AllottedGeometry, const double InCurr TotalTime = 0; } TotalTime += InDeltaTime; - // for (int32 i = 0; i < EffectCardsPanel->EffectCardGroups.Num(); i++) - // { - // for (int32 j = 0; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++) - // { - // if (EffectCardsPanel->EffectCardGroups[i].Cards[j].Name == TEXT("鲨鱼")) - // { - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::Printf(TEXT("TestVar: %d"), EffectCardsPanel->EffectCardGroups[i].Cards[j].ID)); - // } - // } - // } - SCH_DEBUG_INT32(114514, "TestVar"); - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::Printf(TEXT("TestVar: %d"), SCH_DEBUG_INT32(114514, "TestVar"))); } int32 SCutMainWindow::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, @@ -937,7 +925,6 @@ void SCutMainWindow::OpenTimeline(const FString& TimelineName, bool NeedSaveBefo FTimelineInfo TimelineInfo; // 拿到TimelineName路径中的名字,也就是倒数第四位开始,去掉后缀 - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TimelineName); if (CutTimeline->LoadTimeline(TimelineName, TimelineInfo)) { CutTimeline->TimelineInfo = TimelineInfo; @@ -1388,7 +1375,6 @@ void SCutMainWindow::ExportProject(const FString& ExportPath) FString XMLExportPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(ExportPath, FGlobalData::CurrentProjectName + TEXT("_XML"), TEXT("Process.xml"))); TArray Data; FFileHelper::SaveArrayToFile(Data, *XMLExportPath); - //GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, XMLExportPath); FFileHelper::SaveArrayToFile(Data, TEXT("C:\\temp\\Process.xml")); tinyxml2::XMLError NewError = Document.SaveFile("C:\\temp\\Process.xml"); @@ -1730,7 +1716,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par }); if (NewClipArrayData.Num() > 0) { - if (NewClipArrayData[0].ClipStartFrame != 0) + if (NewClipArrayData[0].ClipStartFrame != 0 && GetSelectIsGlobal(GetCurrentSelectCurtain())) { tinyxml2::XMLElement* Event1 = Event_List->InsertNewChildElement("Event"); Event1->InsertNewChildElement("Value")->InsertNewText("0"); @@ -1738,8 +1724,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par } } - - int32 Count = 0; for (int32 k = 0; k < NewClipArrayData.Num(); k++) @@ -1857,7 +1841,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par if (TempClipDataArray.Num() <= k + 1) { - if (TempClipDataArray[k].bIsCycle == false) + if (TempClipDataArray[k].bIsCycle == false && GetSelectIsGlobal(GetCurrentSelectCurtain())) { tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect"); NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0"); @@ -2904,14 +2888,14 @@ bool SCutMainWindow::GetSelectIsGlobal(const FGuid& Guid) { if (Group.Guid == Guid) { - return Group.bIsActive; + return Group.IsGlobal; } } for (FEffectCardProperty& Property : Group.Cards) { if (Property.Guid == Guid) { - return Property.bIsActive = true; + return Property.IsGlobal; } } } diff --git a/Source/Cut5/Widgets/SCutTimeline.cpp b/Source/Cut5/Widgets/SCutTimeline.cpp index dd8c58f..c5a5263 100644 --- a/Source/Cut5/Widgets/SCutTimeline.cpp +++ b/Source/Cut5/Widgets/SCutTimeline.cpp @@ -227,7 +227,7 @@ void SCutTimeline::Construct(const FArguments& InArgs) float TickOffset = TickScrollBox->GetScrollOffset(); float TickMaxOffset = TickScrollBox->GetScrollOffsetOfEnd(); - // GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::White, FString::Printf(TEXT("Offset: %f, MaxOffset: %f, TickOffset: %f, TickMaxOffset: %f"), Offset, MaxOffset, TickOffset, TickMaxOffset)); + @@ -289,6 +289,12 @@ void SCutTimeline::Construct(const FArguments& InArgs) TrackHeadScrollBox->SetScrollOffset(ScrollValue); }) ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SBox) + .HeightOverride(15) + ] ] + SHorizontalBox::Slot() .SizeParam(FStretch(0.03f)) @@ -312,6 +318,12 @@ void SCutTimeline::Construct(const FArguments& InArgs) TrackGroupScrollBox->SetScrollOffset(ScrollValue); }) ] + + SVerticalBox::Slot() + .SizeParam(FAuto()) + [ + SNew(SBox) + .HeightOverride(15) + ] // Track Head ] @@ -542,7 +554,6 @@ TArray SCutTimeline::GetClipData() FReply SCutTimeline::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { FVector2D Vector = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()); - GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::Printf(TEXT("X:%f,Y:%f"), Vector.X, Vector.Y)); return SCompoundWidget::OnMouseMove(MyGeometry, MouseEvent); } diff --git a/Source/Cut5/Widgets/STimelineClip.cpp b/Source/Cut5/Widgets/STimelineClip.cpp index 6a8a3e6..e88a6e1 100644 --- a/Source/Cut5/Widgets/STimelineClip.cpp +++ b/Source/Cut5/Widgets/STimelineClip.cpp @@ -651,15 +651,22 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe float DownSample = 4; // Draw Audio Waveform - const float RangeStart = // MainWidgetInterface->GetCutTimeline()->TrackBodyHScrollBox->GetCachedGeometry().GetLocalPositionAtCoordinates(FVector2D(0, 0)).X; - // MainWidgetInterface->GetSelf()->GetCachedGeometry().GetLocalPositionAtCoordinates(MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().GetLocalPositionAtCoordinates(FVector2D(0, 0))).X; - MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().Position.X; - const float RangeEnd = // MainWidgetInterface->GetCutTimeline()->TrackBodyScrollBox->GetCachedGeometry().GetLocalPositionAtCoordinates(FVector2D(MainWidgetInterface->GetCutTimeline()->TrackBodyScrollBox->GetCachedGeometry().GetLocalSize().X, 0)).X; - MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().GetLocalSize().X; - const float CurrentStartRange = AllottedGeometry.LocalToAbsolute(FVector2D(0, 0)).X; + + const float RangeStart = MainWidgetInterface->GetSelf()->GetCachedGeometry().AbsoluteToLocal( + MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().AbsolutePosition).X; + // MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().LocalToAbsolute(FVector2D(0, 0)).X; + + const float RangeEnd = MainWidgetInterface->GetSelf()->GetCachedGeometry().GetLocalSize().X; + + // MainWidgetInterface->GetCutTimeline()->TimelineMainContentVerticalBox->GetCachedGeometry().GetLocalSize().X; + const float CurrentStartRange = AllottedGeometry.GetAbsolutePosition().X; const float CurrentEndRange = AllottedGeometry.LocalToAbsolute(FVector2D(AllottedGeometry.GetLocalSize().X, 0)).X; - - + + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(CurrentStartRange)); + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::FromInt(CurrentEndRange)); + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(RangeStart)); + // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Blue, FString::FromInt(RangeEnd)); + // int32 CropStartFrameOffset = ((CurrentStartRange * -1) + RangeStart > 0 ? (CurrentStartRange * -1) + RangeStart : 0) / FGlobalData::DefaultTimeTickSpace; if (CurrentEndRange < RangeStart) @@ -674,8 +681,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe int32 NeedDrawCount = (CropEndFrameOffset - CropStartFrameOffset) * FGlobalData::DefaultTimeTickSpace; - GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::Printf(TEXT("CropStartFrameOffset : %d"), CropStartFrameOffset)); - GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::Printf(TEXT("CropEndFrameOffset : %d"), CropEndFrameOffset)); + const int32 StartOffset = (ClipData->ResourcePropertyDataPtr->AudioSample / FGlobalData::GlobalFPS) @@ -698,10 +704,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe const int32 Interval = (CropEndDataOffset - CropStartDataOffset) / NeedDrawCount; - - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, FString::FromInt(NeedDrawCount)); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Green, FString::FromInt(Interval)); - + if (CropStartFrameOffset != -1 || NeedDrawCount != -1) { for (int32 i = 0; i < NeedDrawCount / DownSample; i++) @@ -716,7 +719,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe TArray NewLoc; NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i * DownSample) , AllottedGeometry.GetLocalSize().Y)); NewLoc.Add(FVector2D((CropStartFrameOffset * FGlobalData::DefaultTimeTickSpace + i * DownSample) , Y)); - // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Red, NewLoc[0].ToString()); + FSlateDrawElement::MakeLines(OutDrawElements, LayerId + 6, AllottedGeometry.ToPaintGeometry(), NewLoc, ESlateDrawEffect::None, FColor(45, 214, 153, 255), true, DownSample * 1.2); } @@ -885,7 +888,7 @@ int32 STimelineClip::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGe TArray GradientStops; for (int32 i = 0; i < ClipData->PresetsCustomData.Cursors.Num(); i++) { - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::Printf(TEXT("CursorFrameOffset %s"), *ClipData->PresetsCustomData.Cursors[i].Color.ToString())); + GradientStops.Add(FSlateGradientStop(FVector2D(ClipData->PresetsCustomData.Cursors[i].CursorFrameOffset * FGlobalData::DefaultTimeTickSpace, 0), ClipData->PresetsCustomData.Cursors[i].Color)); } diff --git a/Source/Cut5/Widgets/STrackBody.cpp b/Source/Cut5/Widgets/STrackBody.cpp index af6fb78..acb2d0b 100644 --- a/Source/Cut5/Widgets/STrackBody.cpp +++ b/Source/Cut5/Widgets/STrackBody.cpp @@ -177,7 +177,7 @@ FReply STrackBody::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointer + Y ); - // GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("X:%f,Y:%f"), Y, DragDropOperator->ScrollStartPosition.Y)); + DragDropOperator->DraggingWidget = TrackHead->CutTimeline; return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton).BeginDragDrop(DragDropOperator.ToSharedRef()); } diff --git a/Source/UpdateLog.md b/Source/UpdateLog.md new file mode 100644 index 0000000..8f9076a --- /dev/null +++ b/Source/UpdateLog.md @@ -0,0 +1,8 @@ +#### 2023/9/28 +- [x] 修改了时间轴缩放位置 +- [x] 内化媒体文件到存档中 +- [x] 存档可以在不同电脑上使用 +- [x] 添加了全局选项并且在全局选项不启用时,灯效只会导出编辑器里显示的内容 +- [x] 优化了视频播放逻辑 +- [x] 修复了轨道对不齐 +------------------------ \ No newline at end of file