CGTalk if OR then statements in expressions?
 10-25-2012, 05:16 AM #1 kronique Veteran portfolio kronique United States Minor Outlying Islands   Join Date: Apr 2011 Posts: 44 if OR then statements in expressions? Just wondering if this is possible with expressions ? I'm not a pro or anything, I just researched a bit, this is the result. My book doesn't say if i can or cant use OR. in theory i need something that does this: if (( boneA.rZ=5) && (boneB.rZ=4) OR (boneA.rZ=16) && (boneB.rZ=20)) then {cluster.envelope = 1.0;} else {cluster.envelope = 0.0;} if not what is an alternative? if i give the cluster a floating point will it gradually blend on automatically? thanks !! Last edited by kronique : 10-25-2012 at 05:22 AM. share quote
 10-25-2012, 06:00 AM #2 ristopuukko Earthling   portfolio Risto Puukko Senior fx td FrameStore London, United%2BKingdom   Join Date: Nov 2003 Posts: 820 If you need interpolation between values, checkout linstep and smoothstep - commands. /risto __________________ - Oh no, it's me - share quote
 10-25-2012, 06:46 AM #3 zaskar Expert portfolio franky****inFourFingaz - Dresden, Germany   Join Date: Dec 2010 Posts: 321 Btw the syntax for your example is almost exactly like your example: if( ((a == w) && (b == x)) || ((c == y) && (d == z)) ) Dont let you confuse by complexity, you simply reduce the statement to: if( trueA ) then do... while trueA is the case if ( trueB || trueC ) while trueB is the case if (trueD && trueE) with trueD being the case if (trueF == trueG) -> ad inifinitem share quote
 10-25-2012, 03:51 PM #4 newguy4life Generalist portfolio Quin Barclay 3d Generalist Chicago, USA   Join Date: Mar 2011 Posts: 198 Check out this website, it is a good reference for operators. Code: ```if ( ((boneA.rZ==5) && (boneB.rZ==4)) || ((boneA.rZ==16) && (boneB.rZ==20)) ) { cluster.envelope = 1.0; } else { cluster.envelope = 0.0; }``` Using that code, the envelope will not interpolate. Like risto said, check out linstep and smoothstep, but you may also just want to check out driven keys if you don't have to do this an expression. share quote
10-26-2012, 12:00 AM   #5
kronique
Veteran
portfolio
kronique
United States Minor Outlying Islands

Join Date: Apr 2011
Posts: 44
Quote:
 Originally Posted by zaskar Btw the syntax for your example is almost exactly like your example: if( ((a == w) && (b == x)) || ((c == y) && (d == z)) ) Dont let you confuse by complexity, you simply reduce the statement to: if( trueA ) then do... while trueA is the case if ( trueB || trueC ) while trueB is the case if (trueD && trueE) with trueD being the case if (trueF == trueG) -> ad inifinitem

Are you saying our examples are practically exactly alike? If so yeah i can kind of see that, but having hard time understanding.

10-26-2012, 12:11 AM   #6
kronique
Veteran
portfolio
kronique
United States Minor Outlying Islands

Join Date: Apr 2011
Posts: 44
Quote:
 Originally Posted by newguy4life Check out this website, it is a good reference for operators. Code: ```if ( ((boneA.rZ==5) && (boneB.rZ==4)) || ((boneA.rZ==16) && (boneB.rZ==20)) ) { cluster.envelope = 1.0; } else { cluster.envelope = 0.0; }``` Using that code, the envelope will not interpolate. Like risto said, check out linstep and smoothstep, but you may also just want to check out driven keys if you don't have to do this an expression.

Great its really appreciated. Thanks for getting in touch and I'll check it out.

 10-26-2012, 08:45 AM #7 Aikiman Pixel Collisions   portfolio Jeremy Raven Wellington, New Zealand   Join Date: Jun 2005 Posts: 3,582 C (Mel) uses '||' whereas Python uses 'OR' __________________ www.jeremyraven.co.nz Vimeo share quote
 10-26-2012, 08:45 AM #8 CGTalk Moderation Expert   Join Date: Sep 2003 Posts: 1,066,478 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. share quote