Skip to content

Commit

Permalink
[Unreal] 数学类型 static binding导出默认值 (#1914)
Browse files Browse the repository at this point in the history
* static binding导出默认值

* try to fix ue4 compile ?

* try fix again

* fix typo
  • Loading branch information
BlurryLight authored Nov 15, 2024
1 parent 54e6d4c commit fc83813
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct AutoRegisterForFLinearColor
.Method("GetClamped", MakeFunction(&FLinearColor::GetClamped))
.Method("op_Equality", MakeFunction(&FLinearColor::operator==))
.Method("op_Inequality", MakeFunction(&FLinearColor::operator!=))
.Method("Equals", MakeFunction(&FLinearColor::Equals))
.Method("Equals", MakeFunction(&FLinearColor::Equals, SMALL_NUMBER))
.Method("CopyWithNewOpacity", MakeFunction(&FLinearColor::CopyWithNewOpacity))
.Function("MakeRandomColor", MakeFunction(&FLinearColor::MakeRandomColor))
.Function("MakeFromColorTemperature", MakeFunction(&FLinearColor::MakeFromColorTemperature))
Expand Down
8 changes: 4 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/Gen/FQuat_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct AutoRegisterForFQuat
.Property("W", MakeProperty(&FQuat::W))
.Method("op_Addition", MakeFunction(&FQuat::operator+))
.Method("op_Subtraction", SelectFunction(FQuat(FQuat::*)(const FQuat& Q) const, &FQuat::operator-))
.Method("Equals", MakeFunction(&FQuat::Equals))
.Method("IsIdentity", MakeFunction(&FQuat::IsIdentity))
.Method("Equals", MakeFunction(&FQuat::Equals, KINDA_SMALL_NUMBER))
.Method("IsIdentity", MakeFunction(&FQuat::IsIdentity, SMALL_NUMBER))
.Method("op_Multiply", CombineOverloads(MakeOverload(FQuat(FQuat::*)(const FQuat&) const, &FQuat::operator*),
MakeOverload(FVector(FQuat::*)(const FVector&) const, &FQuat::operator*),
MakeOverload(FQuat(FQuat::*)(const float) const, &FQuat::operator*)))
Expand All @@ -36,8 +36,8 @@ struct AutoRegisterForFQuat
.Method("op_BitwiseOr", MakeFunction(&FQuat::operator|))
.Function("MakeFromEuler", MakeFunction(&FQuat::MakeFromEuler))
.Method("Euler", MakeFunction(&FQuat::Euler))
.Method("Normalize", MakeFunction(&FQuat::Normalize))
.Method("GetNormalized", MakeFunction(&FQuat::GetNormalized))
.Method("Normalize", MakeFunction(&FQuat::Normalize, SMALL_NUMBER))
.Method("GetNormalized", MakeFunction(&FQuat::GetNormalized, SMALL_NUMBER))
.Method("IsNormalized", MakeFunction(&FQuat::IsNormalized))
.Method("Size", MakeFunction(&FQuat::Size))
.Method("SizeSquared", MakeFunction(&FQuat::SizeSquared))
Expand Down
2 changes: 1 addition & 1 deletion unreal/Puerts/Source/JsEnv/Private/Gen/FRotator_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct AutoRegisterForFRotator
.Method("op_Inequality", MakeFunction(&FRotator::operator!=))
.Method("IsNearlyZero", MakeFunction(&FRotator::IsNearlyZero))
.Method("IsZero", MakeFunction(&FRotator::IsZero))
.Method("Equals", MakeFunction(&FRotator::Equals))
.Method("Equals", MakeFunction(&FRotator::Equals, KINDA_SMALL_NUMBER))
.Method("Add", MakeFunction(&FRotator::Add))
.Method("GetInverse", MakeFunction(&FRotator::GetInverse))
.Method("GridSnap", MakeFunction(&FRotator::GridSnap))
Expand Down
26 changes: 13 additions & 13 deletions unreal/Puerts/Source/JsEnv/Private/Gen/FTransform_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct AutoRegisterForFTransform
CombineOverloads(MakeOverload(FTransform(FTransform::*)(const FTransform&) const, &FTransform::operator*),
MakeOverload(FTransform(FTransform::*)(const FQuat&) const, &FTransform::operator*)))
.Function("AnyHasNegativeScale", MakeFunction(&FTransform::AnyHasNegativeScale))
.Method("RemoveScaling", MakeFunction(&FTransform::RemoveScaling))
.Method("RemoveScaling", MakeFunction(&FTransform::RemoveScaling, SMALL_NUMBER))
.Method("GetMaximumAxisScale", MakeFunction(&FTransform::GetMaximumAxisScale))
.Method("GetMinimumAxisScale", MakeFunction(&FTransform::GetMinimumAxisScale))
.Method("GetRelativeTransform", MakeFunction(&FTransform::GetRelativeTransform))
Expand All @@ -63,16 +63,16 @@ struct AutoRegisterForFTransform
MakeOverload(void (FTransform::*)(const double&), &FTransform::ScaleTranslation)))
.Method("GetScaled", CombineOverloads(MakeOverload(FTransform(FTransform::*)(double) const, &FTransform::GetScaled),
MakeOverload(FTransform(FTransform::*)(FVector) const, &FTransform::GetScaled)))
.Function(
"GetSafeScaleReciprocal", SelectFunction(FVector(*)(const FVector&, double), &FTransform::GetSafeScaleReciprocal))
.Function("GetSafeScaleReciprocal",
SelectFunction(FVector(*)(const FVector&, double), &FTransform::GetSafeScaleReciprocal, SMALL_NUMBER))
#else
.Method("ScaleTranslation",
CombineOverloads(MakeOverload(void (FTransform::*)(const FVector&), &FTransform::ScaleTranslation),
MakeOverload(void (FTransform::*)(const float&), &FTransform::ScaleTranslation)))
.Method("GetScaled", CombineOverloads(MakeOverload(FTransform(FTransform::*)(float) const, &FTransform::GetScaled),
MakeOverload(FTransform(FTransform::*)(FVector) const, &FTransform::GetScaled)))
.Function(
"GetSafeScaleReciprocal", SelectFunction(FVector(*)(const FVector&, float), &FTransform::GetSafeScaleReciprocal))
.Function("GetSafeScaleReciprocal",
SelectFunction(FVector(*)(const FVector&, float), &FTransform::GetSafeScaleReciprocal, SMALL_NUMBER))
#endif
.Method("GetScaledAxis", MakeFunction(&FTransform::GetScaledAxis))
.Method("GetUnitAxis", MakeFunction(&FTransform::GetUnitAxis))
Expand All @@ -83,14 +83,14 @@ struct AutoRegisterForFTransform
.Method("SetLocation", MakeFunction(&FTransform::SetLocation))
.Method("ContainsNaN", MakeFunction(&FTransform::ContainsNaN))
.Method("IsValid", MakeFunction(&FTransform::IsValid))
.Function("AreRotationsEqual", MakeFunction(&FTransform::AreRotationsEqual))
.Function("AreTranslationsEqual", MakeFunction(&FTransform::AreTranslationsEqual))
.Function("AreScale3DsEqual", MakeFunction(&FTransform::AreScale3DsEqual))
.Method("RotationEquals", MakeFunction(&FTransform::RotationEquals))
.Method("TranslationEquals", MakeFunction(&FTransform::TranslationEquals))
.Method("Scale3DEquals", MakeFunction(&FTransform::Scale3DEquals))
.Method("Equals", MakeFunction(&FTransform::Equals))
.Method("EqualsNoScale", MakeFunction(&FTransform::EqualsNoScale))
.Function("AreRotationsEqual", MakeFunction(&FTransform::AreRotationsEqual, KINDA_SMALL_NUMBER))
.Function("AreTranslationsEqual", MakeFunction(&FTransform::AreTranslationsEqual, KINDA_SMALL_NUMBER))
.Function("AreScale3DsEqual", MakeFunction(&FTransform::AreScale3DsEqual, KINDA_SMALL_NUMBER))
.Method("RotationEquals", MakeFunction(&FTransform::RotationEquals, KINDA_SMALL_NUMBER))
.Method("TranslationEquals", MakeFunction(&FTransform::TranslationEquals, KINDA_SMALL_NUMBER))
.Method("Scale3DEquals", MakeFunction(&FTransform::Scale3DEquals, KINDA_SMALL_NUMBER))
.Method("Equals", MakeFunction(&FTransform::Equals, KINDA_SMALL_NUMBER))
.Method("EqualsNoScale", MakeFunction(&FTransform::EqualsNoScale, KINDA_SMALL_NUMBER))
.Function("Multiply", MakeFunction(&FTransform::Multiply))
.Method("SetComponents", MakeFunction(&FTransform::SetComponents))
.Method("SetIdentity", MakeFunction(&FTransform::SetIdentity))
Expand Down
8 changes: 4 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/Gen/FVector2D_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ struct AutoRegisterForFVector2D
.Function("DistSquared", MakeFunction(&FVector2D::DistSquared))
.Function("Distance", MakeFunction(&FVector2D::Distance))
.Function("CrossProduct", MakeFunction(&FVector2D::CrossProduct))
.Method("Equals", MakeFunction(&FVector2D::Equals))
.Method("Equals", MakeFunction(&FVector2D::Equals, KINDA_SMALL_NUMBER))
.Method("Set", MakeFunction(&FVector2D::Set))
.Method("GetMax", MakeFunction(&FVector2D::GetMax))
.Method("GetAbsMax", MakeFunction(&FVector2D::GetAbsMax))
.Method("GetMin", MakeFunction(&FVector2D::GetMin))
.Method("Size", MakeFunction(&FVector2D::Size))
.Method("SizeSquared", MakeFunction(&FVector2D::SizeSquared))
.Method("GetRotated", MakeFunction(&FVector2D::GetRotated))
.Method("GetSafeNormal", MakeFunction(&FVector2D::GetSafeNormal))
.Method("Normalize", MakeFunction(&FVector2D::Normalize))
.Method("IsNearlyZero", MakeFunction(&FVector2D::IsNearlyZero))
.Method("GetSafeNormal", MakeFunction(&FVector2D::GetSafeNormal, SMALL_NUMBER))
.Method("Normalize", MakeFunction(&FVector2D::Normalize, SMALL_NUMBER))
.Method("IsNearlyZero", MakeFunction(&FVector2D::IsNearlyZero, KINDA_SMALL_NUMBER))
.Method("ToDirectionAndLength",
SelectFunction(void (FVector2D::*)(FVector2D&, float&) const, &FVector2D::ToDirectionAndLength))
.Method("IsZero", MakeFunction(&FVector2D::IsZero))
Expand Down
8 changes: 4 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/Gen/FVector4_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ struct AutoRegisterForFVector4
.Method("Component", CombineOverloads(MakeOverload(float& (FVector4::*) (int32), &FVector4::Component),
MakeOverload(const float& (FVector4::*) (int32) const, &FVector4::Component)))
#endif
.Method("Equals", MakeFunction(&FVector4::Equals))
.Method("IsUnit3", MakeFunction(&FVector4::IsUnit3))
.Method("Equals", MakeFunction(&FVector4::Equals, KINDA_SMALL_NUMBER))
.Method("IsUnit3", MakeFunction(&FVector4::IsUnit3, KINDA_SMALL_NUMBER))
.Method("ToString", MakeFunction(&FVector4::ToString))
.Method("InitFromString", MakeFunction(&FVector4::InitFromString))
.Method("GetSafeNormal", MakeFunction(&FVector4::GetSafeNormal))
.Method("GetSafeNormal", MakeFunction(&FVector4::GetSafeNormal, SMALL_NUMBER))
.Method("GetUnsafeNormal3", MakeFunction(&FVector4::GetUnsafeNormal3))
.Method("ToOrientationRotator", MakeFunction(&FVector4::ToOrientationRotator))
.Method("ToOrientationQuat", MakeFunction(&FVector4::ToOrientationQuat))
Expand All @@ -60,7 +60,7 @@ struct AutoRegisterForFVector4
.Method("Size", MakeFunction(&FVector4::Size))
.Method("SizeSquared", MakeFunction(&FVector4::SizeSquared))
.Method("ContainsNaN", MakeFunction(&FVector4::ContainsNaN))
.Method("IsNearlyZero3", MakeFunction(&FVector4::IsNearlyZero3))
.Method("IsNearlyZero3", MakeFunction(&FVector4::IsNearlyZero3, KINDA_SMALL_NUMBER))
.Method("Reflect3", MakeFunction(&FVector4::Reflect3))
.Method("FindBestAxisVectors3", MakeFunction(&FVector4::FindBestAxisVectors3))
.Method("DiagnosticCheckNaN", MakeFunction(&FVector4::DiagnosticCheckNaN))
Expand Down
27 changes: 16 additions & 11 deletions unreal/Puerts/Source/JsEnv/Private/Gen/FVector_Wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct AutoRegisterForFVector
MakeOverload(FVector(FVector::*)(const FVector&) const, &FVector::operator/)))
.Method("op_Equality", MakeFunction(&FVector::operator==))
.Method("op_Inequality", MakeFunction(&FVector::operator!=))
.Method("Equals", MakeFunction(&FVector::Equals))
.Method("Equals", MakeFunction(&FVector::Equals, KINDA_SMALL_NUMBER))
.Method("AllComponentsEqual", MakeFunction(&FVector::AllComponentsEqual))
.Method("op_UnaryNegation", SelectFunction(FVector(FVector::*)() const, &FVector::operator-))
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION > 2
Expand Down Expand Up @@ -67,14 +67,19 @@ struct AutoRegisterForFVector
.Method("SizeSquared", MakeFunction(&FVector::SizeSquared))
.Method("Size2D", MakeFunction(&FVector::Size2D))
.Method("SizeSquared2D", MakeFunction(&FVector::SizeSquared2D))
.Method("IsNearlyZero", MakeFunction(&FVector::IsNearlyZero))
.Method("IsNearlyZero", MakeFunction(&FVector::IsNearlyZero, KINDA_SMALL_NUMBER))
.Method("IsZero", MakeFunction(&FVector::IsZero))
.Method("IsUnit", MakeFunction(&FVector::IsUnit))
.Method("IsUnit", MakeFunction(&FVector::IsUnit, KINDA_SMALL_NUMBER))
.Method("IsNormalized", MakeFunction(&FVector::IsNormalized))
.Method("Normalize", MakeFunction(&FVector::Normalize))
.Method("Normalize", MakeFunction(&FVector::Normalize, SMALL_NUMBER))
.Method("GetUnsafeNormal", MakeFunction(&FVector::GetUnsafeNormal))
.Method("GetSafeNormal", MakeFunction(&FVector::GetSafeNormal))
.Method("GetSafeNormal2D", MakeFunction(&FVector::GetSafeNormal2D))
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 3
.Method("GetSafeNormal", MakeFunction(&FVector::GetSafeNormal, SMALL_NUMBER, FVector::ZeroVector))
.Method("GetSafeNormal2D", MakeFunction(&FVector::GetSafeNormal2D, SMALL_NUMBER, FVector::ZeroVector))
#else
.Method("GetSafeNormal", MakeFunction(&FVector::GetSafeNormal, SMALL_NUMBER))
.Method("GetSafeNormal2D", MakeFunction(&FVector::GetSafeNormal2D, SMALL_NUMBER))
#endif
.Method(
"ToDirectionAndLength", SelectFunction(void (FVector::*)(FVector&, float&) const, &FVector::ToDirectionAndLength))
.Method("GetSignVector", MakeFunction(&FVector::GetSignVector))
Expand All @@ -89,7 +94,7 @@ struct AutoRegisterForFVector
.Method("GetClampedToMaxSize2D", MakeFunction(&FVector::GetClampedToMaxSize2D))
.Method("AddBounded", MakeFunction(&FVector::AddBounded))
.Method("Reciprocal", MakeFunction(&FVector::Reciprocal))
.Method("IsUniform", MakeFunction(&FVector::IsUniform))
.Method("IsUniform", MakeFunction(&FVector::IsUniform, KINDA_SMALL_NUMBER))
.Method("MirrorByVector", MakeFunction(&FVector::MirrorByVector))
.Method("MirrorByPlane", MakeFunction(&FVector::MirrorByPlane))
.Method("RotateAngleAxis", MakeFunction(&FVector::RotateAngleAxis))
Expand Down Expand Up @@ -127,10 +132,10 @@ struct AutoRegisterForFVector
.Function("DistSquaredXY", MakeFunction(&FVector::DistSquaredXY))
.Function("DistSquared2D", MakeFunction(&FVector::DistSquared2D))
.Function("BoxPushOut", MakeFunction(&FVector::BoxPushOut))
.Function("Parallel", MakeFunction(&FVector::Parallel))
.Function("Coincident", MakeFunction(&FVector::Coincident))
.Function("Orthogonal", MakeFunction(&FVector::Orthogonal))
.Function("Coplanar", MakeFunction(&FVector::Coplanar))
.Function("Parallel", MakeFunction(&FVector::Parallel, THRESH_NORMALS_ARE_PARALLEL))
.Function("Coincident", MakeFunction(&FVector::Coincident, THRESH_NORMALS_ARE_PARALLEL))
.Function("Orthogonal", MakeFunction(&FVector::Orthogonal, THRESH_NORMALS_ARE_ORTHOGONAL))
.Function("Coplanar", MakeFunction(&FVector::Coplanar, THRESH_NORMALS_ARE_PARALLEL))
.Function("Triple", MakeFunction(&FVector::Triple))
.Function("RadiansToDegrees", MakeFunction(&FVector::RadiansToDegrees))
.Function("DegreesToRadians", MakeFunction(&FVector::DegreesToRadians))
Expand Down

0 comments on commit fc83813

Please sign in to comment.