diff --git a/InteractiveControl/Content/Version2/texture/QuanJingIcon.uasset b/InteractiveControl/Content/Version2/texture/QuanJingIcon.uasset new file mode 100644 index 0000000..8657e55 --- /dev/null +++ b/InteractiveControl/Content/Version2/texture/QuanJingIcon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:555804b6a350851e6c3617f704db00579104cba919e1a417c5942564b468bbac +size 12293 diff --git a/InteractiveControl/Content/Version2/texture/ShiPingIcon.uasset b/InteractiveControl/Content/Version2/texture/ShiPingIcon.uasset new file mode 100644 index 0000000..d134402 --- /dev/null +++ b/InteractiveControl/Content/Version2/texture/ShiPingIcon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4027236eba1a9ae32f8d347ddc0352d4be9750602331f97639891be068bc954e +size 10790 diff --git a/InteractiveControl/Content/Version2/widget/Main2.uasset b/InteractiveControl/Content/Version2/widget/Main2.uasset index e89d302..ecd4bd5 100644 --- a/InteractiveControl/Content/Version2/widget/Main2.uasset +++ b/InteractiveControl/Content/Version2/widget/Main2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:016a9f519ea587363fbeddc6986b4790d09c458338c0ec91230305fe817da1bd -size 92749 +oid sha256:5cc468f8807884f88b78d48b1ecf8456de91ada7e74a9f7d614bc311e6413e2c +size 94178 diff --git a/InteractiveControl/Content/Version2/widget/Page_mode2.uasset b/InteractiveControl/Content/Version2/widget/Page_mode2.uasset index d1edb42..83a963c 100644 --- a/InteractiveControl/Content/Version2/widget/Page_mode2.uasset +++ b/InteractiveControl/Content/Version2/widget/Page_mode2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d66f59aa7e2b64b28f6c4124a2b725f8ea0a1eac26af95f08fe970e4fdc33f8c -size 318895 +oid sha256:4697778ff408d859e0875ec5c86a5564bf5eff4fc0bc8e9f673aec47dda3ec11 +size 333685 diff --git a/InteractiveControl/Content/Version2/widget/Page_mode2_5_ZiDingYiMoShi.uasset b/InteractiveControl/Content/Version2/widget/Page_mode2_5_ZiDingYiMoShi.uasset index 0739e27..b2afe48 100644 --- a/InteractiveControl/Content/Version2/widget/Page_mode2_5_ZiDingYiMoShi.uasset +++ b/InteractiveControl/Content/Version2/widget/Page_mode2_5_ZiDingYiMoShi.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d8e0494ec29fbd2de2fef4700622a13ce47b06be6e06fdffb4df3af5be70788 -size 227779 +oid sha256:9dbcee76d2754875ab1d5325c8ce3cc677ab5bd5bf8874f7f0b0665072fd554e +size 465137 diff --git a/InteractiveControl/Content/blueprint/BP_PC.uasset b/InteractiveControl/Content/blueprint/BP_PC.uasset index d8e4b51..9f01baf 100644 --- a/InteractiveControl/Content/blueprint/BP_PC.uasset +++ b/InteractiveControl/Content/blueprint/BP_PC.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd718913c929e7ef66c9ed19723f26771993a4c23584c9ad119cef5905bec1f8 -size 238502 +oid sha256:dfeb878c21fb39a48de2b914bdc22a8bf1653036dafcde8a3e0c95fe96804c5d +size 227541 diff --git a/SpaceStudioClient/Content/3D_Assets/Blueprint/BP_HDRSphere.uasset b/SpaceStudioClient/Content/3D_Assets/Blueprint/BP_HDRSphere.uasset new file mode 100644 index 0000000..1257598 --- /dev/null +++ b/SpaceStudioClient/Content/3D_Assets/Blueprint/BP_HDRSphere.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c09da45dae56c3c1cb2c3ecb99f157663a106bf48ecf6c800c24a784767692f +size 105961 diff --git a/SpaceStudioClient/Content/3D_Assets/Map/3D_720Scene.umap b/SpaceStudioClient/Content/3D_Assets/Map/3D_720Scene.umap new file mode 100644 index 0000000..bb3be1e --- /dev/null +++ b/SpaceStudioClient/Content/3D_Assets/Map/3D_720Scene.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cc802a17670b101b7e2cda9c362ad2b7c89e490050aabc97aded9766a08b950 +size 1471 diff --git a/SpaceStudioClient/Content/3D_Assets/Map/3D_CustomScene.umap b/SpaceStudioClient/Content/3D_Assets/Map/3D_CustomScene.umap new file mode 100644 index 0000000..3a06f90 --- /dev/null +++ b/SpaceStudioClient/Content/3D_Assets/Map/3D_CustomScene.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e9932dc58998b222e1dfe47bcff380abe5ed61b79be92c232d69e32665cdcca +size 74069 diff --git a/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset index d109826..b43615b 100644 --- a/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset +++ b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fcddc4f4d3c382d758f82655b92240c38d2b7084b546e1898f8159b0e1e03ef0 -size 542450 +oid sha256:a4a0f2b559baef95616b732b82e7aa52d386efa29092998e072ec8099b35e435 +size 509694 diff --git a/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset index 7c6f6b6..dbaf604 100644 --- a/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset +++ b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b99cdec6476f357565a348359c9b9c464928e380ff456f694932668b8f4bc968 -size 1146304 +oid sha256:19d32a383381799430c0571ac1a0db1de6f92339863d32024596a7ec3b51b51b +size 1170517 diff --git a/SpaceStudioClient/Content/Blueprints/ND_PC.uasset b/SpaceStudioClient/Content/Blueprints/ND_PC.uasset index b40a894..e1ca4cb 100644 --- a/SpaceStudioClient/Content/Blueprints/ND_PC.uasset +++ b/SpaceStudioClient/Content/Blueprints/ND_PC.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:366b37742b290e9dae6ab5e7656c52e0e83aeca8500dbbc35a812ad254591d41 -size 1800262 +oid sha256:5d4bf6c473e0adf0a8b0bc184d0d036f0f0227c4b32dac6ae70f35c8e68eebfe +size 1858625 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset index e381edc..086e4be 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db84a9f7fbc65b64e3dddc2f77fbf7ba2fd7981d6d0e6401e5529bc3032221db -size 1171063 +oid sha256:1d86df2f8072683f3fd1fd6ba68548f2bd2045db876915f5730e5e845d3ea41f +size 1172235 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A_自定义模式.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A_自定义模式.uasset index fb9b994..d5244e6 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A_自定义模式.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A_自定义模式.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1f4e2f95ddc655768d2e6b70f521476fbdf5a997c2aeff49f41594ac7892d2c -size 85210 +oid sha256:561111530aac50b86c2cd00ed2f09f17c26ebc8afcf790c6def513a736ec5eb0 +size 79922 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset index 0b0e294..3afe3b2 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e2c1b7ca284c3bc1551f2e623c6802de2543a152ab15a4f64e5e3d0ce0627e5 -size 259314 +oid sha256:9a4f789f5c188aef0fd6cc2b7657db0127aaa4a7b4ee7c9bd847ccdda8fa44d1 +size 258101 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C_自定义模式.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C_自定义模式.uasset index aa8fcbd..d5b37fb 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C_自定义模式.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_C_自定义模式.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e496960b058f9700b2532f5bcf17fdce258eb8ba94a0dca5e370421daec148ad -size 82519 +oid sha256:17bd93a621e3aba66d434cd9836289932862a3a046c74312f88599701ae78569 +size 80331 diff --git a/SpaceStudioClient/Content/Blueprints/案例展示.uasset b/SpaceStudioClient/Content/Blueprints/案例展示.uasset index 84e489c..e1b745a 100644 --- a/SpaceStudioClient/Content/Blueprints/案例展示.uasset +++ b/SpaceStudioClient/Content/Blueprints/案例展示.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da1435ba6dd8fabec6a6aea81739afe4c4f2b69812ecb989653a2346db1a1f94 -size 6373 +oid sha256:79422b293b08bf7b4e0e512e058a474f4855c26212bc6a3a29b99af950e618ac +size 3733 diff --git a/SpaceStudioClient/Content/Main.umap b/SpaceStudioClient/Content/Main.umap index 0df5026..753bf14 100644 --- a/SpaceStudioClient/Content/Main.umap +++ b/SpaceStudioClient/Content/Main.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91fee9beb650b71b1c966781eb3d287d5e71f82b1f5f0d3d4785bc86f67c8346 -size 73563 +oid sha256:b9b50ec2c008b1d441539e3440bd385d4d679ad83d3a612519bddda953b7e008 +size 73893 diff --git a/SpaceStudioClient/Content/PanaTest/lambert2.uasset b/SpaceStudioClient/Content/PanaTest/lambert2.uasset index 04ea73e..5bb3716 100644 --- a/SpaceStudioClient/Content/PanaTest/lambert2.uasset +++ b/SpaceStudioClient/Content/PanaTest/lambert2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41796313b48ee591b508e5496b35b5f1643e7db34a2f7bbeda2fe9e0e5398c8a -size 12670 +oid sha256:e0c7c02bb0c5a59bdd004f7154463e68c29e3c0e7f6ca73891539625c966015c +size 12316 diff --git a/SpaceStudioClient/Content/config.json b/SpaceStudioClient/Content/config.json index 878f365..bfccbf8 100644 --- a/SpaceStudioClient/Content/config.json +++ b/SpaceStudioClient/Content/config.json @@ -92,6 +92,20 @@ "z":160 }, "StageRotation":180 + }, + "3D_CustomScene":{ + "StagePos": { + "x":0, + "y":0, + "z":0 + }, + "ViewPointPos": { + "x":0, + "y":0, + "z":160 + }, + "StageRotation":0, + "HdrRotationSpeed":1 } } } \ No newline at end of file diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp index b37735e..152c8fd 100644 --- a/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp +++ b/SpaceStudioClient/Source/SpaceStudioClient/Private/MyBlueprintFunctionLibrary.cpp @@ -131,3 +131,136 @@ float UMyBlueprintFunctionLibrary::GetSystemVolume() { return _GetSystemVolume(); } + + +#include "IImageWrapperModule.h" +#include "Misc/FileHelper.h" +#include "Misc/Paths.h" +#include "Engine/Texture2D.h" +#include "HAL/FileManagerGeneric.h" + +bool UMyBlueprintFunctionLibrary::LoadImagesFromFolder( + const FString& FolderPath, + TArray& OutImageNames, + TArray& OutTextures, + bool bRecursive +) +{ + // 清空输出数组(避免残留数据) + OutImageNames.Empty(); + OutTextures.Empty(); + + // 1. 校验文件夹路径有效性 + if (!FPaths::DirectoryExists(FolderPath)) + { + UE_LOG(LogTemp, Error, TEXT("图片文件夹不存在:%s"), *FolderPath); + return false; + } + + // 2. 获取文件夹下所有图片文件(支持常见格式:png/jpg/jpeg/bmp) + TArray ImageFilePaths; + const FString FileExtensionFilter = TEXT("*"); + IFileManager& FileManager = IFileManager::Get(); + FileManager.FindFiles(ImageFilePaths, *FolderPath, *FileExtensionFilter); + + if (ImageFilePaths.Num() == 0) + { + UE_LOG(LogTemp, Warning, TEXT("文件夹下未找到图片文件:%s"), *FolderPath); + return true; // 无文件不算错误,返回true + } + + // 3. 遍历加载每张图片 + for (const FString& ImageFilePath : ImageFilePaths) + { + // 加载图片为Texture2D + UTexture2D* Texture = LoadSingleImageToTexture(FPaths::Combine(FolderPath,ImageFilePath)); + if (Texture) + { + // 获取图片名称(不含路径和扩展名) + FString ImageName = FPaths::GetBaseFilename(ImageFilePath); + OutImageNames.Add(ImageName); + OutTextures.Add(Texture); + + UE_LOG(LogTemp, Log, TEXT("成功加载图片:%s → Texture:%s"), *ImageFilePath, *Texture->GetName()); + } + else + { + UE_LOG(LogTemp, Error, TEXT("加载图片失败:%s"), *ImageFilePath); + } + } + + return OutTextures.Num() > 0; +} + +UTexture2D* UMyBlueprintFunctionLibrary::LoadSingleImageToTexture(const FString& ImageFilePath) +{ + // 1. 读取图片文件二进制数据 + TArray ImageFileData; + if (!FFileHelper::LoadFileToArray(ImageFileData, *ImageFilePath)) + { + UE_LOG(LogTemp, Error, TEXT("读取图片文件失败:%s"), *ImageFilePath); + return nullptr; + } + + // 2. 获取ImageWrapper模块(用于解析图片数据) + IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked(TEXT("ImageWrapper")); + TSharedPtr ImageWrapper; + + // 根据扩展名选择对应的解析器 + const FString FileExtension = FPaths::GetExtension(ImageFilePath).ToLower(); + if (FileExtension == TEXT("png")) + { + ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG); + } + else if (FileExtension == TEXT("jpg") || FileExtension == TEXT("jpeg")) + { + ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::JPEG); + } + else if (FileExtension == TEXT("bmp")) + { + ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::BMP); + } + else + { + UE_LOG(LogTemp, Error, TEXT("不支持的图片格式:%s"), *FileExtension); + return nullptr; + } + + // 3. 解析图片数据为RGB格式 + if (!ImageWrapper.IsValid() || !ImageWrapper->SetCompressed(ImageFileData.GetData(), ImageFileData.Num())) + { + UE_LOG(LogTemp, Error, TEXT("解析图片数据失败:%s"), *ImageFilePath); + return nullptr; + } + + TArray RawImageData; + if (!ImageWrapper->GetRaw(ERGBFormat::RGBA, 8, RawImageData)) + { + UE_LOG(LogTemp, Error, TEXT("转换图片为RGBA数据失败:%s"), *ImageFilePath); + return nullptr; + } + + // 4. 创建并初始化Texture2D + UTexture2D* Texture = UTexture2D::CreateTransient( + ImageWrapper->GetWidth(), + ImageWrapper->GetHeight(), + PF_R8G8B8A8 // 像素格式(RGBA8位) + ); + if (!Texture) + { + UE_LOG(LogTemp, Error, TEXT("创建Texture2D失败:%s"), *ImageFilePath); + return nullptr; + } + + // 5. 将图片数据写入Texture + void* TextureData = Texture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE); + FMemory::Memcpy(TextureData, RawImageData.GetData(), RawImageData.Num()); + Texture->GetPlatformData()->Mips[0].BulkData.Unlock(); + + // 6. 设置Texture属性并更新 + Texture->SRGB = true; // 图片默认开启SRGB(非UI/法线贴图需关闭) + #undef UpdateResource // 取消Windows宏干扰 + Texture->UpdateResource(); + + return Texture; +} \ No newline at end of file diff --git a/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h index 1b6845b..88ca5f5 100644 --- a/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h +++ b/SpaceStudioClient/Source/SpaceStudioClient/Public/MyBlueprintFunctionLibrary.h @@ -18,4 +18,25 @@ class SPACESTUDIOCLIENT_API UMyBlueprintFunctionLibrary : public UBlueprintFunct UFUNCTION(BlueprintCallable, Category = "MyLibrary|Sound", meta = (DisplayName = "get system volume")) static float GetSystemVolume(); + +public: + /** + * 加载指定文件夹下的所有图片并生成Texture2D + * @param FolderPath 文件夹路径(支持绝对路径/项目相对路径,如 "/Game/Textures/MyImages" 或 "D:/Images/") + * @param OutImageNames 输出:图片名称数组(不含扩展名) + * @param OutTextures 输出:生成的Texture2D数组 + * @param bRecursive 是否递归加载子文件夹 + * @return 是否加载成功 + */ + UFUNCTION(BlueprintCallable, Category = "ImageLoader") + static bool LoadImagesFromFolder( + const FString& FolderPath, + TArray& OutImageNames, + TArray& OutTextures, + bool bRecursive = false + ); + +private: + // 内部辅助函数:加载单张图片为Texture2D + static UTexture2D* LoadSingleImageToTexture(const FString& ImageFilePath); }; diff --git a/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs index 24b04e6..47f50f0 100644 --- a/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs +++ b/SpaceStudioClient/Source/SpaceStudioClient/SpaceStudioClient.Build.cs @@ -8,7 +8,7 @@ public class SpaceStudioClient : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "ImageWrapper" }); PrivateDependencyModuleNames.AddRange(new string[] { });