You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initializer lists are not allowed as function arguments, would be nice if they were, and would possibly simplify some of the MaterialX code base for OSL code generation.
struct vector2
{
float x;
float y;
};
void NG_switch_vector2I(vector2 in1, vector2 in2, vector2 in3, output vector2 out)
{
out = in1;
}
shader test_shader
(
vector2 input = {1,2}, // this works
output float out = 0
)
{
vector2 outVec;
vector2 in1 = {0,1}; // this works
NG_switch_vector2I(
in1, // this works
vector2(0.000000, 0.000000), // this works
{0.000000, 0.000000}, // this doesn't work
outVec);
out = outVec.x;
}
Expected behavior:
I expected this to compile just fine...
Actual behavior:
But it didn't... I get the following compile error.
Another potentially similar case where list initializer doesn't appear to be valid when assigning to an existing variable, but can be used when the variable is created.
two versions of mx_elementAt function below, one works if I create an intermediate object, but direct assignment to the output variable reports a syntax error.
struct A {
string aa;
string bb;
};
struct B {
string cc[100];
string dd;
};
// doesn't work
void mx_elementAt(B in, int index, output A out)
{
out = { in.cc[index], in.dd };
}
// works
// void mx_elementAt(B in, int index, output A out)
// {
// A tmp = { in.cc[index], in.dd };
// out = tmp;
// }
shader test
(
B in = {{""}, ""},
int index = 0,
output A out = {"", ""}
)
{
A a = A ("", "");
mx_elementAt(in, index, a);
out = a;
}
Problem
Initializer lists are not allowed as function arguments, would be nice if they were, and would possibly simplify some of the MaterialX code base for OSL code generation.
Expected behavior:
I expected this to compile just fine...
Actual behavior:
But it didn't... I get the following compile error.
Steps to Reproduce
Versions
The text was updated successfully, but these errors were encountered: