View Full Version : Conditional toggle not eval'ing
11-05-2003, 06:44 AM
Hi all, here's one that's got me stumped...
eval("polyOptions " + (`polyOptions -query -fullBack` ? "-backCulling" : "-fullBack"));
Even though "polyOptions -query -fullBack" run seperately returns 0.
It always evals to "polyOptions -backCulling".
Any insight is appreciated.
11-05-2003, 07:05 AM
I may have the problem figured out, just don't know how to fix it yet.
I tried an explicit cast of the query results to int, and it errored because the query is returning an int.
11-05-2003, 08:23 AM
Okay, never mind...
I realize now that it is a bigger issue than I realized.
i.e. I thought the int was created because I could query more than one attribute. It is actually created to give a list of attributes for all selected options. Or all objects if -gl is specified.
I need to change my strategy :(
11-05-2003, 09:06 AM
OK, I try this...
int $myToggle = 1 - $myToggle ? eval(`polyOptions -gl -fullBack`) : eval(`polyOptions -gl -backCulling`);
It executes the eval for the toggled value of $myToggle, but the value of $myToggle isn't changed.
I can do...
int $myToggle = 1 - $myToggle;
and it toggles nicely back and forth from 1 to 0, and returns it's value. How come the conditional statement seems to toggle the value, but not save it back to the variable as the statement says it should?
11-05-2003, 09:19 AM
int $ef_bfTogl=($ef_bfTogl=1-$ef_bfTogl)?eval(`polyOptions -gl -fb`): eval(`polyOptions -gl -bc`);
There's what I was shooting for... a single line that toggles backface culling. I don't like using a variable to keep track of the display state, but I can sleep now.
01-16-2006, 03:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.