POV-Ray : Newsgroups : povray.general : Is this a bug? : Re: Is this a bug? Server Time
28 Sep 2024 17:52:32 EDT (-0400)
  Re: Is this a bug?  
From: clipka
Date: 20 Jan 2016 14:31:11
Message: <569fe07f$1@news.povray.org>
Am 17.01.2016 um 20:43 schrieb Ger:

> Including a datafile in the main body works, but
> including it inside a #macro results in an error
> at random frames in the animation. It can be at
> frame 10 or at frame 500.

*HA!*
Got that son of a bitch!

Quick workaround: Add /anything/ anywhere before the "#end" statement of
ParseCenterOfMass(); even somewhere before the macro will do. But no
more than about 50 characters.

"WTF?!" you might ask.


Well, here's what happens in a nutshell:

- For each macro defined, POV-Ray stores some information like what file
it resides in, where it starts and, most importantly in this context,
where it ends. More specifically, it stores the position of the "#end"
that ends the macro.

- While executing a macro, to determine whether it has reached the end,
POV-Ray keeps its eyes peeled for any "#" at the position it has stored
as the macro's end.

- In your example, the 10th (give or take 1) "#declare" in "data.inc"
happens to be at the very same position as the "#end" of
ParseCenterOfMass() in your main file.


Do I need to say more? They say never to spoil a joke by explaining its
punchline, but yeah: When looking out for the end of the macro, POV-Ray
does indeed /not/ bother to test whether it is even in the right file.

*Facepalm!*


Post a reply to this message

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