Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/constraint.c
| Show First 20 Lines • Show All 1,808 Lines • ▼ Show 20 Lines | |||||
| static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets) | static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets) | ||||
| { | { | ||||
| bRotateLikeConstraint *data = con->data; | bRotateLikeConstraint *data = con->data; | ||||
| bConstraintTarget *ct = targets->first; | bConstraintTarget *ct = targets->first; | ||||
| if (VALID_CONS_TARGET(ct)) { | if (VALID_CONS_TARGET(ct)) { | ||||
| float loc[3], size[3], oldrot[3][3], newrot[3][3]; | float loc[3], size[3], oldrot[3][3], newrot[3][3]; | ||||
| float eul[3], obeul[3], defeul[3]; | float eul[3], obeul[3], defeul[3]; | ||||
| float mat[4][4]; | |||||
| copy_m4_m4(mat, ct->matrix); | |||||
| orthogonalize_m4_stable(mat, 1, true); | |||||
| mat4_to_loc_rot_size(loc, oldrot, size, cob->matrix); | mat4_to_loc_rot_size(loc, oldrot, size, cob->matrix); | ||||
| /* Select the Euler rotation order, defaulting to the owner. */ | /* Select the Euler rotation order, defaulting to the owner. */ | ||||
| short rot_order = cob->rotOrder; | short rot_order = cob->rotOrder; | ||||
| if (data->euler_order != CONSTRAINT_EULER_AUTO) { | if (data->euler_order != CONSTRAINT_EULER_AUTO) { | ||||
| rot_order = data->euler_order; | rot_order = data->euler_order; | ||||
| } | } | ||||
| /* To allow compatible rotations, must get both rotations in the order of the owner... */ | /* To allow compatible rotations, must get both rotations in the order of the owner... */ | ||||
| mat4_to_eulO(obeul, rot_order, cob->matrix); | mat4_to_eulO(obeul, rot_order, cob->matrix); | ||||
| /* We must get compatible eulers from the beginning because | /* We must get compatible eulers from the beginning because | ||||
| * some of them can be modified below (see bug T21875). */ | * some of them can be modified below (see bug T21875). */ | ||||
| mat4_to_compatible_eulO(eul, obeul, rot_order, ct->matrix); | mat4_to_compatible_eulO(eul, obeul, rot_order, mat); | ||||
| /* Prepare the copied euler rotation. */ | /* Prepare the copied euler rotation. */ | ||||
| bool legacy_offset = false; | bool legacy_offset = false; | ||||
| switch (data->mix_mode) { | switch (data->mix_mode) { | ||||
| case ROTLIKE_MIX_OFFSET: | case ROTLIKE_MIX_OFFSET: | ||||
| legacy_offset = true; | legacy_offset = true; | ||||
| copy_v3_v3(defeul, obeul); | copy_v3_v3(defeul, obeul); | ||||
| ▲ Show 20 Lines • Show All 4,243 Lines • Show Last 20 Lines | |||||