if OR then statements in expressions?

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 10 October 2012   #1
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 October 2012 at 05:22 AM.
 
Old 10 October 2012   #2
If you need interpolation between values, checkout linstep and smoothstep - commands.

/risto
__________________
- Oh no, it's me -
 
Old 10 October 2012   #3
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
 
Old 10 October 2012   #4
Check out this website, it is a good reference for operators.

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.
 
Old 10 October 2012   #5
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.
 
Old 10 October 2012   #6
Originally Posted by newguy4life: Check out this website, it is a good reference for operators.

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.
 
Old 10 October 2012   #7
C (Mel) uses '||' whereas Python uses 'OR'
__________________
www.jeremyraven.co.nz
Vimeo
 
Old 10 October 2012   #8
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.
 
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 10:28 AM.


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