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>2008-01-19 19:32:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-01-19 19:32:29 +0300
commitd450dbec9177f2e691fddbefdab20adda18c7ae3 (patch)
treeef57d87a2714354da103960926c004edc1874942 /source/blender/blenkernel
parent7b6c88473c02d97485970390086395b515be653e (diff)
add the option to add the parents time offset value.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/group.c4
-rw-r--r--source/blender/blenkernel/intern/object.c25
4 files changed, 22 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 6e363515f41..b9f31d5590b 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -110,6 +110,8 @@ void solve_tracking (struct Object *ob, float targetmat[][4]);
void object_handle_update(struct Object *ob);
+float give_timeoffset(struct Object *ob);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index e09f6207642..6e33805fbeb 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1559,7 +1559,7 @@ static pMatrixCache *cache_object_matrices(Object *ob, int start, int end)
framelenold= G.scene->r.framelen;
G.scene->r.framelen= 1.0f;
cfrao= G.scene->r.cfra;
- sfo= ob->sf;
+ sfo= ob->sf; /* warning, dont use sfo, value should be from give_timeoffset if used for anything */
ob->sf= 0.0f;
/* clear storage, copy recalc tag (bad loop) */
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 3a64f8c8c34..b29cf63ab0b 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -241,12 +241,12 @@ void group_handle_recalc_and_update(Object *parent, Group *group)
GroupObject *go;
/* if animated group... */
- if(parent->sf != 0.0f || parent->nlastrips.first) {
+ if(give_timeoffset(parent) != 0.0f || parent->nlastrips.first) {
int cfrao;
/* switch to local time */
cfrao= G.scene->r.cfra;
- G.scene->r.cfra -= (int)parent->sf;
+ G.scene->r.cfra -= (int)give_timeoffset(parent);
/* we need a DAG per group... */
for(go= group->gobject.first; go; go= go->next) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 3ac4a572b96..70be6d2c79b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1367,7 +1367,7 @@ float bsystem_time(Object *ob, float cfra, float ofs)
/* ofset frames */
if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0)
- cfra-= ob->sf;
+ cfra-= give_timeoffset(ob);
}
cfra-= ofs;
@@ -1438,7 +1438,7 @@ static 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;
+ float timeoffs, sf_orig = 0.0;
Mat4One(mat);
@@ -1449,7 +1449,8 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
/* exception, timeoffset is regarded as distance offset */
if(cu->flag & CU_OFFS_PATHDIST) {
- SWAP(float, timeoffs, ob->sf);
+ timeoffs = give_timeoffset(ob);
+ SWAP(float, sf_orig, ob->sf);
}
/* catch exceptions: feature for nla stride editing */
@@ -1466,7 +1467,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
}
}
else {
- ctime= G.scene->r.cfra - ob->sf;
+ ctime= G.scene->r.cfra - give_timeoffset(ob);
ctime /= cu->pathlen;
CLAMP(ctime, 0.0, 1.0);
@@ -1477,7 +1478,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
ctime += timeoffs/cu->path->totdist;
/* restore */
- SWAP(float, timeoffs, ob->sf);
+ SWAP(float, sf_orig, ob->sf);
}
@@ -1735,7 +1736,7 @@ void where_is_object_time(Object *ob, float ctime)
if(ob->parent) {
Object *par= ob->parent;
- if(ob->ipoflag & OB_OFFS_PARENT) ctime-= ob->sf;
+ if(ob->ipoflag & OB_OFFS_PARENT) ctime-= give_timeoffset(ob);
/* hurms, code below conflicts with depgraph... (ton) */
/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
@@ -1759,7 +1760,7 @@ void where_is_object_time(Object *ob, float ctime)
if(ob->partype & PARSLOW) {
// include framerate
- fac1= (1.0f/(1.0f+ fabs(ob->sf)));
+ fac1= (1.0f/(1.0f+ fabs(give_timeoffset(ob))));
if(fac1>=1.0) return;
fac2= 1.0f-fac1;
@@ -1942,7 +1943,7 @@ for a lamp that is the child of another object */
if(ob->partype & PARSLOW) {
- fac1= (float)(1.0/(1.0+ fabs(ob->sf)));
+ fac1= (float)(1.0/(1.0+ fabs(give_timeoffset(ob))));
fac2= 1.0f-fac1;
fp1= ob->obmat[0];
fp2= slowmat[0];
@@ -2247,3 +2248,11 @@ void object_handle_update(Object *ob)
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
}
}
+
+float give_timeoffset(Object *ob) {
+ if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
+ return ob->sf + give_timeoffset(ob->parent);
+ } else {
+ return ob->sf;
+ }
+} \ No newline at end of file