[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13295] trunk/blender/source/blender: add the option to add the parents time offset value.
Campbell Barton
ideasman42 at gmail.com
Sat Jan 19 17:32:29 CET 2008
Revision: 13295
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13295
Author: campbellbarton
Date: 2008-01-19 17:32:29 +0100 (Sat, 19 Jan 2008)
Log Message:
-----------
add the option to add the parents time offset value.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_object.h
trunk/blender/source/blender/blenkernel/intern/effect.c
trunk/blender/source/blender/blenkernel/intern/group.c
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/makesdna/DNA_object_types.h
trunk/blender/source/blender/python/api2_2x/Effect.c
trunk/blender/source/blender/src/buttons_object.c
trunk/blender/source/blender/src/drawaction.c
trunk/blender/source/blender/src/drawipo.c
trunk/blender/source/blender/src/drawobject.c
trunk/blender/source/blender/src/editipo.c
trunk/blender/source/blender/src/editobject.c
Modified: trunk/blender/source/blender/blenkernel/BKE_object.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_object.h 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/blenkernel/BKE_object.h 2008-01-19 16:32:29 UTC (rev 13295)
@@ -110,6 +110,8 @@
void object_handle_update(struct Object *ob);
+float give_timeoffset(struct Object *ob);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/blender/source/blender/blenkernel/intern/effect.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/effect.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/blenkernel/intern/effect.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -1559,7 +1559,7 @@
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) */
Modified: trunk/blender/source/blender/blenkernel/intern/group.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/group.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/blenkernel/intern/group.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -241,12 +241,12 @@
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) {
Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/blenkernel/intern/object.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -1367,7 +1367,7 @@
/* 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 @@
{
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 @@
/* 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 @@
}
}
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 @@
ctime += timeoffs/cu->path->totdist;
/* restore */
- SWAP(float, timeoffs, ob->sf);
+ SWAP(float, sf_orig, ob->sf);
}
@@ -1735,7 +1736,7 @@
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 @@
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 @@
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 @@
// 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
Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h 2008-01-19 16:32:29 UTC (rev 13295)
@@ -297,6 +297,9 @@
/* for stride edit */
#define OB_DISABLE_PATH 1024
+#define OB_OFFS_PARENTADD 2048
+
+
/* (short) trackflag / upflag */
#define OB_POSX 0
#define OB_POSY 1
Modified: trunk/blender/source/blender/python/api2_2x/Effect.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Effect.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/python/api2_2x/Effect.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -1,5 +1,5 @@
/*
- * $Id: Effect.c 11485 2007-08-05 09:21:29Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -1330,7 +1330,7 @@
/* if object is in motion */
if( ob->ipoflag & OB_OFFS_PARTICLE )
- p_time= ob->sf;
+ p_time= give_timeoffset(ob);
else
p_time= 0.0;
Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/src/buttons_object.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -2494,21 +2494,25 @@
uiDefButI(block, NUM, REDRAWVIEW3D, "DupOn:", 170,85,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "Specify the number of frames to use between DupOff frames");
uiDefButI(block, NUM, REDRAWVIEW3D, "DupEnd", 24,65,140,19, &ob->dupend, 1.0, 32767, 0, 0, "Specify endframe for Dupliframes");
uiDefButI(block, NUM, REDRAWVIEW3D, "DupOff", 171,65,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "Specify recurring frames to exclude from the Dupliframes");
+ uiBlockEndAlign(block);
+
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,35,56,20, &ob->ipoflag, 0, 0, 0, 0, "Not functional at the moment!");
- uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,35,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
- uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
+ uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,35,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
+ uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto", 139,35,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
+ uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs", 173,35,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
+ uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand", 207,35,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
+ uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 250,35,65,20, 0, 0, 0, 0, 0, "Print objectspeed");
+ uiBlockEndAlign(block);
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
- uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto", 139,10,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
- uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs", 173,10,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
- uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand", 207,10,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
- uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 250,10,65,20, 0, 0, 0, 0, 0, "Print objectspeed");
+ uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "OfsEdit", 24,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Use timeoffset when inserting keys and display timeoffset for ipo and action views");
+ uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "OfsParent", 82,10,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Apply the timeoffset to this objects parent relationship");
+ uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "OfsParticle", 140,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
+ uiDefButBitS(block, TOG, OB_OFFS_PARENTADD, REDRAWALL, "AddParent", 196,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Add the parents timeoffset value");
uiBlockEndAlign(block);
sprintf(str, "%.4f", prspeed);
- uiDefBut(block, LABEL, 0, str, 247,35,63,31, NULL, 1.0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, str, 260,10,63,31, NULL, 1.0, 0, 0, 0, "");
}
Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/src/drawaction.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -374,8 +374,8 @@
/* Draw dark green line if slow-parenting/time-offset is enabled */
ob= (G.scene->basact) ? (G.scene->basact->object) : 0;
- if ((ob) && (ob->sf!=0.0) && (ob->ipoflag & OB_OFFS_OB)) {
- vec[0]-= ob->sf;
+ if ((ob) && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0)) {
+ vec[0]-= give_timeoffset(ob); /* could avoid calling twice */
BIF_ThemeColorShade(TH_CFRAME, -30);
Modified: trunk/blender/source/blender/src/drawipo.c
===================================================================
--- trunk/blender/source/blender/src/drawipo.c 2008-01-19 15:13:42 UTC (rev 13294)
+++ trunk/blender/source/blender/src/drawipo.c 2008-01-19 16:32:29 UTC (rev 13295)
@@ -1571,8 +1571,8 @@
if(sipo->blocktype==ID_OB) {
ob= (G.scene->basact) ? (G.scene->basact->object) : 0;
- if (ob && (ob->sf!=0.0) && (ob->ipoflag & OB_OFFS_OB) ) {
- vec[0]-= ob->sf;
+ if (ob && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0)) {
+ vec[0]-= give_timeoffset(ob);
BIF_ThemeColorShade(TH_HILITE, -30);
Modified: trunk/blender/source/blender/src/drawobject.c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list