Hi,
I have dozens of noise nodes that I need to change the values of the noise for but want to use a variable instead of hard coding the values and also use hscript to set them (instead of doing it manually).
Essentially I want to do something like this:
opparm subnet1/noise4d1 amp ($noise_x $noise_y $noise_z)
But of course the variable value gets evaluated in this form but I want to insert the string (i.e. “$noise_x”) into the fields but can't figure out the correct syntax. I've tried various forms using single and double qoutes, no luck.
Any suggestions?
Thanks!
–Mark
Setting An Op Parm To A Variable
5189 7 3- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
- lynch_ppl
- Member
- 176 posts
- Joined: July 2005
- Offline
You can use
“\” to comment out the $
opparm subnet1/noise4d1 amp (\$noise_x \$noise_y \$noise_z)
if you want an expression into a field…in this case you may want to use chadd and chkey…
set cosvar=cos\(\$F*ch\(\“../blender/freq\”))*ch\(\“../blender/amp\”)+ch\(\“../blender/offset\”)
set sinvar=sin\(\$F*ch\(\“../blender/freq\”))*ch\(\“../blender/amp\”)+ch\(\“../blender/offset\”)
chadd -t 0 0 0 $SOP tx
chadd -t 0 0 0 $SOP tz
chkey -t 0 -v 0 -m 0 -A 0 -F “$cosvar” text1/tx
chkey -t 0 -v 0 -m 0 -A 0 -F “$sinvar” text1/tz
“\” to comment out the $
opparm subnet1/noise4d1 amp (\$noise_x \$noise_y \$noise_z)
if you want an expression into a field…in this case you may want to use chadd and chkey…
set cosvar=cos\(\$F*ch\(\“../blender/freq\”))*ch\(\“../blender/amp\”)+ch\(\“../blender/offset\”)
set sinvar=sin\(\$F*ch\(\“../blender/freq\”))*ch\(\“../blender/amp\”)+ch\(\“../blender/offset\”)
chadd -t 0 0 0 $SOP tx
chadd -t 0 0 0 $SOP tz
chkey -t 0 -v 0 -m 0 -A 0 -F “$cosvar” text1/tx
chkey -t 0 -v 0 -m 0 -A 0 -F “$sinvar” text1/tz
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
- JColdrick
- Member
- 4140 posts
- Joined: July 2005
- Offline
I'm pretty sure you want the chadd/chkey approach - by entering an expression into a field, that's actually what you're doing behind the scenes. I don't know the precise param names, but something like:
chadd -t 0 0 0 subnet/noise4d*/ampx
chkey -t 0 -v 0 -m 0 -A 0 -F subnet/noise4d*/ampx $noise_x
Something like that, anyway. Do an opscript on the op to double check.
Cheers,
J.C.
chadd -t 0 0 0 subnet/noise4d*/ampx
chkey -t 0 -v 0 -m 0 -A 0 -F subnet/noise4d*/ampx $noise_x
Something like that, anyway. Do an opscript on the op to double check.
Cheers,
J.C.
John Coldrick
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
Personally, I'd skip the variables and just add spare channels to the operator where the noise is being applied (point SOP?) That way, you have a basic UI right there, you get some sliders, labeled parameters, etc. And if you have the same settings in multiple places, you can always create the parameters as spare channels up one level, or just have a null SOP that provides the channels to which all the other SOPs point.
– Antoine
– Antoine
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
JColdrickHi there JC,
chadd -t 0 0 0 subnet/noise4d*/ampx
chkey -t 0 -v 0 -m 0 -A 0 -F subnet/noise4d*/ampx $noise_x
Thanks for the tip, turns out that Houdini wouldn't create any channels at all, I restarted H and then it was working fine. Weird. More than likely operator error. :-)
–Mark
========================================================
You are no age between space
You are no age between space
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
Antoine DurrHi Antoine,
Personally, I'd skip the variables and just add spare channels to the operator where the noise is being applied (point SOP?) That way, you have a basic UI right there, you get some sliders, labeled parameters, etc. And if you have the same settings in multiple places, you can always create the parameters as spare channels up one level, or just have a null SOP that provides the channels to which all the other SOPs point.
– Antoine
You know, I started by using spare channels then realized I needed to do this at a “global” level, thus the variable usage. But now that you mention it, it would a lot easier to put the spare channel and controls at a higher level in the network. Much better.
Thanks for jogging my synaptic net mess!
–Mark
========================================================
You are no age between space
You are no age between space
- sdugaro
- Member
- 380 posts
- Joined: July 2005
- Offline
-
- Quick Links