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:
authorTon Roosendaal <ton@blender.org>2005-02-11 15:42:02 +0300
committerTon Roosendaal <ton@blender.org>2005-02-11 15:42:02 +0300
commit39959b4f212664c492d068e798e1dfab8d11c571 (patch)
tree8227ab1615f7e6e14d1ee3f53075ff69dd815105
parent34977b8937e7e990b35d3795dc35740e8991fb9c (diff)
Little warming-up getting-feet-wet coding project. :)
Much wanted feature, to have paths with children having fixed distance offsets from each other, for example to animate a train with wagons. Solved it with Path option (Editing buttons curve) "PathDist Offs" which interprets time-offsets of children as blender-unit offsets. The entire animation system still works, but offsets are calculated based on distance, even with a CurvePath without motion (speed curve horizontal). http://download.blender.org/demo/test/pathdist.blend Thanks to Bassam for kicking my ass!
-rw-r--r--source/blender/blenkernel/intern/object.c19
-rw-r--r--source/blender/makesdna/DNA_curve_types.h1
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c3
-rw-r--r--source/blender/src/buttons_editing.c9
4 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ffc1dc36e69..e11ada6f6c2 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -992,12 +992,18 @@ void ob_parcurve(Object *ob, Object *par, float mat[][4])
{
Curve *cu;
float q[4], vec[4], dir[3], *quat, x1, ctime;
+ float timeoffs= 0.0;
Mat4One(mat);
cu= par->data;
- if(cu->path==0 || cu->path->data==0) calc_curvepath(par);
- if(cu->path==0) return;
+ if(cu->path==NULL || cu->path->data==NULL) calc_curvepath(par);
+ if(cu->path==NULL) return;
+
+ /* exception, timeoffset is regarded as distance offset */
+ if(cu->flag & CU_OFFS_PATHDIST) {
+ SWAP(float, timeoffs, ob->sf);
+ }
/* catch exceptions: curve paths used as a duplicator */
if(enable_cu_speed) {
@@ -1014,7 +1020,16 @@ void ob_parcurve(Object *ob, Object *par, float mat[][4])
CLAMP(ctime, 0.0, 1.0);
}
+
+ /* time calculus is correct, now apply distance offset */
+ if(cu->flag & CU_OFFS_PATHDIST) {
+ ctime += timeoffs/cu->path->totdist;
+ /* restore */
+ SWAP(float, timeoffs, ob->sf);
+ }
+
+
/* vec: 4 items! */
if( where_on_path(par, ctime, vec, dir) ) {
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 69ee9851cd7..0713f770dc4 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -176,6 +176,7 @@ typedef struct IpoCurve {
#define CU_UV_ORCO 32
#define CU_NOPUNOFLIP 64
#define CU_STRETCH 128
+#define CU_OFFS_PATHDIST 256
/* spacemode */
#define CU_LEFT 0
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 2b4803bfdec..5bdd0c36702 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -2952,9 +2952,6 @@ void RE_rotateBlenderScene(void)
MTC_Mat4Ortho(R.viewinv);
MTC_Mat4Invert(R.viewmat, R.viewinv);
- /* not so neat: now the viewinv is not equal to viewmat. used for Texcos and such. Improve! */
- //if(R.r.mode & R_ORTHO) R.viewmat[3][2]*= 100.0;
-
RE_setwindowclip(1,-1); /* no jit:(-1) */
/* clear imat flags */
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 371a2f9c94c..65829bd1e3f 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -1262,16 +1262,19 @@ static void editing_panel_curve_type(Object *ob, Curve *cu)
if(ob->type==OB_CURVE) {
extern float prlen; // buttons_object.c, should be moved....
char str[32];
+
+ sprintf(str, "%.4f", prlen);
+ uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 600,135,75,19, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, str, 675,135,75,19, 0, 1.0, 0, 0, 0, "");
+
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_RECALCPATH, "PathLen:", 600,50,150,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "If no speed Ipo was set, the amount of frames of the path");
uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath", 600,30,75,19 , &cu->flag, 0, 0, 0, 0, "Enables curve to become translation path");
uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow",675,30,75,19, &cu->flag, 0, 0, 0, 0, "Makes curve path children to rotate along path");
uiDefButS(block, TOG|BIT|7, B_CURVECHECK, "CurveStretch", 600,10,150,19, &cu->flag, 0, 0, 0, 0, "Option for curve-deform: makes deformed child to stretch along entire path");
+ uiDefButS(block, TOG|BIT|8, REDRAWVIEW3D, "PathDist Offs", 600,-10,150,19, &cu->flag, 0, 0, 0, 0, "Children will use TimeOffs value as path distance offset");
uiBlockEndAlign(block);
- sprintf(str, "%.4f", prlen);
- uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 600,-10,75,19, 0, 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, str, 675,-10,75,19, 0, 1.0, 0, 0, 0, "");
}
uiBlockBeginAlign(block);