POV-Ray : Newsgroups : povray.animations : How do you use an external Text file for animation values : Re: How do you use an external Text file for animation values Server Time
19 May 2024 09:00:38 EDT (-0400)
  Re: How do you use an external Text file for animation values  
From: audioguytodd
Date: 29 Jan 2008 17:30:00
Message: <web.479fa8986e870b0f230bdc7b0@news.povray.org>
Thanks, it works fine now. However, I could not use count as a variable for some
reason.Reseved keyword maybe??? Anyhow- this works. My variable in the text file
is <12,23,04>. Then it is read as a vector.

#fopen MyFile "c:\filename.txt" read
#declare countth =0;
  #while (defined(MyFile)&(countth<=frame_number))
  #read (MyFile, Var1, )
  #declare countth=countth+1;
  #end

audioguytodd

"audioguytodd" <aud### [at] bellsouthnet> wrote:
> Ah yes, now it is coming back to me.
>
> My only question now is where does the read code go?? In the POV file or my
> animation ini file?? I ask because I think When I did this long ago, it was in
> an ini.
> I know about the Vector thing- that is nice.
>
> I will try it out tomorrow.
>
> Thank You!!
> audioguytodd
>
> Leroy <lrw### [at] joplincom> wrote:
> > audioguytodd wrote:
> > > Nope that's not it, but I see what you mean.
> > >
> > > Is there any way to read each line in the text file then move on to the next
> > > frame and read the next line?? Well, I know there is- I just can't remember it.
> > >
> > > I want to read each comma separated variable as in the line. Right now, there
> > > are three (a vector):
> > >
> > > #fopen MyFile "c:\filename.txt" read
> > > #while (defined(MyFile))
> > > #read (MyFile, Var1, Var2, Var3 )
> > > #end
> > >
> > > I thought that is what I was doing above in line 3. Read File, Variable1, etc...
> > >
> > > But it doesn't seem to work right.
> > >
> > > BTW, I am using the Beta 3.7 (for the SMP which is very nice on my new
> > > Core2Quad!)
> > >
> > > audioguytodd
> > >
> >
> > First, I'm using pov3.6, I don't know nothing about 3.7.
> >
> > Your line:
> >   #read (MyFile, Var1, Var2, Var3 )
> > should read a LINE of data like you want if Var1,Var2,Var3 has been NOT
> > been defined earlier as anything but a float or not defined at all.
> >
> > To get the frame data you want you need to add a counter and stop
> > reading when you got your data.
> > something like:
> >   #declare count=0;
> >   #while (defined(MyFile)&(count<=frame_number))
> >   #read (MyFile, Var1, Var2, Var3 )
> >   #declare count=count+1;
> >   #end
> > Now Var1,Var2,Var3 should have the frame data!
> >
> > By the way POV will let you read vectors from a file in the form <0,0,0>.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.