POV-Ray : Newsgroups : povray.general : Write macro-generated objects to file? : Re: Write macro-generated objects to file? Server Time
4 Aug 2024 04:13:15 EDT (-0400)
  Re: Write macro-generated objects to file?  
From: ingo
Date: 23 Jul 2003 08:24:19
Message: <Xns93C19331EFECFseed7@povray.org>
in news:3f1e657d$1@news.povray.org Torsten Crass wrote:

><sigh>if it must be...</sigh> I was just hoping I could use the same 
> macros for creating both .inc files and ready-to-use objects for my
> scene. 
> 

I may be misunderstanding you sihgs, but you can use one macro/inc-file 
for that.

#macro SomeMacro (a,b,c, FileName)
  ....
  ....
  #if(file_exists(FileName))
    #include FileName
    #local WriteFile=0;
  #else
    #if(strlen(FileName)!=0)
      #local WriteFile=1;
      #fopen GeneratedObjectsFile FileName write
    #else
      #local WriteFile=0;
    #end
  #end
  ....
  ....
  // generate an object here,
  // use the WriteFile variable to check
  // wether it should be written to file or not 

#end

When you call the macro with a FileName="" no file will be written.
When you call a macro with a FileName="something" it will be checked 
wether the file already exists. In that case the existing file will be 
parsed. If it doesn't exist a new file will be written.

Ingo


Post a reply to this message

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