diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_particlesystem.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_shapekey.c | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 64 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 2 |
6 files changed, 31 insertions, 67 deletions
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index cdb200ff180..638e91e22f1 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -88,10 +88,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -#define EDGE_MARK 1 - #ifdef USE_BM_BEVEL_OP_AS_MOD +#define EDGE_MARK 1 + /* BMESH_TODO * * this bevel calls the operator which is missing many of the options diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 890e45f7e80..254c02b7672 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -188,11 +188,9 @@ static void deformVerts(ModifierData *md, Object *ob, psmd->totdmface = psmd->dm->getNumTessFaces(psmd->dm); } - if (psys) { - psmd->flag &= ~eParticleSystemFlag_psys_updated; - particle_system_update(md->scene, ob, psys); - psmd->flag |= eParticleSystemFlag_psys_updated; - } + psmd->flag &= ~eParticleSystemFlag_psys_updated; + particle_system_update(md->scene, ob, psys); + psmd->flag |= eParticleSystemFlag_psys_updated; } /* disabled particles in editmode for now, until support for proper derivedmesh diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 4fd2c658380..a94b4834d18 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -393,7 +393,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mul_m4_v3(mtx_tx, vc->co); /* length in 2d, don't sqrt because this is only for comparison */ - vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + + vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ @@ -410,7 +410,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->v[0] = vc->v[1] = -1; /* length in 2d, don't sqrt because this is only for comparison */ - vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + + vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ @@ -430,7 +430,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->e[1] = med_new; } else { - vc->v[0] = vc->v[1] = -2; /* erro value - don't use, 3 edges on vert */ + vc->v[0] = vc->v[1] = -2; /* error value - don't use, 3 edges on vert */ } vc = &vert_connect[med_new->v2]; @@ -445,7 +445,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->e[1] = med_new; } else { - vc->v[0] = vc->v[1] = -2; /* erro value - don't use, 3 edges on vert */ + vc->v[0] = vc->v[1] = -2; /* error value - don't use, 3 edges on vert */ } } diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 3353382fa3d..8ef86362edd 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -54,7 +54,7 @@ static void deformVerts(ModifierData *md, Object *ob, int numVerts, ModifierApplyFlag UNUSED(flag)) { - KeyBlock *kb = ob_get_keyblock(ob); + KeyBlock *kb = BKE_keyblock_from_object(ob); float (*deformedVerts)[3]; if (kb && kb->totelem == numVerts) { @@ -69,8 +69,8 @@ static void deformVerts(ModifierData *md, Object *ob, static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { - Key *key = ob_get_key(ob); - KeyBlock *kb = ob_get_keyblock(ob); + Key *key = BKE_key_from_object(ob); + KeyBlock *kb = BKE_keyblock_from_object(ob); float scale[3][3]; (void)vertexCos; /* unused */ @@ -94,7 +94,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, float (*vertexCos)[3], int numVerts) { - Key *key = ob_get_key(ob); + Key *key = BKE_key_from_object(ob); if (key && key->type == KEY_RELATIVE) deformVerts(md, ob, derivedData, vertexCos, numVerts, 0); @@ -107,8 +107,8 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, float (*defMats)[3][3], int numVerts) { - Key *key = ob_get_key(ob); - KeyBlock *kb = ob_get_keyblock(ob); + Key *key = BKE_key_from_object(ob); + KeyBlock *kb = BKE_keyblock_from_object(ob); float scale[3][3]; (void)vertexCos; /* unused */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index eb5a74f0dcc..88951919272 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -157,7 +157,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, int override_image = ((umd->flags & MOD_UVPROJECT_OVERRIDEIMAGE) != 0); Projector projectors[MOD_UVPROJECT_MAXPROJECTORS]; int num_projectors = 0; - float aspect; char uvname[MAX_CUSTOMDATA_LAYER_NAME]; float aspx = umd->aspectx ? umd->aspectx : 1.0f; float aspy = umd->aspecty ? umd->aspecty : 1.0f; @@ -165,8 +164,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float scay = umd->scaley ? umd->scaley : 1.0f; int free_uci = 0; - aspect = aspx / aspy; - for (i = 0; i < umd->num_projectors; ++i) if (umd->projectors[i]) projectors[num_projectors++].ob = umd->projectors[i]; @@ -199,39 +196,23 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, free_uci = 1; } else { - float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); - int sensor_fit = BKE_camera_sensor_fit(cam->sensor_fit, aspx, aspy); - float scale = (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; - float xmax, xmin, ymax, ymin; - - if (sensor_fit == CAMERA_SENSOR_FIT_HOR) { - xmax = 0.5f * scale; - ymax = xmax / aspect; - } - else { - ymax = 0.5f * scale; - xmax = ymax * aspect; - } + CameraParams params; - xmin = -xmax; - ymin = -ymax; + /* setup parameters */ + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, projectors[i].ob); - /* scale the matrix */ - xmin *= scax; - xmax *= scax; - ymin *= scay; - ymax *= scay; + /* compute matrix, viewplane, .. */ + BKE_camera_params_compute_viewplane(¶ms, 1, 1, aspx, aspy); - if (cam->type == CAM_PERSP) { - float perspmat[4][4]; - perspective_m4(perspmat, xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); - mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat); - } - else { /* if (cam->type == CAM_ORTHO) */ - float orthomat[4][4]; - orthographic_m4(orthomat, xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend); - mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat); - } + /* scale the view-plane */ + params.viewplane.xmin *= scax; + params.viewplane.xmax *= scax; + params.viewplane.ymin *= scay; + params.viewplane.ymax *= scay; + + BKE_camera_params_compute_matrix(¶ms); + mult_m4_m4m4(tmpmat, params.winmat, projectors[i].projmat); } } else { @@ -241,22 +222,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, unit_m4(offsetmat); mul_mat3_m4_fl(offsetmat, 0.5); offsetmat[3][0] = offsetmat[3][1] = offsetmat[3][2] = 0.5; - - if (cam) { - if (aspx == aspy) { - offsetmat[3][0] -= cam->shiftx; - offsetmat[3][1] -= cam->shifty; - } - else if (aspx < aspy) { - offsetmat[3][0] -= (cam->shiftx * aspy / aspx); - offsetmat[3][1] -= cam->shifty; - } - else { - offsetmat[3][0] -= cam->shiftx; - offsetmat[3][1] -= (cam->shifty * aspx / aspy); - } - } - + mult_m4_m4m4(projectors[i].projmat, offsetmat, tmpmat); /* calculate worldspace projector normal (for best projector test) */ diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 22b1e33e2a6..25a2a61d8e3 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -185,7 +185,7 @@ static float get_ob2ob_distance(const Object *ob, const Object *obr) /** * Maps distances to weights, with an optional "smoothing" mapping. */ -void do_map(float *weights, const int nidx, const float min_d, const float max_d, short mode) +static void do_map(float *weights, const int nidx, const float min_d, const float max_d, short mode) { const float range_inv = 1.0f / (max_d - min_d); /* invert since multiplication is faster */ unsigned int i = nidx; |