UE4压缩和解压缩工具

前言

UE4编辑器和运行时使用解压缩和压缩功能, 一个简单的蓝图库, 源代码来自GitHub的ZipUtility Plugin

对其做了稍微修改, 修复了部分因为版本更新的报错信息(大量头文件包含问题)

ZipUtility-UE4-Extra

本文简单介绍这个插件的使用方式

UE4Editor_Eenx6GKDoT

使用

  • 下载/克隆
  • 放到目录 项目/Plugins/
  • 刷新项目

检查VS是否安装了最新的ATLMFC组件,否则会提示atlbase.h找不到

如果已经安装了还是报错, 检查ZipUtility.Build.cs文件

检查如下字段,默认是vs2017的, 我这里改成了2019

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
private string VsDirectory
{
get
{
// Trying to find VS installation directory from registry
string regPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7\", "15.0", "");
if (!string.IsNullOrEmpty(regPath))
{
Console.WriteLine("ZipUtility: Found VS path in registry: " + regPath);
return regPath;
}
else
{
// If failed - using the most common install path
string vsDefaultBasePath = @"C:\Program Files (x86)\Microsoft Visual Studio\2019";
string vsVersion = Directory.GetDirectories(vsDefaultBasePath)[0];
string vsPath = Path.Combine(vsDefaultBasePath, vsVersion);
Console.WriteLine("ZipUtility Warning: Using default VS path: " + vsPath);
return vsPath;
}
}
}

private string ATLPath
{
get
{
// Trying to find ATL path similar to:
// C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.14.26428/atlmfc
string atlPath = "";
try
{
var vsDir = VsDirectory;
if (!string.IsNullOrEmpty(vsDir))
{

string msvcPath = Path.Combine(vsDir, @"VC\Tools\MSVC\");
string msvcVersion = Directory.GetDirectories(msvcPath)[0];
atlPath = Path.Combine(msvcPath, msvcVersion, "atlmfc");
}
}
catch (Exception ex)
{
Console.WriteLine("ZipUtility Error: can't find VS path: " + ex.ToString());
}

if (!Directory.Exists(atlPath))
{
Console.WriteLine("ZipUtility Error: Couldn't find an ATLPath, fix it in ZipUtility.Build.cs");
}
return atlPath;
}
}

比如我这边的路径是C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\atlmfc,需要与上述csharp指定的atl路径匹配,否则在VS编译会报警告和错误

尝试在 Property->VC++ Directories->Include Directories中加入类似Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\atlmfc\include的路径

UE4Editor_md5TmgDXhY

image-20210326134323995

每个方法都需要提供一个UObject类对象, 该对象如果挂上接口就可以获取回调事件