script : change parameter value on condition

   4868   6   1
User Avatar
Member
383 posts
Joined:
Offline
Hello,

I would like to change the value of a parameter of a child node regarding the value of a parameter of the parent one.

if parentParmValue == XXX:
childParmValue = YYY
else :
childParmValue = ZZZ

I tried to put this kind of script as experession in the child parameter but Houdini doesn't stop to cook

thanks for your help
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
606 posts
Joined: May 2007
Offline
This should be pretty straightforward, maybe share your scene so we can better advise?

Attachments:
ee_parameter_condition.hip (70.6 KB)

User Avatar
Member
383 posts
Joined:
Offline
thanks eetu

I will check your scene asap

For the moment, I added a new parameter where I put a python script.
It seems to work for now …
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
well… My idea was a very bad one.

My goal is to make an asset dealing with external data.
The interface allows to load the data file.
Regarding the nature of the data, parameters of nodes inside the asset have to change.

I have a good prototype of the script but I don't know where to put it.
I tried to write the script as an expression directly in the “changing parm” but Houdini blocked ( endless cook).
I tried to create new parm with the script inside, on the interface level. Good success until I save the asset. The script is not saved and if I rewrite it, I have an error : editing of content not allowed !

I prepared a little hip for you to watch the structure and what I am talking about.

Attachments:
myProblem.hip (60.0 KB)

http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
after other attempt it seems that if a put my python script in any parameter it only works if the content of the asset is editable.

How can I script parameter's changes inside an asset ?
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
183 posts
Joined: Nov. 2008
Offline
Here is an example. I'v created embedded asset, take a look inside Python Module.

Attachments:
myproblem_114_solved.hip (65.4 KB)

Aleksei Rusev
Sr. Graphics Tools Engineer @ Nvidia
User Avatar
Member
383 posts
Joined:
Offline
It's works like a charm.
Thanks a lot Alexei.

If you don't mind I have a couple of questions :

Regarding what you wrote. Why 2 arguments in the numRows function ?

My code read elevation data and add attribute to millions of points. I manage to reduce my grid rez to 2x2 when no file are loaded but it doesn't release memory. Once a file is loaded and attribute added .. it's just to late. Even if a delete the asset and use File ->New command the memory is still used.
Any idea of what happens ?

Is it possible to read file in Vex ?
http://vimeo.com/vbkstudio [vimeo.com]
  • Quick Links