Conditional toggle not eval'ing

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 11 November 2003   #1
Conditional toggle not eval'ing

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.
__________________
Whoever said "laughter is the best medicine" never had morphine with the little thumb pump.
 
Old 11 November 2003   #2
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[].
__________________
Whoever said "laughter is the best medicine" never had morphine with the little thumb pump.
 
Old 11 November 2003   #3
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 :(
__________________
Whoever said "laughter is the best medicine" never had morphine with the little thumb pump.
 
Old 11 November 2003   #4
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?
__________________
Whoever said "laughter is the best medicine" never had morphine with the little thumb pump.
 
Old 11 November 2003   #5
Bingo!

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.
__________________
Whoever said "laughter is the best medicine" never had morphine with the little thumb pump.

Last edited by Electrofirma : 11 November 2003 at 09:29 AM.
 
Old 01 January 2006   #6
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:54 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.