|
|
|
|
|
|
| |
| |
|
|
From: Torsten Crass
Subject: Write macro-generated objects to file?
Date: 22 Jul 2003 11:46:04
Message: <3f1d5c3c@news.povray.org>
|
|
|
| |
| |
|
|
Hi there!
When populating a scene with loads of macro-generated objects, I thought
it would be a nice idea to run those time-consuming macros only once,
write their "return values" (in this case: unions of triangles) to an
.inc file and re-use this file when further experimenting with the
scene. However, I couldn't figure out a way to write those objects to a
file - the #write directive apparently only accepts strings, numbers and
vectors.
Does anybody have a clue how one could save macro-generated objects to a
file - i.e. use PovRay for creating its own .inc files?
Thanx in advance -
Torsten
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Write macro-generated objects to file?
Date: 22 Jul 2003 12:13:00
Message: <3F1D628B.3D8D14B2@gmx.de>
|
|
|
| |
| |
|
|
Torsten Crass wrote:
>
> Hi there!
>
> When populating a scene with loads of macro-generated objects, I thought
> it would be a nice idea to run those time-consuming macros only once,
> write their "return values" (in this case: unions of triangles) to an
> .inc file and re-use this file when further experimenting with the
> scene. However, I couldn't figure out a way to write those objects to a
> file - the #write directive apparently only accepts strings, numbers and
> vectors.
> Does anybody have a clue how one could save macro-generated objects to a
> file - i.e. use PovRay for creating its own .inc files?
You can find some samples for using the #write directive in the standard
include file 'shapes.inc'. As you said #write supports strings, floats
and vectors. Since all objects consist of such elements you can write
them quite easily.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 17 Jun. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi Christoph!
> You can find some samples for using the #write directive in the standard
> include file 'shapes.inc'. As you said #write supports strings, floats
> and vectors. Since all objects consist of such elements you can write
> them quite easily.
Uhm, well... yes and no. Of course it is possible to assemble all
keywords and parameter values which define an object into a file - if
you can retrieve them one by one. But what about a union that comes out
of a macro, and whose sub-objects have been created and randomly
transformed by further sub-macros, and so forth?
Something like a to_string(OBJECT) function would be really handy! But
there isn't one, is there?
Regards -
Torsten
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Write macro-generated objects to file?
Date: 22 Jul 2003 13:13:59
Message: <3F1D70D6.36FCB076@gmx.de>
|
|
|
| |
| |
|
|
Torsten Crass wrote:
>
> Uhm, well... yes and no. Of course it is possible to assemble all
> keywords and parameter values which define an object into a file - if
> you can retrieve them one by one. But what about a union that comes out
> of a macro, and whose sub-objects have been created and randomly
> transformed by further sub-macros, and so forth?
Just add writing code in your macros wherever an object is created.
> Something like a to_string(OBJECT) function would be really handy! But
> there isn't one, is there?
There won't be - objects are not always stored internally as they are
written in script.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 17 Jun. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
From: Gilles Tran
Subject: Re: Write macro-generated objects to file?
Date: 22 Jul 2003 15:45:18
Message: <3f1d944e@news.povray.org>
|
|
|
| |
| |
|
|
3f1d5c3c@news.povray.org...
> Hi there!
>
> Does anybody have a clue how one could save macro-generated objects to a
> file - i.e. use PovRay for creating its own .inc files?
Look for the advanced/blocks examples in the demo scenes for instance.
Other examples can be found in my tree and grass macros
http://www.oyonale.com/ressources/english/sources01.htm and pipe macros
http://www.oyonale.com/ressources/english/sources08.htm
G.
--
**********************
http://www.oyonale.com
**********************
- Graphic experiments
- POV-Ray and Poser computer images
- Posters
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi Christoph,
> Just add writing code in your macros wherever an object is created.
<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.
Thanx anyway -
Torsten
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |