Cleanup: Make curve deform argument optional
The "dir" argument to `BKE_where_on_path` was only actually used in a few places. It's easier to see where those are if there isn't always a dummy argument.
This commit is contained in:
@@ -295,10 +295,12 @@ bool BKE_where_on_path(const Object *ob,
|
|||||||
|
|
||||||
key_curve_tangent_weights(frac, w, KEY_BSPLINE);
|
key_curve_tangent_weights(frac, w, KEY_BSPLINE);
|
||||||
|
|
||||||
interp_v3_v3v3v3v3(r_dir, p0->vec, p1->vec, p2->vec, p3->vec, w);
|
if (r_dir) {
|
||||||
|
interp_v3_v3v3v3v3(r_dir, p0->vec, p1->vec, p2->vec, p3->vec, w);
|
||||||
|
|
||||||
/* Make compatible with #vec_to_quat. */
|
/* Make compatible with #vec_to_quat. */
|
||||||
negate_v3(r_dir);
|
negate_v3(r_dir);
|
||||||
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
const ListBase *nurbs = BKE_curve_editNurbs_get(cu);
|
const ListBase *nurbs = BKE_curve_editNurbs_get(cu);
|
||||||
|
|||||||
@@ -405,8 +405,8 @@ static void splineik_evaluate_bone(
|
|||||||
|
|
||||||
if (pchan->bone->length < FLT_EPSILON) {
|
if (pchan->bone->length < FLT_EPSILON) {
|
||||||
/* Only move the bone position with zero length bones. */
|
/* Only move the bone position with zero length bones. */
|
||||||
float bone_pos[4], dir[3], rad;
|
float bone_pos[4], rad;
|
||||||
BKE_where_on_path(ik_data->tar, state->curve_position, bone_pos, dir, NULL, &rad, NULL);
|
BKE_where_on_path(ik_data->tar, state->curve_position, bone_pos, NULL, NULL, &rad, NULL);
|
||||||
|
|
||||||
apply_curve_transform(ik_data, ob, rad, bone_pos, &rad);
|
apply_curve_transform(ik_data, ob, rad, bone_pos, &rad);
|
||||||
|
|
||||||
@@ -445,13 +445,13 @@ static void splineik_evaluate_bone(
|
|||||||
|
|
||||||
/* Step 1: determine the positions for the endpoints of the bone. */
|
/* Step 1: determine the positions for the endpoints of the bone. */
|
||||||
if (point_start < 1.0f) {
|
if (point_start < 1.0f) {
|
||||||
float vec[4], dir[3], rad;
|
float vec[4], rad;
|
||||||
radius = 0.0f;
|
radius = 0.0f;
|
||||||
|
|
||||||
/* Calculate head position. */
|
/* Calculate head position. */
|
||||||
if (point_start == 0.0f) {
|
if (point_start == 0.0f) {
|
||||||
/* Start of the path. We have no previous tail position to copy. */
|
/* Start of the path. We have no previous tail position to copy. */
|
||||||
BKE_where_on_path(ik_data->tar, point_start, vec, dir, NULL, &rad, NULL);
|
BKE_where_on_path(ik_data->tar, point_start, vec, NULL, NULL, &rad, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy_v3_v3(vec, state->prev_tail_loc);
|
copy_v3_v3(vec, state->prev_tail_loc);
|
||||||
@@ -486,7 +486,7 @@ static void splineik_evaluate_bone(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Scale to fit curve end position. */
|
/* Scale to fit curve end position. */
|
||||||
if (BKE_where_on_path(ik_data->tar, point_end, vec, dir, NULL, &rad, NULL)) {
|
if (BKE_where_on_path(ik_data->tar, point_end, vec, NULL, NULL, &rad, NULL)) {
|
||||||
state->prev_tail_radius = rad;
|
state->prev_tail_radius = rad;
|
||||||
copy_v3_v3(state->prev_tail_loc, vec);
|
copy_v3_v3(state->prev_tail_loc, vec);
|
||||||
copy_v3_v3(pose_tail, vec);
|
copy_v3_v3(pose_tail, vec);
|
||||||
|
|||||||
@@ -1495,7 +1495,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
|
|||||||
|
|
||||||
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVES_LEGACY)) {
|
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVES_LEGACY)) {
|
||||||
Curve *cu = ct->tar->data;
|
Curve *cu = ct->tar->data;
|
||||||
float vec[4], dir[3], radius;
|
float vec[4], radius;
|
||||||
float curvetime;
|
float curvetime;
|
||||||
|
|
||||||
unit_m4(ct->matrix);
|
unit_m4(ct->matrix);
|
||||||
@@ -1532,7 +1532,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
|
|||||||
if (BKE_where_on_path(ct->tar,
|
if (BKE_where_on_path(ct->tar,
|
||||||
curvetime,
|
curvetime,
|
||||||
vec,
|
vec,
|
||||||
dir,
|
NULL,
|
||||||
(data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL,
|
(data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL,
|
||||||
&radius,
|
&radius,
|
||||||
NULL)) { /* quat_pt is quat or NULL. */
|
NULL)) { /* quat_pt is quat or NULL. */
|
||||||
@@ -3886,7 +3886,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
|
|||||||
|
|
||||||
/* get targetmatrix */
|
/* get targetmatrix */
|
||||||
if (data->tar->runtime.curve_cache && data->tar->runtime.curve_cache->anim_path_accum_length) {
|
if (data->tar->runtime.curve_cache && data->tar->runtime.curve_cache->anim_path_accum_length) {
|
||||||
float vec[4], dir[3], totmat[4][4];
|
float vec[4], totmat[4][4];
|
||||||
float curvetime;
|
float curvetime;
|
||||||
short clamp_axis;
|
short clamp_axis;
|
||||||
|
|
||||||
@@ -3969,7 +3969,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 3. position on curve */
|
/* 3. position on curve */
|
||||||
if (BKE_where_on_path(ct->tar, curvetime, vec, dir, NULL, NULL, NULL)) {
|
if (BKE_where_on_path(ct->tar, curvetime, vec, NULL, NULL, NULL, NULL)) {
|
||||||
unit_m4(totmat);
|
unit_m4(totmat);
|
||||||
copy_v3_v3(totmat[3], vec);
|
copy_v3_v3(totmat[3], vec);
|
||||||
|
|
||||||
|
|||||||
@@ -3087,12 +3087,12 @@ void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4])
|
|||||||
static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4])
|
static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4])
|
||||||
{
|
{
|
||||||
Curve *cu = (Curve *)par->data;
|
Curve *cu = (Curve *)par->data;
|
||||||
float vec[4], dir[3], quat[4], radius, ctime;
|
float vec[4], quat[4], radius, ctime;
|
||||||
|
|
||||||
/* NOTE: Curve cache is supposed to be evaluated here already, however there
|
/* NOTE: Curve cache is supposed to be evaluated here already, however there
|
||||||
* are cases where we can not guarantee that. This includes, for example,
|
* are cases where we can not guarantee that. This includes, for example,
|
||||||
* dependency cycles. We can't correct anything from here, since that would
|
* dependency cycles. We can't correct anything from here, since that would
|
||||||
* cause a threading conflicts.
|
* cause threading conflicts.
|
||||||
*
|
*
|
||||||
* TODO(sergey): Some of the legit looking cases like T56619 need to be
|
* TODO(sergey): Some of the legit looking cases like T56619 need to be
|
||||||
* looked into, and maybe curve cache (and other dependencies) are to be
|
* looked into, and maybe curve cache (and other dependencies) are to be
|
||||||
@@ -3125,7 +3125,7 @@ static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4])
|
|||||||
|
|
||||||
/* vec: 4 items! */
|
/* vec: 4 items! */
|
||||||
if (BKE_where_on_path(
|
if (BKE_where_on_path(
|
||||||
par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : nullptr, &radius, nullptr)) {
|
par, ctime, vec, nullptr, (cu->flag & CU_FOLLOW) ? quat : nullptr, &radius, nullptr)) {
|
||||||
if (cu->flag & CU_FOLLOW) {
|
if (cu->flag & CU_FOLLOW) {
|
||||||
quat_apply_track(quat, ob->trackflag, ob->upflag);
|
quat_apply_track(quat, ob->trackflag, ob->upflag);
|
||||||
normalize_qt(quat);
|
normalize_qt(quat);
|
||||||
|
|||||||
@@ -1372,7 +1372,7 @@ static bool vfont_to_curve(Object *ob,
|
|||||||
|
|
||||||
ct = chartransdata;
|
ct = chartransdata;
|
||||||
for (i = 0; i <= slen; i++, ct++) {
|
for (i = 0; i <= slen; i++, ct++) {
|
||||||
float ctime, dtime, vec[4], tvec[4], rotvec[3];
|
float ctime, dtime, vec[4], rotvec[3];
|
||||||
float si, co;
|
float si, co;
|
||||||
|
|
||||||
/* Rotate around center character. */
|
/* Rotate around center character. */
|
||||||
@@ -1392,9 +1392,9 @@ static bool vfont_to_curve(Object *ob,
|
|||||||
CLAMP(ctime, 0.0f, 1.0f);
|
CLAMP(ctime, 0.0f, 1.0f);
|
||||||
|
|
||||||
/* Calculate the right loc AND the right rot separately. */
|
/* Calculate the right loc AND the right rot separately. */
|
||||||
/* `vec`, `tvec` need 4 items. */
|
/* `vec` needs 4 items. */
|
||||||
BKE_where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL);
|
BKE_where_on_path(cu->textoncurve, ctime, vec, NULL, NULL, NULL, NULL);
|
||||||
BKE_where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL);
|
BKE_where_on_path(cu->textoncurve, ctime + dtime, NULL, rotvec, NULL, NULL, NULL);
|
||||||
|
|
||||||
mul_v3_fl(vec, sizefac);
|
mul_v3_fl(vec, sizefac);
|
||||||
|
|
||||||
|
|||||||
@@ -528,13 +528,13 @@ static void OVERLAY_forcefield(OVERLAY_ExtraCallBuffers *cb, Object *ob, ViewLay
|
|||||||
case PFIELD_GUIDE:
|
case PFIELD_GUIDE:
|
||||||
if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->anim_path_accum_length) {
|
if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->anim_path_accum_length) {
|
||||||
instdata.size_x = instdata.size_y = instdata.size_z = pd->f_strength;
|
instdata.size_x = instdata.size_y = instdata.size_z = pd->f_strength;
|
||||||
float pos[4], tmp[3];
|
float pos[4];
|
||||||
BKE_where_on_path(ob, 0.0f, pos, tmp, NULL, NULL, NULL);
|
BKE_where_on_path(ob, 0.0f, pos, NULL, NULL, NULL, NULL);
|
||||||
copy_v3_v3(instdata.pos, ob->obmat[3]);
|
copy_v3_v3(instdata.pos, ob->obmat[3]);
|
||||||
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
|
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
|
||||||
DRW_buffer_add_entry(cb->field_curve, color, &instdata);
|
DRW_buffer_add_entry(cb->field_curve, color, &instdata);
|
||||||
|
|
||||||
BKE_where_on_path(ob, 1.0f, pos, tmp, NULL, NULL, NULL);
|
BKE_where_on_path(ob, 1.0f, pos, NULL, NULL, NULL, NULL);
|
||||||
copy_v3_v3(instdata.pos, ob->obmat[3]);
|
copy_v3_v3(instdata.pos, ob->obmat[3]);
|
||||||
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
|
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
|
||||||
DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
|
DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
|
||||||
|
|||||||
Reference in New Issue
Block a user