Page 1 of 1

Multiple output expression node ... bug?

PostPosted: Thu Aug 23, 2018 10:17 pm
by sethhall
Hi,

I'm trying to use an Expression node to write some simple code. I want to have multiple outputs but I can't seem to figure out how to get it to work.

I see there is a list of 'Inputs' in the property window. I can add multiple inputs however if I add one and change the Qualifier to Out, it doesn't quite behave as I'd expect. .. In fact, I can't seem to figure out how to get mutiple outputs to work at all.

Are multiple outputs via an expression node doable?

Right now I'm just doing return <code> at the end, and it does work for the 1 output I have. I'd like to just say MyOutput1 = <code> ... and MyOutput2 = <code>

Thanks

Seth

Re: Multiple output expression node ... bug?

PostPosted: Fri Aug 24, 2018 11:35 am
by Amplify_Borba
Hello!

It's possible to have several outputs in your Custom Expression node through using the Qualifier parameter of the added Inputs. Please refer to the image below:

Image

Note that we've set the Output Type to Float4, so that we can pass the Color node's value that is received by the first input, In0, which is also a Float4. Values assigned to this parameter will be copied into it when the function is called and it can be modified inside function as it will not affect original one. This value is the one that I'm returning through the code, so it's passed into the original Output port.

The second input set in the node's parameters is also a Float4, with its Qualifier set to Out, which means that its value is not initialized by the function caller, so the Value parameter is ignored and you'll have to initialized it within the function. There is also a visual issue where a Out port also appears as an Input port, but it can be ignored for now as any values connected to it will also be ignored.

The third input has its Qualifier set to InOut, so it's a mixture of both In and Out qualifiers. Its value will be set to the one passed by the function call but also all changes done to it inside the function body will be copied to the original one. In this specific case I'm setting its value in the parameters.

Please let me know if this helps, I'll be happy to elaborate, thanks!