diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-12 23:46:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-12 23:46:27 +0400 |
commit | 460bb787e2b6ed539f342c6ceeaaa49877297b2e (patch) | |
tree | feb8592d8e4e672de78faf41a842006f3fdc8fd9 /source/blender/editors/uvedit/uvedit_unwrap_ops.c | |
parent | 889a940ceff6c0f00f328a95c9314883d77f25e0 (diff) |
minor speedup for construct_param_handle_subsurfed() break out of texface_from_original_index() early and dont get the offset for each vertex.
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_unwrap_ops.c')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index fd8b6233817..183d76a0892 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -367,19 +367,17 @@ static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh } -static void texface_from_original_index(BMFace *efa, int index, float **uv, ParamBool *pin, ParamBool *select, Scene *scene, BMEditMesh *em) +static void texface_from_original_index(BMFace *efa, int index, float **uv, ParamBool *pin, ParamBool *select, + Scene *scene, BMEditMesh *em, const int cd_loop_uv_offset) { BMLoop *l; BMIter liter; MLoopUV *luv; - const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); - *uv = NULL; *pin = 0; *select = 1; - if (index == ORIGINDEX_NONE) return; @@ -389,6 +387,7 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para *uv = luv->uv; *pin = (luv->flag & MLOOPUV_PINNED) ? 1 : 0; *select = (uvedit_uv_select_test(em, scene, l) != 0); + break; } } } @@ -424,6 +423,8 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B /* similar to the above, we need a way to map edges to their original ones */ BMEdge **edgeMap; + const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + handle = param_construct_begin(); if (correct_aspect) { @@ -512,10 +513,10 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B /* This is where all the magic is done. If the vertex exists in the, we pass the original uv pointer to the solver, thus * flushing the solution to the edit mesh. */ - texface_from_original_index(origFace, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene, em); - texface_from_original_index(origFace, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene, em); - texface_from_original_index(origFace, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene, em); - texface_from_original_index(origFace, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene, em); + texface_from_original_index(origFace, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene, em, cd_loop_uv_offset); + texface_from_original_index(origFace, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene, em, cd_loop_uv_offset); + texface_from_original_index(origFace, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene, em, cd_loop_uv_offset); + texface_from_original_index(origFace, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene, em, cd_loop_uv_offset); param_face_add(handle, key, 4, vkeys, co, uv, pin, select); } |