Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_collision.c
| Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | static void deformVerts(ModifierData *md, | ||||
| float (*vertexCos)[3], | float (*vertexCos)[3], | ||||
| int numVerts) | int numVerts) | ||||
| { | { | ||||
| CollisionModifierData *collmd = (CollisionModifierData *)md; | CollisionModifierData *collmd = (CollisionModifierData *)md; | ||||
| Mesh *mesh_src; | Mesh *mesh_src; | ||||
| MVert *tempVert = NULL; | MVert *tempVert = NULL; | ||||
| Object *ob = ctx->object; | Object *ob = ctx->object; | ||||
| /* If collision is disabled, free the stale data and exit. */ | |||||
| if (!ob->pd || !ob->pd->deflect) { | |||||
| if (!ob->pd) { | |||||
| printf("CollisionModifier: collision settings are missing!\n"); | |||||
| } | |||||
| freeData(md); | |||||
| return; | |||||
| } | |||||
| if (mesh == NULL) { | if (mesh == NULL) { | ||||
| mesh_src = MOD_deform_mesh_eval_get(ob, NULL, NULL, NULL, numVerts, false, false); | mesh_src = MOD_deform_mesh_eval_get(ob, NULL, NULL, NULL, numVerts, false, false); | ||||
| } | } | ||||
| else { | else { | ||||
| /* Not possible to use get_mesh() in this case as we'll modify its vertices | /* Not possible to use get_mesh() in this case as we'll modify its vertices | ||||
| * and get_mesh() would return 'mesh' directly. */ | * and get_mesh() would return 'mesh' directly. */ | ||||
| mesh_src = (Mesh *)BKE_id_copy_ex(NULL, (ID *)mesh, NULL, LIB_ID_COPY_LOCALIZE); | mesh_src = (Mesh *)BKE_id_copy_ex(NULL, (ID *)mesh, NULL, LIB_ID_COPY_LOCALIZE); | ||||
| } | } | ||||
| if (!ob->pd) { | |||||
| printf("CollisionModifier deformVerts: Should not happen!\n"); | |||||
| return; | |||||
| } | |||||
| if (mesh_src) { | if (mesh_src) { | ||||
| float current_time = 0; | float current_time = 0; | ||||
| uint mvert_num = 0; | uint mvert_num = 0; | ||||
| BKE_mesh_vert_coords_apply(mesh_src, vertexCos); | BKE_mesh_vert_coords_apply(mesh_src, vertexCos); | ||||
| BKE_mesh_calc_normals(mesh_src); | BKE_mesh_calc_normals(mesh_src); | ||||
| current_time = DEG_get_ctime(ctx->depsgraph); | current_time = DEG_get_ctime(ctx->depsgraph); | ||||
| ▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines | |||||