|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi, guys !
Is there a way to assign an empty value to variable, using something like 'None'
in Python or NULL in C ? I would like to use it while passing parameters to
macros, for more compact notation.
Can not find any info in docs about it.
Thanks in advance,
--
YB
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"yesbird" <nomail@nomail> wrote:
> Is there a way to assign an empty value to variable, using something like 'None'
> in Python or NULL in C ? I would like to use it while passing parameters to
> macros, for more compact notation.
> Can not find any info in docs about it.
not that I can think of[*]. as a workaround, if the argument is optional and
not supplied, you can '#if (!defined(local.varName))' in the macro, to check, if
not supplied == NULL?
[*] however, two .. misfires already, this morning :-(
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi, jr.
Your answer assumes that macros can accept variable number of arguments, but
docs states following:
https://www.povray.org/documentation/3.7.0/r3_3.html#r3_3_2_8
----
3.3.2.8.2 Invoking Macros
You invoke the macro by specifying the macro name followed by a list of zero or
more actual parameters enclosed in parentheses and separated by commas. The
number of actual parameters must match the number of formal parameters in the
definition.
----
I only want to pass 'None' values to some of them to exclude their values from
object definitions, using system defaults for them and having more compact
notation finally.
Looks like it's not possible :(.
--
YB
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"yesbird" <nomail@nomail> wrote:
> Your answer assumes that macros can accept variable number of arguments, but
> docs states following:
it does, sort of. eg
#macro foo(a, optional b)
#if (!defined(local.b))
/* no b given on call */
#end
...
#end
foo(1,2)
or
foo(1,)
presuming that a "misisng" when called can be used for your purpose.
(have a look at the 'queues.inc' for use of optional args)
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
Thanks a lot, it really works ! (on ver. 3.8 only),
> (have a look at the 'queues.inc' for use of optional args)
but I can't find this file anywhere, where did you get from ?
--
YB
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"yesbird" <nomail@nomail> wrote:
> Thanks a lot, it really works ! (on ver. 3.8 only),
ah, yes, forgot, sorry. 'optional' was new in 3.8.
> > (have a look at the 'queues.inc' for use of optional args)
>
> but I can't find this file anywhere, where did you get from ?
my own, on the wiki. however, there's also a macro in 'pvars.inc' (on wiki)
which has only optional arguments.
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> my own, on the wiki. however, there's also a macro in 'pvars.inc' (on wiki)
> which has only optional arguments.
Thanks, I've found it, moreover structures are very useful itself :)
--
YB
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"yesbird" <nomail@nomail> wrote:
> Hi, guys !
>
> Is there a way to assign an empty value to variable, using something like 'None'
> in Python or NULL in C ? I would like to use it while passing parameters to
> macros, for more compact notation.
> Can not find any info in docs about it.
>
> Thanks in advance,
> --
> YB
As jr pointed out, there are work-arounds.
I find the optional keyword, and its required commas to be awkward and clunky.
Can you store your macro parameters in an array?
Then the array will exist, but it might not have certain elements defined. Then
you test each element in the size of the array
#declare SizeOfArray = dimension_size (Array, 1)-1;
#for (i, 0, SizeOfArray)
#if (!defined (Array[i])
.....
#end
Just another option.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
> Just another option.
Good idea, but 'optional' works fine for me, as I prefer to simplify the passing
process.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"jr" <cre### [at] gmailcom> wrote:
Hi,
> my own, on the wiki. however, there's also a macro in 'pvars.inc' (on wiki)
> which has only optional arguments.
Looks like there is some limitation on number of optional args:
----------------------------------------------
#macro _vector(optional p1, optional p2, optional p3)
#end
_vector(1, 2, 3) // OK
_vector(1, 2, ) // OK
_vector(1, ) // Error
----------------------------------------------
I wonder how is your code works ?
Regards,
--
YB
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |