Hi! I am making a recursive flood fill function. the problem is that I get infinite loop after a low recursive situation (like 240 iterations or so). I added a counter for checking it and also increased the max loop in the settings to 10000000 and I still getting infinite loop.
9/10 when I get an infinite loop, I wired something in Loop Body that should have gone off on Completed instead. The other 10% is an imperfect if while condition.
I have my ‘pixels color’ in an integer array (it stores color ids) I added all the pixels
sequentialy in the array because Unreal dont allow multi dimensional arrays. So I have
other pure functions that make the conversion lineal to coordinates and coordinates to linear:
FILL boolean is to abort the filling…it determines if is a valid fill or not ( I just want to fill closed shapes)…if you have an open shape in any paint program and you click fill in the canvas you will just fill all the canvas. I avoid that with the FILL boolean…if fill is false then it aborts and dont fill…
I set fill to true before run the first iteration of the filling ( the root filling pixel )…then the function will iterate recursively and come back to continue…if after the ‘first function run thread’ fill is true then I can take the ‘to fill pixels queue’ and do the actual filling.
if filling is < about 240 bricks works perfect…I am trying to make this in a different way with events and feeding in stages but is a lot more complicated
should not trigger infinite loop…the loop ammount is really low and fast…when I paint 200 blocks I dont miss a frame in performance (120fps) but if i paint like 240 blocks it halts with infinite loop. Obviously is a false infinite loop and increasing the max loops in settings dont do anything…Unreal should have a turn off infinite loop detection.