Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-08 11:29:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-08 11:29:08 +0400
commit65b0893df0c82b04701f5f39c725df983c19f0c7 (patch)
tree7efc4126e852ead95ce7e3e5164b9dd6e14a567e /source/blender/blenkernel
parent5e232548d3d3362ba5f2af7807237bc7d6b672d6 (diff)
bugfix [#21483] Twisting when Dupliframing a Surface Circle (Nurbs) along a Curve.
use the curve's twist for follow path constraint and parent-path.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/constraint.c16
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/object.c10
3 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index fe69f13bbda..3df395244f4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1201,7 +1201,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
if (VALID_CONS_TARGET(ct)) {
Curve *cu= ct->tar->data;
- float q[4], vec[4], dir[3], quat[4], radius, x1;
+ float vec[4], dir[3], radius;
float totmat[4][4];
float curvetime;
@@ -1217,7 +1217,8 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
makeDispListCurveTypes(cob->scene, ct->tar, 0);
if (cu->path && cu->path->data) {
- if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
+ float quat[4];
+ if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
/* animated position along curve depending on time */
if (cob->scene)
curvetime= bsystem_time(cob->scene, ct->tar, cu->ctime, 0.0) - data->offset;
@@ -1238,8 +1239,10 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
curvetime= data->offset_fac;
}
- if ( where_on_path(ct->tar, curvetime, vec, dir, NULL, &radius, NULL) ) {
+ if ( where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/
if (data->followflag & FOLLOWPATH_FOLLOW) {
+#if 0
+ float x1, q[4];
vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag);
normalize_v3(dir);
@@ -1249,10 +1252,13 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
q[2]= -x1*dir[1];
q[3]= -x1*dir[2];
mul_qt_qtqt(quat, q, quat);
-
+#else
+ quat_apply_track(quat, data->trackflag, data->upflag);
+#endif
+
quat_to_mat4(totmat, quat);
}
-
+
if (data->followflag & FOLLOWPATH_RADIUS) {
float tmat[4][4], rmat[4][4];
scale_m4_fl(tmat, radius);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 71e5049f2cc..638cab58229 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -633,7 +633,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
/* zero the axis which is not used,
* the big block of text above now applies to these 3 lines */
- quat_apply_track(quat, axis-1);
+ quat_apply_track(quat, axis-1, (axis==1 || axis==3) ? 1:0); /* up flag is a dummy, set so no rotation is done */
vec_apply_track(cent, axis-1);
cent[axis < 4 ? axis-1 : axis-4]= 0.0f;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index d9ee67920eb..0c437db335b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1791,9 +1791,10 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
/* vec: 4 items! */
- if( where_on_path(par, ctime, vec, dir, NULL, &radius, NULL) ) {
+ if( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
if(cu->flag & CU_FOLLOW) {
+#if 0
vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
/* the tilt */
@@ -1804,8 +1805,11 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
q[2]= -x1*dir[1];
q[3]= -x1*dir[2];
mul_qt_qtqt(quat, q, quat);
-
- quat_to_mat4( mat,quat);
+#else
+ quat_apply_track(quat, ob->trackflag, ob->upflag);
+#endif
+
+ quat_to_mat4(mat,quat);
}
if(cu->flag & CU_PATH_RADIUS) {