POV-Ray : Newsgroups : povray.general : Is this a bug? : Re: Is this a bug? : WORKAROUND Server Time
26 Jun 2024 01:25:33 EDT (-0400)
  Re: Is this a bug? : WORKAROUND  
From: Ger
Date: 19 Jan 2016 04:24:40
Message: <569e00d8@news.povray.org>
Jaime Vives Piqueres wrote:

>    Well, thanks to a recent question by Thomas about Parse_String(), if
> you absolutely need to include code on a macro, there is a workaround
> using that function from strings.inc:
> 
>    Write the include file like this:
> 
> #write(filehandle, "\"#declare CFS[",str(Count,0,0),"] = <", vstr(3,
> CFS[Count], ", ", -1,-1),">;\",\n")
> 
>    Then, instead using #include "data.inc", use a call to this macro:
> 
> #macro ParseInclude(IncludeFile)
>    #fopen filehandle IncludeFile read
>    #while (defined(filehandle))
>      #read (filehandle,IncludeLine)
>      #debug IncludeLine
>      #debug "\n"
>      Parse_String(IncludeLine)
>    #end
>    #fclose filehandle
> #end
> 
>    like this:
> 
> ParseInclude("data.inc")
> 
> 
>    Hope this helps...
> 
> --
> jaime

It's an interesting technique to say the least, and I must say that it works 
all be it slow (I did implement it in this little animation). But the whole 
point is that an #include should work inside a #macro. 
The simplest workaround for me would be to put the #include in the main body 
of the scene. I've done it and it works fine.
So it's not like "It doesn't work" but more like "It doesn't work the way it 
should"

-- 

Ger


Post a reply to this message

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