MothCocoon / FlowGraph

Design-agnostic node system for scripting game’s flow in Unreal Engine
https://discord.gg/Xmtr6GhbmW
MIT License
1.21k stars 239 forks source link

Nodes with Context Pins, loose ALL pins on CTRL+Z / can lead to crash #187

Closed soraphis closed 7 months ago

soraphis commented 8 months ago

Reproduction:

Result:

image

My guess is that there is no "OnReconstructionRequested.ExecuteIfBound()" call for Undo!?

To make it crash the editor:

Reproduction:

MothDoctor commented 7 months ago

Thanks for a precise repro :)

I kinda managed to fix the first problem, pins won't disappear if I would call pin reconstruction from PostEditUndo. Sadly, it's not enough to fix a crash. More time is needed to dig into the scheme of transactions here.

This is what I have locally.

void UFlowNode::PostEditUndo()
{
    UObject::PostEditUndo();

    // rebuild context pins on Undo any of node properties
    if (SupportsContextPins())
    {
        OnReconstructionRequested.ExecuteIfBound();
    }
}
MothDoctor commented 7 months ago

Fixed by a pull request :) https://github.com/MothCocoon/FlowGraph/pull/189