Isolated event graph nodes in Animation Blueprints can fail compilation

In normal blueprints, isolated nodes do not cause compilation to fail because they will never be executed. In animation blueprints, event graph nodes will cause compilation to fail despite being isolated. The attached repro is a contrived way to get an invalid node into an animation blueprint event graph, but we have custom blueprint nodes perform validations from ValidateNodeDuringCompilation.

I’ve tracked the issue down to the fact that the function `FAnimBlueprintCompilerContext::ProcessAllAnimationNodes` calls `ValidateGraphIsWellFormed` during the `MergeUbergraphPagesIn` step of `FKismetCompilerContext::CreateAndProcessUbergraph`. At this time, isolated event graph nodes have not yet been pruned by a call to `PruneIsolatedNodes`. This happens later in `ExpansionStep`. The result is that `ValidateNodeDuringCompilation` is called on isolated event graph nodes, which is not correct behavior.

I’m not sure what a correct fix to this looks like, but on my end I’m attempting to replace the `ValidateGraphIsWellFormed` call with a function that only validates nodes that are derived from `UAnimGraphNode_Base`.

Steps to Reproduce

  1. Create a new Animation Blueprint
  2. Create an erroring node in the Event Graph of that Animation Blueprint. Ex:
    1. Create a new Editor Utility Blueprint (Asset Action Utility)
    2. In the event graph of that blueprint, add a “Get Asset Editor Subsystem” node
    3. Copy that node and paste it into the Animation Blueprint (this should cause UK2Node_GetEditorSubsystem::ValidateNodeDuringCompilation to log an error when compiling)
  3. Make sure the node is completely isolated (not connected to any entry point in the graph)
  4. Compile the Animation Blueprint
  5. Observe that compilation fails despite the node being isolated
  6. Repeat the process in a new base Blueprint class and observe that compilation does not fail when the node is isolated

Hi - the approach of validating only UAnimGraphNode_Base-derived nodes at the point we currently call ValidateGraphIsWellFormed in ProcessAllAnimationNodes seems like it should work.

Unfortunately the reason for why that particular call was added is lost to memory (I added it back in 2020 in a large refactor, but cant remember why this specific call was added). If you get a working version of this change, please could you forward it to us so we can validate it for inclusion in a future engine version.