diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-09 16:43:40 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-09 16:43:40 +0400 |
commit | 98fab9e530bae7c031701aed3e5140494470f850 (patch) | |
tree | 0ab8ef86ac4b82d764c5203393a8c76fa0785787 | |
parent | 55e55e21b0a6ae65da20a4449d87b4a29cc0ed88 (diff) |
Fix #33454: cycles wasn't hiding the original object used for dupliverts or
duplifaces like blender internal.
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 24 |
3 files changed, 43 insertions, 12 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 95263ebe463..38f27bcf2af 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -310,6 +310,13 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P return object; } +static bool object_dupli_hide_original(BL::Object::dupli_type_enum dupli_type) +{ + return (dupli_type == BL::Object::dupli_type_VERTS || + dupli_type == BL::Object::dupli_type_FACES || + dupli_type == BL::Object::dupli_type_FRAMES); +} + /* Object Loop */ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) @@ -371,6 +378,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) emitter_hide = false; } + /* hide original object for duplis */ + BL::Object parent = b_dup_ob.parent(); + if(parent && object_dupli_hide_original(parent.dupli_type())) + if(b_dup->type() == BL::DupliObject::type_GROUP) + dup_hide = true; + if(!(b_dup->hide() || dup_hide || emitter_hide)) { /* the persistent_id allows us to match dupli objects * between frames and updates */ @@ -399,10 +412,14 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) /* check if we should render or hide particle emitter */ BL::Object::particle_systems_iterator b_psys; - for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) { + for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) if(b_psys->settings().use_render_emitter()) hide = false; - } + + /* hide original object for duplis */ + BL::Object parent = b_ob->parent(); + if(parent && object_dupli_hide_original(parent.dupli_type())) + hide = true; if(!hide) { /* object itself */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index f5c0660371b..9a2462e9724 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1257,6 +1257,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p float (*obmat)[4], (*oldobmat)[4]; int a, b, hair = 0; int totpart, totchild, totgroup = 0 /*, pa_num */; + int dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene); int no_draw_flag = PARS_UNEXIST; @@ -1474,6 +1475,13 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p } } else { + int dupli_type = OB_DUPLIPARTS; + + /* blender internal needs this to be set to dupligroup to render + * groups correctly, but we don't want this hack for cycles */ + if(dupli_type_hack && GS(id->name) == ID_GR) + dupli_type = OB_DUPLIGROUP; + /* to give ipos in object correct offset */ BKE_object_where_is_calc_time(scene, ob, ctime - pa_time); @@ -1527,7 +1535,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p if (part->draw & PART_DRAW_GLOBAL_OB) add_v3_v3v3(mat[3], mat[3], vec); - dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED)); + dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, dupli_type, (flag & DUPLILIST_ANIMATED)); dob->particle_system = psys; copy_m4_m4(dob->omat, oldobmat); if (flag & DUPLILIST_FOR_RENDER) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index bd51af77b34..1d08ea97b79 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -94,6 +94,15 @@ static EnumPropertyItem parent_type_items[] = { {0, NULL, 0, NULL, NULL} }; +static EnumPropertyItem dupli_items[] = { + {0, "NONE", 0, "None", ""}, + {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"}, + {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"}, + {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"}, + {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"}, + {0, NULL, 0, NULL, NULL} +}; + static EnumPropertyItem collision_bounds_items[] = { {OB_BOUND_BOX, "BOX", 0, "Box", ""}, {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, @@ -2019,15 +2028,7 @@ static void rna_def_object(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dupli_items[] = { - {0, "NONE", 0, "None", ""}, - {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"}, - {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"}, - {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"}, - {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"}, - {0, NULL, 0, NULL, NULL} - }; - + /* XXX: this RNA enum define is currently duplicated for objects, * since there is some text here which is not applicable */ static EnumPropertyItem prop_rotmode_items[] = { @@ -2681,6 +2682,11 @@ static void rna_def_dupli_object(BlenderRNA *brna) RNA_def_property_array(prop, 2); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space"); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, dupli_items); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object"); } static void rna_def_object_base(BlenderRNA *brna) |