OSL getattribute() Crash

Hi,
Trying to run this:


shader testShader(
output color c = color (0,0,0))
{
    c = color(1,0,1);
    vector tmp;
    getattribute("Cube","geom:location",tmp);
}

file: getattribute_crash.blend (547 KB)

It compiles ok, but if you turn on cycles-viewport or try to render blender crash. I have tried different string functions according to my understanding of this:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL#Attributes

blender version 2.7, mac osx 10.8.3
Does someone else get the same behaviour? Workaround?

Attachments

getattribute_bug.blend (547 KB)

Hi - I think a few people have had troubles with getattribute.

There is a work around to get all sorts of data into your shader however.

There’s a demo of this here: http://youtu.be/mf69t-hKxVk starting at the 12:12 mark.

The gist of it is written below.

For example, to get the position of some object into your shader as a vector, use three Input Value nodes and a CombineRGB node to transform the three values into a vector (to feed to your shader). Assign drivers to each Value node by right clicking in the Value field abs selecting “Add Driver”. Then - in the Graph editor, select Drivers, open the properties pane (N key), scroll down, and enter the text “VAR” (without the quotes) into the Expr: field (expression). Next, from the Ob/Bone drop down combo box, select the object that you want the position of (e.g. the Cube). Then, from the Type combo box, select the attribute you want to ‘drive’ into the shader (e.g. X Location). Repeat these steps for the other Value nodes.

:slight_smile: D