|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> I recently had a need for it:
> #ifdef(AA & BB)
>
> Apparently, it doe not (yet) work with 'tuples' like the newer v3.8 #declare
> does, for example. Nor with boolean operators, so it seems.
> Any suggestions or comments? It seems to me that at least one of these schemes
> *should* work, unless I'm making a basic error or wrong assumption somewhere.
Depending on how many variables you need to test, you lump them all together
into an array and cycle through them, using the product of the result as a sort
of Boolean AND result.
Not sure I knew about "defined" - that's a handy keyword.
#declare AA = 1;
#declare BB = 3;
#declare Variables = array {AA, BB}
#macro And (_Array)
#declare Elements = dimension_size (_Array, 1)-1;
#declare AndResult = 1;
#for (Index, 0, Elements)
#declare AndResult = AndResult * defined (_Array[Index]);
#end
AndResult
#end
#if (And (Variables))
#debug "All variables are defined. \n"
#end
#error "No objects in scene"d
Post a reply to this message
|
|