Skip to content

Commit

Permalink
[unreal]ue 5.x 添加对FHitResult::GetActor的静态绑定
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Oct 31, 2024
1 parent 892499b commit 3bdc530
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions unreal/Puerts/Source/JsEnv/Private/Ext/UEExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ static void FText_Format(const v8::FunctionCallbackInfo<v8::Value>& Info)
}
#endif

struct AutoRegisterForUE
#if ENGINE_MAJOR_VERSION > 4
UsingUClass(AActor);
UsingUStruct(FHitResult)
#endif

struct AutoRegisterForUE
{
AutoRegisterForUE()
{
Expand All @@ -96,15 +101,15 @@ struct AutoRegisterForUE
.Method("GetName", SelectFunction(FString(UObjectBaseUtility::*)() const, &UObjectBaseUtility::GetName))
.Method("GetOuter", MakeFunction(&UObject::GetOuter))
.Method("GetClass", MakeFunction(&UObject::GetClass))
.Method("IsA", SelectFunction(bool (UObjectBaseUtility::*)(UClass*) const, &UObjectBaseUtility::IsA))
.Method("IsA", SelectFunction(bool(UObjectBaseUtility::*)(UClass*) const, &UObjectBaseUtility::IsA))
.Method("IsNative", MakeFunction(&UObjectBaseUtility::IsNative))
#if !defined(ENGINE_INDEPENDENT_JSENV)
.Method("GetWorld", MakeFunction(&UObject::GetWorld))
#endif
.Register();

PUERTS_NAMESPACE::DefineClass<UStruct>()
.Method("IsChildOf", SelectFunction(bool (UStruct::*)(const UStruct*) const, &UStruct::IsChildOf))
.Method("IsChildOf", SelectFunction(bool(UStruct::*)(const UStruct*) const, &UStruct::IsChildOf))
.Register();

#if !defined(ENGINE_INDEPENDENT_JSENV)
Expand All @@ -130,6 +135,10 @@ struct AutoRegisterForUE
.Function("Format", FText_Format, &FormatSignature)
.Register();
#endif

#if ENGINE_MAJOR_VERSION > 4
PUERTS_NAMESPACE::DefineClass<FHitResult>().Method("GetActor", MakeFunction(&FHitResult::GetActor)).Register();
#endif
}
};

Expand Down

0 comments on commit 3bdc530

Please sign in to comment.