Commit Graph

29 Commits

Author SHA1 Message Date
thomas sarkanen
45b9547da9 Anim blueprints now dont participate in unneeded dependency compilation
This is because dependent BPs at least need a re-link to pick up layout changes in their property access 'bytecode'.

The also requires some re-arranging of where sparse class data gets created, linked and patched.
 - Previously sparse class data was patched in the linker at the point of re-creation, but this meant that stale TRASHCLASS sparse class data was could still be in the struct hierarchy when we are BATCH compiling (when batch compiling, each compilation phase is performed in turn for all compiling/dependent BPs). This change removes the sparse class data when the class is sanitized prior to full compilation and stashes it for later patching. This ensures that sparse class data doesnt get linked into stale structs that can then get GCed later, invalidating property links.
- Sparse class data is now linked when its containing ABPGC is linked. It also ensures that the hierarchy of sparse class data mirrors that of the ABPGC. The 'mirror hierarchy' is currently only an invariant of anim blueprints.

Part of this change alters the behavior of UClass::SetSparseClassDataStruct when passed a NULL value. This will now ensure that subclasses are left in a valid state when this occurs. Previously if sparse class data was nulled-out, subclasses would be left pointing at a potentially stale struct in the case where the struct was being regenerated.

Added an override point for subsystems to participate in Link() and made sure property access offsets are patched there, to catch cases where dependent BPs get either a bytecode-only or link-only compile

#jira UE-136035 - Unexpected results from Property Access after changing Lyra animbp
#jira UE-130965 - Multiple crashes involving anim BP sparse class data, inheritance & GC
#rb Phillip.Kavan,Matt.Peters
#preflight 61af321f470c73a8c4933ff5

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 18393342 in //UE5/Release-5.0/... via CL 18393349
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v896-18170469)

[CL 18393353 by thomas sarkanen in ue5-release-engine-test branch]
2021-12-07 05:32:13 -05:00
thomas sarkanen
d9d8fc91ed Fix crash compiling child anim BPs with certain configurations
Copy mutable data (in the same way as constant data) to ensure that child class containers are coorectly initialized

#jira UE-135480 - Crash compiling child anim BP with invalid mutable data
#rb Jurre.deBaare
#preflight 619cbaaa801b361978a544d8

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 18268116 in //UE5/Release-5.0/... via CL 18268125
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18268128 by thomas sarkanen in ue5-release-engine-test branch]
2021-11-23 05:26:00 -05:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -05:00
aurel cordonnier
a6e741e007 Merge from Release-Engine-Staging @ 17915896 to Release-Engine-Test
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-25 20:05:28 -04:00
aurel cordonnier
a12d56ff31 Merge from Release-Engine-Staging @ 17791557 to Release-Engine-Test
This represents UE4/Main @17774255, Release-5.0 @17791557 and Dev-PerfTest @17789485

[CL 17794212 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-12 21:21:22 -04:00
thomas sarkanen
d708b24c66 Anim node references
Added the abiity to tag and retrieve any anim graph node (similar to how we could reference linked anim graph nodes previously).
Ported linked anim graph nodes to use the new system
Added the ability to reference any anim graph node by tag (via a new custom node, spawnable from the context menu, with the appearance of an actor reference in a level blueprint)
Added tag display and editing in the bottom-right of anim graph nodes
Added new override point to SGraphNodeK2Var to allow for title widget parameters to be overriden by child classes

#jira UE-126286 - Anim node functions: Add anim node references
#rb Jurre.deBaare

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 17472894 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17472913 by thomas sarkanen in ue5-release-engine-test branch]
2021-09-09 11:42:21 -04:00
thomas sarkanen
bbdd9ec262 Fix load ordering dependency with parent->child hierarchies of anim BPs
In the case where child clases are PostLoaded() after their parents, incorrect node data can be assigned to the class causing OOB access. This fix switches the init of the node data to be lazy/latched, so subsequent subclass loads dont overwrite parent class node data

#jira FROST-4098
#rb Jurre.deBaare

#ROBOMERGE-SOURCE: CL 17386060 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17386077 by thomas sarkanen in ue5-release-engine-test branch]
2021-09-01 09:58:57 -04:00
thomas sarkanen
9296c2ffe1 Fixed crash when editing callsites for event graph property accesses
#jira UE-124719 - Assert occurs when selecting Call Site options other than Automatic or Thread Safe within a Property Access node

#ROBOMERGE-SOURCE: CL 17368301 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17368323 by thomas sarkanen in ue5-release-engine-test branch]
2021-08-31 10:58:13 -04:00
thomas sarkanen
6153d306e8 Fixed warning when linked anim graph node pins are connected
#jira UE-118583
#rb Jurre.deBaare

#ROBOMERGE-SOURCE: CL 16743757 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16743763 by thomas sarkanen in ue5-release-engine-test branch]
2021-06-22 11:31:18 -04:00
thomas sarkanen
cecebd0cf8 Anim blueprint encapsulation improvements
Adds 'template' anim BP concept. These anim BPs have no TargetSkeleton and as such cannot have direct references to animations placed inside of their anim graphs
Adds function call support from anim nodes. All anim graph nodes can now call functions when initialized, updated, evaluated or when they first become relevant.
Relevancy is established using a new FAnimSubsystemInstance_NodeRelevancy which tracks nodes in a local map, per UAnimInstance, if nodes require it.
Functions are displayed on the node if bound, and in the details panel.
Added a new override point to FAnimSubsystemInstance to allow for WT init.
Moved FMemberReference customization into a public header so it can be used on anim node functions.
Wrapped functions up into FAnimNodeFunctionRef structure so they can be re-used more effectively. Converted CallFunction node to use them.
Added a couple of simple BP function libraries to demonstrate the use of the new FAnimNodeContext (this is intended to be a generic way of exposing FAnimNode_Base types to script without the node types themselves having to be known to script directly).
Added the ability to set exposed properties as 'always dynamic' so they appear in mutable data rather than being merged into constants. This allows for the anim node data API to be changed to be less strict (and more script friendly). Now values can be set in mutable data (via GET_MUTABLE_ANIM_NODE_DATA_PTR) and attempted sets to constant data can be ignored and reported to client code.
A few minor crash fixes with edge cases (inc when trying to open an asset editor fails because of a missing skeleton/cancellation).
Also fixes an issue where literal linked anim graph/control rig/custom poroperty node inputs didnt get copied

#rb Jurre.deBaare,Aaron.Cox

#ROBOMERGE-SOURCE: CL 16703644 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16703653 by thomas sarkanen in ue5-release-engine-test branch]
2021-06-17 08:59:23 -04:00
Thomas Sarkanen
0f8ecdb48d Fix static analysis warning
#rb Jurre.deBaare

[CL 16435879 by Thomas Sarkanen in ue5-main branch]
2021-05-24 11:20:41 -04:00
Thomas Sarkanen
3e92b56aa0 Animation: thread-safe execution and property access improvements
"Call function" anim node:
- Adds the ability to call functions at different points in the anim graph execution (and under different conditions, e.g. when a branch has started blending in). Only thread-safe functions are allowed to be called.
- Adds a thread-safe override point BlueprintThreadSafeUpdateAnimation, called on worker threads for the main instance and for linked instances when they are relevant in the graph (only one call per frame for linked layer instances).

Subsystems:
- Added new override points pre/post event graph(s) (moved override point for worker thread work to around the thread safe update function call).

Improves property access integration:
- Property access now shows (and allows the user to override) the call site of accesses. This is to allow users to see when their property access calls will be made, hopefully making its use less confusing for power users.
- Tweaked UX for property access nodes and dropdowns.
- Anim node pins now have property access bindings in-line on the pin.

Also adds the abilility for the anim graph to opt-in (via a config flag) to more stringent thread safety checks. Disabled by default for now as this requires content fixup.

#jira UE-115745 - Anim Blueprint Encapsulation
#rb Jurre.deBaare

[CL 16434092 by Thomas Sarkanen in ue5-main branch]
2021-05-24 04:47:52 -04:00
Thomas Sarkanen
e485a55acb Fix various issues with child anim BPs
If a child anim BP is made and is saved without saving its parent, then when the class is reloaded later it will not be able to find the parent's sparse class data in the linker (as it will have been generated again from scratch on load, which doesnt patch the linker until the asset is resaved). This leads to serialization size mismatches.
To address this (and because the sparse class data will always be regenerated as part of compile-on-load), we skip the portion of the CDO's archive that represents the serialized sparse class data if it is null after serialization. It can of course be legitimately null in a lot of cases (say a regular actor Blueprint), but this should have no ill effects and effectively be a seek to the current archive offset.

This CL also fixes a number of child anim BP-related issues. First of all it prevents a crash when accessing out-of-bounds AnimNodeData by ensuring it is correctly duplicated in all circumstances. It also correctly propogates values from root->child sparse class data (in the same manner that anim node data used to be propogated before). This deals with compile-on-load issues where the child classes sparse class data is regenerated without serializing the parent classes sparse class data (see crash fix above).

#jira UE-114674 - Creating a new child anim BP crashes
#rb Fred.Kimberley,Phillip.Kavan,Jurre.deBaare

[CL 16313070 by Thomas Sarkanen in ue5-main branch]
2021-05-13 10:56:35 -04:00
Brandon Schaefer
ec9f8e23d9 Fix reference possibly being invalidated in while loop
#jira none
#rb none
#fyi Thomas.Sarkanen

[CL 16196527 by Brandon Schaefer in ue5-main branch]
2021-05-04 14:01:51 -04:00
Thomas Sarkanen
e3e68d14d4 Fix for renaming issues with animation blueprints
Switches generated structs to be subobjects of the generated class.
Key to this is supporting re-instancing via re-linking the mutable struct before the generated class is linked to allow the correct class layout to be used by serializers. This is because the property links are not preserved with StaticDuplicateObject.

#jira UE-114456 - Crash on loading Animation Blueprint asset that was renamed twice prior to that
#jira UE-114457 - A duplicate is created for an Animation Blueprint asset after its renaming
#rb Jurre.deBaare
#fyi Benn.Gallagher

[CL 16166745 by Thomas Sarkanen in ue5-main branch]
2021-04-30 05:41:57 -04:00
Marc Audy
3cfedaade8 Fix PVS warning V502 when comparing against NAME_None in a trinary
[CL 16137741 by Marc Audy in ue5-main branch]
2021-04-28 01:58:36 -04:00
Thomas Sarkanen
c9a92f12c2 Fix anim BP internal structs showing up in the content browser
#jira none
#rb Jurre.deBaare

[CL 16112747 by Thomas Sarkanen in ue5-main branch]
2021-04-26 06:37:16 -04:00
Thomas Sarkanen
16eee0289d Anim node data/compiler refactor
Per-node constant data is now held on a generated struct as part of sparse class data.
Per-node mutable data (i.e. pin links/property access mappings) is now held on a generated 'mutable data' struct that is compiled as part of the generated class.

The anim BP compiler is now extended more conventionally using UAnimBlueprintExtension, derived from UBlueprintExtension. This directly replaces the older 'compiler handler' pattern that was added in an emergency fashion for 4.26. Anim graph nodes now request their required extensions and these are held on the UAnimBlueprint in the UBlueprint::Extensions array. The Extensions array is potentially refreshed with any node addition or removal. The Extensions array is force-refreshed each time an anim BP is compiled for the first time to deal with newly added or removed requirements.

Const-corrected a bunch of UAnimInstance/FAnimInstanceProxy APIs that rely on (now truly) const data.
Added a split state/constant version of FInputScaleBiasClamp to allow some of its data to be split into constants.
Tweaked alignment/ordering of FPoseLinkBase to save a few bytes per pose link.
Deprecated FAnimNode_Base::OverrideAsset in favor of a more UAnimGraphNode_Base-based approach. Individual nodes can still have runtime overrides via specific accessors. The new approach will also give us the oppurtunity to override multiple assets per node if required in the future.

Moved property access into Engine module & removed event support from it - this was never used.
Reworked property access compilation API a little - construction/lifetime was a bit confusing previously.

Optimized path used to create UK2Node_StructMemberSet nodes in per-node custom events. When using mutable data, the structure used is large and very sparsely connected (i.e. only a few properties are written) so we only create pins that are actually going to be used, rather than creating all of them and conly connecting a few.

Patched the following nodes to use the new data approach:

- Asset players (sequences, blendspaces, aim offsets)
- Blend lists
- Ref poses
- Roots

#rb Jurre.deBaare, Martin.Wilson, Keith.Yerex

[CL 16090510 by Thomas Sarkanen in ue5-main branch]
2021-04-22 04:57:09 -04:00
Thomas Sarkanen
5364bab827 Backing out CL 16071104
[CL 16071592 by Thomas Sarkanen in ue5-main branch]
2021-04-21 08:01:44 -04:00
Thomas Sarkanen
0ddbfb9894 Anim node data/compiler refactor
Per-node constant data is now held on a generated struct as part of sparse class data.
Per-node mutable data (i.e. pin links/property access mappings) is now held on a generated 'mutable data' struct that is compiled as part of the generated class.

The anim BP compiler is now extended more conventionally using UAnimBlueprintExtension, derived from UBlueprintExtension. This directly replaces the older 'compiler handler' pattern that was added in an emergency fashion for 4.26. Anim graph nodes now request their required extensions and these are held on the UAnimBlueprint in the UBlueprint::Extensions array. The Extensions array is potentially refreshed with any node addition or removal. The Extensions array is force-refreshed each time an anim BP is compiled for the first time to deal with newly added or removed requirements.

Const-corrected a bunch of UAnimInstance/FAnimInstanceProxy APIs that rely on (now truly) const data.
Added a split state/constant version of FInputScaleBiasClamp to allow some of its data to be split into constants.
Tweaked alignment/ordering of FPoseLinkBase to save a few bytes per pose link.
Deprecated FAnimNode_Base::OverrideAsset in favor of a more UAnimGraphNode_Base-based approach. Individual nodes can still have runtime overrides via specific accessors. The new approach will also give us the oppurtunity to override multiple assets per node if required in the future.

Moved property access into Engine module & removed event support from it - this was never used.
Includes a thread-safety fix for 4.26 that hasnt made it over to 5.0 yet.
Reworked property access compilation API a little - construction/lifetime was a bit confusing previously.

Optimized path used to create UK2Node_StructMemberSet nodes in per-node custom events. When using mutable data, the structure used is large and very sparsely connected (i.e. only a few properties are written) so we only create pins that are actually going to be used, rather than creating all of them and conly connecting a few.

Patched the following nodes to use the new data approach:

- Asset players (sequences, blendspaces, aim offsets)
- Blend lists
- Ref poses
- Roots

#rb Jurre.deBaare, Martin.Wilson, Keith.Yerex

[CL 16071104 by Thomas Sarkanen in ue5-main branch]
2021-04-21 07:09:28 -04:00
danny chapman
0fba84358e Fix Invalid use of pointer in warning output
#jira UE-113834
#rb thomas.sarkanen

[CL 16060917 by danny chapman in ue5-main branch]
2021-04-20 10:15:49 -04:00
Marc Audy
01b7c9f4f5 Merge UE5/RES @ 15958325 to UE5/Main
This represents UE4/Main @ 15913390 and Dev-PerfTest @ 15913304

[CL 15958515 by Marc Audy in ue5-main branch]
2021-04-08 14:32:07 -04:00
thomas sarkanen
74bb8c17ca Fix property access nodes creating and using an incorrect internal property type
Previously there was no checking to see whether a variable that was created actually exists already, which could cause collisions.
Also fixed issue where connecting to a wildcard pin would mean that the output pin always stayed a wildcard.

#jira UE-103473 - Assert using Property Access pitch and yaw AimRotationDelta float variables for AimOffset
#jira UE-103470 - AnimBP Property Access node compile error accessing different variable types
#rb Jurre.deBaare

#ROBOMERGE-SOURCE: CL 15406686 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15406701 by thomas sarkanen in ue5-main branch]
2021-02-15 10:47:36 -04:00
Thomas Sarkanen
5419497f90 BlendSpace 2.0: Blendspace Graph Node
Added a new animation graph node that hosts its own UBlendSpaceBase. Modified UBlendSpaceBase to allow for pose links to be evaluated as the sample points.
The new blend space graphs can be spawned from existing UBlendSpace and UBlendSpace1D assets, or they can be created from scratch, or they can be converted from existing blendspace player nodes via the context menu.

Fixed anim node conversion functions so that their transactions work correctly.

Updated FBlueprintEditorUtils::IsGraphNameUnique to allow it to work with any object as the outer, not just UBlueprint. UBlueprint still has a special case for functions and events. This is to support GenerateUniqueGraphName within a scope (e.g. an outer graph).

Formalized the concept of 'node sub-graphs' (as well as the composite node pattern a little). Previously a number of known node types that contained sub-graphs (e.g. UK2Node_Composite) had special case logic for dealing with node/graph deletion etc. Now  any node can opt into this behaviour via the GetSubGraphs() override.

Added status bar readouts for the blendspace grid, so we dont have to stuff the prompts into the tooltip any more.

Moved anim BP related APIs out of FBlueprintEditor. They are always used via FAnimationBlueprintEditor.

Refactored graph title bar widget creation out into a function to allow other document tab factories to create it.

Altered breadcrumb trail click callbacks and SMyBlueprint::ExecuteAction to always JumpToHyperLink rather than calling OpenDocument directly. This allows unknown (to FBlueprintEditor) document types that reference objects to be correctly jumped to using the breadcrumb trail. Derived asset editors (i.e. FAnimationBlueprintEditor) can intercept the JumpToHyperlink call to ensure that the correct document is presented (i.e. the correct tab payload is generated).

Instead of making yet another bunch of duplicated code for handling the various alpha blend options, refactored this into FAnimGraphNodeAlphaOptions (for editor code) and FAnimNodeAlphaOptions (for runtime code).

Added OnCopyTermDefaultsToDefaultObject for per-node copying of default values from editor node to runtime node, rather than another special-case in the compiler.

#rb Jurre.deBaare,Phillip.Kavan

[CL 15177316 by Thomas Sarkanen in ue5-main branch]
2021-01-25 08:43:19 -04:00
Thomas Sarkanen
b85a3cea8c Animation sync node and anim graph attributes
Refactored tick record sync into utility structure - FAnimSync. This improves the odd API around tick records, better encapsulating functionality and leaving less for the caller to get wrong. This will also eventually allow this to be refactored out into a scriptable pipeline stage.
Added sync node and scoped sync message for new 'graph based sync'. Nodes that subscribe to graph-based-sync determine their sync group based on the scope that they are in.
Removed 4.26-style sync scopes - pushed all syncing up to the main anim instance. Linked anim instances no longer sync their own tick records.
To make graph based sync more useful, surfaced graph attributes and their visualizations as labels on pins and parallel wires to visualize flow.
This involves statically determining the attribute flow of the graph at compile time. Added a new compiler handler to deal with this new debug data.
Updated a lot of nodes to specify their attributes so graph flow can be correctly visualized.
Added tracing of attributes and sync records and visualization of traced records when debugging the anim graph.

#rb Jurre.deBaare, Martin.Wilson

[CL 14998555 by Thomas Sarkanen in ue5-main branch]
2021-01-06 09:11:59 -04:00