Extending Custom HLSL / Custom Expressions

Heya @****Büke, can you help me understand why I get


[SM5] /Engine/Private/test.usf(13:25): error: reference to local variable 'InColor' declared in enclosing function 'CustomExpression0'
        return OrangeBright(InColor);
                            ^


. I’ve spent hours trying to understand. It just seem like I can’t pass a node pin variable into a function that lives inside a struct, but somehow everyone here compiled. I don’t know what i’m missing.

full code is


#pragma once
struct Functions
{
  float3 OrangeBright(float3 c)
  {
      return c * float3(1, .7, 0);
  }
  float3 Out()
  {
    return OrangeBright(InColor);
  }
};
Functions f;
return f.Out();

I do have one workaround which is to pass the node pin variables in as parameters at the final return outside of the struct. But this workaround is useless : / So for example:


float3 Out(A)
{
return OrangeBright(A);
}

...

return f.Out(InColor);