diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-21 16:52:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-21 16:52:28 +0400 |
commit | c3e1fce77552b5626d2939710cb6d0020891d218 (patch) | |
tree | 5d59df38ec009f21000a959531129aa511868773 /intern/cycles/blender | |
parent | ea11bc980ad428950efb430618a6de439ffd5951 (diff) |
Cycles: add Object Info node, with outputs object location, object/material
pass index, and a random number unique to the instance of the object.
This can be useful to give some variation to a single material assigned to
multiple instances, either manually controlled through the object index, based
on the object location, or randomized for each instance.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Object_Info
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 641aa88d6ef..405c7eada1d 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -245,6 +245,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, /* object sync */ if(object_updated || (object->mesh && object->mesh->need_update)) { object->name = b_ob.name().c_str(); + object->instance_id = b_index; object->pass_id = b_ob.pass_index(); object->tfm = tfm; object->motion.pre = tfm; diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index b33de789631..59eeb25ed74 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -334,6 +334,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader node = new LightFalloffNode(); break; } + case BL::ShaderNode::type_OBJECT_INFO: { + node = new ObjectInfoNode(); + break; + } case BL::ShaderNode::type_TEX_IMAGE: { BL::ShaderNodeTexImage b_image_node(b_node); BL::Image b_image(b_image_node.image()); |