Hi Guys,
I am sure i have done this in the past and I know its possible.... If I have a custom node, and I have inputs for that node, how can I check if the input has a connection? i.e a value is connected to the specific input ... I'd like to set a flag somewhere so that I can do something else if there is a value connected to the specific input?
Andy
Replies
It's "if.. else" and "greater" and such nodes in value and pixel processors. You set a simple logic if "if" input has greater than 0 then "else" input is passing through.
But in many cases just having zero (black) empty input is enough by itself. if add math is used further for example.
So this is great thanks, i used your concept and am able to check if an image is connected by checking for black and using the MinMax node which works great, but i cant seem to set a variable / parameter with the result that will cause another input to appear or hide. I use a function to get a true/false value and set that on a parameter and i try using that on a different input in the visible if field but it doesnt seem to work....
As far as I know inputs hiding is only allowed by input parameters ( by expression). Here is a link I usually copy/paste from .
https://substance3d.adobe.com/documentation/sddoc/visible-if-display-hide-inputs-and-outputs-with-conditions-102400063.html
So not sure any calculation result or output could make it through . I tried it and never worked . But I am not 100% sure
i haven't tried this for a couple of years but checking for black used to be a bit risky - in that a missing input wasn't necessarily black. you'd want to be sure that you're constraining the range before doing a conditional check i think .
if the parameter is definitely being set correctly, it could be that the order they are defined is causing you a problem.
yeah, checkin for black especially with min/max approach could be not working if you use negative pixel values in 32 bit calculations . For heigh combine for example. I once used an approach when I put transform node with manual mip level set to 10. It's a kind of quick blur my guess and a value processor after that . it samples only top left pixel I believe if you put the sampler node inside. So even if your input is having just a few not zero pixels the number you would see in value processor would be not zero . Something 0.001 or -000.1 of a sort . It kind of checks if all input pixels are perfectly nada.
It could be further used in if else to chose other input if value processor output anything other than perfectly zero.
But my sbs materials are so heavy and slow working closer to the end side all those extra blurs and samplers might be the reason.
perhaps there might be more clever way for nada check without blur , a matrix of sample points maybe.
ps. well, the timing shown says it's not the mip "blur", rather sampling in value processor.