Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue https://github.com/MothCocoon/FlowGraph/issues/187 #189

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

MaksymKapelianovych
Copy link
Contributor

No description provided.

@MaksymKapelianovych
Copy link
Contributor Author

The reason of that issue was, that during transactions, resetting pin arrays was not stored as part of the transaction, and after undo/redo action these arrays were empty and pins connections could not be properly restored or removed.

void UFlowGraphNode::ReconstructNode()
{
        ... 
	// Reset pin arrays
	Pins.Reset();
	InputPins.Reset();
	OutputPins.Reset();
         ...
}

To fix this we simply need to call Modify() before changing pins arrays. I decided to add this into the OnExternalChange() function and not into the ReconstructNode() itself, because in other places, where ReconstructNode() is called, transactions (and Modify() function call) exist in calling functions.
I did not add transaction object itself, because if the OnExternalChange() is called from property modification event, it is already inside transaction, and if it is called from BP compilation, then this transaction would be stored as a separate transaction, and undoing it would not bring much use (to undo actual changes, user needs to press Ctrl+Z again).

@MaksymKapelianovych
Copy link
Contributor Author

This issue was reproduced with nodes PlayLevelSequence, CallOwnerFunction, SubGraph (when adding custom input/output), basically every node, that call OnReconstructionRequested.ExecuteIfBound() from its PostEditChangeProperty(). With my fix everything is working properly.

@MothDoctor
Copy link
Contributor

Thank you, it works beautifully! :)

@MaksymKapelianovych MaksymKapelianovych deleted the fix_undo-redo_issue branch March 29, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants