|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 18-02-05 à 17:47, Mike Horvath a écrit :
> 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
Not any that I'm aware of.
What you can do is define the macro with only a single, or no, parameter
and use some global variable and #if statements to assign defaut values
it any variable is not already defined.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Horvath <mik### [at] gmailcom> wrote:
> 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?
I know what you mean.
I just came up with this idea 5 sec ago:
What if you "always" pass a vector to the macro - one that is reset to default
"null" values, and then you can re-#declare the vector before calling the macro
with the vector as an argument.
That way the vector need not always have the same number of components, but it's
always ONE vector.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 05.02.2018 um 23:47 schrieb Mike Horvath:
> 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?
In the new versions, you can use e.g.
#macro Fnord(A, optional B, C)
#ifdef(local.B)
#debug "Got a value for B.\n"
#else
#debug "B was left empty.\n"
#endif
#end
Fnord(A,,C)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2/6/2018 8:10 AM, clipka wrote:
> Am 05.02.2018 um 23:47 schrieb Mike Horvath:
>> 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?
>
> In the new versions, you can use e.g.
>
> #macro Fnord(A, optional B, C)
> #ifdef(local.B)
> #debug "Got a value for B.\n"
> #else
> #debug "B was left empty.\n"
> #endif
> #end
>
> Fnord(A,,C)
>
Interesting, thanks.
Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|