Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_warp.c
| Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | if (wmd->curfalloff == NULL) /* should never happen, but bad lib linking could cause it */ | ||||
| wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| if (wmd->curfalloff) { | if (wmd->curfalloff) { | ||||
| curvemapping_initialize(wmd->curfalloff); | curvemapping_initialize(wmd->curfalloff); | ||||
| } | } | ||||
| invert_m4_m4(obinv, ob->obmat); | invert_m4_m4(obinv, ob->obmat); | ||||
| mul_m4_m4m4(mat_from, obinv, DEG_get_evaluated_object(ctx->depsgraph, wmd->object_from)->obmat); | mul_m4_m4m4(mat_from, obinv, wmd->object_from->obmat); | ||||
| mul_m4_m4m4(mat_to, obinv, DEG_get_evaluated_object(ctx->depsgraph, wmd->object_to)->obmat); | mul_m4_m4m4(mat_to, obinv, wmd->object_to->obmat); | ||||
| 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); | ||||
| invert_m4_m4(mat_from_inv, mat_from); | invert_m4_m4(mat_from_inv, mat_from); | ||||
| unit_m4(mat_unit); | unit_m4(mat_unit); | ||||
| if (strength < 0.0f) { | if (strength < 0.0f) { | ||||
| float loc[3]; | float loc[3]; | ||||
| strength = -strength; | strength = -strength; | ||||
| /* inverted location is not useful, just use the negative */ | /* inverted location is not useful, just use the negative */ | ||||
| copy_v3_v3(loc, mat_final[3]); | copy_v3_v3(loc, mat_final[3]); | ||||
| invert_m4(mat_final); | invert_m4(mat_final); | ||||
| negate_v3_v3(mat_final[3], loc); | negate_v3_v3(mat_final[3], loc); | ||||
| } | } | ||||
| weight = strength; | weight = strength; | ||||
| Tex *tex_target = (Tex *)DEG_get_evaluated_id(ctx->depsgraph, &wmd->texture->id); | Tex *tex_target = wmd->texture; | ||||
| if (mesh != NULL && tex_target != NULL) { | if (mesh != NULL && tex_target != NULL) { | ||||
| tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co"); | tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co"); | ||||
| MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co); | MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co); | ||||
| MOD_init_texture((MappingInfoModifierData *)wmd, ctx); | MOD_init_texture((MappingInfoModifierData *)wmd, ctx); | ||||
| } | } | ||||
| for (i = 0; i < numVerts; i++) { | for (i = 0; i < numVerts; i++) { | ||||
| ▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines | |||||