diff --git a/Resources/Presets/PresetVideo/Lighting.mp4 b/Resources/Presets/PresetVideo/5次闪电.mp4 similarity index 100% rename from Resources/Presets/PresetVideo/Lighting.mp4 rename to Resources/Presets/PresetVideo/5次闪电.mp4 diff --git a/Resources/Presets/PresetVideo/心跳-宏.mp4 b/Resources/Presets/PresetVideo/心跳-宏.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/心跳-宏.mp4 differ diff --git a/Resources/Presets/PresetVideo/跑马灯-橘.mp4 b/Resources/Presets/PresetVideo/跑马灯-橘.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/跑马灯-橘.mp4 differ diff --git a/Resources/Presets/PresetVideo/跑马灯-玫红.mp4 b/Resources/Presets/PresetVideo/跑马灯-玫红.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/跑马灯-玫红.mp4 differ diff --git a/Resources/Presets/PresetVideo/闪烁彩云.mp4 b/Resources/Presets/PresetVideo/闪烁彩云.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/闪烁彩云.mp4 differ diff --git a/Resources/Presets/PresetVideo/闪电-绿.mp4 b/Resources/Presets/PresetVideo/闪电-绿.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/闪电-绿.mp4 differ diff --git a/Resources/Presets/PresetVideo/闪电.mp4 b/Resources/Presets/PresetVideo/闪电.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/闪电.mp4 differ diff --git a/Resources/Presets/PresetVideo/随机闪电.mp4 b/Resources/Presets/PresetVideo/随机闪电.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/随机闪电.mp4 differ diff --git a/Resources/Presets/PresetVideo/雷-红.mp4 b/Resources/Presets/PresetVideo/雷-红.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/雷-红.mp4 differ diff --git a/Resources/Presets/PresetVideo/雷-蓝.mp4 b/Resources/Presets/PresetVideo/雷-蓝.mp4 new file mode 100644 index 0000000..9173ed8 Binary files /dev/null and b/Resources/Presets/PresetVideo/雷-蓝.mp4 differ diff --git a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp index 7a0f329..559e4e3 100644 --- a/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp +++ b/Source/Cut5/Widgets/DragDropOperator/DragDropOperator.cpp @@ -529,11 +529,11 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& } if (TrackHead->TrackData.TrackType == ETrackType::AudioTrack || - TrackHead->TrackData.TrackType == ETrackType::AudioTrackR || - TrackHead->TrackData.TrackType == ETrackType::VideoTrack) + TrackHead->TrackData.TrackType == ETrackType::AudioTrackR) { return; } + @@ -579,6 +579,18 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& NewClipData.ClipEndFrame = NewClipData.ClipStartFrame + 15; } + if (PresetDragOperation->PresetData.PresetType == EPresetType::Video) + { + NewClipData.ClipType = ETrackType::VideoTrack; + if (FUtils::DetectDragTypeCanDrop(NewClipData, TrackHead->TrackData.TrackType) + { + TrackHead->TrackData.ClipData.Add(NewClipData); + TrackBody->CallRender(); + } + return ; + + } + TrackHead->TrackData.ClipData.Add(NewClipData); diff --git a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp index 013ec01..59d004b 100644 --- a/Source/Cut5/Widgets/Presets/SEffectPreset.cpp +++ b/Source/Cut5/Widgets/Presets/SEffectPreset.cpp @@ -4,6 +4,7 @@ #include "SEffectPreset.h" #include "SlateOptMacros.h" +#include "Cut5/Utils/FFMPEGUtils.h" #include "Cut5/Utils/Utils.h" #include "Cut5/Widgets/MicroWidgets/SNewProjectTips.h" #include "Cut5/Widgets/Style/CutButtonWidgetStyle.h" @@ -26,13 +27,23 @@ void SEffectPreset::Construct(const FArguments& InArgs) if (!PresetPath.IsEmpty()) { - TArray Data; - FString LoadPath = FUtils::GetResourcesPath(TEXT("Presets/") + PresetPath, true); - // GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Cyan, LoadPath); - FFileHelper::LoadFileToArray(Data, *LoadPath); + if (PresetType == EPresetType::Video) + { + FString LoadPath = FUtils::GetResourcesPath(TEXT("Presets/PresetVideo/") + PresetPath, true); + FFFMPEGUtils::LoadMedia(LoadPath, &NewPropertyData); + PresetsData.PresetType = EPresetType::Video; + } + else + { + 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); + MemoryReader << PresetsData; + } - FMemoryReader MemoryReader(Data); - MemoryReader << PresetsData; } PresetsData.PresetType = PresetType; diff --git a/Source/Cut5/Widgets/Presets/SEffectPreset.h b/Source/Cut5/Widgets/Presets/SEffectPreset.h index 6501258..68af570 100644 --- a/Source/Cut5/Widgets/Presets/SEffectPreset.h +++ b/Source/Cut5/Widgets/Presets/SEffectPreset.h @@ -30,6 +30,7 @@ public: FString PresetPath; FPresetsData PresetsData; ICutMainWidgetInterface* MainInterface; + FTimelinePropertyData NewPropertyData; EPresetType PresetType; TSharedPtr>> GroupComboBox; virtual TSharedPtr GetPropertiesWidget() override; diff --git a/Source/Cut5/Widgets/SCustomInputPanel.cpp b/Source/Cut5/Widgets/SCustomInputPanel.cpp index fd7d825..6fecbe3 100644 --- a/Source/Cut5/Widgets/SCustomInputPanel.cpp +++ b/Source/Cut5/Widgets/SCustomInputPanel.cpp @@ -368,15 +368,15 @@ void SCustomInputPanel::Construct(const FArguments& InArgs) AddPreset(TEXT("青柠"), TEXT("青柠.dat"), EPresetType::Color); AddPreset(TEXT("红-暗"), TEXT("红-暗.dat"), EPresetType::Gradient); AddPreset(TEXT("闪电"), TEXT("闪电.dat"), EPresetType::Video); - AddPreset(TEXT("跑马灯-玫红"), TEXT("")); - AddPreset(TEXT("心跳-宏"), TEXT("")); - AddPreset(TEXT("5次闪电"), TEXT("")); - AddPreset(TEXT("闪电-绿"), TEXT("")); - AddPreset(TEXT("雷-红"), TEXT("")); - AddPreset(TEXT("雷-蓝"), TEXT("")); - AddPreset(TEXT("闪烁彩云"), TEXT("")); - AddPreset(TEXT("跑马灯-橘"), TEXT("")); - AddPreset(TEXT("随机闪电"), TEXT("")); + AddPreset(TEXT("跑马灯-玫红"), TEXT("跑马灯-玫红.mp4"), EPresetType::Video); + AddPreset(TEXT("心跳-宏"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("5次闪电"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("闪电-绿"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("雷-红"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("雷-蓝"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("闪烁彩云"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("跑马灯-橘"), TEXT(""), EPresetType::Video); + AddPreset(TEXT("随机闪电"), TEXT(""), EPresetType::Video); AddPreset(TEXT("启动投影"), TEXT(""), EPresetType::EnableProjector); AddPreset(TEXT("屏蔽投影"), TEXT(""), EPresetType::DisableProjector);