修改一大堆内容

This commit is contained in:
Sch 2023-09-04 22:43:50 +08:00
parent e6f57bf33a
commit 0a1e95ef90
13 changed files with 612 additions and 315 deletions

View File

@ -7,67 +7,49 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{233774
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{B95E7D0E-DB45-3765-9058-E00EBBC4B157}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{6EE39883-7339-3FB6-AD82-931FB137D37F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE5", "Intermediate\ProjectFiles\UE5.vcxproj", "{C48D0E9D-C862-3EA3-96A7-752EE9D06362}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cut5", "Intermediate\ProjectFiles\Cut5.vcxproj", "{AF5A253A-0F37-38CE-8998-45CA936C112B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
ProjectSection(SolutionItems) = preProject
..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = ..\..\Software\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis
D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis = D:\UE\UE_5.2\Engine\Extras\VisualStudioDebugging\Unreal.natvis
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugGame Editor|Android = DebugGame Editor|Android
DebugGame Editor|Win64 = DebugGame Editor|Win64
DebugGame|Android = DebugGame|Android
DebugGame|Win64 = DebugGame|Win64
Development Editor|Android = Development Editor|Android
Development Editor|Win64 = Development Editor|Win64
Development|Android = Development|Android
Development|Win64 = Development|Win64
Shipping|Android = Shipping|Android
Shipping|Win64 = Shipping|Win64
EndGlobalSection
# UnrealVS Section
GlobalSection(ddbf523f-7eb6-4887-bd51-85a714ff87eb) = preSolution
AvailablePlatforms=Win64;Android
AvailablePlatforms=Win64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Android.ActiveCfg = Invalid|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Android.Build.0 = Android_DebugGame|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.ActiveCfg = DebugGame|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.DebugGame|Win64.Build.0 = DebugGame|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Android.ActiveCfg = Invalid|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development Editor|Win64.Build.0 = Development_Editor|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.ActiveCfg = Android_Development|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Android.Build.0 = Android_Development|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.ActiveCfg = Development|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Development|Win64.Build.0 = Development|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.ActiveCfg = Android_Shipping|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Android.Build.0 = Android_Shipping|Win64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.ActiveCfg = Shipping|x64
{B95E7D0E-DB45-3765-9058-E00EBBC4B157}.Shipping|Win64.Build.0 = Shipping|x64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{C48D0E9D-C862-3EA3-96A7-752EE9D06362}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{6EE39883-7339-3FB6-AD82-931FB137D37F}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.ActiveCfg = DebugGame|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.DebugGame|Win64.Build.0 = DebugGame|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development Editor|Win64.Build.0 = Development_Editor|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.ActiveCfg = Development|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Development|Win64.Build.0 = Development|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.ActiveCfg = Shipping|x64
{AF5A253A-0F37-38CE-8998-45CA936C112B}.Shipping|Win64.Build.0 = Shipping|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C48D0E9D-C862-3EA3-96A7-752EE9D06362} = {233774A8-CC9D-3FA9-86D1-90573E92B704}
{B95E7D0E-DB45-3765-9058-E00EBBC4B157} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}
{6EE39883-7339-3FB6-AD82-931FB137D37F} = {233774A8-CC9D-3FA9-86D1-90573E92B704}
{AF5A253A-0F37-38CE-8998-45CA936C112B} = {DE1F8B53-6C02-3C13-9101-A7C8D96F3FF6}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=psaf/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

BIN
Resources/OutOfFile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -104,44 +104,95 @@ uint32 FVideoThread::Run()
continue;;
}
const AVCodecContext* VideoCodecContext = NewPropertyData.VideoCodecContext;
struct SwsContext* SwsCtx = sws_getContext(
AllocatedFrame->width, AllocatedFrame->height, VideoCodecContext->pix_fmt,
AllocatedFrame->width, AllocatedFrame->height, AV_PIX_FMT_BGRA,
SWS_BILINEAR, nullptr, nullptr, nullptr
);
if (!SwsCtx)
uint8* RawData = nullptr;
int32 Width = AllocatedFrame->width;
if (ClipData.ClipType == ETrackType::LightArrayTrack)
{
UE_LOG(LogTemp, Error, TEXT("Error creating swsContext"));
CurrentSeekingFrame = -1;
continue;;
RawData = new uint8[FGlobalData::LightArrayX * FGlobalData::LightArrayY * 4];
Width = FGlobalData::LightArrayX;
}
else if (ClipData.ClipType == ETrackType::VideoTrack)
{
RawData = new uint8[AllocatedFrame->width * AllocatedFrame->height * 4];
Width = AllocatedFrame->width;
}
uint8* RawData = new uint8[AllocatedFrame->width * AllocatedFrame->height * 4];
uint8* Dest[4] = {RawData, nullptr, nullptr, nullptr};
const int32 DestLineSize[4] = {AllocatedFrame->width * 4, 0, 0, 0};
sws_scale(SwsCtx, AllocatedFrame->data, AllocatedFrame->linesize, 0, AllocatedFrame->height, Dest, DestLineSize);
sws_freeContext(SwsCtx);
int32 DestLineSize[4] = {Width * 4, 0, 0, 0};
int32 DataSize = AllocatedFrame->width * AllocatedFrame->height * 4;
if (AllocatedFrame->data[0] == nullptr)
{
CurrentSeekingFrame = -1;
delete RawData;
continue;;
}
if (ClipData.ClipType == ETrackType::VideoTrack)
{
const AVCodecContext* VideoCodecContext = NewPropertyData.VideoCodecContext;
struct SwsContext* SwsCtx = sws_getContext(
AllocatedFrame->width, AllocatedFrame->height, VideoCodecContext->pix_fmt,
AllocatedFrame->width, AllocatedFrame->height, AV_PIX_FMT_BGRA,
SWS_BILINEAR, nullptr, nullptr, nullptr
);
if (!SwsCtx)
{
UE_LOG(LogTemp, Error, TEXT("Error creating swsContext"));
CurrentSeekingFrame = -1;
continue;;
}
sws_scale(SwsCtx, AllocatedFrame->data, AllocatedFrame->linesize, 0, AllocatedFrame->height, Dest, DestLineSize);
sws_freeContext(SwsCtx);
}
else if (ClipData.ClipType == ETrackType::LightArrayTrack)
{
const AVCodecContext* VideoCodecContext = NewPropertyData.VideoCodecContext;
struct SwsContext* SwsCtx = sws_getContext(
AllocatedFrame->width, AllocatedFrame->height, VideoCodecContext->pix_fmt,
FGlobalData::LightArrayX, FGlobalData::LightArrayY, AV_PIX_FMT_BGRA,
SWS_BILINEAR, nullptr, nullptr, nullptr
);
if (!SwsCtx)
{
UE_LOG(LogTemp, Error, TEXT("Error creating swsContext"));
CurrentSeekingFrame = -1;
continue;;
}
sws_scale(SwsCtx, AllocatedFrame->data, AllocatedFrame->linesize, 0, AllocatedFrame->height, Dest, DestLineSize);
sws_freeContext(SwsCtx);
}
int32 X = AllocatedFrame->width;
int32 Y = AllocatedFrame->height;
AsyncTask(ENamedThreads::GameThread, [this, X, Y, RawData]()
AsyncTask(ENamedThreads::GameThread, [this, X, Y, RawData, AllocatedFrame]()
{
MainInterface->OnUpdateVideo(FGuid(), X, Y, RawData);
if (ClipData.ClipType == ETrackType::VideoTrack)
{
MainInterface->OnUpdateVideo(FGuid(), X, Y, RawData);
}
if (ClipData.ClipType == ETrackType::LightArrayTrack)
{
TArray<FColor> ColorArray;
ColorArray.Init(FColor::Black, FGlobalData::LightArrayX * FGlobalData::LightArrayY);
FMemory::Memcpy(ColorArray.GetData(), RawData, FGlobalData::LightArrayX * FGlobalData::LightArrayY * 4);
MainInterface->OnUpdateLightArray(ColorArray);
}
});
// });
LastFrame = av_frame_alloc();
// av_frame_copy(LastFrame, AllocatedFrame);
LastFrame = av_frame_clone(AllocatedFrame);

View File

@ -419,7 +419,7 @@ FString FUtils::GetFfmepg()
TArray<FEncodeVideoInfo> FUtils::ExportPsaf(FTrackData TrackData, const FString& ExportPath)
{
using namespace cv;
using namespace cv;
TArray<FClipData> ClipData = TrackData.ClipData;
ClipData.Sort([](const FClipData& A, const FClipData& B) {return A.ClipStartFrame < B.ClipStartFrame; });
TArray<FEncodeVideoInfo> EncodeVideoInfos;
@ -429,153 +429,243 @@ TArray<FEncodeVideoInfo> FUtils::ExportPsaf(FTrackData TrackData, const FString&
FString ExportName = FGuid::NewGuid().ToString();;
if (TempClipData.ResourcePropertyDataPtr)
{
FTimelinePropertyData PropertyData;
FFFMPEGUtils::LoadContextPure(TempClipData.ResourcePropertyDataPtr->MoviePath, &PropertyData);
const FString PsafSavePath = ExportPath + FString::FromInt(i) + ".psaf";
int32 TimeStamp = av_rescale_q(static_cast<float>(TempClipData.VideoStartFrame) / FGlobalData::GlobalFPS * AV_TIME_BASE, AVRational{1, AV_TIME_BASE}, PropertyData.Context->streams[PropertyData.VideoStream]->time_base);
int32 EndTimeStamp = av_rescale_q(static_cast<float>(TempClipData.VideoEndFrame) / FGlobalData::GlobalFPS * AV_TIME_BASE, AVRational{1, AV_TIME_BASE}, PropertyData.Context->streams[PropertyData.VideoStream]->time_base);
av_seek_frame(PropertyData.Context, PropertyData.VideoStream, TimeStamp, AVSEEK_FLAG_BACKWARD);
TArray<uint8> LightArrayResult;
uint8 Width = FGlobalData::LightArrayX;
uint8 Height = FGlobalData::LightArrayY;
uint8 p[128] = "pasf";
LightArrayResult.Append(p, 128);
TempClipData.ResourcePropertyDataPtr->MoviePath;
FString TempPath = TempClipData.ResourcePropertyDataPtr->MoviePath;
frames.Empty();
AVPacket* Packet = av_packet_alloc();
AVFrame* Frame = av_frame_alloc();
while (av_read_frame(PropertyData.Context, Packet) >= 0)
{
avcodec_send_packet(PropertyData.VideoCodecContext, Packet);
int32 Response = avcodec_receive_frame(PropertyData.VideoCodecContext, Frame);
if (Response == AVERROR(EAGAIN) || AVERROR_EOF)
{
VideoCapture capture;
bool ret = capture.open(TCHAR_TO_UTF8(*TempPath));
//setNumThreads(2);
std::ofstream outfile;
FString leftStr;
FString rightStr;
FString SourceLeft;
FString SourceRight;
UKismetStringLibrary::Split(TempPath,".",SourceLeft, SourceRight, ESearchCase::IgnoreCase,ESearchDir::FromEnd);
UKismetStringLibrary::Split(SourceLeft,"/",SourceLeft, SourceRight, ESearchCase::IgnoreCase,ESearchDir::FromEnd);
FString psafPath = ExportPath + ExportName + FString::FromInt(i) + ".psaf";
FString psafPath2 = leftStr + ".psaf2";
//outfile.open(TCHAR_TO_UTF8(*leftStr), ios::binary);
outfile.open(*psafPath, std::ios::binary);
// outfile.close();
UE_LOG(LogTemp, Log, TEXT("open flie -> %s "), *leftStr);
uint8 width = capture.get(CAP_PROP_FRAME_WIDTH);
uint8 height = capture.get(CAP_PROP_FRAME_HEIGHT);
Size frameSize = Size(width,height );
uint8 fps = capture.get(CAP_PROP_FPS);
float duration = capture.get(CV_CAP_PROP_FRAME_COUNT) / capture.get(CV_CAP_PROP_FPS);
Size old_size = frameSize;
capture.set(CAP_PROP_POS_FRAMES, TempClipData.ClipStartFrame);
int32 frameCount = capture.get(CV_CAP_PROP_FRAME_COUNT);
frameCount -= ClipData[i].ClipStartFrame;
UE_LOG(LogTemp, Log, TEXT("frameCount: %s"), *FString::FromInt(frameCount));
char p[128] = "pasf";
outfile.write(reinterpret_cast<const char*>(p), sizeof(p));
#if 1
Mat frameOrg;
Mat frame;
int frameIndex = 0;
while (ret && frameIndex < frameCount) {
if (frameIndex % 2 == 0) {
capture.grab();
frameIndex++;
continue;
}
if (Frame->best_effort_timestamp >= EndTimeStamp)
{
break;
}
if (Frame->best_effort_timestamp >= TimeStamp)
{
SwsContext* FormatContext = sws_getContext(
Frame->width,
Frame->height,
PropertyData.VideoCodecContext->pix_fmt,
FGlobalData::LightArrayX,
FGlobalData::LightArrayY,
AVPixelFormat::AV_PIX_FMT_RGB24,
SWS_BILINEAR,
nullptr,
nullptr,
nullptr
);
uint8* RawData = static_cast<uint8*>(FMemory::Malloc(FGlobalData::LightArrayX * FGlobalData::LightArrayY * 3));
uint8* Dest[4] = {RawData, nullptr, nullptr ,nullptr};
const int32 DestLineSize[4] = {FGlobalData::LightArrayX * 3, 0, 0, 0};
sws_scale(FormatContext, Frame->data, Frame->linesize, 0, Frame->height, Dest, DestLineSize);
sws_freeContext(FormatContext);
LightArrayResult.Add(static_cast<uint8>(FGlobalData::GlobalFPS));
LightArrayResult.Add(blockNum);
LightArrayResult.Add(Height);
LightArrayResult.Add(Width);
LightArrayResult.Add(0);
LightArrayResult.Add(0);
LightArrayResult.Add(0);
LightArrayResult.Add(0);
int32 Length = TempClipData.VideoEndFrame - TempClipData.VideoStartFrame;
LightArrayResult.Append(reinterpret_cast<uint8*>(&Length), sizeof(int32));
for (int32 CurrentHeight = Height / 3 - 1; CurrentHeight >= 0; CurrentHeight--)
/* */
tempIndex = frameIndex;
if (capture.read(frameOrg)) {
if (!capture.isOpened())
{
if (CurrentHeight % 2 == 0)
{
for (int32 CurrentWidth = Width - 1; CurrentWidth >= 0; CurrentWidth--)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
}
}
else
{
for (int32 CurrentWidth = 0; CurrentWidth < Width; CurrentWidth++)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
}
}
UE_LOG(LogTemp, Log, TEXT("cant open video -> %s"), *TempPath);
i++;
continue;;
}
for (int32 CurrentHeight = Height / 3; CurrentHeight < 2 * Height / 3 ; CurrentHeight++) {
if (CurrentHeight % 2 == 0)
{
for (int32 CurrentWidth = 0; CurrentWidth < Width; CurrentWidth++)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
if (frameOrg.empty())
{
UE_LOG(LogTemp, Log, TEXT("no frame"));
i++;
continue;;
}
UE_LOG(LogTemp, Log, TEXT("frameOrg size - > (%s, %s),frameOrg type -> %s "),
*FString::FromInt(frameOrg.rows),*FString::FromInt(frameOrg.cols), *FString::FromInt(frameOrg.type()));
resize(frameOrg, frameOrg, Size(70, 42), 0, 0, INTER_LINEAR);
frameOrg.copyTo(frame);
if (frame.empty()) {
UE_LOG(LogTemp, Log, TEXT(" read none "));
return EncodeVideoInfos;
}
/* 每帧标头 */
outfile.write(reinterpret_cast<const char*>(&fps), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&blockNum), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&height), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&width), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>("00"), sizeof(float));
outfile.write(reinterpret_cast<const char*>(&duration), sizeof(float));
for (int32 row = frame.rows / 3 - 1; row >= 0; row--) {
if (row % interval == 0) {
for (int32 col = frame.cols - 1; col >= 0; col--) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
//outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)), sizeof(uint8) * 3);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
//UE_LOG(LogTemp, Log, TEXT("row -> %s ,col - > %s "),
// *FString::FromInt(row), *FString::FromInt(col));
}
}
else
{
for (int32 CurrentWidth = Width - 1; CurrentWidth >= 0; CurrentWidth--)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
else {
for (int32 col = 0; col < frame.cols; col++) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
}
}
}
for (int32 row = frame.rows/3; row < 2 * frame.rows / 3 ; row++) {
if (row % interval == 0) {
for (int32 col = 0; col < frame.cols; col++) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
}
}
else {
for (int32 col = frame.cols - 1; col >= 0; col--) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
}
}
}
for (int32 CurrentHeight = 2 * Height / 3; CurrentHeight < Height; CurrentHeight++) {
if (CurrentHeight % 2 == 0)
{
for (int32 CurrentWidth = 0; CurrentWidth < Width; CurrentWidth++)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
for (int32 row = 2 * frame.rows/3; row < frame.rows ; row++) {
if (row % interval == 0) {
for (int32 col = 0; col < frame.cols ; col++) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
}
}
else {
for (int32 CurrentWidth = Width - 1; CurrentWidth >= 0; CurrentWidth--)
{
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 0]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 1]);
LightArrayResult.Add(RawData[CurrentHeight * FGlobalData::LightArrayX + CurrentWidth + 2]);
for (int32 col = frame.cols - 1; col >= 0 ; col--) {
frame.at<Vec3b>(row, col) = frameOrg.at<Vec3b>(row, col);
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[2]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[1]), sizeof(uint8));
outfile.write(reinterpret_cast<const char*>(&frame.at<Vec3b>(row, col)[0]), sizeof(uint8));
}
}
}
#if EXPORT_PROCESSED_VIDEO
writer.write(frame);
#endif
//frames.Add(MatToTexture2D(frame, width, height, true));
frameIndex++;
//UE_LOG(LogTemp, Log, TEXT(" write frame,frameSize( %s, %s )"), *FString::FromInt(frame.rows), *FString::FromInt(frame.cols));
}
else
{
frameIndex++;
}
}
int32 RemainData = 1024 - LightArrayResult.Num() % 1024;
LightArrayResult.AddZeroed(RemainData);
FFileHelper::SaveArrayToFile(LightArrayResult, *PsafSavePath);
FEncodeVideoInfo EncodeVideoInfo;
EncodeVideoInfo.EncodedVideoName = ExportName + FString::FromInt(i) + ".psaf";
EncodeVideoInfo.EncodedVideoTimeCode = FGlobalData::GetTimeData(TempClipData.ClipStartFrame);
EncodeVideoInfos.Add(EncodeVideoInfo);
#endif
FFFMPEGUtils::UnLoadContext(&PropertyData);
av_packet_free(&Packet);
av_frame_free(&Frame);
outfile.seekp(0, outfile.end);
size_t fileSize = outfile.tellp();
UE_LOG(LogTemp, Log, TEXT("fileSize1 -> %s"), *FString::FromInt(fileSize));
int32 remains = 1024 - fileSize % (1024);
outfile.write(reinterpret_cast<const char*>("0x00"), sizeof(uint8)* remains);
fileSize = outfile.tellp();
UE_LOG(LogTemp, Log, TEXT("fileSize2 -> %s"), *FString::FromInt(fileSize));
capture.release();
#if EXPORT_PROCESSED_VIDEO
writer.release();
#endif
outfile.close();
UE_LOG(LogTemp, Log, TEXT("proecess completed , video close"));
}
FEncodeVideoInfo EncodeVideoInfo;
FString String = ExportPath + ExportName + FString::FromInt(i) + ".psaf";
EncodeVideoInfo.EncodedVideoName = FPaths::GetBaseFilename(String) + ".psaf";
EncodeVideoInfo.EncodedVideoTimeCode = FGlobalData::GetTimeData(TempClipData.ClipStartFrame);
EncodeVideoInfo.TrackData = TrackData;
EncodeVideoInfo.ClipData = TempClipData;
EncodeVideoInfos.Add(EncodeVideoInfo);
i++;
}
return EncodeVideoInfos;

View File

@ -81,7 +81,7 @@ void SCurtain::Construct(const FArguments& InArgs)
{
FSlateApplication::Get().SetKeyboardFocus(InlineEditableTextBlock);
}
Curtain->Step = 1 + Offset + (Curtain - CurtainGroup->Curtains.GetData());
Curtain->Step = Offset + (Curtain - CurtainGroup->Curtains.GetData());
}
FReply SCurtain::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)

View File

@ -31,7 +31,7 @@ public:
inline static float GlobalFPS = 30.0f;
inline static FString CurrentProjectName = "DefaultProject";
inline static FString BasePath = FPaths::ProjectDir();
inline static FString Version = "1.0.1";
inline static FString Version = "3.0";
inline static FString ExportPath = "";
inline static TArray<FColor> Colors =
@ -384,7 +384,7 @@ struct CUT5_API FClipData : public TSharedFromThis<FClipData>
if (CropMethod == ECropMethod::FromFront)
{
ClipStartFrame += CropFrame;
if (ClipType == ETrackType::VideoTrack || ClipType == ETrackType::AudioTrack || ClipType == ETrackType::LightArrayTrack || ClipType == ETrackType::LightBarTrack)
if (ClipType == ETrackType::VideoTrack || ClipType == ETrackType::AudioTrack || ClipType == ETrackType::AudioTrackR || ClipType == ETrackType::LightArrayTrack || ClipType == ETrackType::LightBarTrack)
{
VideoStartFrame += CropFrame;
}
@ -392,11 +392,10 @@ struct CUT5_API FClipData : public TSharedFromThis<FClipData>
else
{
ClipEndFrame -= CropFrame;
if (ClipType == ETrackType::VideoTrack || ClipType == ETrackType::AudioTrack || ClipType == ETrackType::LightArrayTrack || ClipType == ETrackType::LightBarTrack)
if (ClipType == ETrackType::VideoTrack || ClipType == ETrackType::AudioTrack || ClipType == ETrackType::AudioTrackR || ClipType == ETrackType::LightArrayTrack || ClipType == ETrackType::LightBarTrack)
{
VideoEndFrame -= CropFrame;
}
}
if (PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::None)
{
@ -1036,4 +1035,18 @@ enum class ESoundSolveType
None,
OnlyLeft,
OnlyRight,
};
};
static bool IsVideo(enum ETrackType TrackType)
{
if ( TrackType == ETrackType::VideoTrack
|| TrackType == ETrackType::AudioTrack
|| TrackType == ETrackType::AudioTrackR
|| TrackType == ETrackType::LightArrayTrack
|| TrackType == ETrackType::LightBarTrack)
{
return true;
}
return false;
}

View File

@ -770,6 +770,7 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
if (ClipDragOperation.TimelinePropertyData->Type != TrackHead->TrackData.TrackType)
{
if ((ClipDragOperation.TimelinePropertyData->Type == ETrackType::VideoTrack && TrackHead->TrackData.TrackType == ETrackType::LightArrayTrack)
|| (ClipDragOperation.TimelinePropertyData->Type == ETrackType::VideoTrack && TrackHead->TrackData.TrackType == ETrackType::LightBarTrack)
|| (ClipDragOperation.TimelinePropertyData->Type == ETrackType::VideoTrack && TrackHead->TrackData.TrackType == ETrackType::PlayerTrack)
|| (ClipDragOperation.TimelinePropertyData->Type == ETrackType::AudioTrack && TrackHead->TrackData.TrackType == ETrackType::AudioTrackR)
|| (ClipDragOperation.TimelinePropertyData->Type == ETrackType::VideoTrack && TrackHead->TrackData.TrackType == ETrackType::AtomSphereLightTrack))
@ -797,11 +798,11 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
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::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;
@ -814,15 +815,6 @@ void DragDropOperator::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent&
NewClipData.PlayerName = TrackBody->MainWidgetInterface->GetGroupName(TrackHead);
NewClipData.PlayerLightData = FOpencvUtils::GetVideoSingleLightColor(ClipDragOperation.TimelinePropertyData->MoviePath);
}
if (TrackHead->TrackData.TrackType == ETrackType::VideoTrack)
{
SCutMainWindow* MainWidget = static_cast<SCutMainWindow*>(TrackHead->MainWidgetInterface);
if (!MainWidget->CutTimeline->GetTrackGroupByName(TEXT("视频附着")))
{
MainWidget->CutTimeline->AddNewTrackToGroup(TEXT("视频附着"), FTrackData(TEXT("附着音频"), ETrackType::AudioTrack, FDeviceTrack(TEXT("附着音频"), ETrackType::AudioTrack)));
}
}
}
else if (ClipDragOperation.TimelinePropertyData->Type == ETrackType::LightArrayTrack)
{

View File

@ -854,6 +854,7 @@ void SCutMainWindow::OpenProject(const FString& Project)
FFileManagerGeneric::Get().FindFiles(CutlinkName, *FPaths::Combine(Project, TEXT("*.cutlink")), true, false);
if (CutlinkName.Num() == 0)
{
// GEngine->GameViewport->AddViewportWidgetContent(SNew(SNewProjectTips).Title(FText::FromString(TEXT("存档失效或这不是一个存档"))).OnEnsure_Lambda([]))
UE_LOG(LogTemp, Error, TEXT("项目关联文件不存在"));
return;
}
@ -988,7 +989,7 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
File->InsertNewChildElement("Author")->InsertNewText("Sch");
File->InsertNewChildElement("Date")->InsertNewText("2020-12-12");
File->InsertNewChildElement("Describe")->InsertNewText("描述");
File->InsertNewChildElement("FileVersion")->InsertNewText("1.0");
File->InsertNewChildElement("FileVersion")->InsertNewText("3.0");
File->InsertNewChildElement("SoftWareVersion")->InsertNewText(TCHAR_TO_UTF8(*FGlobalData::Version));
// Device List
@ -1034,8 +1035,8 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
tinyxml2::XMLElement* RotationSpeaker = RoundSpeakerList->InsertNewChildElement("RotationSpeaker");
RotationSpeaker->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
RotationSpeaker->InsertNewChildElement("Name")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceName));
DeviceID++;
IDList.Add(TrackData.Guid, DeviceID);
DeviceID++;
RotatorSpeakerIndex = DeviceID;
}
break;
@ -1044,8 +1045,8 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
tinyxml2::XMLElement* LightArray = LightArrayList->InsertNewChildElement("GuangZhen");
LightArray->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
LightArray->InsertNewChildElement("Name")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceName));
DeviceID++;
IDList.Add(TrackData.Guid, DeviceID);
DeviceID++;
LightArrayIndex = DeviceID;
}
break;
@ -1054,6 +1055,7 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
tinyxml2::XMLElement* Projector = ProjectorList->InsertNewChildElement("Projector");
Projector->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
Projector->InsertNewChildElement("Name")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceName));
IDList.Add(TrackData.Guid, DeviceID);
DeviceID++;
}
break;
@ -1062,8 +1064,8 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
tinyxml2::XMLElement* DMLight = DMLightList->InsertNewChildElement("DMLight");
DMLight->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
DMLight->InsertNewChildElement("Name")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceName));
DeviceID++;
IDList.Add(TrackData.Guid, DeviceID);
DeviceID++;
break;
}
case ETrackType::LightBarTrack:
@ -1075,8 +1077,8 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
tinyxml2::XMLElement* LightArray = LightArrayList->InsertNewChildElement("GuangZhen2");
LightArray->InsertNewChildElement("ID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(DeviceID)));
LightArray->InsertNewChildElement("Name")->InsertNewText(TCHAR_TO_UTF8(*TrackData.DeviceName));
DeviceID++;
IDList.Add(TrackData.Guid, DeviceID);
DeviceID++;
bIsLightBar = true;
break;
}
@ -1109,13 +1111,13 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
int32 ToStepID = 0;
if (TypeID == 1)
{
for (int32 k = 0; i < CurtainPanel->Groups.Num(); k++)
for (int32 k = 0; k < CurtainPanel->Groups.Num(); k++)
{
for (FCurtain& Curtain : CurtainPanel->Groups[k].Curtains)
{
if (Curtain.CurtainUUID == EffectCardsPanel->EffectCardGroups[i].Cards[j].JumpStepCurtains.Guid)
{
ToStepID = Curtain.Step + 1;
ToStepID = Curtain.Step;
break;
}
}
@ -1147,13 +1149,13 @@ void SCutMainWindow::ExportProject(const FString& ExportPath)
int32 ToStepID = 0;
if (TypeID == 3)
{
for (int32 k = 0; i < CurtainPanel->Groups.Num(); k++)
for (int32 k = 0; k < CurtainPanel->Groups.Num(); k++)
{
for (FCurtain& Curtain : CurtainPanel->Groups[k].Curtains)
{
if (Curtain.CurtainUUID == EffectCardsPanel->EffectCardGroups[i].JumpStepCurtains.Guid)
{
ToStepID = Curtain.Step + 1;
ToStepID = Curtain.Step;
break;
}
}
@ -1482,18 +1484,35 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
const FTrackData& TrackData = StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData;
if (TrackData.TrackType == ETrackType::SpotLightTrack)
{
tinyxml2::XMLElement* DMLight = DMLightList->InsertNewChildElement(TCHAR_TO_UTF8(*FString::Printf(TEXT("DMLight"))));
DMLight->SetAttribute("ID", TCHAR_TO_UTF8(*FString::FromInt(GetTrackID(TrackData.DeviceTrack.Guid))));
tinyxml2::XMLElement* Event_List = DMLight->InsertNewChildElement("Event_List");
int32 Count = 0;
for (int32 k = 0; k < TrackData.ClipData.Num(); k++)
TArray<FClipData> NewClipArrayData = TrackData.ClipData;
Sort(NewClipArrayData.GetData(), NewClipArrayData.Num(), [](const FClipData& A, const FClipData& B)
{
const FClipData& TempClipData = TrackData.ClipData[k];
return A.ClipStartFrame < B.ClipStartFrame;
});
if (NewClipArrayData.Num() > 0)
{
if (NewClipArrayData[0].ClipStartFrame != 0)
{
tinyxml2::XMLElement* Event1 = Event_List->InsertNewChildElement("Event");
Event1->InsertNewChildElement("Value")->InsertNewText("0");
Event1->InsertNewChildElement("TimeCode")->InsertNewText("0");
}
}
int32 Count = 0;
for (int32 k = 0; k < NewClipArrayData.Num(); k++)
{
const FClipData& TempClipData = NewClipArrayData[k];
tinyxml2::XMLElement* Event1 = Event_List->InsertNewChildElement("Event");
Event1->InsertNewChildElement("Value")->InsertNewText("1");
Event1->InsertNewChildElement("Value")->InsertNewText("-1");
Event1->InsertNewChildElement("TimeCode")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipData.ClipStartFrame)))));
tinyxml2::XMLElement* Event2 = Event_List->InsertNewChildElement("Event");
@ -1527,16 +1546,37 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
// Default
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")->InsertNewText("106090");
NewSpeicalEffect->InsertNewChildElement("InitialColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("EndColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("TimeLength")->InsertNewText("-1");
NewSpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("Cycle")->InsertNewText("0");
}
for (int32 k = 0; k < TrackData.ClipData.Num(); k++)
TArray<FClipData> TempClipDataArray = TrackData.ClipData;
Sort(TempClipDataArray.GetData(), TempClipDataArray.Num(), [](const FClipData& A, const FClipData& B)
{
const FClipData& TempClipData = TrackData.ClipData[k];
return A.ClipStartFrame < B.ClipStartFrame;
});
if (TempClipDataArray.Num() > 0)
{
if (TempClipDataArray[0].ClipStartFrame != 0)
{
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("EndColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("TimeLength")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipDataArray[0].ClipStartFrame)))));
NewSpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("Cycle")->InsertNewText("0");
}
}
for (int32 k = 0; k < TempClipDataArray.Num(); k++)
{
const FClipData& TempClipData = TempClipDataArray[k];
if (TempClipData.PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::Breathe)
{
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
@ -1549,8 +1589,7 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
}
if (TempClipData.PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::Gradient)
{
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
GetGradientLight(NewSpeicalEffect, TempClipData);
GetGradientLight(SpeicalEffect, TempClipData);
}
if (TempClipData.PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::None)
{
@ -1564,6 +1603,28 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
NewSpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipData.ClipStartFrame)))));
NewSpeicalEffect->InsertNewChildElement("Cycle")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%d"), 1)));
}
if (TempClipDataArray.Num() <= k + 1)
{
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("EndColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("TimeLength")->InsertNewText("-1");
NewSpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipData.ClipEndFrame)))));
NewSpeicalEffect->InsertNewChildElement("Cycle")->InsertNewText("0");
}
else if (TempClipDataArray[k + 1].ClipStartFrame - TempClipData.ClipEndFrame != 0)
{
tinyxml2::XMLElement* NewSpeicalEffect = SpeicalEffect->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("EndColor")->InsertNewText("000000");
NewSpeicalEffect->InsertNewChildElement("TimeLength")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipDataArray[k + 1].ClipStartFrame - TempClipData.ClipEndFrame)))));
NewSpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(TempClipData.ClipEndFrame)))));
NewSpeicalEffect->InsertNewChildElement("Cycle")->InsertNewText("0");
}
}
j++;
}
@ -1577,7 +1638,9 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
for (int32 k = 0; k < CutTimeline->TrackGroupInstances.Num(); k++)
{
int32 Index = 0;
const FTrackData& TrackData = StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[k].Head)->TrackData;
const TSharedPtr<STrackHead> CurrentTrackHead = StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[k].Head);
const FTrackData& TrackData = CurrentTrackHead->TrackData;
int32 Count = 0;
if (TrackData.TrackType == ETrackType::LightArrayTrack || TrackData.TrackType == ETrackType::LightBarTrack)
{
if (GetTrackID(TrackData.DeviceTrack.Guid) == -1)
@ -1586,50 +1649,61 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
}
auto GuangZhen = GuangZhenList->InsertNewChildElement("GuangZhen");
GuangZhen->SetAttribute("ID", TCHAR_TO_UTF8(*FString::FromInt(GetTrackID(TrackData.DeviceTrack.Guid))));
int32 Count = 0;
auto GuangZhenSpecialEffectList = GuangZhen->InsertNewChildElement("SpecialEffectList");
for (int32 i = 0; i < CutTimeline->TrackGroupInstances.Num(); i++)
TArray<FClipData> TempClipData = TrackData.ClipData;
Sort(TempClipData.GetData(), TempClipData.Num(), [](const FClipData& A, const FClipData& B)
{
if (StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::LightArrayTrack)
return A.ClipStartFrame < B.ClipStartFrame;
});
if (TempClipData.Num() > 0)
{
if (TempClipData[0].ClipStartFrame != 0)
{
FString Filename;
for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups)
auto SpeicalEffect = GuangZhenSpecialEffectList->InsertNewChildElement("SpecialEffect");
{
for (const FCurtain& Curtain : CurtainGroup.Curtains)
{
if (Curtain.bIsActive)
{
Filename = Curtain.CurtainName;
}
}
}
TArray<FEncodeVideoInfo> EncodeVideoInfos = FUtils::ExportPsaf(StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData, *(FGlobalData::ExportPath / "PSAF" / Filename));
for (int32 j = 0; j < EncodeVideoInfos.Num(); j++)
{
auto SpeicalEffect = GuangZhenSpecialEffectList->InsertNewChildElement("SpecialEffect");
{
auto SpeicalEffectTimeCode = SpeicalEffect->InsertNewChildElement("TimeCode");
{
SpeicalEffectTimeCode->InsertNewText(TCHAR_TO_UTF8(*FUtils::GetMsFromString(EncodeVideoInfos[j].EncodedVideoTimeCode)));
}
auto SpeicalEffectURL = SpeicalEffect->InsertNewChildElement("URL");
{
SpeicalEffectURL->InsertNewText(TCHAR_TO_UTF8(*EncodeVideoInfos[j].EncodedVideoName));
}
auto SpeicalEffectLoop = SpeicalEffect->InsertNewChildElement("Loop");
{
SpeicalEffectLoop->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(!EncodeVideoInfos[j].ClipData.bIsCycle)));
}
auto SpeicalEffectMode = SpeicalEffect->InsertNewChildElement("Mode");
{
SpeicalEffectMode->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(0)));
}
}
Count++;
SpeicalEffect->InsertNewChildElement("TimeCode")->InsertNewText("0");
SpeicalEffect->InsertNewChildElement("URL")->InsertNewText("");
SpeicalEffect->InsertNewChildElement("Loop")->InsertNewText("1");
SpeicalEffect->InsertNewChildElement("Mode")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(0)));
}
}
}
FString Filename;
for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups)
{
for (const FCurtain& Curtain : CurtainGroup.Curtains)
{
if (Curtain.bIsActive)
{
Filename = Curtain.CurtainName;
}
}
}
TArray<FEncodeVideoInfo> EncodeVideoInfos = FUtils::ExportPsaf(StaticCastSharedPtr<STrackHead>(CurrentTrackHead)->TrackData, *(FGlobalData::ExportPath / "PSAF" / Filename));
for (int32 j = 0; j < EncodeVideoInfos.Num(); j++)
{
auto SpeicalEffect = GuangZhenSpecialEffectList->InsertNewChildElement("SpecialEffect");
{
auto SpeicalEffectTimeCode = SpeicalEffect->InsertNewChildElement("TimeCode");
{
SpeicalEffectTimeCode->InsertNewText(TCHAR_TO_UTF8(*FUtils::GetMsFromString(EncodeVideoInfos[j].EncodedVideoTimeCode)));
}
auto SpeicalEffectURL = SpeicalEffect->InsertNewChildElement("URL");
{
SpeicalEffectURL->InsertNewText(TCHAR_TO_UTF8(*EncodeVideoInfos[j].EncodedVideoName));
}
auto SpeicalEffectLoop = SpeicalEffect->InsertNewChildElement("Loop");
{
SpeicalEffectLoop->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(!EncodeVideoInfos[j].ClipData.bIsCycle)));
}
auto SpeicalEffectMode = SpeicalEffect->InsertNewChildElement("Mode");
{
SpeicalEffectMode->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(0)));
}
}
Count++;
}
if (Count == 0)
{
GuangZhenSpecialEffectList->InsertNewText("");
@ -1658,6 +1732,19 @@ tinyxml2::XMLElement* SCutMainWindow::GetDeviceElement(tinyxml2::XMLElement* Par
tinyxml2::XMLElement* SCutMainWindow::GetVideoElement(tinyxml2::XMLElement* Parent, FEncodeVideoInfo EncodeVideoInfo)
{
int32 TempProjectorID = 0;
for (FSingleTrackGroupInstance& SingleTrackGroupInstance : CutTimeline->TrackGroupInstances)
{
const TSharedPtr<STrackHead> TempTrackHead = StaticCastSharedPtr<STrackHead>(SingleTrackGroupInstance.Head);
if (TempTrackHead->TrackData.TrackType != ETrackType::ProjectorTrack)
{
continue;
}
if (GetTrackID(TempTrackHead->TrackData.DeviceTrack.Guid) != -1)
{
TempProjectorID = GetTrackID(TempTrackHead->TrackData.DeviceTrack.Guid);
}
}
tinyxml2::XMLElement* Video = Parent->InsertNewChildElement("Video");
tinyxml2::XMLElement* URL = Video->InsertNewChildElement("URL");
@ -1703,8 +1790,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetVideoElement(tinyxml2::XMLElement* Pare
VolumeEventTimeCode->InsertNewText("0");
VolumeEventValue->InsertNewText("100");
}
}
}
@ -1724,11 +1809,28 @@ tinyxml2::XMLElement* SCutMainWindow::GetVideoElement(tinyxml2::XMLElement* Pare
int32 Value;
};
TArray<FProjectorEvent> ProjectorEvents;
ProjectorEvents.Add(FProjectorEvent{ FUtils::GetMsFromString(FGlobalData::GetTimeData(EncodeVideoInfo.ClipStartFrame)), 1 });
for (int32 i = 0; i < CutTimeline->TrackGroupInstances.Num(); i++)
{
if (StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::ProjectorTrack)
{
TArray<FClipData> TempClipData = StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.ClipData;
Sort(TempClipData.GetData(), TempClipData.Num(), [](const FClipData& A, const FClipData& B)
{
return A.ClipStartFrame < B.ClipStartFrame;
});
if (TempClipData.Num() > 0)
{
if (TempClipData[0].ClipStartFrame != 0)
{
ProjectorEvents.Add({"0", 1 });
}
}
for (FClipData& ClipData : StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.ClipData)
{
if (ClipData.ClipStartFrame > EncodeVideoInfo.ClipStartFrame - 10 && ClipData.ClipEndFrame < EncodeVideoInfo.ClipEndFrame + 10)
@ -1737,7 +1839,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetVideoElement(tinyxml2::XMLElement* Pare
ClipData.PresetType == EPresetType::EnableProjector ? ShowProjector = 1 : ShowProjector = 0;
ProjectorEvents.Add({FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame - EncodeVideoInfo.ClipStartFrame)), ShowProjector});
}
}
}
}
@ -1771,9 +1872,26 @@ tinyxml2::XMLElement* SCutMainWindow::GetVideoElement(tinyxml2::XMLElement* Pare
tinyxml2::XMLElement* SCutMainWindow::GetSoundElement(tinyxml2::XMLElement* Parent, FEncodeVideoInfo EncodeVideoInfo)
{
int32 TempSoundID = 0;
for (FSingleTrackGroupInstance& SingleTrackGroupInstance : CutTimeline->TrackGroupInstances)
{
const TSharedPtr<STrackHead> TempTrackHead = StaticCastSharedPtr<STrackHead>(SingleTrackGroupInstance.Head);
if (TempTrackHead->TrackData.TrackType != ETrackType::AudioTrackR)
{
continue;
}
if (GetTrackID(TempTrackHead->TrackData.DeviceTrack.Guid) != -1)
{
TempSoundID = GetTrackID(TempTrackHead->TrackData.DeviceTrack.Guid);
}
}
tinyxml2::XMLElement* Sound = Parent->InsertNewChildElement("Sound");
{
Sound->InsertNewChildElement("RotationSpeakerID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(RotatorSpeakerIndex)));
Sound->InsertNewChildElement("RotationSpeakerID")->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(TempSoundID)));
if (EncodeVideoInfo.EncodedVideoName == "")
{
Sound->InsertNewChildElement("URL")->InsertNewText("");
@ -1855,7 +1973,6 @@ tinyxml2::XMLElement* SCutMainWindow::GetVideoListElement(tinyxml2::XMLElement*
GetVideoElement(VideoList, EncodeVideoInfo);
Count++;
}
}
}
if (Count == 0)
@ -1875,16 +1992,16 @@ tinyxml2::XMLElement* SCutMainWindow::GetSoundListElement(tinyxml2::XMLElement*
if (StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::AudioTrack ||
StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::AudioTrackR)
{
FString Filename;
for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups)
FString Filename = GetCurrentSelectFileName();
if (StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::AudioTrackR)
{
for (const FCurtain& Curtain : CurtainGroup.Curtains)
{
if (Curtain.bIsActive)
{
Filename = Curtain.CurtainName;
}
}
Filename += TEXT("_R");
}
if (StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData.TrackType == ETrackType::AudioTrack)
{
Filename += TEXT("_L");
}
FString NewExportFilePath = FGlobalData::ExportPath / "Sound" / Filename;
TArray<FEncodeVideoInfo> EncodeVideoInfos = FUtils::TrackEncodeAudio(StaticCastSharedPtr<STrackHead>(CutTimeline->TrackGroupInstances[i].Head)->TrackData, NewExportFilePath);
@ -1957,7 +2074,8 @@ tinyxml2::XMLElement* SCutMainWindow::GetProcessB(tinyxml2::XMLElement* Parent,
if (!EffectCardsPanel->EffectCardGroups[i].bIsDedicated)
{
if (EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(Curtain->CurtainUUID))
if (EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(Curtain->CurtainUUID) ||
EffectCardsPanel->EffectCardGroups[i].UsedCurtains.Contains(FStringWithGUID()))
{
tinyxml2::XMLElement* SerialNumber = EnableCard->InsertNewChildElement("SerialNumber");
SerialNumber->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(EffectCardsPanel->EffectCardGroups[i].ID)));
@ -1968,7 +2086,8 @@ tinyxml2::XMLElement* SCutMainWindow::GetProcessB(tinyxml2::XMLElement* Parent,
for (int32 j = 0 ; j < EffectCardsPanel->EffectCardGroups[i].Cards.Num(); j++)
{
if (EffectCardsPanel->EffectCardGroups[i].Cards[j].UsedCurtains.Contains(Curtain->CurtainUUID))
if (EffectCardsPanel->EffectCardGroups[i].Cards[j].UsedCurtains.Contains(Curtain->CurtainUUID) ||
EffectCardsPanel->EffectCardGroups[i].Cards[j].UsedCurtains.Contains(FStringWithGUID()))
{
tinyxml2::XMLElement* SerialNumber = EnableCard->InsertNewChildElement("SerialNumber");
SerialNumber->InsertNewText(TCHAR_TO_UTF8(*FString::FromInt(EffectCardsPanel->EffectCardGroups[i].Cards[j].ID)));
@ -2118,9 +2237,9 @@ tinyxml2::XMLElement* SCutMainWindow::GetFlashLight(tinyxml2::XMLElement* Parent
Parent->InsertNewChildElement("InitialColor")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::Color2Hex3(ClipData.PresetsCustomData.Colors[0].ToFColor(false)))));
Parent->InsertNewChildElement("EndColor")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::Color2Hex3(FLinearColor::Black.ToFColor(false)))));
float PerLength = (ClipData.PresetsCustomData.Time / ClipData.PresetsCustomData.Times);
Parent->InsertNewChildElement("TimeLength")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%d"), int32(PerLength * 1000))));
Parent->InsertNewChildElement("TimeLength")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%d"), int32(ClipData.PresetsCustomData.Time * 1000))));
Parent->InsertNewChildElement("TimeCode")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame)))));
Parent->InsertNewChildElement("Cycle")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%d"), static_cast<int32>(PerLength * 1000))));
Parent->InsertNewChildElement("Cycle")->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%d"), static_cast<int32>(PerLength * 500))));
return nullptr;
}
@ -2131,22 +2250,23 @@ tinyxml2::XMLElement* SCutMainWindow::GetGradientLight(tinyxml2::XMLElement* Par
if (ClipData.PresetsCustomData.Cursors[0].CursorFrameOffset > 0)
{
Parent->InsertNewChildElement("Mode")->InsertNewText("0");
Parent->InsertNewChildElement("InitialColor")
tinyxml2::XMLElement* NewSpeicalEffect = Parent->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[0].Color.ToFColor(false)))));
Parent->InsertNewChildElement("EndColor")
NewSpeicalEffect->InsertNewChildElement("EndColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),*FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[0].Color.ToFColor(false)))));
Parent->InsertNewChildElement("TimeLength")
NewSpeicalEffect->InsertNewChildElement("TimeLength")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.PresetsCustomData.Cursors[0].CursorFrameOffset)))));
Parent->InsertNewChildElement("TimeCode")
NewSpeicalEffect->InsertNewChildElement("TimeCode")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame + ClipData.PresetsCustomData.Cursors[0].CursorFrameOffset)))));
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame)))));
Parent->InsertNewChildElement("Cycle")
NewSpeicalEffect->InsertNewChildElement("Cycle")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.PresetsCustomData.Cursors[0].CursorFrameOffset)))));
}
@ -2157,47 +2277,49 @@ tinyxml2::XMLElement* SCutMainWindow::GetGradientLight(tinyxml2::XMLElement* Par
{
if (Index == CursorNum - 1 && CursorData.CursorFrameOffset <= (ClipData.ClipEndFrame - ClipData.ClipStartFrame))
{
Parent->InsertNewChildElement("Mode")->InsertNewText("0");
Parent->InsertNewChildElement("InitialColor")
tinyxml2::XMLElement* NewSpeicalEffect = Parent->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("0");
NewSpeicalEffect->InsertNewChildElement("InitialColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[Index].Color.ToFColor(false)))));
Parent->InsertNewChildElement("EndColor")
NewSpeicalEffect->InsertNewChildElement("EndColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),*FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[Index].Color.ToFColor(false)))));
Parent->InsertNewChildElement("TimeLength")
NewSpeicalEffect->InsertNewChildElement("TimeLength")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(
(ClipData.ClipEndFrame - ClipData.ClipStartFrame) -
ClipData.PresetsCustomData.Cursors[Index].CursorFrameOffset)))));
Parent->InsertNewChildElement("TimeCode")
NewSpeicalEffect->InsertNewChildElement("TimeCode")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame + ClipData.PresetsCustomData.Cursors[Index].CursorFrameOffset)))));
Parent->InsertNewChildElement("Cycle")
NewSpeicalEffect->InsertNewChildElement("Cycle")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(
(ClipData.ClipEndFrame - ClipData.ClipStartFrame) -
ClipData.PresetsCustomData.Cursors[Index].CursorFrameOffset)))));
break;
}
Parent->InsertNewChildElement("Mode")->InsertNewText("1");
Parent->InsertNewChildElement("InitialColor")
tinyxml2::XMLElement* NewSpeicalEffect = Parent->InsertNewChildElement("Special_Effect");
NewSpeicalEffect->InsertNewChildElement("Mode")->InsertNewText("1");
NewSpeicalEffect->InsertNewChildElement("InitialColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"), *FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[Index].Color.ToFColor(false)))));
Parent->InsertNewChildElement("EndColor")
NewSpeicalEffect->InsertNewChildElement("EndColor")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),*FUtils::Color2Hex3(ClipData.PresetsCustomData.Cursors[Index + 1].Color.ToFColor(false)))));
Parent->InsertNewChildElement("TimeLength")
NewSpeicalEffect->InsertNewChildElement("TimeLength")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(
ClipData.PresetsCustomData.Cursors[Index + 1].CursorFrameOffset - CursorData.CursorFrameOffset)))));
Parent->InsertNewChildElement("TimeCode")
NewSpeicalEffect->InsertNewChildElement("TimeCode")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(FGlobalData::GetTimeData(ClipData.ClipStartFrame + CursorData.CursorFrameOffset)))));
Parent->InsertNewChildElement("Cycle")
NewSpeicalEffect->InsertNewChildElement("Cycle")
->InsertNewText(TCHAR_TO_UTF8(*FString::Printf(TEXT("%ls"),
*FUtils::GetMsFromString(
FGlobalData::GetTimeData(ClipData.PresetsCustomData.Cursors[Index + 1].CursorFrameOffset - CursorData.CursorFrameOffset)))));
@ -2207,6 +2329,27 @@ tinyxml2::XMLElement* SCutMainWindow::GetGradientLight(tinyxml2::XMLElement* Par
return nullptr;
}
void SCutMainWindow::DeselectAll()
{
for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups)
{
for (FCurtain& Curtain : CurtainGroup.Curtains)
{
Curtain.bIsActive = false;
}
}
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].bIsActive)
{
EffectCardsPanel->EffectCardGroups[i].Cards[j].bIsActive = false;
}
}
}
}
int32 SCutMainWindow::GetTrackID(FGuid Guid) const
{
const int32* Index = IDList.Find(Guid);

View File

@ -14,6 +14,7 @@
#include "StatePanel/SVideoPlayer.h"
#include "Cut5/Interface/CutMainWidgetInterface.h"
#include "Cut5/Interface/SoundInterface.h"
#include "FX/SEffectCardsPanel.h"
#include "StatePanel/SStatePanel.h"
#include "Widgets/SCompoundWidget.h"
@ -120,6 +121,8 @@ public:
tinyxml2::XMLElement* GetBreatheLight(tinyxml2::XMLElement* Parent, const FClipData& ClipData);
tinyxml2::XMLElement* GetFlashLight(tinyxml2::XMLElement* Parent, const FClipData& ClipData);
tinyxml2::XMLElement* GetGradientLight(tinyxml2::XMLElement* Parent, const FClipData& ClipData);
FString GetCurrentSelectFileName();
void DeselectAll();
int32 RotatorSpeakerIndex = 0;
int32 LightArrayIndex = 0;
@ -133,4 +136,29 @@ public:
void RemoveThread(const FGuid& Guid);
};
inline FString SCutMainWindow::GetCurrentSelectFileName()
{
for (FCurtainGroup& CurtainGroup : CurtainPanel->Groups)
{
for (const FCurtain& Curtain : CurtainGroup.Curtains)
{
if (Curtain.bIsActive)
{
return Curtain.CurtainName;
}
}
}
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].bIsActive)
{
return EffectCardsPanel->EffectCardGroups[i].Cards[j].Name;
}
}
}
return "NULL";
}

View File

@ -382,8 +382,6 @@ void SCutTimeline::Construct(const FArguments& InArgs)
AddNewDeviceToGroup(TEXT("固定轨道"), LightArrayData);
FDeviceTrack LightBarData(TEXT("灯带"), ETrackType::LightBarTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData);
FDeviceTrack LightBarData2(TEXT("灯带2"), ETrackType::LightBarTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), LightBarData2);
FDeviceTrack SpotLightData(TEXT("投射灯一"), ETrackType::SpotLightTrack);
AddNewDeviceToGroup(TEXT("固定轨道"), SpotLightData);

View File

@ -238,7 +238,7 @@ void STimelineClip::Construct(const FArguments& InArgs)
// FRunnableThread::Create(Thread, TEXT("VideoThread"));
// }
}
if (ClipData->ClipType == ETrackType::VideoTrack)
if (ClipData->ClipType == ETrackType::VideoTrack || ClipData->ClipType == ETrackType::LightArrayTrack || ClipData->ClipType == ETrackType::LightBarTrack)
{
if (!MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThreadGuid(ClipData->ClipGuid)))
{
@ -246,7 +246,7 @@ void STimelineClip::Construct(const FArguments& InArgs)
{
MainWidgetInterface->OnUpdateVideo(ClipData->ClipGuid, X, Y, RawData);
}, *ClipData, MainWidgetInterface);
FRunnableThread::Create(Thread, TEXT("VideoThread"));
FRunnableThread::Create(Thread, TEXT("VideoThread"));
MainWidgetInterface->GetSelf()->AddThread(FUtils::GetVideoThreadGuid(ClipData->ClipGuid), Thread);
}
@ -346,11 +346,12 @@ void STimelineClip::Seek(int32 Frame)
const int32 Offset = Frame - ClipData->ClipStartFrame;
const int32 SeekMovieFrame = ClipData->VideoStartFrame + Offset;
if (ClipData->LightArrayData.Num() != 0 && SeekMovieFrame < ClipData->LightArrayData.Num())
if (MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThreadGuid(ClipData->ClipGuid)))
{
MainWidgetInterface->OnUpdateLightArray(ClipData->LightArrayData[SeekMovieFrame]);
break;
static_cast<FVideoThread*>(MainWidgetInterface->GetSelf()->GetThread(FUtils::GetVideoThreadGuid(ClipData->ClipGuid)))->SeekFrame(SeekMovieFrame);
}
if (ClipData->PresetsCustomData.PresetCustomType != FPresetsCustomData::EPresetCustomType::None)
{
if (ClipData->PresetsCustomData.PresetCustomType == FPresetsCustomData::EPresetCustomType::Breathe)
@ -446,7 +447,7 @@ void STimelineClip::UpdatePosition(int32 StartFrame)
SetRenderTransform(FSlateRenderTransform(FVector2D(NewPosX, 0)));
ClipDataBox->SetWidthOverride((ClipData->ClipEndFrame - StartFrame) * FGlobalData::DefaultTimeTickSpace);
if (ClipData->ClipType == ETrackType::VideoTrack)
if (ClipData->ClipType == ETrackType::VideoTrack || ClipData->ClipType == ETrackType::AudioTrack || ClipData->ClipType == ETrackType::AudioTrackR)
{
ClipData->VideoStartFrame += StartFrame - ClipData->ClipStartFrame;
}
@ -479,7 +480,7 @@ void STimelineClip::UpdateLength(int32 EndFrame)
ClipDataBox->SetWidthOverride((EndFrame - ClipData->ClipStartFrame) * FGlobalData::DefaultTimeTickSpace);
if (ClipData->ClipType == ETrackType::VideoTrack)
if (ClipData->ClipType == ETrackType::VideoTrack || ClipData->ClipType == ETrackType::AudioTrack || ClipData->ClipType == ETrackType::AudioTrackR)
{
ClipData->VideoEndFrame += EndFrame - ClipData->ClipEndFrame;
}
@ -492,10 +493,8 @@ void STimelineClip::UpdateLength(int32 EndFrame)
{
ClipData->PresetsCustomData.Cursors[i].CursorFrameOffset = ClipData->ClipEndFrame - ClipData->ClipStartFrame;
}
}
}
}
void STimelineClip::UpdateMove(int32 X, int32 DragOffset)

View File

@ -283,7 +283,6 @@ void STrackBody::BreakClip(const FGuid& Guid)
FFFMPEGUtils::GetAudioBrush(&TrackHead->TrackData.ClipData[i]);
FFFMPEGUtils::GetAudioBrush(&NewClipData);
}
}
}