Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/DerivedMesh.c
| Show First 20 Lines • Show All 1,508 Lines • ▼ Show 20 Lines | static void mesh_calc_modifiers(struct Depsgraph *depsgraph, | ||||
| for (md = firstmd; md; md = md->next) { | for (md = firstmd; md; md = md->next) { | ||||
| modifier_freeTemporaryData(md); | modifier_freeTemporaryData(md); | ||||
| } | } | ||||
| /* Yay, we are done. If we have a Mesh and deformed vertices | /* Yay, we are done. If we have a Mesh and deformed vertices | ||||
| * need to apply these back onto the Mesh. If we have no | * need to apply these back onto the Mesh. If we have no | ||||
| * Mesh then we need to build one. */ | * Mesh then we need to build one. */ | ||||
| if (mesh_final == NULL) { | if (mesh_final == NULL) { | ||||
| if (deformed_verts == NULL) { | |||||
| mesh_final = mesh_input; | |||||
| } | |||||
| else { | |||||
| mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); | mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); | ||||
| } | } | ||||
| } | |||||
| if (deformed_verts) { | if (deformed_verts) { | ||||
| BKE_mesh_apply_vert_coords(mesh_final, deformed_verts); | BKE_mesh_apply_vert_coords(mesh_final, deformed_verts); | ||||
| MEM_freeN(deformed_verts); | MEM_freeN(deformed_verts); | ||||
| deformed_verts = NULL; | deformed_verts = NULL; | ||||
| } | } | ||||
| /* Add orco coordinates to final and deformed mesh if requested. */ | /* Add orco coordinates to final and deformed mesh if requested. */ | ||||
| if (dataMask->vmask & CD_MASK_ORCO) { | if (dataMask->vmask & CD_MASK_ORCO) { | ||||
| if (mesh_final != mesh_input) { | |||||
| add_orco_mesh(ob, NULL, mesh_final, mesh_orco, CD_ORCO); | add_orco_mesh(ob, NULL, mesh_final, mesh_orco, CD_ORCO); | ||||
| } | |||||
| if (mesh_deform) { | if (mesh_deform) { | ||||
| add_orco_mesh(ob, NULL, mesh_deform, NULL, CD_ORCO); | add_orco_mesh(ob, NULL, mesh_deform, NULL, CD_ORCO); | ||||
| } | } | ||||
| } | } | ||||
| if (mesh_orco) { | if (mesh_orco) { | ||||
| BKE_id_free(NULL, mesh_orco); | BKE_id_free(NULL, mesh_orco); | ||||
| } | } | ||||
| if (mesh_orco_cloth) { | if (mesh_orco_cloth) { | ||||
| BKE_id_free(NULL, mesh_orco_cloth); | BKE_id_free(NULL, mesh_orco_cloth); | ||||
| } | } | ||||
| /* Compute normals. */ | /* Compute normals. */ | ||||
| if (mesh_final != mesh_input) { | |||||
| mesh_calc_modifier_final_normals(mesh_input, dataMask, sculpt_dyntopo, mesh_final); | mesh_calc_modifier_final_normals(mesh_input, dataMask, sculpt_dyntopo, mesh_final); | ||||
| } | |||||
| /* Return final mesh */ | /* Return final mesh */ | ||||
| *r_final = mesh_final; | *r_final = mesh_final; | ||||
| if (r_deform) { | if (r_deform) { | ||||
| *r_deform = mesh_deform; | *r_deform = mesh_deform; | ||||
| } | } | ||||
| } | } | ||||
| float (*editbmesh_get_vertex_cos(BMEditMesh *em, int *r_numVerts))[3] | float (*editbmesh_get_vertex_cos(BMEditMesh *em, int *r_numVerts))[3] | ||||
| { | { | ||||
| BMIter iter; | BMIter iter; | ||||
| BMVert *eve; | BMVert *eve; | ||||
| float(*cos)[3]; | float(*cos)[3]; | ||||
| int i; | int i; | ||||
| *r_numVerts = em->bm->totvert; | *r_numVerts = em->bm->totvert; | ||||
| cos = MEM_malloc_arrayN(em->bm->totvert, 3 * sizeof(float), "vertexcos"); | cos = MEM_malloc_arrayN(em->bm->totvert, 3 * sizeof(float), "vertexcos"); | ||||
mont29: This can be put above (in block defined by lines 1579-1581) I think? ;) | |||||
Done Inline ActionsProbably, but then it's not "Compute normals" anymore. However, the block inside of mutex is already not really just-a-normals =\ sergey: Probably, but then it's not "Compute normals" anymore. However, the block inside of mutex is… | |||||
| BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) { | BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) { | ||||
| copy_v3_v3(cos[i], eve->co); | copy_v3_v3(cos[i], eve->co); | ||||
| } | } | ||||
| return cos; | return cos; | ||||
| } | } | ||||
| bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, bool has_prev_mesh) | bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, bool has_prev_mesh) | ||||
| ▲ Show 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | if (r_cage) { | ||||
| *r_cage = mesh_cage; | *r_cage = mesh_cage; | ||||
| } | } | ||||
| } | } | ||||
| static void mesh_finalize_eval(Object *object) | static void mesh_finalize_eval(Object *object) | ||||
| { | { | ||||
| Mesh *mesh = (Mesh *)object->data; | Mesh *mesh = (Mesh *)object->data; | ||||
| Mesh *mesh_eval = object->runtime.mesh_eval; | Mesh *mesh_eval = object->runtime.mesh_eval; | ||||
| if (mesh_eval == mesh) { | |||||
| return; | |||||
| } | |||||
| /* Special Tweaks for cases when evaluated mesh came from | /* Special Tweaks for cases when evaluated mesh came from | ||||
| * BKE_mesh_new_nomain_from_template(). | * BKE_mesh_new_nomain_from_template(). | ||||
| */ | */ | ||||
| BLI_strncpy(mesh_eval->id.name, mesh->id.name, sizeof(mesh_eval->id.name)); | BLI_strncpy(mesh_eval->id.name, mesh->id.name, sizeof(mesh_eval->id.name)); | ||||
| if (mesh_eval->mat != NULL) { | if (mesh_eval->mat != NULL) { | ||||
| MEM_freeN(mesh_eval->mat); | MEM_freeN(mesh_eval->mat); | ||||
| } | } | ||||
| /* Set flag which makes it easier to see what's going on in a debugger. */ | /* Set flag which makes it easier to see what's going on in a debugger. */ | ||||
| ▲ Show 20 Lines • Show All 712 Lines • Show Last 20 Lines | |||||
This can be put above (in block defined by lines 1579-1581) I think? ;)