Skip to content

Commit f77d431

Browse files
committed
Interface
1 parent 6e2d058 commit f77d431

18 files changed

+285
-12
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Diff for: Script/Game/UnrealCSharpTest/TestCore/UTestCoreSubsystem.cs

+6
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,11 @@ public void TestEqual(string InWhat, FTestDynamicStruct InActual, FTestDynamicSt
247247
{
248248
TestEqual(InWhat, InActual == InExpected);
249249
}
250+
251+
public void TestEqual(string InWhat, TScriptInterface<ITestDynamicInterface> InActual,
252+
TScriptInterface<ITestDynamicInterface> InExpected)
253+
{
254+
TestEqual(InWhat, InActual == InExpected);
255+
}
250256
}
251257
}

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintBlueprintDynamicFunction/CSharp_TestBlueprintBlueprintDynamicFunctionActor_C.cs

+39-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace Script.CoreUObject
77
{
88
[UClass]
99
[PathName("/Script/CoreUObject.CSharp_TestBlueprintBlueprintDynamicFunctionActor_C")]
10-
public class CSharp_TestBlueprintBlueprintDynamicFunctionActor_C : BP_TestClass_C, IStaticClass
10+
public class CSharp_TestBlueprintBlueprintDynamicFunctionActor_C : BP_TestClass_C, IStaticClass,
11+
ITestDynamicInterface
1112
{
1213
public CSharp_TestBlueprintBlueprintDynamicFunctionActor_C()
1314
{
@@ -33,6 +34,8 @@ public CSharp_TestBlueprintBlueprintDynamicFunctionActor_C()
3334

3435
ObjectValue = this;
3536

37+
InterfaceValue = this;
38+
3639
SubclassOfValue = GetClass();
3740

3841
SoftObjectPtrValue = this;
@@ -156,6 +159,16 @@ public UObject ObjectValue
156159
__ObjectValue, value);
157160
}
158161

162+
[UProperty, BlueprintReadWrite]
163+
public TScriptInterface<ITestDynamicInterface> InterfaceValue
164+
{
165+
get => FPropertyImplementation.FProperty_GetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
166+
__InterfaceValue) as TScriptInterface<ITestDynamicInterface>;
167+
168+
set => FPropertyImplementation.FProperty_SetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
169+
__InterfaceValue, value);
170+
}
171+
159172
[UProperty, BlueprintReadWrite]
160173
public TSubclassOf<UObject> SubclassOfValue
161174
{
@@ -457,6 +470,27 @@ public void OutObjectValueFunction(ref UObject OutObjectValue)
457470
OutObjectValue = ObjectValue;
458471
}
459472

473+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
474+
public void SetInterfaceValueFunction(TScriptInterface<ITestDynamicInterface> InInterfaceValue)
475+
{
476+
InterfaceValue = InInterfaceValue;
477+
}
478+
479+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
480+
public TScriptInterface<ITestDynamicInterface> GetInterfaceValueFunction()
481+
{
482+
return InterfaceValue;
483+
}
484+
485+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
486+
public void OutInterfaceValueFunction(ref TScriptInterface<ITestDynamicInterface> OutInterfaceValue)
487+
{
488+
TestCoreSubsystem.TestEqual("BlueprintBlueprintDynamicOutGetInterfaceFunction", OutInterfaceValue,
489+
InterfaceValue);
490+
491+
OutInterfaceValue = InterfaceValue;
492+
}
493+
460494
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
461495
public void SetSubclassOfValueFunction(TSubclassOf<UObject> InSubclassOfValue)
462496
{
@@ -472,7 +506,8 @@ public TSubclassOf<UObject> GetSubclassOfValueFunction()
472506
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
473507
public void OutSubclassOfValueFunction(ref TSubclassOf<UObject> OutSubclassOfValue)
474508
{
475-
TestCoreSubsystem.TestEqual("BlueprintBlueprintDynamicOutGetClassFunction", OutSubclassOfValue, GetClass());
509+
TestCoreSubsystem.TestEqual("BlueprintBlueprintDynamicOutGetSubclassOfFunction", OutSubclassOfValue,
510+
GetClass());
476511

477512
OutSubclassOfValue = SubclassOfValue;
478513
}
@@ -604,6 +639,8 @@ public void OutMapValueFunction(ref TMap<int, int> OutMapValue)
604639

605640
private static uint __ObjectValue = 0;
606641

642+
private static uint __InterfaceValue = 0;
643+
607644
private static uint __SubclassOfValue = 0;
608645

609646
private static uint __SoftObjectPtrValue = 0;

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintBlueprintDynamicProperty/CSharp_TestBlueprintBlueprintDynamicPropertyActor_C.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace Script.CoreUObject
66
{
77
[UClass]
88
[PathName("/Script/CoreUObject.CSharp_TestBlueprintBlueprintDynamicPropertyActor_C")]
9-
public class CSharp_TestBlueprintBlueprintDynamicPropertyActor_C : BP_TestClass_C, IStaticClass
9+
public class CSharp_TestBlueprintBlueprintDynamicPropertyActor_C : BP_TestClass_C, IStaticClass,
10+
ITestDynamicInterface
1011
{
1112
public CSharp_TestBlueprintBlueprintDynamicPropertyActor_C()
1213
{
@@ -32,6 +33,8 @@ public CSharp_TestBlueprintBlueprintDynamicPropertyActor_C()
3233

3334
ObjectValue = this;
3435

36+
InterfaceValue = this;
37+
3538
SubclassOfValue = GetClass();
3639

3740
SoftObjectPtrValue = this;
@@ -155,6 +158,16 @@ public UObject ObjectValue
155158
__ObjectValue, value);
156159
}
157160

161+
[UProperty, BlueprintReadWrite]
162+
public TScriptInterface<ITestDynamicInterface> InterfaceValue
163+
{
164+
get => FPropertyImplementation.FProperty_GetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
165+
__InterfaceValue) as TScriptInterface<ITestDynamicInterface>;
166+
167+
set => FPropertyImplementation.FProperty_SetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
168+
__InterfaceValue, value);
169+
}
170+
158171
[UProperty, BlueprintReadWrite]
159172
public TSubclassOf<UObject> SubclassOfValue
160173
{
@@ -243,6 +256,8 @@ public TMap<int, int> MapValue
243256

244257
private static uint __ObjectValue = 0;
245258

259+
private static uint __InterfaceValue = 0;
260+
246261
private static uint __SubclassOfValue = 0;
247262

248263
private static uint __SoftObjectPtrValue = 0;

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintDynamicFunction/CSharp_TestBlueprintDynamicFunctionActor_C.cs

+34-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Script.CoreUObject
77
{
88
[UClass]
99
[PathName("/Script/CoreUObject.CSharp_TestBlueprintDynamicFunctionActor_C")]
10-
public class CSharp_TestBlueprintDynamicFunctionActor_C : BP_TestClass_C, IStaticClass
10+
public class CSharp_TestBlueprintDynamicFunctionActor_C : BP_TestClass_C, IStaticClass, ITestDynamicInterface
1111
{
1212
public CSharp_TestBlueprintDynamicFunctionActor_C()
1313
{
@@ -232,6 +232,16 @@ public UObject ObjectValue
232232
__ObjectValue, value);
233233
}
234234

235+
[UProperty]
236+
public TScriptInterface<ITestDynamicInterface> InterfaceValue
237+
{
238+
get => FPropertyImplementation.FProperty_GetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
239+
__InterfaceValue) as TScriptInterface<ITestDynamicInterface>;
240+
241+
set => FPropertyImplementation.FProperty_SetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
242+
__InterfaceValue, value);
243+
}
244+
235245
[UProperty]
236246
public TSubclassOf<UObject> SubclassOfValue
237247
{
@@ -671,6 +681,26 @@ public void OutObjectValueFunction(ref UObject OutObjectValue)
671681
OutObjectValue = ObjectValue;
672682
}
673683

684+
[UFunction]
685+
public void SetInterfaceValueFunction(TScriptInterface<ITestDynamicInterface> InInterfaceValue)
686+
{
687+
InterfaceValue = InInterfaceValue;
688+
}
689+
690+
[UFunction]
691+
public TScriptInterface<ITestDynamicInterface> GetInterfaceValueFunction()
692+
{
693+
return InterfaceValue;
694+
}
695+
696+
[UFunction]
697+
public void OutInterfaceValueFunction(ref TScriptInterface<ITestDynamicInterface> OutInterfaceValue)
698+
{
699+
TestCoreSubsystem.TestEqual("BlueprintDynamicOutGetInterfaceFunction", OutInterfaceValue, InterfaceValue);
700+
701+
OutInterfaceValue = InterfaceValue;
702+
}
703+
674704
[UFunction]
675705
public void SetSubclassOfValueFunction(TSubclassOf<UObject> InSubclassOfValue)
676706
{
@@ -686,7 +716,7 @@ public TSubclassOf<UObject> GetSubclassOfValueFunction()
686716
[UFunction]
687717
public void OutSubclassOfValueFunction(ref TSubclassOf<UObject> OutSubclassOfValue)
688718
{
689-
TestCoreSubsystem.TestEqual("BlueprintDynamicOutGetClassFunction", OutSubclassOfValue, GetClass());
719+
TestCoreSubsystem.TestEqual("BlueprintDynamicOutGetSubclassOfFunction", OutSubclassOfValue, GetClass());
690720

691721
OutSubclassOfValue = SubclassOfValue;
692722
}
@@ -832,6 +862,8 @@ public void OutMapValueFunction(ref TMap<int, int> OutMapValue)
832862

833863
private static uint __ObjectValue = 0;
834864

865+
private static uint __InterfaceValue = 0;
866+
835867
private static uint __SubclassOfValue = 0;
836868

837869
private static uint __WeakObjectPtrValue = 0;

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintDynamicFunction/UUnitTestSubsystem.cs

+18
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,24 @@ private void TestBlueprintDynamicFunction()
270270

271271
TestCoreSubsystem.TestEqual("BlueprintDynamicOutSetObjectFunction", OutObjectValue, this);
272272

273+
// UInterface
274+
TestCoreSubsystem.TestEqual("BlueprintDynamicGetInterfaceFunction",
275+
FunctionActor.GetInterfaceValueFunction(),
276+
FunctionActor.InterfaceValue);
277+
278+
FunctionActor.SetInterfaceValueFunction(FunctionActor.InterfaceValue);
279+
280+
TestCoreSubsystem.TestEqual("BlueprintDynamicSetInterfaceFunction",
281+
FunctionActor.GetInterfaceValueFunction(),
282+
FunctionActor.InterfaceValue);
283+
284+
var OutInterfaceValue = FunctionActor.InterfaceValue;
285+
286+
FunctionActor.OutInterfaceValueFunction(ref OutInterfaceValue);
287+
288+
TestCoreSubsystem.TestEqual("BlueprintDynamicOutSetInterfaceFunction", OutInterfaceValue,
289+
FunctionActor.InterfaceValue);
290+
273291
// TSubclassOf
274292
TestCoreSubsystem.TestEqual("BlueprintDynamicGetSubclassOfFunction",
275293
FunctionActor.GetSubclassOfValueFunction(),

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintDynamicProperty/CSharp_TestBlueprintDynamicPropertyActor_C.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Script.CoreUObject
66
{
77
[UClass]
88
[PathName("/Script/CoreUObject.CSharp_TestBlueprintDynamicPropertyActor_C")]
9-
public class CSharp_TestBlueprintDynamicPropertyActor_C : BP_TestClass_C, IStaticClass
9+
public class CSharp_TestBlueprintDynamicPropertyActor_C : BP_TestClass_C, IStaticClass, ITestDynamicInterface
1010
{
1111
public CSharp_TestBlueprintDynamicPropertyActor_C()
1212
{
@@ -44,6 +44,8 @@ public CSharp_TestBlueprintDynamicPropertyActor_C()
4444

4545
ObjectValue = this;
4646

47+
InterfaceValue = this;
48+
4749
SubclassOfValue = GetClass();
4850

4951
WeakObjectPtrValue = this;
@@ -231,6 +233,16 @@ public UObject ObjectValue
231233
__ObjectValue, value);
232234
}
233235

236+
[UProperty]
237+
public TScriptInterface<ITestDynamicInterface> InterfaceValue
238+
{
239+
get => FPropertyImplementation.FProperty_GetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
240+
__InterfaceValue) as TScriptInterface<ITestDynamicInterface>;
241+
242+
set => FPropertyImplementation.FProperty_SetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
243+
__InterfaceValue, value);
244+
}
245+
234246
[UProperty]
235247
public TSubclassOf<UObject> SubclassOfValue
236248
{
@@ -351,6 +363,8 @@ public TMap<int, int> MapValue
351363

352364
private static uint __ObjectValue = 0;
353365

366+
private static uint __InterfaceValue = 0;
367+
354368
private static uint __SubclassOfValue = 0;
355369

356370
private static uint __WeakObjectPtrValue = 0;

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintDynamicProperty/UUnitTestSubsystem.cs

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ private void TestBlueprintDynamicProperty()
137137

138138
TestCoreSubsystem.TestEqual("BlueprintDynamicSetObjectProperty", PropertyActor.ObjectValue, this);
139139

140+
// UInterface
141+
TestCoreSubsystem.TestEqual("BlueprintDynamicGetInterfaceProperty", PropertyActor.InterfaceValue,
142+
PropertyActor.InterfaceValue);
143+
144+
PropertyActor.InterfaceValue = PropertyActor.InterfaceValue;
145+
146+
TestCoreSubsystem.TestEqual("BlueprintDynamicSetInterfaceProperty", PropertyActor.InterfaceValue,
147+
PropertyActor.InterfaceValue);
148+
140149
// TSubclassOf
141150
TestCoreSubsystem.TestEqual("BlueprintDynamicGetSubclassOfProperty", PropertyActor.SubclassOfValue,
142151
PropertyActor.GetClass());

Diff for: Script/Game/UnrealCSharpTest/UnitTest/Dynamic/BlueprintRawDynamicFunction/ATestBlueprintRawDynamicFunctionActor.cs

+37-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Script.CoreUObject
77
{
88
[UClass]
99
[PathName("/Script/CoreUObject.TestBlueprintRawDynamicFunctionActor")]
10-
public class ATestBlueprintRawDynamicFunctionActor : AActor, IStaticClass
10+
public class ATestBlueprintRawDynamicFunctionActor : AActor, IStaticClass, ITestDynamicInterface
1111
{
1212
public ATestBlueprintRawDynamicFunctionActor()
1313
{
@@ -33,6 +33,8 @@ public ATestBlueprintRawDynamicFunctionActor()
3333

3434
ObjectValue = this;
3535

36+
InterfaceValue = this;
37+
3638
SubclassOfValue = GetClass();
3739

3840
SoftObjectPtrValue = this;
@@ -156,6 +158,16 @@ public UObject ObjectValue
156158
__ObjectValue, value);
157159
}
158160

161+
[UProperty, BlueprintReadWrite]
162+
public TScriptInterface<ITestDynamicInterface> InterfaceValue
163+
{
164+
get => FPropertyImplementation.FProperty_GetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
165+
__InterfaceValue) as TScriptInterface<ITestDynamicInterface>;
166+
167+
set => FPropertyImplementation.FProperty_SetObjectCompoundPropertyImplementation(GarbageCollectionHandle,
168+
__InterfaceValue, value);
169+
}
170+
159171
[UProperty, BlueprintReadWrite]
160172
public TSubclassOf<UObject> SubclassOfValue
161173
{
@@ -455,6 +467,27 @@ public void OutObjectValueFunction(ref UObject OutObjectValue)
455467
OutObjectValue = ObjectValue;
456468
}
457469

470+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
471+
public void SetInterfaceValueFunction(TScriptInterface<ITestDynamicInterface> InInterfaceValue)
472+
{
473+
InterfaceValue = InInterfaceValue;
474+
}
475+
476+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
477+
public TScriptInterface<ITestDynamicInterface> GetInterfaceValueFunction()
478+
{
479+
return InterfaceValue;
480+
}
481+
482+
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
483+
public void OutInterfaceValueFunction(ref TScriptInterface<ITestDynamicInterface> OutInterfaceValue)
484+
{
485+
TestCoreSubsystem.TestEqual("BlueprintRawDynamicOutGetInterfaceFunction", OutInterfaceValue,
486+
InterfaceValue);
487+
488+
OutInterfaceValue = InterfaceValue;
489+
}
490+
458491
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
459492
public void SetSubclassOfValueFunction(TSubclassOf<UObject> InSubclassOfValue)
460493
{
@@ -470,7 +503,7 @@ public TSubclassOf<UObject> GetSubclassOfValueFunction()
470503
[UFunction, BlueprintCallable, BlueprintImplementableEvent]
471504
public void OutSubclassOfValueFunction(ref TSubclassOf<UObject> OutSubclassOfValue)
472505
{
473-
TestCoreSubsystem.TestEqual("BlueprintRawDynamicOutGetClassFunction", OutSubclassOfValue, GetClass());
506+
TestCoreSubsystem.TestEqual("BlueprintRawDynamicOutGetSubclassOfFunction", OutSubclassOfValue, GetClass());
474507

475508
OutSubclassOfValue = SubclassOfValue;
476509
}
@@ -600,6 +633,8 @@ public void OutMapValueFunction(ref TMap<int, int> OutMapValue)
600633

601634
private static uint __ObjectValue = 0;
602635

636+
private static uint __InterfaceValue = 0;
637+
603638
private static uint __SubclassOfValue = 0;
604639

605640
private static uint __SoftObjectPtrValue = 0;

0 commit comments

Comments
 (0)