Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/constraint.c
| Show First 20 Lines • Show All 6,317 Lines • ▼ Show 20 Lines | if (cti && cti->get_constraint_targets) { | ||||
| else { | else { | ||||
| for (ct = targets->first; ct; ct = ct->next) { | for (ct = targets->first; ct; ct = ct->next) { | ||||
| unit_m4(ct->matrix); | unit_m4(ct->matrix); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void BKE_constraint_custom_object_space_get(float r_mat[4][4], bConstraint *con) | /** Initialize the Custom Space matrix inside cob. */ | ||||
| void BKE_constraint_custom_object_space_init(bConstraintOb *cob, bConstraint *con) | |||||
| { | { | ||||
| if (!con || | if (con && con->space_object && is_custom_space_needed(con)) { | ||||
| (con->ownspace != CONSTRAINT_SPACE_CUSTOM && con->tarspace != CONSTRAINT_SPACE_CUSTOM)) { | |||||
| return; | |||||
| } | |||||
| bConstraintTarget *ct; | |||||
| ListBase target = {NULL, NULL}; | |||||
| SINGLETARGET_GET_TARS(con, con->space_object, con->space_subtarget, ct, &target); | |||||
| /* Basically default_get_tarmat but without the unused parameters. */ | /* Basically default_get_tarmat but without the unused parameters. */ | ||||
| if (VALID_CONS_TARGET(ct)) { | constraint_target_to_mat4(con->space_object, | ||||
| constraint_target_to_mat4(ct->tar, | con->space_subtarget, | ||||
| ct->subtarget, | |||||
| NULL, | NULL, | ||||
| ct->matrix, | cob->space_obj_world_matrix, | ||||
| CONSTRAINT_SPACE_WORLD, | CONSTRAINT_SPACE_WORLD, | ||||
| CONSTRAINT_SPACE_WORLD, | CONSTRAINT_SPACE_WORLD, | ||||
| 0, | 0, | ||||
| 0); | 0); | ||||
| copy_m4_m4(r_mat, ct->matrix); | |||||
| } | return; | ||||
| else { | |||||
| unit_m4(r_mat); | |||||
| } | } | ||||
| SINGLETARGET_FLUSH_TARS(con, con->space_object, con->space_subtarget, ct, &target, true); | unit_m4(cob->space_obj_world_matrix); | ||||
| } | } | ||||
| /* ---------- Evaluation ----------- */ | /* ---------- Evaluation ----------- */ | ||||
| void BKE_constraints_solve(struct Depsgraph *depsgraph, | void BKE_constraints_solve(struct Depsgraph *depsgraph, | ||||
| ListBase *conlist, | ListBase *conlist, | ||||
| bConstraintOb *cob, | bConstraintOb *cob, | ||||
| float ctime) | float ctime) | ||||
| Show All 28 Lines | if (con->enforce == 0.0f) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* influence of constraint | /* influence of constraint | ||||
| * - value should have been set from animation data already | * - value should have been set from animation data already | ||||
| */ | */ | ||||
| enf = con->enforce; | enf = con->enforce; | ||||
| /* Get custom space matrix. */ | /* Initialize the custom space for use in calculating the matrices. */ | ||||
| BKE_constraint_custom_object_space_get(cob->space_obj_world_matrix, con); | BKE_constraint_custom_object_space_init(cob, con); | ||||
| /* make copy of world-space matrix pre-constraint for use with blending later */ | /* make copy of world-space matrix pre-constraint for use with blending later */ | ||||
| copy_m4_m4(oldmat, cob->matrix); | copy_m4_m4(oldmat, cob->matrix); | ||||
| /* move owner matrix into right space */ | /* move owner matrix into right space */ | ||||
| BKE_constraint_mat_convertspace( | BKE_constraint_mat_convertspace( | ||||
| cob->ob, cob->pchan, cob, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace, false); | cob->ob, cob->pchan, cob, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace, false); | ||||
| ▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines | |||||