Skip to content

Commit

Permalink
Expose string properties for actors and components
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed May 28, 2021
1 parent 9aee85f commit 6b85ca1
Show file tree
Hide file tree
Showing 19 changed files with 298 additions and 6 deletions.
16 changes: 16 additions & 0 deletions API/Actor-GetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[Actor](./Actor.md 'UnrealEngine.Framework.Actor')
## Actor.GetString(string, string) Method
Retrieves the value of the string property
```csharp
public bool GetString(string name, ref string value);
```
#### Parameters
<a name='UnrealEngine-Framework-Actor-GetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-Actor-GetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
16 changes: 16 additions & 0 deletions API/Actor-SetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[Actor](./Actor.md 'UnrealEngine.Framework.Actor')
## Actor.SetString(string, string) Method
Sets the value of the string property
```csharp
public bool SetString(string name, string value);
```
#### Parameters
<a name='UnrealEngine-Framework-Actor-SetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-Actor-SetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
2 changes: 2 additions & 0 deletions API/Actor.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [GetLong(string, long)](./Actor-GetLong(string_long).md 'UnrealEngine.Framework.Actor.GetLong(string, long)')
- [GetRootComponent&lt;T&gt;()](./Actor-GetRootComponent-T-().md 'UnrealEngine.Framework.Actor.GetRootComponent&lt;T&gt;()')
- [GetShort(string, short)](./Actor-GetShort(string_short).md 'UnrealEngine.Framework.Actor.GetShort(string, short)')
- [GetString(string, string)](./Actor-GetString(string_string).md 'UnrealEngine.Framework.Actor.GetString(string, string)')
- [GetText(string, string)](./Actor-GetText(string_string).md 'UnrealEngine.Framework.Actor.GetText(string, string)')
- [GetUInt(string, uint)](./Actor-GetUInt(string_uint).md 'UnrealEngine.Framework.Actor.GetUInt(string, uint)')
- [GetULong(string, ulong)](./Actor-GetULong(string_ulong).md 'UnrealEngine.Framework.Actor.GetULong(string, ulong)')
Expand All @@ -77,6 +78,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [SetLong(string, long)](./Actor-SetLong(string_long).md 'UnrealEngine.Framework.Actor.SetLong(string, long)')
- [SetRootComponent(UnrealEngine.Framework.SceneComponent)](./Actor-SetRootComponent(SceneComponent).md 'UnrealEngine.Framework.Actor.SetRootComponent(UnrealEngine.Framework.SceneComponent)')
- [SetShort(string, short)](./Actor-SetShort(string_short).md 'UnrealEngine.Framework.Actor.SetShort(string, short)')
- [SetString(string, string)](./Actor-SetString(string_string).md 'UnrealEngine.Framework.Actor.SetString(string, string)')
- [SetText(string, string)](./Actor-SetText(string_string).md 'UnrealEngine.Framework.Actor.SetText(string, string)')
- [SetUInt(string, uint)](./Actor-SetUInt(string_uint).md 'UnrealEngine.Framework.Actor.SetUInt(string, uint)')
- [SetULong(string, ulong)](./Actor-SetULong(string_ulong).md 'UnrealEngine.Framework.Actor.SetULong(string, ulong)')
Expand Down
16 changes: 16 additions & 0 deletions API/ActorComponent-GetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[ActorComponent](./ActorComponent.md 'UnrealEngine.Framework.ActorComponent')
## ActorComponent.GetString(string, string) Method
Retrieves the value of the string property
```csharp
public bool GetString(string name, ref string value);
```
#### Parameters
<a name='UnrealEngine-Framework-ActorComponent-GetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-ActorComponent-GetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
16 changes: 16 additions & 0 deletions API/ActorComponent-SetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[ActorComponent](./ActorComponent.md 'UnrealEngine.Framework.ActorComponent')
## ActorComponent.SetString(string, string) Method
Sets the value of the string property
```csharp
public bool SetString(string name, string value);
```
#### Parameters
<a name='UnrealEngine-Framework-ActorComponent-SetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-ActorComponent-SetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
2 changes: 2 additions & 0 deletions API/ActorComponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [GetInt(string, int)](./ActorComponent-GetInt(string_int).md 'UnrealEngine.Framework.ActorComponent.GetInt(string, int)')
- [GetLong(string, long)](./ActorComponent-GetLong(string_long).md 'UnrealEngine.Framework.ActorComponent.GetLong(string, long)')
- [GetShort(string, short)](./ActorComponent-GetShort(string_short).md 'UnrealEngine.Framework.ActorComponent.GetShort(string, short)')
- [GetString(string, string)](./ActorComponent-GetString(string_string).md 'UnrealEngine.Framework.ActorComponent.GetString(string, string)')
- [GetText(string, string)](./ActorComponent-GetText(string_string).md 'UnrealEngine.Framework.ActorComponent.GetText(string, string)')
- [GetUInt(string, uint)](./ActorComponent-GetUInt(string_uint).md 'UnrealEngine.Framework.ActorComponent.GetUInt(string, uint)')
- [GetULong(string, ulong)](./ActorComponent-GetULong(string_ulong).md 'UnrealEngine.Framework.ActorComponent.GetULong(string, ulong)')
Expand All @@ -47,6 +48,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [SetInt(string, int)](./ActorComponent-SetInt(string_int).md 'UnrealEngine.Framework.ActorComponent.SetInt(string, int)')
- [SetLong(string, long)](./ActorComponent-SetLong(string_long).md 'UnrealEngine.Framework.ActorComponent.SetLong(string, long)')
- [SetShort(string, short)](./ActorComponent-SetShort(string_short).md 'UnrealEngine.Framework.ActorComponent.SetShort(string, short)')
- [SetString(string, string)](./ActorComponent-SetString(string_string).md 'UnrealEngine.Framework.ActorComponent.SetString(string, string)')
- [SetText(string, string)](./ActorComponent-SetText(string_string).md 'UnrealEngine.Framework.ActorComponent.SetText(string, string)')
- [SetUInt(string, uint)](./ActorComponent-SetUInt(string_uint).md 'UnrealEngine.Framework.ActorComponent.SetUInt(string, uint)')
- [SetULong(string, ulong)](./ActorComponent-SetULong(string_ulong).md 'UnrealEngine.Framework.ActorComponent.SetULong(string, ulong)')
Expand Down
16 changes: 16 additions & 0 deletions API/AnimationInstance-GetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[AnimationInstance](./AnimationInstance.md 'UnrealEngine.Framework.AnimationInstance')
## AnimationInstance.GetString(string, string) Method
Retrieves the value of the string property
```csharp
public bool GetString(string name, ref string value);
```
#### Parameters
<a name='UnrealEngine-Framework-AnimationInstance-GetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-AnimationInstance-GetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
16 changes: 16 additions & 0 deletions API/AnimationInstance-SetString(string_string).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[AnimationInstance](./AnimationInstance.md 'UnrealEngine.Framework.AnimationInstance')
## AnimationInstance.SetString(string, string) Method
Sets the value of the string property
```csharp
public bool SetString(string name, string value);
```
#### Parameters
<a name='UnrealEngine-Framework-AnimationInstance-SetString(string_string)-name'></a>
`name` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

<a name='UnrealEngine-Framework-AnimationInstance-SetString(string_string)-value'></a>
`value` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
`true` on success
2 changes: 2 additions & 0 deletions API/AnimationInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [GetPlayRate(UnrealEngine.Framework.AnimationMontage)](./AnimationInstance-GetPlayRate(AnimationMontage).md 'UnrealEngine.Framework.AnimationInstance.GetPlayRate(UnrealEngine.Framework.AnimationMontage)')
- [GetPosition(UnrealEngine.Framework.AnimationMontage)](./AnimationInstance-GetPosition(AnimationMontage).md 'UnrealEngine.Framework.AnimationInstance.GetPosition(UnrealEngine.Framework.AnimationMontage)')
- [GetShort(string, short)](./AnimationInstance-GetShort(string_short).md 'UnrealEngine.Framework.AnimationInstance.GetShort(string, short)')
- [GetString(string, string)](./AnimationInstance-GetString(string_string).md 'UnrealEngine.Framework.AnimationInstance.GetString(string, string)')
- [GetText(string, string)](./AnimationInstance-GetText(string_string).md 'UnrealEngine.Framework.AnimationInstance.GetText(string, string)')
- [GetUInt(string, uint)](./AnimationInstance-GetUInt(string_uint).md 'UnrealEngine.Framework.AnimationInstance.GetUInt(string, uint)')
- [GetULong(string, ulong)](./AnimationInstance-GetULong(string_ulong).md 'UnrealEngine.Framework.AnimationInstance.GetULong(string, ulong)')
Expand All @@ -48,6 +49,7 @@ Implements [System.IEquatable&lt;](https://docs.microsoft.com/en-us/dotnet/api/S
- [SetPlayRate(UnrealEngine.Framework.AnimationMontage, float)](./AnimationInstance-SetPlayRate(AnimationMontage_float).md 'UnrealEngine.Framework.AnimationInstance.SetPlayRate(UnrealEngine.Framework.AnimationMontage, float)')
- [SetPosition(UnrealEngine.Framework.AnimationMontage, float)](./AnimationInstance-SetPosition(AnimationMontage_float).md 'UnrealEngine.Framework.AnimationInstance.SetPosition(UnrealEngine.Framework.AnimationMontage, float)')
- [SetShort(string, short)](./AnimationInstance-SetShort(string_short).md 'UnrealEngine.Framework.AnimationInstance.SetShort(string, short)')
- [SetString(string, string)](./AnimationInstance-SetString(string_string).md 'UnrealEngine.Framework.AnimationInstance.SetString(string, string)')
- [SetText(string, string)](./AnimationInstance-SetText(string_string).md 'UnrealEngine.Framework.AnimationInstance.SetText(string, string)')
- [SetUInt(string, uint)](./AnimationInstance-SetUInt(string_uint).md 'UnrealEngine.Framework.AnimationInstance.SetUInt(string, uint)')
- [SetULong(string, ulong)](./AnimationInstance-SetULong(string_ulong).md 'UnrealEngine.Framework.AnimationInstance.SetULong(string, ulong)')
Expand Down
Binary file modified Content/Tests/BlueprintActor.uasset
Binary file not shown.
Binary file modified Content/Tests/BlueprintAnimation.uasset
Binary file not shown.
Binary file modified Content/Tests/BlueprintSceneComponent.uasset
Binary file not shown.
Binary file modified Content/Tests/Tests.umap
Binary file not shown.
8 changes: 6 additions & 2 deletions 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 = 0x2CE;
internal const int checksum = 0x2D0;
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 All @@ -48,7 +48,7 @@ internal static class Shared {
private const TypeAttributes delegateTypeAttributes = TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass;

internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr functions, Assembly pluginAssembly) {
int position = 0;
int position = 0;
IntPtr* buffer = (IntPtr*)functions;

unchecked {
Expand Down Expand Up @@ -109,6 +109,7 @@ internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr funct
Object.getFloat = (delegate* unmanaged[Cdecl]<IntPtr, string, ref float, Bool>)objectFunctions[head++];
Object.getDouble = (delegate* unmanaged[Cdecl]<IntPtr, string, ref double, Bool>)objectFunctions[head++];
Object.getEnum = (delegate* unmanaged[Cdecl]<IntPtr, string, ref int, Bool>)objectFunctions[head++];
Object.getString = (delegate* unmanaged[Cdecl]<IntPtr, string, byte[], Bool>)objectFunctions[head++];
Object.getText = (delegate* unmanaged[Cdecl]<IntPtr, string, byte[], Bool>)objectFunctions[head++];
Object.setBool = (delegate* unmanaged[Cdecl]<IntPtr, string, Bool, Bool>)objectFunctions[head++];
Object.setByte = (delegate* unmanaged[Cdecl]<IntPtr, string, byte, Bool>)objectFunctions[head++];
Expand All @@ -121,6 +122,7 @@ internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr funct
Object.setFloat = (delegate* unmanaged[Cdecl]<IntPtr, string, float, Bool>)objectFunctions[head++];
Object.setDouble = (delegate* unmanaged[Cdecl]<IntPtr, string, double, Bool>)objectFunctions[head++];
Object.setEnum = (delegate* unmanaged[Cdecl]<IntPtr, string, int, Bool>)objectFunctions[head++];
Object.setString = (delegate* unmanaged[Cdecl]<IntPtr, string, string, Bool>)objectFunctions[head++];
Object.setText = (delegate* unmanaged[Cdecl]<IntPtr, string, string, Bool>)objectFunctions[head++];
}

Expand Down Expand Up @@ -1402,6 +1404,7 @@ internal static unsafe class Object {
internal static delegate* unmanaged[Cdecl]<IntPtr, string, ref float, Bool> getFloat;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, ref double, Bool> getDouble;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, ref int, Bool> getEnum;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, byte[], Bool> getString;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, byte[], Bool> getText;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, Bool, Bool> setBool;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, byte, Bool> setByte;
Expand All @@ -1414,6 +1417,7 @@ internal static unsafe class Object {
internal static delegate* unmanaged[Cdecl]<IntPtr, string, float, Bool> setFloat;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, double, Bool> setDouble;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, int, Bool> setEnum;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, string, Bool> setString;
internal static delegate* unmanaged[Cdecl]<IntPtr, string, string, Bool> setText;
}

Expand Down
99 changes: 99 additions & 0 deletions Source/Managed/Framework/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4951,6 +4951,25 @@ public bool GetEnum<T>(string name, ref T value) where T : Enum {
return false;
}

/// <summary>
/// Retrieves the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool GetString(string name, ref string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

byte[] stringBuffer = ArrayPool.GetStringBuffer();

if (Object.getString(Pointer, name, stringBuffer)) {
value = stringBuffer.BytesToString();

return true;
}

return false;
}

/// <summary>
/// Retrieves the value of the text property
/// </summary>
Expand Down Expand Up @@ -5090,6 +5109,20 @@ public bool SetEnum<T>(string name, T value) where T : Enum {
return Object.setEnum(Pointer, name, Convert.ToInt32(value));
}

/// <summary>
/// Sets the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool SetString(string name, string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

if (value == null)
throw new ArgumentNullException(nameof(value));

return Object.setString(Pointer, name, value);
}

/// <summary>
/// Sets the value of the text property
/// </summary>
Expand Down Expand Up @@ -6726,6 +6759,25 @@ public bool GetEnum<T>(string name, ref T value) where T : Enum {
return false;
}

/// <summary>
/// Retrieves the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool GetString(string name, ref string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

byte[] stringBuffer = ArrayPool.GetStringBuffer();

if (Object.getString(Pointer, name, stringBuffer)) {
value = stringBuffer.BytesToString();

return true;
}

return false;
}

/// <summary>
/// Retrieves the value of the text property
/// </summary>
Expand Down Expand Up @@ -6865,6 +6917,20 @@ public bool SetEnum<T>(string name, T value) where T : Enum {
return Object.setEnum(Pointer, name, Convert.ToInt32(value));
}

/// <summary>
/// Sets the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool SetString(string name, string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

if (value == null)
throw new ArgumentNullException(nameof(value));

return Object.setString(Pointer, name, value);
}

/// <summary>
/// Sets the value of the text property
/// </summary>
Expand Down Expand Up @@ -7732,6 +7798,25 @@ public bool GetEnum<T>(string name, ref T value) where T : Enum {
return false;
}

/// <summary>
/// Retrieves the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool GetString(string name, ref string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

byte[] stringBuffer = ArrayPool.GetStringBuffer();

if (Object.getString(Pointer, name, stringBuffer)) {
value = stringBuffer.BytesToString();

return true;
}

return false;
}

/// <summary>
/// Retrieves the value of the text property
/// </summary>
Expand Down Expand Up @@ -7871,6 +7956,20 @@ public bool SetEnum<T>(string name, T value) where T : Enum {
return Object.setEnum(Pointer, name, Convert.ToInt32(value));
}

/// <summary>
/// Sets the value of the string property
/// </summary>
/// <returns><c>true</c> on success</returns>
public bool SetString(string name, string value) {
if (name == null)
throw new ArgumentNullException(nameof(name));

if (value == null)
throw new ArgumentNullException(nameof(value));

return Object.setString(Pointer, name, value);
}

/// <summary>
/// Sets the value of the text property
/// </summary>
Expand Down
Loading

0 comments on commit 6b85ca1

Please sign in to comment.