Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/tools/bmesh_bevel.c
| Context not available. | |||||
| else if (bp->vertex_only) { | else if (bp->vertex_only) { | ||||
| /* Weight has already been applied to bv->offset, if present. | /* Weight has already been applied to bv->offset, if present. | ||||
| * Transfer to e->offset_[lr]_spec and treat percent as special case */ | * Transfer to e->offset_[lr]_spec and treat percent as special case */ | ||||
| if (bp->offset_type == BEVEL_AMT_PERCENT) { | float edge_dir[3]; | ||||
| v2 = BM_edge_other_vert(e->e, bv->v); | switch (bp->offset_type) { | ||||
| e->offset_l_spec = BM_edge_calc_length(e->e) * bv->offset / 100.0f; | case BEVEL_AMT_OFFSET: | ||||
| } | e->offset_l_spec = bv->offset; | ||||
| else { | break; | ||||
| e->offset_l_spec = bv->offset; | case BEVEL_AMT_WIDTH: | ||||
| v2 = BM_edge_other_vert(e->e, bv->v); | |||||
| sub_v3_v3v3(edge_dir, bv->v->co, v2->co); | |||||
| normalize_v3(edge_dir); | |||||
| z = fabsf(2.0f * sinf((float)M_PI - angle_normalized_v3v3(bv->v->no, edge_dir))); | |||||
| if (z < BEVEL_EPSILON) { | |||||
| e->offset_l_spec = 0.01f * bp->offset; /* undefined behavior, so tiny bevel */ | |||||
| } | |||||
| else { | |||||
| e->offset_l_spec = bp->offset / z; | |||||
| } | |||||
| break; | |||||
| case BEVEL_AMT_DEPTH: | |||||
| v2 = BM_edge_other_vert(e->e, bv->v); | |||||
| sub_v3_v3v3(edge_dir, bv->v->co, v2->co); | |||||
| normalize_v3(edge_dir); | |||||
| z = fabsf(cosf((float)M_PI - angle_normalized_v3v3(bv->v->no, edge_dir))); | |||||
| if (z < BEVEL_EPSILON) { | |||||
| e->offset_l_spec = 0.01f * bp->offset; /* undefined behavior, so tiny bevel */ | |||||
| } | |||||
| else { | |||||
| e->offset_l_spec = bp->offset / z; | |||||
| } | |||||
| break; | |||||
| case BEVEL_AMT_PERCENT: | |||||
| e->offset_l_spec = BM_edge_calc_length(e->e) * bv->offset / 100.0f; | |||||
| break; | |||||
| } | } | ||||
| e->offset_r_spec = e->offset_l_spec; | e->offset_r_spec = e->offset_l_spec; | ||||
| } | } | ||||
| Context not available. | |||||