McManning/BlueGraph

Add OnValidate and error state

McManning opened this issue ยท 2 comments

Add something equivalent to Unity's OnValidate for each node, specifically to handle things like assembly reloads while in the editor. Specifically, I want a centralized place for nodes to respond to code changes to update their ports, values, etc etc (potentially to handle #9).

If validation fails, or, honestly, any runtime failures occur - I want a common interface to be able to report that error back to the developer nicely. At a bare minimum, this would throw a node into an error state with an error message string, and the developer can review these errors in context on the canvas.

Errors should also be throwable during assembly reloads and plastered all over the canvas. And if a node isn't open in the canvas, error messages should still be dumped into the debug console so a developer knows they just broke a bunch of graphs by their recent code change.

I'm thinking something like...

OnValidate()
  Check NodeReflection for updated IO attributes
  Rename / re-type ports to match new definitions
  Go into an error state if something cannot be converted safely (type change would break connections, or cannot figure out what something was renamed to)
     Put the node into an error state and drop the error message into console

... at which point a developer would need to either fix the code issue to reload assemblies and try OnValidate again, or open the canvas editor and make the appropriate changes (delete nodes, make new connections, etc)

OnValidate is done in 03b734c - and I have a local build with error states that I'm still testing prior to pushing.

๐ŸŽ‰ This issue has been resolved in version 1.0.0 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€