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 12:28:37 EDT (-0400)
  Re: How do you use an external Text file for animation values  
From: Leroy
Date: 26 Jan 2008 23:35:14
Message: <479C0955.3050009@joplin.com>
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.