getting an expression to do nothing!

   5353   6   0
User Avatar
Member
196 posts
Joined: July 2005
Offline
Hi,

How do you get an if() expression to do nothing?

e.g.

if($PT<5,3,leave the same)

so unless the point no. is less than 3 it will leave the value the same.

Is the only way to reference its own channel? if you know what I mean.

so

if($PT<5,3,ch(“/obj/geo/me/thisvalue”))


???

Thanks
Henster
Henster
User Avatar
Member
7710 posts
Joined: July 2005
Online
I don't think that will work as that will create infinite recursion.

For regular object values, cubic() often works. If you're using this in a Point SOP, for say Position, then use one of $TX, $TY, or $TZ. ie. the default expression when you add an attribute there. Basically, the method depends on where you're trying to do this.
User Avatar
Member
344 posts
Joined: July 2005
Offline
Not sure I'm follwing what you are after but…

Maybe try multiplying $PT by 1 or adding 0. That way, if() has something to do, but doesn't change the variable. Or, you could shove the value into a variable you create especially for garbage collection or something.
User Avatar
Member
87 posts
Joined: July 2005
Offline
Doesn't this work?

if ($PT < 5, 3, $PT)


:?
/ken_jones/$: _
User Avatar
Member
7710 posts
Joined: July 2005
Online
Not really because you want to return the value of the attribute that was previously there, not the point number.
User Avatar
Member
387 posts
Joined: July 2005
Offline
kemijo
Doesn't this work?
if ($PT < 5, 3, $PT)
:?

yeah, I was about to say the same thing, but couldn't log in. This expression would usually be used to limit a value, right? In which case the two numbers would be the same, eg: if($PT<5,5,$PT) which says $PT should not be less than 5.

If you want to a minimum AND maximum limits, then check out clamp() ie:

-> exhelp clamp
float clamp (float value, float minimum, float maximum)
This is a Houdini expression function that will clamp the value
between the minimum and maximum numbers. It is used to prevent
the value from going outside the specified range.

i.e. If the value is less than the minimum number, the
minimum number will be returned. If the value is greater
than the maximum number, the maximum number will be returned.

cheers,
ben.
''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
User Avatar
Member
12433 posts
Joined: July 2005
Offline
Ah, this thread makes you wish for a $V local variable defined and loaded with the contents of the field, like whats available in the Expression CHOP.

Then you could:

if( $PT>6, 3, $V )


Otherwise, I'm not sure how to do this..
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
  • Quick Links