Skip to content

Commit 065eefc

Browse files
committed
Additional hooking info.
1 parent f5cd968 commit 065eefc

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

modules/ROOT/pages/Development/Cpp/Cookbook.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,3 @@ https://forums.unrealengine.com/t/how-to-create-k2node-that-appears-as-multiple-
114114
== Custom Cpp Struct Equality Operator
115115

116116
https://forums.unrealengine.com/t/creating-a-custom-equality-operator-between-structures/151127
117-
https://forums.unrealengine.com/t/creating-a-custom-equality-operator-between-structures/151127

modules/ROOT/pages/Development/ModLoader/ActorMixins.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ image::Development/ModLoader/ActorMixins/Components.png[]
3535
By default, Mixins allow you to implement additional code for the Begin Play, Construction Script, End Play, and Tick functions on the actor.
3636
Note that even though the Unreal editor labels these as overrides when creating them,
3737
they do not cancel the original function on the actor
38-
and are instead created as event notes.
38+
and are instead created as event nodes.
3939

4040
image::Development/ModLoader/ActorMixins/Functions.png[]
4141

modules/ROOT/pages/Development/ModLoader/BlueprintHooks.adoc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ The "Hook Implementation" option on hook nodes determines what function is invok
104104

105105
=== Hook Function Parameters
106106

107-
Hook functions parameters are populated by the hooking system based on
107+
Hook functions parameters are populated by the hooking system based on
108+
the target function's parameters, target class, and type of hook.
108109

109-
The first parameter should be the type of Blueprint you are hooking.
110-
Subsequent parameters can be any variable that is available in the hooked function's context that the hook might want to read/write. If set to be By Ref, the type must exactly match, but otherwise a wider type can be used.
110+
The first parameter should be named `Target` and be of the type of Blueprint you are hooking.
111+
Subsequent parameters can be any variable that is available in the hooked function's context that the hook might want to read/write.
112+
If set to be By Ref, the type must exactly match, but otherwise a wider type can be used.
111113

112114
Parameters will be mapped using their name to:
113115

114-
* `Target` - special hooking argument that resolves to the object instance the hooked function was running
116+
* `Target` - special hooking argument that resolves to the object instance the hooked function was running on
115117
* Global Variables - on the object instance
116118
* Local Variables - function inputs, function locals, and function temps (which you can check for in a BP code dump, either via the link:#ViewingBlueprintFunctionImplementations[`-DumpBlueprintPatchingResults` launch argument] which generates pseudocode, or in xref:Development/ExtractGameFiles.adoc#FModel[FModel] which generates a json very similar to the asset dump)
117119
* `TargetReturnValue` - special hooking argument that resolves to the hooked function's ReturnValue
@@ -136,6 +138,28 @@ If your hooks aren't triggering as expected,
136138
check your logs for messages in the `LogBlueprintHookingCodeGen` and `LogBlueprintHookManager` categories.
137139
A failure to attach a hook will produce a message and usually also the blueprint bytecode.
138140

141+
== Advanced Functionality
142+
143+
=== Modify Function Arguments
144+
145+
You can modify the arguments the hooked function receives by using a Before Hook targeting Function Entry Statement.
146+
Add the parameter you want to modify as a By-Ref parameter on your hook function.
147+
The initial value can be accessed via the parameter and modified by a Set By Ref node.
148+
149+
// === Cancel Hooked Function Execution
150+
151+
// TODO, see https://discord.com/channels/555424930502541343/562722670974599227/1451402917624942612
152+
153+
// You can (conditionally) cancel the execution of a function using a Replace hook.
154+
// By default, Replace hooks do not execute their original target, .
155+
// When relevant, Replace hooks will still execute their original target if the Hook Implementation returns `True` for a boolean output parameter named `ReturnValue`.
156+
157+
=== More!
158+
159+
The Blueprint Hooking system is very powerful and flexible.
160+
The examples on this page and ExampleMod only scratch the surface of what is possible.
161+
Please use the "Edit this Page" button in the top right to add more examples
162+
139163
== Limitations and Workarounds
140164

141165
=== Event Graph Nodes

0 commit comments

Comments
 (0)