Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_solidify_extrude.c
| Context not available. | |||||
| const bool do_clamp = (smd->offset_clamp != 0.0f); | const bool do_clamp = (smd->offset_clamp != 0.0f); | ||||
| const bool do_angle_clamp = do_clamp && (smd->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP) != 0; | const bool do_angle_clamp = do_clamp && (smd->flag & MOD_SOLIDIFY_OFFSET_ANGLE_CLAMP) != 0; | ||||
| const bool do_bevel_convex = bevel_convex != 0.0f; | const bool do_bevel_convex = bevel_convex != 0.0f; | ||||
| const bool do_shell = ((smd->flag & MOD_SOLIDIFY_RIM) && (smd->flag & MOD_SOLIDIFY_NOSHELL)) == | const bool do_rim = (smd->flag & MOD_SOLIDIFY_RIM); | ||||
mont29: `== 0` is **very** important when assigning a bitflag check to a bool, since you have no other… | |||||
| 0; | const bool do_shell = (do_rim && (smd->flag & MOD_SOLIDIFY_NOSHELL)) == 0; | ||||
mont29Unsubmitted Not Done Inline Actionsand this is wrong too actually, == 0 should only concern the bitwise &, not the boolean &&. mont29: and this is wrong too actually, `== 0` should only concern the bitwise `&`, not the boolean… | |||||
| /* weights */ | /* weights */ | ||||
| MDeformVert *dvert; | MDeformVert *dvert; | ||||
| Context not available. | |||||
| STACK_INIT(new_vert_arr, numVerts * 2); | STACK_INIT(new_vert_arr, numVerts * 2); | ||||
| STACK_INIT(new_edge_arr, numEdges * 2); | STACK_INIT(new_edge_arr, numEdges * 2); | ||||
| if (smd->flag & MOD_SOLIDIFY_RIM) { | if (do_rim) { | ||||
| BLI_bitmap *orig_mvert_tag = BLI_BITMAP_NEW(numVerts, __func__); | BLI_bitmap *orig_mvert_tag = BLI_BITMAP_NEW(numVerts, __func__); | ||||
| uint eidx; | uint eidx; | ||||
| uint i; | uint i; | ||||
| Context not available. | |||||
| medge = result->medge; | medge = result->medge; | ||||
| mvert = result->mvert; | mvert = result->mvert; | ||||
| if (do_bevel_convex) { | |||||
| /* Make sure bweight is enabled. */ | |||||
| result->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT; | |||||
| } | |||||
| if (do_shell) { | if (do_shell) { | ||||
| CustomData_copy_data(&mesh->vdata, &result->vdata, 0, 0, (int)numVerts); | CustomData_copy_data(&mesh->vdata, &result->vdata, 0, 0, (int)numVerts); | ||||
| CustomData_copy_data(&mesh->vdata, &result->vdata, 0, (int)numVerts, (int)numVerts); | CustomData_copy_data(&mesh->vdata, &result->vdata, 0, (int)numVerts, (int)numVerts); | ||||
| Context not available. | |||||
| } | } | ||||
| if (do_bevel_convex) { | if (do_bevel_convex) { | ||||
| edge_angs = MEM_malloc_arrayN(numEdges, sizeof(float), "edge_angs"); | edge_angs = MEM_malloc_arrayN(numEdges, sizeof(float), "edge_angs"); | ||||
| if (!do_rim) { | |||||
| edge_users = MEM_malloc_arrayN(numEdges, sizeof(*edge_users), "solid_mod edges"); | |||||
| } | |||||
| } | } | ||||
| uint(*edge_user_pairs)[2] = MEM_malloc_arrayN( | uint(*edge_user_pairs)[2] = MEM_malloc_arrayN( | ||||
| numEdges, sizeof(*edge_user_pairs), "edge_user_pairs"); | numEdges, sizeof(*edge_user_pairs), "edge_user_pairs"); | ||||
| Context not available. | |||||
| } | } | ||||
| if (do_bevel_convex) { | if (do_bevel_convex) { | ||||
| edge_angs[i] = angle; | edge_angs[i] = angle; | ||||
| if (!do_rim) { | |||||
| edge_users[i] = INVALID_PAIR; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!do_rim) { | |||||
| MEM_freeN(edge_users); | |||||
| } | |||||
| MEM_freeN(edge_angs); | MEM_freeN(edge_angs); | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| if (do_bevel_convex) { | if (do_bevel_convex) { | ||||
| edge_angs = MEM_malloc_arrayN(numEdges, sizeof(float), "edge_angs even"); | edge_angs = MEM_malloc_arrayN(numEdges, sizeof(float), "edge_angs even"); | ||||
| if (!do_rim) { | |||||
| edge_users = MEM_malloc_arrayN(numEdges, sizeof(*edge_users), "solid_mod edges"); | |||||
| } | |||||
| } | } | ||||
| uint(*edge_user_pairs)[2] = MEM_malloc_arrayN( | uint(*edge_user_pairs)[2] = MEM_malloc_arrayN( | ||||
| numEdges, sizeof(*edge_user_pairs), "edge_user_pairs"); | numEdges, sizeof(*edge_user_pairs), "edge_user_pairs"); | ||||
| Context not available. | |||||
| sub_v3_v3v3(e, orig_mvert[ed->v1].co, orig_mvert[ed->v2].co); | sub_v3_v3v3(e, orig_mvert[ed->v1].co, orig_mvert[ed->v2].co); | ||||
| normalize_v3(e); | normalize_v3(e); | ||||
| edge_angs[i] = angle_signed_on_axis_v3v3_v3(n0, n1, e); | edge_angs[i] = angle_signed_on_axis_v3v3_v3(n0, n1, e); | ||||
| if (!do_rim) { | |||||
| edge_users[i] = INVALID_PAIR; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!do_rim) { | |||||
| MEM_freeN(edge_users); | |||||
| } | |||||
| MEM_freeN(edge_angs); | MEM_freeN(edge_angs); | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| /* must recalculate normals with vgroups since they can displace unevenly [#26888] */ | /* must recalculate normals with vgroups since they can displace unevenly [#26888] */ | ||||
| if ((mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) || (smd->flag & MOD_SOLIDIFY_RIM) || dvert) { | if ((mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) || do_rim || dvert) { | ||||
| result->runtime.cd_dirty_vert |= CD_MASK_NORMAL; | result->runtime.cd_dirty_vert |= CD_MASK_NORMAL; | ||||
| } | } | ||||
| else if (do_shell) { | else if (do_shell) { | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (smd->flag & MOD_SOLIDIFY_RIM) { | if (do_rim) { | ||||
| uint i; | uint i; | ||||
| /* bugger, need to re-calculate the normals for the new edge faces. | /* bugger, need to re-calculate the normals for the new edge faces. | ||||
| Context not available. | |||||
== 0 is very important when assigning a bitflag check to a bool, since you have no other boolean operation. Otherwise, result is of type of the flag storage, and assigning to a bool will overflow in some cases (and you will get some wrong result then).