MothCocoon / FlowGraph

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

Flow Traits are now stored locally for every user #199

Open MaksymKapelianovych opened 4 months ago

MaksymKapelianovych commented 4 months ago

Breakpoints state (node and pins) was not serialized and after launching editor all breakpoints was disabled.

MothDoctor commented 4 months ago

Yes, this is intended behavior. It would serialize the Enabled property, it would make it possible to submit assets with enabled breakpoints to the repository. That would later infuriate other team members - suspending the game out of the blue. So they would disable breakpoint and submit to the repository. It would be a vicious cycle.

That's why blueprints only save "a breakpoint was placed here", but not an "Enabled" state.

Thus I cannot accept change in this form. I would gladly take it in, if you would find a way to keep this state as local, user-specific data. Not as information serialized to the game asset itself.

MaksymKapelianovych commented 4 months ago

Thanks for your quick response! Yes, very good argument for not making this serializable. I will try to find the way how it is done in Blueprints and implement this properly.

MaksymKapelianovych commented 4 months ago

Moved traits from UFlowGraphNode to UFlowGraphEditorSettings, which is using config EditorPerProjectUserSettings, so now traits will not be part of an asset. I decided to store them per node, as it was previously. Also enum EFlowTraitType was added to leave possibility to easily add new trait in future. Previously it was enough to add new UFlowGraphNode member FFlowPinTrait Something;, but now it is not the case anymore, so I decided enum would be optimal solution. All functions to work with traits now contained in UFlowDebuggerSubsystem as static functions, FFlowDebugTrait can be modified only by UFlowDebuggerSubsystem. For reference was taken UBlueprintEditorSettings and FKismetDebugUtilities.

Tested scenarios:

  1. Add/remove/toggle/disable breakpoints and restarting editor - everything restores as it should
  2. Remove all breakpoints - PerNodeSettings map is cleared in config
  3. Delete pin/node with added breakpoint - breakpoint is deleted from PerNodeSettings
  4. Rename pin (regular and context pins) - new pin is generated and new one is created, so breakpoint is deleted with the old one
  5. Breakpoint actions on ghost nodes (with unset or deleted UFlowNode) - everything work as for normal node
  6. Breakpoins are not duplicated when duplicating node/graph
MaksymKapelianovych commented 4 months ago

It is very easy to add new trait types. For example, we want to add "Log" trait, which will print to log node/pin execution. First we need to add new type to the EFlowTraitType: image_2024-05-14_16-13-11

then we need to define how this trait will work: image_2024-05-14_16-14-52 image_2024-05-14_16-14-52 (2) image_2024-05-14_16-14-52 (3)

and create and bind all corresponding UI actions

And after adding Log trait to some nodes and pins we get this result: image_2024-05-14_16-14-54

Of course new trait will require some visual representation and organizing its actions in context menu, but I think it is not urgent right now.

MothDoctor commented 2 months ago

Hi, please grab the latest changes as this change has merge conflicts with just accepted Flow AddOns.

MaksymKapelianovych commented 2 months ago

Updated!