Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 01:40:39 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-05 01:40:39 +0400
commitfedc8e17223cc5490d465788cac211328a712e5f (patch)
tree78fa4eb2ab6a50cc29dcb411272c71b24d971568 /intern/cycles/blender
parent984e9f9cc8eee131c6602b326e588d2903eda90a (diff)
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.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/blender_object.cpp17
-rw-r--r--intern/cycles/blender/blender_shader.cpp5
-rw-r--r--intern/cycles/blender/blender_sync.h2
-rw-r--r--intern/cycles/blender/blender_util.h4
4 files changed, 21 insertions, 7 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 8fbb223cbc5..27301026d35 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -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;
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index ebf8bb45420..b6d5cc623bb 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -490,7 +490,10 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
break;
}
case BL::ShaderNode::type_TEX_COORD: {
- node = new TextureCoordinateNode();
+ BL::ShaderNodeTexCoord b_tex_coord_node(b_node);
+ TextureCoordinateNode *tex_coord = new TextureCoordinateNode();
+ tex_coord->from_dupli = b_tex_coord_node.from_dupli();
+ node = tex_coord;
break;
}
case BL::ShaderNode::type_TEX_SKY: {
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 27f6b6ee4ee..ce563087b4a 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -81,7 +81,7 @@ private:
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
- void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag, int motion, int particle_id);
+ void sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, int motion, int particle_id);
void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
void sync_background_light();
void sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion);
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 46fbead9bc1..da8f30ea169 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -36,7 +36,7 @@ struct RenderResult;
ID *rna_Object_to_mesh(void *_self, void *reports, void *scene, int apply_modifiers, int settings);
void rna_Main_meshes_remove(void *bmain, void *reports, void *mesh);
-void rna_Object_create_duplilist(void *ob, void *reports, void *sce);
+void rna_Object_create_duplilist(void *ob, void *reports, void *sce, int settings);
void rna_Object_free_duplilist(void *ob);
void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values);
void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
@@ -84,7 +84,7 @@ static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh)
static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
{
- rna_Object_create_duplilist(self.ptr.data, NULL, scene.ptr.data);
+ rna_Object_create_duplilist(self.ptr.data, NULL, scene.ptr.data, 2);
}
static inline void object_free_duplilist(BL::Object self)