Skip to content

Commit

Permalink
Expose pawn control rotation property for spring arm component
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed Feb 9, 2021
1 parent 4c47793 commit e8a014a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 3 deletions.
8 changes: 8 additions & 0 deletions API/SpringArmComponent-UsePawnControlRotation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[SpringArmComponent](./SpringArmComponent.md 'UnrealEngine.Framework.SpringArmComponent')
## SpringArmComponent.UsePawnControlRotation Property
Gets or sets if the component should use the view/control rotation of the pawn
```csharp
public bool UsePawnControlRotation { get; set; }
```
#### Property Value
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
1 change: 1 addition & 0 deletions API/SpringArmComponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.O
- [ProbeChannel](./SpringArmComponent-ProbeChannel.md 'UnrealEngine.Framework.SpringArmComponent.ProbeChannel')
- [ProbeSize](./SpringArmComponent-ProbeSize.md 'UnrealEngine.Framework.SpringArmComponent.ProbeSize')
- [TargetArmLength](./SpringArmComponent-TargetArmLength.md 'UnrealEngine.Framework.SpringArmComponent.TargetArmLength')
- [UsePawnControlRotation](./SpringArmComponent-UsePawnControlRotation.md 'UnrealEngine.Framework.SpringArmComponent.UsePawnControlRotation')
### Methods
- [GetDesiredRotation()](./SpringArmComponent-GetDesiredRotation().md 'UnrealEngine.Framework.SpringArmComponent.GetDesiredRotation()')
- [GetDesiredRotation(System.Numerics.Quaternion)](./SpringArmComponent-GetDesiredRotation(Quaternion).md 'UnrealEngine.Framework.SpringArmComponent.GetDesiredRotation(System.Numerics.Quaternion)')
Expand Down
6 changes: 5 additions & 1 deletion Source/Managed/Framework/Codegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace UnrealEngine.Framework {
// Automatically generated

internal static class Shared {
internal const int checksum = 0x2C4;
internal const int checksum = 0x2C6;
internal static Dictionary<int, IntPtr> userFunctions = new();
private const string dynamicTypesAssemblyName = "UnrealEngine.DynamicTypes";
private static readonly ModuleBuilder moduleBuilder = AssemblyBuilder.DefineDynamicAssembly(new(dynamicTypesAssemblyName), AssemblyBuilderAccess.RunAndCollect).DefineDynamicModule(dynamicTypesAssemblyName);
Expand Down Expand Up @@ -673,6 +673,7 @@ internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr funct
SpringArmComponent.getUnfixedCameraPosition = (delegate* unmanaged[Cdecl]<IntPtr, ref Vector3, void>)springArmComponentFunctions[head++];
SpringArmComponent.getDesiredRotation = (delegate* unmanaged[Cdecl]<IntPtr, ref Quaternion, void>)springArmComponentFunctions[head++];
SpringArmComponent.getTargetRotation = (delegate* unmanaged[Cdecl]<IntPtr, ref Quaternion, void>)springArmComponentFunctions[head++];
SpringArmComponent.getUsePawnControlRotation = (delegate* unmanaged[Cdecl]<IntPtr, Bool>)springArmComponentFunctions[head++];
SpringArmComponent.setDrawDebugLagMarkers = (delegate* unmanaged[Cdecl]<IntPtr, Bool, void>)springArmComponentFunctions[head++];
SpringArmComponent.setCollisionTest = (delegate* unmanaged[Cdecl]<IntPtr, Bool, void>)springArmComponentFunctions[head++];
SpringArmComponent.setCameraPositionLag = (delegate* unmanaged[Cdecl]<IntPtr, Bool, void>)springArmComponentFunctions[head++];
Expand All @@ -690,6 +691,7 @@ internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr funct
SpringArmComponent.setSocketOffset = (delegate* unmanaged[Cdecl]<IntPtr, in Vector3, void>)springArmComponentFunctions[head++];
SpringArmComponent.setTargetArmLength = (delegate* unmanaged[Cdecl]<IntPtr, float, void>)springArmComponentFunctions[head++];
SpringArmComponent.setTargetOffset = (delegate* unmanaged[Cdecl]<IntPtr, in Vector3, void>)springArmComponentFunctions[head++];
SpringArmComponent.setUsePawnControlRotation = (delegate* unmanaged[Cdecl]<IntPtr, Bool, void>)springArmComponentFunctions[head++];
}

unchecked {
Expand Down Expand Up @@ -1899,6 +1901,7 @@ unsafe partial class SpringArmComponent {
internal static delegate* unmanaged[Cdecl]<IntPtr, ref Vector3, void> getUnfixedCameraPosition;
internal static delegate* unmanaged[Cdecl]<IntPtr, ref Quaternion, void> getDesiredRotation;
internal static delegate* unmanaged[Cdecl]<IntPtr, ref Quaternion, void> getTargetRotation;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool> getUsePawnControlRotation;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool, void> setDrawDebugLagMarkers;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool, void> setCollisionTest;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool, void> setCameraPositionLag;
Expand All @@ -1916,6 +1919,7 @@ unsafe partial class SpringArmComponent {
internal static delegate* unmanaged[Cdecl]<IntPtr, in Vector3, void> setSocketOffset;
internal static delegate* unmanaged[Cdecl]<IntPtr, float, void> setTargetArmLength;
internal static delegate* unmanaged[Cdecl]<IntPtr, in Vector3, void> setTargetOffset;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool, void> setUsePawnControlRotation;
}

unsafe partial class PostProcessComponent {
Expand Down
8 changes: 8 additions & 0 deletions Source/Managed/Framework/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8762,6 +8762,14 @@ public float TargetArmLength {
set => setTargetArmLength(Pointer, value);
}

/// <summary>
/// Gets or sets if the component should use the view/control rotation of the pawn
/// </summary>
public bool UsePawnControlRotation {
get => getUsePawnControlRotation(Pointer);
set => setUsePawnControlRotation(Pointer, value);
}

/// <summary>
/// Retrieves offset at the end of the spring arm, can be used instead of the relative offset of the attached component to ensure the line trace works as desired
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Source/Native/Source/UnrealCLR/Private/UnrealCLR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ void UnrealCLR::Module::StartupModule() {
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::GetUnfixedCameraPosition;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::GetDesiredRotation;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::GetTargetRotation;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::GetUsePawnControlRotation;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetDrawDebugLagMarkers;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetCollisionTest;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetCameraPositionLag;
Expand All @@ -861,6 +862,7 @@ void UnrealCLR::Module::StartupModule() {
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetSocketOffset;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetTargetArmLength;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetTargetOffset;
Shared::SpringArmComponentFunctions[head++] = (void*)&UnrealCLRFramework::SpringArmComponent::SetUsePawnControlRotation;

checksum += head;
}
Expand Down
10 changes: 9 additions & 1 deletion Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Unreal Engine 4 .NET 5 integration
* Unreal Engine 4 .NET 5 integration
* Copyright (c) 2021 Stanislav Denisov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -2712,6 +2712,10 @@ namespace UnrealCLRFramework {
*Value = SpringArmComponent->GetTargetRotation().Quaternion();
}

bool GetUsePawnControlRotation(USpringArmComponent* SpringArmComponent) {
return SpringArmComponent->bUsePawnControlRotation;
}

void SetDrawDebugLagMarkers(USpringArmComponent* SpringArmComponent, bool Value) {
SpringArmComponent->bDrawDebugLagMarkers = Value;
}
Expand Down Expand Up @@ -2779,6 +2783,10 @@ namespace UnrealCLRFramework {
void SetTargetOffset(USpringArmComponent* SpringArmComponent, const Vector3* Value) {
SpringArmComponent->TargetOffset = *Value;
}

void SetUsePawnControlRotation(USpringArmComponent* SpringArmComponent, bool value) {
SpringArmComponent->bUsePawnControlRotation = value;
}
}

namespace PostProcessComponent {
Expand Down
2 changes: 2 additions & 0 deletions Source/Native/Source/UnrealCLR/Public/UnrealCLRFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ namespace UnrealCLRFramework {
static void GetUnfixedCameraPosition(USpringArmComponent* SpringArmComponent, Vector3* Value);
static void GetDesiredRotation(USpringArmComponent* SpringArmComponent, Quaternion* Value);
static void GetTargetRotation(USpringArmComponent* SpringArmComponent, Quaternion* Value);
static bool GetUsePawnControlRotation(USpringArmComponent* SpringArmComponent);
static void SetDrawDebugLagMarkers(USpringArmComponent* SpringArmComponent, bool Value);
static void SetCollisionTest(USpringArmComponent* SpringArmComponent, bool Value);
static void SetCameraPositionLag(USpringArmComponent* SpringArmComponent, bool Value);
Expand All @@ -890,6 +891,7 @@ namespace UnrealCLRFramework {
static void SetSocketOffset(USpringArmComponent* SpringArmComponent, const Vector3* Value);
static void SetTargetArmLength(USpringArmComponent* SpringArmComponent, float Value);
static void SetTargetOffset(USpringArmComponent* SpringArmComponent, const Vector3* Value);
static void SetUsePawnControlRotation(USpringArmComponent* SpringArmComponent, bool value);
}

namespace PostProcessComponent {
Expand Down
2 changes: 1 addition & 1 deletion Source/Native/UnrealCLR.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.26",
"VersionName": "1.27",
"FriendlyName": "UnrealCLR",
"Description": ".NET 5 integration",
"Category": "Scripting",
Expand Down

0 comments on commit e8a014a

Please sign in to comment.