Custom properties defined on objects are not accessible from the
attribute node when rendering a volume in Cycles. This appears to be
caused by ShaderData.type not being setup in shader_eval_volume,
which makes primitive_surface_attribute_float4 return a zero value.
(Object attributes are always of type float4 as the code in
blender_object.cpp does not attempt to discriminate the actual type.)
To fix this, I added a primitive type for volumes (PRIMITIVE_VOLUME)
which is used to initialized ShaderData.type.
primitive_surface_attribute_float4 then uses this information to
dispatch a call to volume_attribute_float4 which will then check
the attribute element type to choose the lookup function.
This may have some slight performance penalties, as checking the
attribute element type will be done multiple times, every existing
calls to volume_attribute_float4 already check if we have
ATTR_ELEM_VOXEL. I haven't checked this.