feat: add many user-friendly features
Signed-off-by: LingSamuel [email protected]
-
cache some global vars to make linter happy
-
add a "Go back" feature. User can now go back after go to

-
add array length indicator for fields

-
add local index indicator for states in order to find the corresponding condition quickly
-
add states indicator for conditions like states

-
add "Start states conditions"

-
add "Replace action by id" to avoid a very long drop list

-
add a "Referenced by" array to query nodes to it (by states or start states)

-
support make side panel width static. Increase its width from
/4to/3.5 -
support render children in "Transition Position". It displays the start state and states in a tree format.

I am trying to test this but there is a crash occurring now within imnodes.end_editor(), only when using transition positioning. It only occurs on some nodes. The one in particular I am seeing is 2554 on Longsword, in a lobby, not a hunt. Maybe too many draw calls? I can't tell.

I finally had time to update this script to make it suitable for PR.
Newly added features:
-
Handle some common-used action/condition types, make them easy to edit.

-
~~Display some node metadata (maybe useless for most users but it helped me a lot) and parent.~~ require my forked version

-
Some performance limit, for example, draw max 100 links, won't draw node 0, etc.
-
Node tree analysis (won't update after editing unless a reset-script for now), also some bug-fixes for it
- purple (dangling in the node tree): the node is not referenced by any state or start state in the node tree
- red (is a start state): the node is referenced as a start state
- yellow (is an exit state): one of the states or start states is not a child of the node tree

I am trying to test this but there is a crash occurring now within
imnodes.end_editor(), only when using transition positioning. It only occurs on some nodes. The one in particular I am seeing is 2554 on Longsword, in a lobby, not a hunt. Maybe too many draw calls? I can't tell.
Strange, I can't reproduce this.
I also implements a fully "deep copy" for nodes. To do so, I need the "resize" function to make the relocating happen only once. I do this in my fork repo. It's not included in this PR because public REF does not currently have a resize function.
I found that this is because the nodes referenced by some fields need to be all inside the subtree (or more precisely, they can't refer to children of other subtrees, I guess). This internal relationship was probably broken by the "duplicate node" feature of the BHVT editor, as it did not handle these reference relationships, making the copied nodes not work properly. I then spent a few hours implementing a full "deepcopy" that relocates all the pointers it should have. (I edited the REF to get some of the funcs I needed)
Now I can add nodes dynamically via lua and they work just like they were loaded from the motfsm file.