Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_warp.c
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
| static void matrix_from_obj_pchan(float mat[4][4], | static void matrix_from_obj_pchan(float mat[4][4], | ||||
| const float obinv[4][4], | const float obinv[4][4], | ||||
| Object *ob, | Object *ob, | ||||
| const char *bonename) | const char *bonename) | ||||
| { | { | ||||
| bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename); | bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename); | ||||
| if (pchan) { | if (pchan) { | ||||
| float mat_bone_world[4][4]; | float mat_bone_world[4][4]; | ||||
| mul_m4_m4m4(mat_bone_world, ob->obmat, pchan->pose_mat); | mul_m4_m4m4(mat_bone_world, ob->object_to_world, pchan->pose_mat); | ||||
| mul_m4_m4m4(mat, obinv, mat_bone_world); | mul_m4_m4m4(mat, obinv, mat_bone_world); | ||||
| } | } | ||||
| else { | else { | ||||
| mul_m4_m4m4(mat, obinv, ob->obmat); | mul_m4_m4m4(mat, obinv, ob->object_to_world); | ||||
| } | } | ||||
| } | } | ||||
| static bool dependsOnTime(struct Scene *UNUSED(scene), ModifierData *md) | static bool dependsOnTime(struct Scene *UNUSED(scene), ModifierData *md) | ||||
| { | { | ||||
| WarpModifierData *wmd = (WarpModifierData *)md; | WarpModifierData *wmd = (WarpModifierData *)md; | ||||
| if (wmd->texture) { | if (wmd->texture) { | ||||
| ▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | static void warpModifier_do(WarpModifierData *wmd, | ||||
| if (wmd->curfalloff == NULL) { /* should never happen, but bad lib linking could cause it */ | if (wmd->curfalloff == NULL) { /* should never happen, but bad lib linking could cause it */ | ||||
| wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| } | } | ||||
| if (wmd->curfalloff) { | if (wmd->curfalloff) { | ||||
| BKE_curvemapping_init(wmd->curfalloff); | BKE_curvemapping_init(wmd->curfalloff); | ||||
| } | } | ||||
| invert_m4_m4(obinv, ob->obmat); | invert_m4_m4(obinv, ob->object_to_world); | ||||
| /* Checks that the objects/bones are available. */ | /* Checks that the objects/bones are available. */ | ||||
| matrix_from_obj_pchan(mat_from, obinv, wmd->object_from, wmd->bone_from); | matrix_from_obj_pchan(mat_from, obinv, wmd->object_from, wmd->bone_from); | ||||
| matrix_from_obj_pchan(mat_to, obinv, wmd->object_to, wmd->bone_to); | matrix_from_obj_pchan(mat_to, obinv, wmd->object_to, wmd->bone_to); | ||||
| invert_m4_m4(tmat, mat_from); // swap? | invert_m4_m4(tmat, mat_from); // swap? | ||||
| mul_m4_m4m4(mat_final, tmat, mat_to); | mul_m4_m4m4(mat_final, tmat, mat_to); | ||||
| ▲ Show 20 Lines • Show All 315 Lines • Show Last 20 Lines | |||||