Cycles: add "From Dupli" option for texture coordinate node. This gets the

Generated and UV coordinates from the duplicator of instance instead of the
object itself.

This was used in e.g. Big Buck Bunny for texturing instanced feathers with
a UV map on the bird. Many files changed, mainly to do some refactoring to
get rid of G.rendering global in duplilist code.
This commit is contained in:
2012-10-04 21:40:39 +00:00
parent 984e9f9cc8
commit fedc8e1722
32 changed files with 222 additions and 80 deletions

View File

@@ -194,8 +194,10 @@ void BlenderSync::sync_background_light()
/* Object */
void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag, int motion, int particle_id)
void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, int motion, int particle_id)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
/* light is handled separately */
if(object_is_light(b_ob)) {
if(!motion)
@@ -274,6 +276,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
object->visibility &= ~PATH_RAY_CAMERA;
}
if (b_dupli_ob) {
object->dupli_generated = get_float3(b_dupli_ob.orco());
object->dupli_uv = get_float2(b_dupli_ob.uv());
}
else {
object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
object->dupli_uv = make_float2(0.0f, 0.0f);
}
object->particle_id = particle_id;
object->tag_update(scene);
@@ -328,7 +339,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
if(!(b_dup->hide() || dup_hide)) {
sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer, motion, b_dup->particle_index() + particle_offset);
sync_object(*b_ob, b_index, *b_dup, tfm, ob_layer, motion, b_dup->particle_index() + particle_offset);
}
++b_index;
@@ -346,7 +357,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer, motion, 0);
sync_object(*b_ob, 0, PointerRNA_NULL, tfm, ob_layer, motion, 0);
}
particle_offset += num_particles;