Assigning Expressions with hScript

   6672   10   3
User Avatar
Member
2 posts
Joined:
Offline
Hello Im trying to assign an expression to a parameter using hScript. Im using the opparm function to assign values to parameters but when I try to assign a expression with it, it doesnt seem to work work.

opparm /obj/bone1 length 123 # Works OK

opparm /obj/bone1 length ‘“$a”*chop(\“/ch/ch1/chopnode/ch1\”)’ # Doesnt Work

Does anyone know how to assign an expression rather than a value to a parameter?
National Center for Computer Animation
Bournemouth University, UK
User Avatar
Member
2199 posts
Joined: July 2005
Online
I think you'll find you have to create a key and then assign the expression to the channel that's created. Unless this has changed in H8.

If you type in what you want manually then do an opscript on the node you should see what is required to reproduce it.
The trick is finding just the right hammer for every screw
User Avatar
Member
2 posts
Joined:
Offline
Thanks.

Thant opscript tip was very useful

Karl
National Center for Computer Animation
Bournemouth University, UK
User Avatar
Member
7025 posts
Joined: July 2005
Offline
This brings up a bigger topic… you should be able to do it in one command! Having to chadd etc etc is really tedious. Please, a command that lets you put an expression in, and does all the other crap for you…

Cheers,

Peter B
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
I agree…
if you do this:
opparm bone1 length (foo)

you get this:
Warning: Invalid channel “foo” specified in parameter
so Houdini should just make the channel…
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
2199 posts
Joined: July 2005
Online
Hear, hear viva la revolution!

Get's my vote.
The trick is finding just the right hammer for every screw
User Avatar
Member
1631 posts
Joined: July 2005
Offline
I concur!
User Avatar
Member
641 posts
Joined: July 2005
Offline
me too
User Avatar
Member
15 posts
Joined:
Offline
Oh yes. Me too!

This seems like a no-brainer. Surely if Houdini sees that the user is opparming an expression then it could just implicitly add the required chadd and chkey commands for you. This must have been an RFE for years.

Furthermore, it is a major hassle to write scripts that copy parameters from one node to another if they have to account for those parameters containing channels. It would be great to make that process smoother too.
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
Thanks. I submitted an RFE for that.
User Avatar
Member
387 posts
Joined: July 2005
Offline
arctor
so Houdini should just make the channel…

And put a key at Frame-1?

Ahhh…. Frame-1 … the first refuge for the keyless! :-) tee hee.

—–8<——————————————————————————

Actually, I just noticed a bug with a bad opparm and the channel viewer. It can show channels which don't exist anymore. Houdini 8.0.394. Try this in the textport:

opcf /obj
opadd geo thing
chadd thing tx

set one of your panes to be the channel editor . Scope the tx channel . Change the value at frame 1 to be 0.3 say. Now!

opparm thing tx nuthin

you'll see:
Warning: Invalid channel “nuthin” specified in parameter

and the tx channel in the parameter's pane is clear. It's a plain old 0.3 constant. But! In the channel editor it's still there. Hmmm. Now, let's have some fun. Change the 0.3 in the parameters to, say, 0.5. The Channel Editor says 0.3 still. Cool. Now change the value in the channel editor to -2, and move the key to another frame. Frame 42 for example. Noice.
Which is true?

/obj -> opparm -d thing tx
opparm thing tx ( 0.5 )

Oooh! What if we now make a channel in the parameters pane by ALT+LMB clicking on the 0.5. What will happen!?! Yay! A New Key at Frame-1 and a value of -0.1 (and i'm at frame-13; the unlucky frame number).

An “opparm usage error” probably shouldn't blow away a channel.
Actually, that's probably the real bug..

beers!
b.
''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
  • Quick Links