Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_cast.c
| Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | static void sphere_do(CastModifierData *cmd, | ||||
| ctrl_ob = cmd->object; | ctrl_ob = cmd->object; | ||||
| /* spherify's center is {0, 0, 0} (the ob's own center in its local | /* spherify's center is {0, 0, 0} (the ob's own center in its local | ||||
| * space), by default, but if the user defined a control object, | * space), by default, but if the user defined a control object, | ||||
| * we use its location, transformed to ob's local space */ | * we use its location, transformed to ob's local space */ | ||||
| if (ctrl_ob) { | if (ctrl_ob) { | ||||
| if (flag & MOD_CAST_USE_OB_TRANSFORM) { | if (flag & MOD_CAST_USE_OB_TRANSFORM) { | ||||
| invert_m4_m4(imat, ctrl_ob->obmat); | invert_m4_m4(imat, ctrl_ob->object_to_world); | ||||
| mul_m4_m4m4(mat, imat, ob->obmat); | mul_m4_m4m4(mat, imat, ob->object_to_world); | ||||
| invert_m4_m4(imat, mat); | invert_m4_m4(imat, mat); | ||||
| } | } | ||||
| invert_m4_m4(ob->imat, ob->obmat); | invert_m4_m4(ob->imat, ob->object_to_world); | ||||
| mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]); | mul_v3_m4v3(center, ob->imat, ctrl_ob->object_to_world[3]); | ||||
| } | } | ||||
| /* now we check which options the user wants */ | /* now we check which options the user wants */ | ||||
| /* 1) (flag was checked in the "if (ctrl_ob)" block above) */ | /* 1) (flag was checked in the "if (ctrl_ob)" block above) */ | ||||
| /* 2) cmd->radius > 0.0f: only the vertices within this radius from | /* 2) cmd->radius > 0.0f: only the vertices within this radius from | ||||
| * the center of the effect should be deformed */ | * the center of the effect should be deformed */ | ||||
| if (cmd->radius > FLT_EPSILON) { | if (cmd->radius > FLT_EPSILON) { | ||||
| ▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | static void cuboid_do(CastModifierData *cmd, | ||||
| /* 3) if we were given a vertex group name, | /* 3) if we were given a vertex group name, | ||||
| * only those vertices should be affected */ | * only those vertices should be affected */ | ||||
| if (cmd->defgrp_name[0] != '\0') { | if (cmd->defgrp_name[0] != '\0') { | ||||
| MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); | MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); | ||||
| } | } | ||||
| if (ctrl_ob) { | if (ctrl_ob) { | ||||
| if (flag & MOD_CAST_USE_OB_TRANSFORM) { | if (flag & MOD_CAST_USE_OB_TRANSFORM) { | ||||
| invert_m4_m4(imat, ctrl_ob->obmat); | invert_m4_m4(imat, ctrl_ob->object_to_world); | ||||
| mul_m4_m4m4(mat, imat, ob->obmat); | mul_m4_m4m4(mat, imat, ob->object_to_world); | ||||
| invert_m4_m4(imat, mat); | invert_m4_m4(imat, mat); | ||||
| } | } | ||||
| invert_m4_m4(ob->imat, ob->obmat); | invert_m4_m4(ob->imat, ob->object_to_world); | ||||
| mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]); | mul_v3_m4v3(center, ob->imat, ctrl_ob->object_to_world[3]); | ||||
| } | } | ||||
| if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { | if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { | ||||
| for (i = 0; i < 3; i++) { | for (i = 0; i < 3; i++) { | ||||
| min[i] = -cmd->radius; | min[i] = -cmd->radius; | ||||
| max[i] = cmd->radius; | max[i] = cmd->radius; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines | |||||