No announcement yet.

Recursive function calls.

  • Filter
  • Time
  • Show
Clear All
new posts

    Recursive function calls.

    I wonder if it's safe to use recursive function calls, or i am pushing it?

    Click image for larger version

Name:	recursive.jpg
Views:	1
Size:	91.2 KB
ID:	1134357

    This works quite well, however to compile it one needs to set that dummy blem variable as result,
    then after first compile call TEST node will have correct pins.

    Ps. there are 2 connection missing for < and == zero should get straight to return node. Blame that recompiling trick on it.
    Last edited by Nawrot; 04-29-2014, 11:44 PM.

    Recursive functions are fine, but there are a few things you need to be aware of!

    When you make a function, after you define the inputs and outputs, it's best to hit compile before placing calls to that function. You can do it, but you'll need to right click on the call and refresh the node if you change the function signature. We're going to make this automatic in the future, but for right now, just keep that in mind!

    I'm not sure what the issue you were seeing with the blem variable is...I just tried making a recursive function here with the result disconnected, and it didn't complain when I compiled. Was there originally a by-ref parameter in there, perhaps?


      Thanks for reply. Good to hear it works.

      Issue was something like you described. Until I compiled call function node had no result pin, but my result node required something to be connected to. So I made that dummy variable to get return result node of right type. I think it was result of my messing around with nodes before i could get it all right, I probably had old version of "call TEST" node in this BP while i tried to compile new version.


        Cool stuff! I'm digging this functionality.
        Machine Learning C++ Plugin
        Lindenmayer System C++ Plugin