POV-Ray : Newsgroups : povray.advanced-users : Undefined variables : Re: Undefined variables Server Time
24 Jun 2024 00:04:55 EDT (-0400)
  Re: Undefined variables  
From: dick balaska
Date: 5 Feb 2018 20:46:40
Message: <5a790900$1@news.povray.org>
On 02/05/2018 05:47 PM, Mike Horvath wrote:
> I am trying to create a macro:
> 
>    #macro BlurredReflection(InPigment, InFinish, InNormal)
>      ...
>    #end
> 
> But I don't want to *always* pass a value to the macro. Is there a way 
> to pass a "null" or "nil" value to the macro, and then check for it 
> using a conditional statement?
> 
> Thanks.
> 
> Mike

There are optional parameters, which may help you out.
http://news.povray.org/povray.beta-test/thread/%3Cweb.58d3f1da55c5eb5fc437ac910%40news.povray.org%3E/

I had a similar need, but I ended up not using optionals, because the 
caller still needs to be aware of the missing parameters via comma 
count; i.e. BlurredReflection(Red,,)

I ended up just creating a mostly duplicate, different named macro with 
the optional parameter.
#macro BlurredReflection(InPigment, Infinish) #end
#macro BlurredReflectionWithNormal(InPigment, InFinish, InNormal) #end

-- 
dik
Rendered 920576 of 921600 pixels (99%)


Post a reply to this message

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