POV-Ray : Newsgroups : povray.newusers : passing values Server Time
26 Dec 2024 19:35:03 EST (-0500)
  passing values (Message 1 to 3 of 3)  
From: David Kraics
Subject: passing values
Date: 7 Nov 2018 19:45:01
Message: <web.5be38644fb00a658749dac470@news.povray.org>
I am working on a scene involving the inside of a cabin. Each room is in a
separate INC file. I use IF statements to make certain walls invisible so the
inside of the room can be seen. Normally I do this by adjusting a #declared
value in the individual INC file. Is there a way to pass a value from the main
POV file to the INC file so I can do it in one location?


Post a reply to this message

From: clipka
Subject: Re: passing values
Date: 7 Nov 2018 20:05:39
Message: <5be38be3@news.povray.org>
Am 08.11.2018 um 01:41 schrieb David Kraics:
> I am working on a scene involving the inside of a cabin. Each room is in a
> separate INC file. I use IF statements to make certain walls invisible so the
> inside of the room can be seen. Normally I do this by adjusting a #declared
> value in the individual INC file. Is there a way to pass a value from the main
> POV file to the INC file so I can do it in one location?

Any variable you declare in the main file is available in any file it 
subsequently includes.

E.g.:

     // main file
     #declare Foo = 42;
     #include "whatever.inc"

     // whatever.inc
     #debug concat("Foo is ", str(Foo,0,0), "\n")

This even works with files declared using `#local` in the main file.


Post a reply to this message

From: Thomas de Groot
Subject: Re: passing values
Date: 8 Nov 2018 02:27:38
Message: <5be3e56a$1@news.povray.org>
On 8-11-2018 2:05, clipka wrote:
> Am 08.11.2018 um 01:41 schrieb David Kraics:
>> I am working on a scene involving the inside of a cabin. Each room is 
>> in a
>> separate INC file. I use IF statements to make certain walls invisible 
>> so the
>> inside of the room can be seen. Normally I do this by adjusting a 
>> #declared
>> value in the individual INC file. Is there a way to pass a value from 
>> the main
>> POV file to the INC file so I can do it in one location?
> 
> Any variable you declare in the main file is available in any file it 
> subsequently includes.
> 
> E.g.:
> 
>      // main file
>      #declare Foo = 42;
>      #include "whatever.inc"
> 
>      // whatever.inc
>      #debug concat("Foo is ", str(Foo,0,0), "\n")
> 
> This even works with files declared using `#local` in the main file.


Maybe it could also be achieved if each room were embedded in a separate 
macro?

-- 
Thomas


Post a reply to this message

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