POV-Ray : Newsgroups : povray.newusers : Incrementing variables in #for loop : Incrementing variables in #for loop Server Time
20 May 2024 18:13:29 EDT (-0400)
  Incrementing variables in #for loop  
From: Bald Eagle
Date: 26 Mar 2020 19:40:00
Message: <web.5e7d3c6f8fc02199fb0b41570@news.povray.org>
So, I came across a strange complaint from the POV-Ray parser. (qtpovray 3.8)

I have a standalone file that makes the virus particle for jr's animation.
Works fine.

I copied and pasted the object definition into an include file, and I was
suddenly getting the "Parse Error: Cannot pass uninitialized identifier to
non-optional LValue." error.

When I change the #local in the loop to a #declare, it works.

before the loop:
#declare dlong = pi*(3-sqrt(5));  //~2.39996323
#declare dz = 2/N;
#declare long = 0;
#declare Z = 1 - dz/2;

// ....

#declare COVID_19 = union {
#for (k, 0, N-1)

// ....
// and here we have the #local vs #declare problem:

 #local Z = Z - dz;
 #local long = long + dlong;

I'm not sure why it would work in one scene, and not the other.
It's as if the loop or the #local somehow negates the global name, but only in
the include file.   :O

Post a reply to this message

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