imnodes icon indicating copy to clipboard operation
imnodes copied to clipboard

connecting two edges to one input crashes color_node_editor evaluator

Open lfnoise opened this issue 3 years ago • 3 comments

assert(value_stack.size() == 3ull); fails if you connect two wires to one input. It leaves an extra value on the stack.

One possible recreation is to create 3 boxes: sine, sine and output. and connect both sine outputs to the 'r' input of 'output'. But any other connection of two outputs to an input failed for me as well.

lfnoise avatar Oct 19 '20 16:10 lfnoise

Also creating a cycle in the graph causes an infinite loop in dfs_traverse. I made a cycle of two 'sine' blocks feeding back with one of them also connected to the output node. sine1 -> sine2 -> both sine1 and output r I assume it should be up to user code (or in this case, the example code) to prevent fan-in and cycle connections if they will crash the evaluator?

lfnoise avatar Oct 19 '20 18:10 lfnoise

Just added https://github.com/sonoro1234/LuaJIT-ImGui/blob/master/examples/imnodes_graph_sample.lua to LuaJIT-ImGui

Avoids more than one input for input pin and allows cycles (detected as graph node already visited in dfs but still without calculated output) taking the value produced in previous dfs for that node. Also takes care of saving and reloading.

graphGIF

sonoro1234 avatar Oct 26 '20 16:10 sonoro1234

Thanks for reporting this @lfnoise . The examples should handle these situations a bit better.

Nelarius avatar Oct 29 '20 06:10 Nelarius