diff options
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 13 | ||||
-rw-r--r-- | intern/cycles/kernel/shaders/stdosl.h | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index d6e52e28c62..498d10f385b 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -634,11 +634,10 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri { KernelGlobals *kg = kernel_globals; ShaderData *sd = (ShaderData *)renderstate; - int object = sd->object; - int tri = sd->prim; + int object, tri; /* lookup of attribute on another object */ - if (object_name != u_empty) { + if (object_name != u_empty || sd == NULL) { OSLGlobals::ObjectNameMap::iterator it = kg->osl->object_name_map.find(object_name); if (it == kg->osl->object_name_map.end()) @@ -647,8 +646,12 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri object = it->second; tri = ~0; } - else if (object == ~0) { - return get_background_attribute(kg, sd, name, type, derivatives, val); + else { + object = sd->object; + tri = sd->prim; + + if (object == ~0) + return get_background_attribute(kg, sd, name, type, derivatives, val); } /* find attribute on object */ diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h index 6accf4556ea..69ca6b32c36 100644 --- a/intern/cycles/kernel/shaders/stdosl.h +++ b/intern/cycles/kernel/shaders/stdosl.h @@ -161,7 +161,6 @@ vector cross (vector a, vector b) BUILTIN; float dot (vector a, vector b) BUILTIN; float length (vector v) BUILTIN; float distance (point a, point b) BUILTIN; -float distance (point a, point b, point q) BUILTIN; normal normalize (normal v) BUILTIN; vector normalize (vector v) BUILTIN; vector faceforward (vector N, vector I, vector Nref) BUILTIN; |