Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyanghuang-tencent committed Oct 8, 2022
2 parents ce0cc4e + 7176781 commit 7a2781e
Show file tree
Hide file tree
Showing 96 changed files with 1,369 additions and 1,208 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.DS_Store
.vs/
Binaries/
Build/
Expand All @@ -18,3 +19,4 @@ IOS/
/.idea
/TPSProject.sln.DotSettings.user
/Plugins/Developer/RiderLink
/Benchmark
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,34 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.3.0] - 2022-10-8

### Added
- 支持使用 `UnLua.PackagePath` 的方式来搜索Lua文件,也支持从插件Content目录加载
- 支持Android下的x86_64
- 支持自定义预绑定类型,参考[预绑定类型列表](./Docs/CN/Settings.md#预绑定类型列表)配置选项
- 支持UE5下的蓝图UMG输入绑定,使用新增的 `UnLua.Input` 模块,可以做到更细节的输入绑定
- `UnLua.Ref``UnLua.Unref` 接口,提供将 `UObject` 生命周期和Lua侧同步的管理机制
- 提升Lua访问UE函数和属性的性能
- [自定义生成Lua模版](./Docs/CN/CustomTemplate.md)

### Fixed
- Mac下编辑器的dylib无法加载
- PushMetatable时会使用旧的metatable [#515](https://github.com/Tencent/UnLua/pull/515)
- Delegate的闭包函数的upvalue无法被gc [#516](https://github.com/Tencent/UnLua/issues/516)
- 在Lua中访问TArray不存在的字段会报stackoverflow
- 自动保存的打包设置没有生效
- UE5下打包后UnLua配置没有正确加载

### Changed
- 默认关闭运行时对`UTF-8 BOM`文件头的加载支持,需要兼容请开启[兼容UTF-8 BOM文件头](./Docs/CN/Settings.md#兼容UTF-8%20BOM文件头)选项

### Removed
- 移除 `AddPackagePath` 接口

## [2.2.4] - 2022-9-1

### Added
- 增加最佳实践工程示例 [Lyra with UnLua](https://github.com/xuyanghuang-tencent/LyraWithUnLua)
- 支持配置按C/C++编译Lua环境
- 支持Lua启动入口脚本配置
Expand Down
1 change: 1 addition & 0 deletions Content/Localization/UnLua/UnLua.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Date/Time,Word Count,zh-Hans
2022.06.07-19.09.46,606,606
2022.06.07-21.37.50,504,504
2022.06.07-22.44.41,568,568
2022.09.24-18.38.33,665,665
Binary file modified Content/Localization/UnLua/UnLua.manifest
Binary file not shown.
Binary file modified Content/Localization/UnLua/zh-Hans/UnLua.archive
Binary file not shown.
Binary file modified Content/Localization/UnLua/zh-Hans/UnLua.locres
Binary file not shown.
183 changes: 183 additions & 0 deletions Content/Script/Tests/Benchmark/BP_UnLuaBenchmark.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
local M = UnLua.Class()

local Start = UE.UUnLuaBenchmarkFunctionLibrary.Start
local Stop = UE.UUnLuaBenchmarkFunctionLibrary.Stop
local StartTimer = UE.UUnLuaBenchmarkFunctionLibrary.StartTimer
local StopTimer = UE.UUnLuaBenchmarkFunctionLibrary.StopTimer

function M:Run(N)
local SpawnClass = UE.AUnLuaBenchmarkProxy
local Transform = UE.FTransform()
local AlwaysSpawn = UE.ESpawnActorCollisionHandlingMethod.AlwaysSpawn
local Proxy = self:GetWorld():SpawnActor(SpawnClass, Transform, AlwaysSpawn)

-- warm up
for i=1, N do
Proxy:NOP()
end

StartTimer("read int32")
for i=1, N do
local MeshID = Proxy.MeshID
end
StopTimer()

StartTimer("write int32")
for i=1, N do
Proxy.MeshID = i
end
StopTimer()

StartTimer("read FString")
for i=1, N do
local MeshName = Proxy.MeshName
end
StopTimer()

StartTimer("write FString")
for i=1, N do
Proxy.MeshName = "9527"
end
StopTimer()

StartTimer("read FVector")
for i=1, N do
local COM = Proxy.COM
end
StopTimer()

local COM = UE.FVector(1.0, 1.0, 1.0)
StartTimer("write FVector")
for i=1, N do
Proxy.COM = COM
end
StopTimer()

StartTimer("read TArray<FVector>")
for i=1, N do
local Positions = Proxy.Positions
end
StopTimer()

local PredictedPositions = UE.TArray(UE.FVector)
StartTimer("write TArray<FVector>")
for i=1, N do
Proxy.PredictedPositions = PredictedPositions
end
StopTimer()

StartTimer("void NOP()")
for i=1, N do
Proxy:NOP()
end
StopTimer()

StartTimer("void Simulate(float)")
for i=1, N do
Proxy:Simulate(0.0167)
end
StopTimer()

StartTimer("int32 GetMeshID() const")
for i=1, N do
local MeshID = Proxy:GetMeshID()
end
StopTimer()

StartTimer("const FString& GetMeshName() const")
for i=1, N do
local MeshName = Proxy:GetMeshName()
end
StopTimer()

StartTimer("const FVector& GetCOM()")
for i=1, N do
Proxy:GetCOM(COM)
end
StopTimer()

StartTimer("int32 UpdateMeshID(int32)")
for i=1, N do
local NewMeshID = Proxy:UpdateMeshID(1024)
end
StopTimer()

StartTimer("FString UpdateMeshName(const FString&)")
for i=1, N do
local NewMeshName = Proxy:UpdateMeshName("1024")
end
StopTimer()

local Origin = UE.FVector(1.0, 1.0, 1.0)
local Direction = UE.FVector(1.0, 0.0, 0.0)
StartTimer("bool Raycast(const FVector&, const FVector&) const")
for i=1, N do
local bHit = Proxy:Raycast(Origin, Direction)
end
StopTimer()

local Indices = UE.TArray(0)
StartTimer("void GetIndices(TArray<int32>&) const")
for i=1, N do
Proxy:GetIndices(Indices)
end
StopTimer()

for i=1, 1024 do
Indices:Add(i)
end
StartTimer("void GetIndices(TArray<int32>&) const with 1024 items")
for i=1, N do
Proxy:GetIndices(Indices)
end
StopTimer()

StartTimer("void UpdateIndices(const TArray<int32>&)")
for i=1, N do
Proxy:UpdateIndices(Indices)
end
StopTimer()

local Positions = UE.TArray(UE.FVector)
StartTimer("void GetPositions(TArray<FVector>&) const")
for i=1, N do
Proxy:GetPositions(Positions)
end
StopTimer()

for i=1, 1024 do
Positions:Add(UE.FVector(i, i, i))
end
StartTimer("void GetPositions(TArray<FVector>&) const with 1024 items")
for i=1, N do
Proxy:GetPositions(Positions)
end
StopTimer()

StartTimer("void UpdatePositions(const TArray<FVector>&)")
for i=1, N do
Proxy:UpdatePositions(Positions)
end
StopTimer()

StartTimer("const TArray<FVector>& GetPredictedPositions() const")
for i=1, N do
Proxy:GetPredictedPositions(PredictedPositions)
end
StopTimer()

StartTimer("bool GetMeshInfo(int32&, FString&, FVector&, TArray<int32>&, TArray<FVector>&, TArray<FVector>&) const")
for i=1, N do
local bResult, ID, Name = Proxy:GetMeshInfo(0, "", COM, Indices, Positions, PredictedPositions)
end
StopTimer()

StartTimer("FHitResult()")
local FHitResult = UE.FHitResult
for i=1, N do
local HitResult = FHitResult()
end
StopTimer()
end

return M
Loading

0 comments on commit 7a2781e

Please sign in to comment.