diff options
Diffstat (limited to 'source/blender/blenkernel/intern/shrinkwrap.c')
-rw-r--r-- | source/blender/blenkernel/intern/shrinkwrap.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 7a9ccc66824..3cd2131c22b 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -378,10 +378,12 @@ static void shrinkwrap_calc_nearest_vertex_cb_ex(void *__restrict userdata, * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex * so we can initiate the "nearest.dist" with the expected value to that last hit. * This will lead in pruning of the search tree. */ - if (nearest->index != -1) + if (nearest->index != -1) { nearest->dist_sq = len_squared_v3v3(tmp_co, nearest->co); - else + } + else { nearest->dist_sq = FLT_MAX; + } BLI_bvhtree_find_nearest(treeData->tree, tmp_co, nearest, treeData->nearest_callback, treeData); @@ -647,23 +649,28 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) /* If the user doesn't allows to project in any direction of projection axis * then there's nothing todo. */ if ((calc->smd->shrinkOpts & - (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0) + (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0) { return; + } /* Prepare data to retrieve the direction in which we should project each vertex */ if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) { - if (calc->vert == NULL) + if (calc->vert == NULL) { return; + } } else { /* The code supports any axis that is a combination of X,Y,Z * although currently UI only allows to set the 3 different axis */ - if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) + if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) { proj_axis[0] = 1.0f; - if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) + } + if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) { proj_axis[1] = 1.0f; - if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) + } + if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) { proj_axis[2] = 1.0f; + } normalize_v3(proj_axis); @@ -675,8 +682,9 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) if (calc->aux_target) { auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, false); - if (!auxMesh) + if (!auxMesh) { return; + } BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->aux_target); } @@ -1036,8 +1044,9 @@ static void mesh_looptri_target_project(void *userdata, nearest->dist_sq); #endif - if (dist_sq >= nearest->dist_sq) + if (dist_sq >= nearest->dist_sq) { return; + } /* Decode normals */ normal_short_to_float_v3(vtri_no[0], vtri[0]->no); @@ -1146,8 +1155,9 @@ static void shrinkwrap_calc_nearest_surface_point_cb_ex(void *__restrict userdat nearest->dist_sq = len_squared_v3v3(tmp_co, nearest->co); } } - else + else { nearest->dist_sq = FLT_MAX; + } BKE_shrinkwrap_find_nearest_surface(data->tree, nearest, tmp_co, calc->smd->shrinkType); @@ -1375,10 +1385,12 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData; /* remove loop dependencies on derived meshes (TODO should this be done elsewhere?) */ - if (smd->target == ob) + if (smd->target == ob) { smd->target = NULL; - if (smd->auxTarget == ob) + } + if (smd->auxTarget == ob) { smd->auxTarget = NULL; + } /* Configure Shrinkwrap calc data */ calc.smd = smd; @@ -1461,6 +1473,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, } /* free memory */ - if (ss_mesh) + if (ss_mesh) { ss_mesh->release(ss_mesh); + } } |