Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/constraint.c
| Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | if (em) { | ||||
| dm = CDDM_from_editbmesh(em, false, false); | dm = CDDM_from_editbmesh(em, false, false); | ||||
| freeDM = 1; | freeDM = 1; | ||||
| } | } | ||||
| else { | else { | ||||
| /* when not in EditMode, use the 'final' derived mesh, depsgraph | /* when not in EditMode, use the 'final' derived mesh, depsgraph | ||||
| * ensures we build with CD_MDEFORMVERT layer | * ensures we build with CD_MDEFORMVERT layer | ||||
| */ | */ | ||||
| dm = (DerivedMesh *)ob->derivedFinal; | dm = (DerivedMesh *)ob->derivedFinal; | ||||
| BLI_assert(dm != NULL); | |||||
| } | } | ||||
| /* only continue if there's a valid DerivedMesh */ | /* only continue if there's a valid DerivedMesh */ | ||||
| if (dm) { | if (dm) { | ||||
| MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); | MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); | ||||
| int numVerts = dm->getNumVerts(dm); | int numVerts = dm->getNumVerts(dm); | ||||
| int i; | int i; | ||||
| float co[3], nor[3]; | float co[3], nor[3]; | ||||
| ▲ Show 20 Lines • Show All 3,007 Lines • ▼ Show 20 Lines | if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) { | ||||
| SpaceTransform transform; | SpaceTransform transform; | ||||
| /* TODO(sergey): use proper for_render flag here when known. */ | /* TODO(sergey): use proper for_render flag here when known. */ | ||||
| DerivedMesh *target = object_get_derived_final(ct->tar, false); | DerivedMesh *target = object_get_derived_final(ct->tar, false); | ||||
| BVHTreeFromMesh treeData = {NULL}; | BVHTreeFromMesh treeData = {NULL}; | ||||
| unit_m4(ct->matrix); | unit_m4(ct->matrix); | ||||
| BLI_assert(target != NULL); | |||||
| if (target != NULL) { | if (target != NULL) { | ||||
| BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat); | BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat); | ||||
| switch (scon->shrinkType) { | switch (scon->shrinkType) { | ||||
| case MOD_SHRINKWRAP_NEAREST_SURFACE: | case MOD_SHRINKWRAP_NEAREST_SURFACE: | ||||
| case MOD_SHRINKWRAP_NEAREST_VERTEX: | case MOD_SHRINKWRAP_NEAREST_VERTEX: | ||||
| { | { | ||||
| BVHTreeNearest nearest; | BVHTreeNearest nearest; | ||||
| ▲ Show 20 Lines • Show All 659 Lines • ▼ Show 20 Lines | if (len > FLT_EPSILON) { | ||||
| copy_v3_v3(cob->matrix[3], disp); | copy_v3_v3(cob->matrix[3], disp); | ||||
| } | } | ||||
| if (data->depth_ob) { | if (data->depth_ob) { | ||||
| Object *depth_ob = data->depth_ob; | Object *depth_ob = data->depth_ob; | ||||
| /* TODO(sergey): use proper for_render flag here when known. */ | /* TODO(sergey): use proper for_render flag here when known. */ | ||||
| DerivedMesh *target = object_get_derived_final(depth_ob, false); | DerivedMesh *target = object_get_derived_final(depth_ob, false); | ||||
| BLI_assert(target != NULL); | |||||
| if (target) { | if (target) { | ||||
| BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh; | BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh; | ||||
| BVHTreeRayHit hit; | BVHTreeRayHit hit; | ||||
| float ray_start[3], ray_end[3], ray_nor[3], imat[4][4]; | float ray_start[3], ray_end[3], ray_nor[3], imat[4][4]; | ||||
| int result; | int result; | ||||
| invert_m4_m4(imat, depth_ob->obmat); | invert_m4_m4(imat, depth_ob->obmat); | ||||
| ▲ Show 20 Lines • Show All 785 Lines • Show Last 20 Lines | |||||