Add a "if" in the texture field.

   1211   3   0
User Avatar
Member
2 posts
Joined: Nov. 2019
Offline
Hello everyone,

I am new at Houdini and I have some issues about the “if” in the texture field.

I want to call different image textures after 200 frames, and for that I wanted to use the if operation.
I've tested many syntaxes for it, but it's not working:

$HIP/assets/bouche_`if($F >200){echo padzero(2,$F%33)}else{echo padzero(2,00)}`.jpg
`if($F >200){return $HIP/assets/bouche_padzero(2,$F%33).jpg}else{return $HIP/assets/bouche_padzero(2,00).jpg}`
if($F > 200, $HIP/assets/bouche_padzero(2,$F%33).jpg, $HIP/assets/bouche_padzero(2,00).jpg) )
if($F > 200, $HIP/assets/bouche_`padzero(2,$F%33)`.jpg, $HIP/assets/bouche_`padzero(2,00)`.jpg) )
if($F > 200)then
echo $HIP/assets/bouche_`padzero(2,$F%33)`.jpg
else
echo $HIP/assets/bouche_00.jpg
endif
if ($F > 200):
$HIP/assets/bouche_`padzero(2,$F%33)`.jpg

else:
$HIP/assets/bouche_`padzero(2,00)`.jpg

Could you help me please ?
Have a great day.

Ps: I used `padzero(2,$F%33)` because I want to loop an image sequence.
User Avatar
Member
7770 posts
Joined: Sept. 2011
Online
you haven't tried the correct syntax though.

In many cases the texture field cannot be animated, so be wary.

The correct syntax for an hscript expression would be `ifs(condition, valuetrue, valuefalse)` for values that are strings. Keyframes or animated attributes may also be more suitable.
User Avatar
Member
2 posts
Joined: Nov. 2019
Offline
It works! Thanks for your advice and help.
User Avatar
Member
859 posts
Joined: Oct. 2008
Offline
jsmack
you haven't tried the correct syntax though.

In many cases the texture field cannot be animated, so be wary.

Do we know why that is? It's always struck me as mysterious.
--
Jobless
  • Quick Links