Suzie Native Bodies API
The Native Bodies API adds C++ behaviour to Suzie-generated classes without declaring the complete original class. It supports actors, components, widgets, Data Assets, and other UObject classes created by Suzie.
The JMAP still defines the class, its properties, and its reflected functions: the functions Unreal knows about through its class information. Your implementation file supplies function bodies and optional callbacks.
|
This API belongs to the modkit Editor. Forging a mod does not add these C++ implementations to the shipped PAYDAY 3 game. Lifecycle callbacks are disabled during cook commandlets. |
Source files and building
Place handwritten implementations in:
<ModkitRoot>/Plugins/Suzie/NativeClasses/<ModuleName>/<ClassName>.cpp
The folder and filename identify /Script/ModuleName.ClassName. Use the exact reflected module and class names, without adding a C++ U or A prefix. Each file belongs to one class and may contain several bodies and callbacks.
-
Add or edit the class’s implementation file.
-
Close the Editor.
-
Build
PAYDAY3Editorfor Win64 Development. In Visual Studio, use Development Editor. -
Restart the Editor and check the Output Log for Suzie messages.
Registration and wrapper generation happen automatically during the build. Do not edit Plugins/Suzie/Intermediate/NativeBodies/, which contains generated output. No original Starbreeze headers, UCLASS, or manual registration are required. You can include additional C++ headers when needed.
|
The examples below are templates. |
Macro reference
Each macro introduces a body with an automatically supplied FSuzieFunctionContext& Context.
| Declaration | Purpose |
|---|---|
|
Implement an existing compatible Suzie-generated reflected function. Runs when that function is called. |
|
Run early setup during Suzie construction, before final defaults are applied. |
|
Run once after the object’s reflected properties, defaults, and required loading are ready. |
|
React to an editor notification for the named property, including changes to fields inside it. |
|
Handle a deferred refresh requested by the API, a watched dependency, or an observed widget replacement. |
The class argument must match the filename. SUZIE_CONSTRUCTOR(Class) is a compatibility alias for SUZIE_CONSTRUCT(Class).
SUZIE_FUNCTION
SUZIE_FUNCTION(ClassName, FunctionName)
{
const bool bEnabled = Context.GetParam<bool>("bEnabled");
if (!Context.IsValid()) { return; }
Context.SetProperty<bool>("bActive", bEnabled);
}
This template expects a boolean input named bEnabled and a boolean object property named bActive.
-
The target must be an existing Suzie-generated synchronous native UFunction. Missing functions are not created.
-
Inputs, outputs, return values, and property types must match the reflected signature.
-
Put inherited function implementations in the file for the Suzie class that declares the function.
-
Static functions are supported. Their
Context.GetSelf()is the declaring class’s default object rather than a normal instance. -
Function bodies run on the game thread. Calls from another thread are rejected.
-
RPCs, delegates, and latent functions are not supported injection targets.
-
This macro cannot override ordinary native C++ methods that are not compatible Suzie-generated UFunctions.
Existing Blueprint calls continue to use the same function name and class identity.
Lifecycle timing
| Callback | Timing and restrictions |
|---|---|
Construct |
Suzie-declared property storage and the native parent are initialized. Final archetype, JMAP, and saved values are applied afterwards and can replace values written here. Blueprint-added fields are not ready. This callback may run away from the main editor thread; keep it to early property setup. |
Post-initialize |
Deferred to the editor game thread after Suzie defaults and required object loading are complete. It is not a native |
Property changed |
Responds to Unreal’s editor property-change notifications. It matches the named member or changed nested field. Direct C++ memory writes do not automatically send those notifications. |
Refresh |
Deferred and coalesced: several requests can produce one update. Requires an explicit refresh request, dependency subscription, or widget observation; it is not a general per-frame callback. |
Construct and post-initialize callbacks also apply to class defaults and templates. A class default object holds starting values for instances. To skip all templates, including class defaults:
SUZIE_POST_INITIALIZE(ClassName)
{
if (Context.IsTemplate()) { return; }
// Apply instance behaviour using initialized properties.
}
Inheritance and registration rules
-
Lifecycle callbacks apply to the target class and its descendants, including Blueprint children.
-
If callbacks exist on several classes in the hierarchy, they run parent first, then child. Child callbacks do not replace parent callbacks.
-
Inherited reflected properties can be used with
SUZIE_PROPERTY_CHANGED. -
Keep one callback per class and event type. Property-change callbacks may have separate registrations for different properties.
-
Duplicate declarations, missing targets, and incompatible function signatures are reported instead of silently selecting an implementation.
-
Recursive lifecycle dispatch for the same object is suppressed.
Context reference
Context provides checked access to the current object and its reflected data. Keep the Context and any value views within the current body; do not store them for use after it returns.
Object and callback information
| Method | Result |
|---|---|
|
The current |
|
An |
|
Whether the object is a class default object. |
|
Whether the object is a template, including a class default object. |
|
The top-level changed member name for a property-change callback. |
|
The changed nested field name, when supplied by the editor event. |
|
The current |
|
Whether the Context has recorded an error. It does not check whether a referenced asset is valid or has finished loading. |
|
The first recorded Context error message. |
|
Record and log an error. Return from your body if execution should stop; this method does not return for you. |
Changed-property names are meaningful for property-change callbacks. Other phases normally receive NAME_None.
Object properties
| Method | Behaviour |
|---|---|
|
Read a copy of a property on the current object. |
|
Write a property on the current object. Returns |
|
Get a checked value view of a property on the current object. |
|
Get a property view on another object. Pass a valid |
const FVector Location = Context.GetProperty<FVector>("Location");
Context.SetProperty<bool>("bActive", true);
UObject* Definition = Context.GetProperty<UObject*>("Definition");
if (Context.IsValid() && IsValid(Definition))
{
const float Amount = Context.Property("Amount", Definition).Get<float>();
}
Property writes change the reflected value directly. They do not automatically call native setters, refresh visuals, or send editor property-change notifications. Apply any required behaviour explicitly.
Function inputs, outputs, and returns
These methods require a function context. Lifecycle callbacks have no parameter frame or return value.
A const function body cannot write properties on its own object through Context. Const parameters also remain read-only.
| Method | Behaviour |
|---|---|
|
Read a copy of a named input or output parameter. |
|
Write a parameter. Use this for output and reference values that need to reach the caller. Const parameters cannot be written by the body. |
|
Read the return value, for example after |
|
Set the result of a function with a compatible return type. |
|
Get checked value views of a parameter or return value. |
SUZIE_FUNCTION(ClassName, FunctionName)
{
// This template requires a boolean return value in the JMAP.
Context.SetReturn<bool>(true);
}
Calling reflected functions
Context.CallFunction("RefreshState");
The full form is:
auto Result = Context.CallFunction(
"FunctionName",
[](FSuzieFunctionContext& Call)
{
Call.SetParam<bool>("bEnabled", true);
});
CallFunction(Name, Setup, Target) calls synchronously and returns a TUniquePtr<FSuzieFunctionContext> containing the called function’s parameters and return value. Setup is optional; use it to supply inputs. Target is an optional object, defaulting to the current object.
Check the returned pointer before reading its outputs. Missing or unsupported functions, or failed input setup, return nullptr and record an error. Read outputs with Result→GetParam<T>() and a return value with Result→GetReturn<T>() using the actual signature.
Reflected calls require the game thread. RPC, delegate, and latent calls are unsupported. Prefer post-initialization or later callbacks over construction for this work.
Supported value types
| Type group | Examples and requirements |
|---|---|
Basic values |
|
Text and names |
|
Object references |
|
Structs |
Compiled reflected structs such as |
Enums |
Matching compiled Unreal enum types, or the value view’s |
Containers |
|
Reads return copies. Changing a local array, struct, or other copied value does not change the object until you write it back. Missing names and incompatible types record a Context error; a failed typed read returns a default-initialized value.
Reflected value views
Property(), Param(), Return(), Field(), and Element() return FSuzieReflectionValue views. These let you inspect nested data without declaring the original game structs.
| View method | Behaviour |
|---|---|
|
Read a copy or write a checked value. |
|
Get a named field inside a reflected struct. |
|
Get an existing array element. This does not add or resize elements. |
|
Get the number of items in an array, set, or map. |
|
Read an enum’s numeric value as |
|
Write an enum by |
|
Whether this view has a property and address. Use |
const float Amount = Context.Property("Settings")
.Field("Amount").Get<float>();
Context.Property("Items").Element(0)
.Field("bEnabled").Set<bool>(true);
Context.Property("Mode").SetEnum(FName(TEXT("Enabled")));
These templates require the named fields, an existing array element, and a valid enum member in the reflected data. Set and map items can be accessed through typed container copies; Element() is for arrays only.
Dependency and refresh API
Use these helpers after initialization, on the game thread. The target class needs a SUZIE_REFRESH callback.
| Method | Behaviour |
|---|---|
|
Refresh the current object when the watched object’s named property changes in the editor. The filter matches the changed member or nested field. |
|
Watch any notified property change on that object. The default filter is |
|
Remove all dependency subscriptions for the current object, including those registered by other callbacks on it. |
|
Queue a deferred |
|
For |
Subscriptions use weak references, so they do not keep the owner or dependency alive. Suzie also handles loaded or replaced dependencies where applicable. It does not automatically follow every reference inside every asset.
When a reference changes, rebuild the subscriptions from the object’s current references. For example, in a shared update helper:
Context.ClearDependencies();
UObject* Definition = Context.GetProperty<UObject*>("Definition");
if (Context.IsValid() && IsValid(Definition))
{
Context.WatchDependency(Definition, "Settings");
}
Keep shared dependency tracking together: ClearDependencies() applies to the whole object, not just the callback that calls it. Watching a reference property on the owner does not automatically watch edits inside the referenced asset.
Errors and known limitations
Check the Output Log for Suzie registration and execution errors. After an operation that can fail, check Context.IsValid() before using the returned data. Fail() records an error but does not stop C++ execution.
-
Class and property names must exist in the current JMAP or supported inherited reflection data. The API does not add missing properties or functions.
-
Lifecycle callbacks are safe event callbacks, not actual native C++ constructors or virtual overrides. Arbitrary
PostLoad(),PostEditChangeProperty(),RebuildWidget(), andSynchronizeProperties()calls cannot be intercepted withSUZIE_FUNCTION. -
Widget observation detects Slate replacement on opted-in widgets. It does not intercept every synchronization call.
-
The API does not make partially loaded referenced assets safe to read. Check their readiness where your behaviour depends on loaded data.
-
Rebuild the C++ Editor target and restart the Editor after changes. Blueprint compilation alone does not rebuild native body files.
-
Keep game-owned cooked assets read-only. Native bodies provide local editor behaviour and are not a way to redistribute or replace PAYDAY 3’s runtime code.
Class API pages
-
SBZUITextBlock lists the class properties, style fields, implemented functions, and editor refresh behaviour.
-
SBZVariationSetUtils: Applies meshes, materials, CPD values and morph targets.
-
SBZAICharacter: Selects and refreshes AI character appearances.
-
SBZCharacter: Connects character seeds to AI appearance refreshes.
-
SBZWheeledVehicle: Applies seeded appearances to skeletal vehicles.
-
SBZStaticVehicle: Applies seeded appearances to static vehicles.
-
SBZPawnSpawnBase: Preserves manually authored pawn-spawner seeds.
-
SBZVariationEditComponent: Applies an explicitly selected row to editor preview components.
-
SBZVariationEditActor: Repairs missing links between variation preview components.
-
SBZVariationViewActor: Refreshes a viewer from an explicitly supplied appearance.
-
SBZMenuArmor: Refreshes menu armour from a supplied variation selection.
-
SBZCustomizationManager: Resolves armour configuration and updates its preview.