[Bf-committers] sequence.c

Shaul Kedem shaul.kedem at gmail.com
Fri Sep 16 19:34:13 CEST 2005


Yes, I see what you mean.

+= usually denotes increments, and there lyes my err.

I'd use se = se + nr or stripdata[nr], but thats me,

Thanks!
Shaul

On 9/16/05, Kent Mein <mein at cs.umn.edu> wrote:
> 
> In reply to Shaul Kedem (shaul.kedem at gmail.com):
> 
> > Also..
> > Just wanted to add that I went to the cvs and back to the initial 
> version,
> > there too it is += for what looks like no apparent reason,
> > Shaul
> 
> Its there for a very good reason.
> I'm not trying to sound like a jerk, hard to explain it through email but
> I'll try to explain. The sudo code may be slightly off but you should get
> the idea.
> Its the same thing as image data we have something like this:
> unsigned char *pict = (unsigned char *)imbuf->rect;
> 
> if we do a pict++;
> pict now points to the second element in the rect data structure.
> instead of cycling through them all though if we do:
> unsigned char *pict = (unsigned char *)imbuf->rect; /* now it points to 
> the start again */
> pict+=10;
> We jump ahead 10 elements.
> 
> If you look at the code below "se" points to the strip->stripdata.
> Which is all of the strip information.... But we don't want that we really
> want the data from "frame" nr so we need to do a
> se+= nr;
> Then we can play with our data and do whatever we need. (All the other
> code here just determines what nr should be and then at the very
> end makes sure that in our current stripdata
> strip->stripdata[nr] we set nr to = nr.
> or strip->stripdata[nr]->nr = nr;
> 
> There is no ok I want frame 10,9, 22, this bit of code is just
> giving the element of the strip at cfra. So what we do is
> translate cfra into an element # of the strip (or frame number for the 
> strip)
> stick that in nr and look it up and return it.
> and just to be safe we set that element's nr (probably needs it)
> 
> Kent
> 
> > > > > StripElem *give_stripelem(Sequence *seq, int cfra)
> > > > > {
> > > > > Strip *strip;
> > > > > StripElem *se;
> > > > > int nr;
> > > > >
> > > > > strip= seq->strip;
> > > > > se= strip->stripdata;
> > > > >
> > > > > *if*(se==0) *return* 0;
> > > > > *if*(seq->startdisp >cfra || seq->enddisp <= cfra) *return* 0;
> > > > >
> > > > > *if*(cfra <= seq->start) nr= 0;
> > > > > *else* *if*(cfra >= seq->start+seq->len-1) nr= seq->len-1;
> > > > > *else* nr= cfra-seq->start;
> > > > >
> > > > >
> > > > > se+= nr;
> > > > > se->nr= nr;
> > > > >
> > > > > *return* se;
> > > > > }
> > > > >
> 
> --
> mein at cs.umn.edu
> http://www.cs.umn.edu/~mein
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.blender.org/pipermail/bf-committers/attachments/20050916/9b157cc3/attachment.htm


More information about the Bf-committers mailing list