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:49:48 EDT (-0400)
  Re: How do you use an external Text file for animation values  
From: audioguytodd
Date: 27 Jan 2008 11:55:00
Message: <web.479cb7386e870b0f230bdc7b0@news.povray.org>
Hmmm. I am getting this error:

Parse Error: Expected 'float, vector, or string literal', ,found instead.

My code in the POV file:

#fopen MyFile "c:\filename.txt" read
#while (defined(MyFile))
#read (MyFile, Var1, Var2, Var3
#end

The text file Filename just has three comma separated variables:

0, 0, 0
0, 0, 0
0, 0, 0
-12, -18, 0

etc...

In the Camera Object I want to use those variables:

amera {
  location  <Var1, Var2, Var3>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.3, 0.3,  0.3>
}

The POV documentation says to use comma separated files, but now it looks as if
it is hanging in the second line in the text file and giving me that error.

Any thoughts??

audioguytodd



Leroy <lrw### [at] joplincom> wrote:
> audioguytodd wrote:
> > Could someone please post a small example of how to use an external Text file to
> > input variables in an animation??? I have Vectors (and other data) in a text
> > file that I would like to read for each frame. I have done this a long time
> > ago, but seem to have forgotten.
> >
> > Thank in advance,
> >
> > audioguytodd
> >
> >
> Your in luck I was just doing that the other day.
> (reading text files for my animated robots)
>   here's an example
>
> #declare RVal=0;
> #fopen Myfile "Action.txt" read
>   #while (defined(Myfile))
>    #read (Myfile Frame,Data)
>    #declare Frame_Count=Frame_Count+Frame;
>    #if ((Frame_Count>Frame_number)&(K=0))
>     // fix two frame data variables
>     #declare K=1;
>     #declare AtFrame1=Frame_Count-Frame; //first data frame
>     #declare First_Data=OldData;// first data
>     #declare Second_Data=Data;// second data frame
>     #declare AtFrame2=BTD; //second data
>    #end
>    #declare OldData=Data;
>    #declare RVal=RVal+1;//keep track of reads
>   #end
>
> You might not be in luck at that.
>   My data has in it the difference between each "pose's" frame.
>   It also reads all the data for every frame you render.
>   Well I hope this helps.


Post a reply to this message

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