diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-23 03:53:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-23 03:55:40 +0400 |
commit | 7b8622457ba06b60320bb2e3c8e0a908b1b17d60 (patch) | |
tree | c723acf9f661a1bf5dd99386153e1539e0960551 /source/blender/blenkernel/intern/anim.c | |
parent | 98ed7fa2db1c98bcb63293b3032b67c1c0575bb8 (diff) |
Dupliverts: avoid calculating normals if not used
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 9226538910c..1624a02e773 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -943,6 +943,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3], static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[4][4], int persistent_id[MAX_DUPLI_RECUR], int level, short flag) { + const bool use_rotation = (par->transflag & OB_DUPLIROT) != 0; Object *ob, *ob_iter; Mesh *me = par->data; Base *base = NULL; @@ -1034,14 +1035,19 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl if (ob->type != OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */ if (me->edit_btmesh) { - dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void *) &vdd, DM_FOREACH_USE_NORMAL); + dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void *) &vdd, + use_rotation ? DM_FOREACH_USE_NORMAL : 0); } else { + const float *no_pt = use_rotation ? no : NULL; for (a = 0; a < totvert; a++) { dm->getVertCo(dm, a, vec); - dm->getVertNo(dm, a, no); + + if (use_rotation) { + dm->getVertNo(dm, a, no); + } - vertex_dupli__mapFunc(&vdd, a, vec, no, NULL); + vertex_dupli__mapFunc(&vdd, a, vec, no_pt, NULL); } } if (sce) { |