Fix T41276: OSL bug in getmessage ("trace", "geom:name" , output)
This commit is contained in:
parent
5efa7fa534
commit
a192facd8c
Notes:
blender-bot
2023-02-14 10:16:32 +01:00
Referenced by issue #41276, OSL bug in getmessage ("trace", "geom:name" , output) and possible fix
|
@ -479,7 +479,7 @@ static bool set_attribute_int(int i, TypeDesc type, bool derivatives, void *val)
|
|||
|
||||
static bool set_attribute_string(ustring str, TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
if(type.basetype == TypeDesc::INT && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
|
||||
if(type.basetype == TypeDesc::STRING && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
|
||||
ustring *sval = (ustring *)val;
|
||||
sval[0] = str;
|
||||
|
||||
|
@ -758,6 +758,12 @@ bool OSLRenderServices::get_attribute(OSL::ShaderGlobals *sg, bool derivatives,
|
|||
return false;
|
||||
|
||||
ShaderData *sd = (ShaderData *)(sg->renderstate);
|
||||
return get_attribute(sd, derivatives, object_name, type, name, val);
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_attribute(ShaderData *sd, bool derivatives, ustring object_name,
|
||||
TypeDesc type, ustring name, void *val)
|
||||
{
|
||||
KernelGlobals *kg = sd->osl_globals;
|
||||
bool is_curve;
|
||||
int object;
|
||||
|
@ -1100,7 +1106,7 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri
|
|||
return set_attribute_float(f, type, derivatives, val);
|
||||
}
|
||||
|
||||
return get_attribute(sg, derivatives, u_empty, type, name, val);
|
||||
return get_attribute(sd, derivatives, u_empty, type, name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
int index, void *val);
|
||||
bool get_attribute(OSL::ShaderGlobals *sg, bool derivatives, ustring object,
|
||||
TypeDesc type, ustring name, void *val);
|
||||
bool get_attribute(ShaderData *sd, bool derivatives, ustring object_name,
|
||||
TypeDesc type, ustring name, void *val);
|
||||
|
||||
bool get_userdata(bool derivatives, ustring name, TypeDesc type,
|
||||
OSL::ShaderGlobals *sg, void *val);
|
||||
|
|
Loading…
Reference in New Issue