Using cache to control recooking and pressing 2 buttons automatically

   5579   7   2
User Avatar
Member
52 posts
Joined: Nov. 2016
Offline
Hey guys.

I am trying to find a way to “manually update” a part of my graph.
Current approach, which works, but is not the greatest, is to just have a switch to turn it off.

Alternatively, I was considering just having 2 File Cache nodes, one for saving and one for loading.

Questions are: If it seems to work, should I go with it, or does it make any red lights go off in your heads
And
I would like it if I don't have to tell the artists what order to push several buttons. Can I “string together” button clicks?
Like make a button Parameter activate multiple buttons or make a button listen for another one or maybe plug in some Python code somewhere?

Thanks!
User Avatar
Member
197 posts
Joined: July 2015
Offline
Hi Martin,

One way of pressing multiple buttons through a single exposed one is by using some python script. Every HDA contains a section which we call “Asset Module”. In there you can store python script which can be called from nodes, buttons etc. So what you could do is have one “master” button, which will press other buttons for you through that script. The link below explains how it works.
http://www.sidefx.com/docs/houdini/hom/locations.html#asset_modules [www.sidefx.com]

So what you could do is create a function called PressButtons() inside the module, which will press (hidden?) buttons on the interface or inside your HDA.

So in your case it could be:

def PressButtons():
    hou.node("path/to/node/").parm("Button1").pressButton()
    hou.node("path/to/node/").parm("Button2").pressButton()

Then on your “main” button, you would add a callback script. Info:
http://www.sidefx.com/docs/houdini/hom/locations#parameter_callback_scripts [www.sidefx.com]

Using the example above, your callback could be:
kwargs['node'].hm().PressButtons()

Hope that helps,
Paul
Paul Ambrosiussen
Technical Artist, Freelance
twitter.com/ambrosiussen_p
User Avatar
Member
52 posts
Joined: Nov. 2016
Offline
Hey Paul.
Thanks a ton! This is super sleek!
I had not come across this
and I was also not entirely sure how much I could rely on python calls from the Houdini Engine.

But I will be trying this out
User Avatar
Member
52 posts
Joined: Nov. 2016
Offline
So I can make a PythonModule script under the Scripts tab, I take it that is where it lives these days instead of under Extra Files, as mentioned in the doc? Just checking to be sure I got it right…

Also, hope you don't mind me asking a slightly irrelevant question, but I'm rather curious and can't find any info anywhere.

What is the “Code” tab for, under Operator Type Properties? It looks like it does sort of the same but it is always empty, except for in this example I found for Unity Behavior Scripts in the Spaceship Door example, called “uscript” (type: UnityBehaviorScript)
User Avatar
Member
197 posts
Joined: July 2015
Offline
Hi,

Yes. You're correct about the Scripts tab. Just make a python module there.

As for the code tab, it will only be available for HDA types that support it. (Python surface nodes, VEX shaders, VOP operators)
An example is one of the GameDev Lens Shaders. Thats an HDA which only has VEX in it (Since its a shader), hence with the code tab being enabled.
You can create an asset type which supports this by doing File>New Asset.

Link, but I pretty much explained above:
http://www.sidefx.com/docs/houdini/ref/windows/optype.html#vex [www.sidefx.com]

Paul
Paul Ambrosiussen
Technical Artist, Freelance
twitter.com/ambrosiussen_p
User Avatar
Member
52 posts
Joined: Nov. 2016
Offline
Aaah!, gotcha..
Cheers!
User Avatar
Member
52 posts
Joined: Nov. 2016
Offline
So this method worked perfectly! After some trial and error I can now get it to cache somewhere on disk and load it from there in one click.

Question is if there is a method where I can avoid having files floating around on the artists' machines.

I tried the Stash node, but it doesn't seem to work in Unity.

Also there is a hou.geometry.freeze() but not sure how to use it like this…
User Avatar
Member
5 posts
Joined: Sept. 2021
Offline
Hi,

I got a problem when using stash and filecache.

I set a button to control file write and read just like you and it works well most of the time, but will always automatically write to disk after rebuilding or recooking in Unreal 4.25.

Is there any way to solve this? I'm stuck in.

Thanks!
  • Quick Links