Jump to content

Reload FileCache

Recommended Posts

Hi , I'm having this problem that when I do a rop chain to write a bunch of filecaches , some doesnt get updated and fail the rest of the caches , so I was looking how to force this realoading with python by hitting the reload button via and external python file(so I can do other stuff on postprocess beside updating) and @Adam Ferestad gave me this solution, but I can't getting working. it's a postprocess command on the node I want to reaload that calls a python node  wich then calls an external python function to reload...  also I would like to print something to the houdini or python houdini console so I can know that the script run but I can't...  what I'm doing wrong here? ... also it might be a simpler quick solution for this realoading problem, I'm happy to hear any because I really need this to iterate quickly.

I attached a test setup 



Link to comment
Share on other sites

The way I had built it, the python you have in the python node was in the scripts of an HDA.  The HDA had a button on it that executed the callback.  hou.phm() only works on an HDA actually, so what you should need to do is put the code you have in the Python node directly into the Post Render Script and take out the callback def in favor of just calling GE.reloadNode() directly.  

Link to comment
Share on other sites

13 hours ago, jmquintela said:

ok , I'll built that way then to make it work.. I was having this random external py so I could edit an external py file from VS, but to have it on an hda is a fair solution, I´ll try that.

If that is the reason you are doing this, then you just need to setup an external editor and target VS.  The method here is MUCH more about actually hacking around a bit to get external libraries and larger projects working within the interface.  I personally was doing this because I needed to test a standalone package and it ended up being easier to make an HDA that could call it on a button instead of having to keep calling it in a console window, but the end goal was a standalone process that was being run without Houdini open.  There are definitely use cases for what I did other than that, but if you just want to edit in a different editor, there are other ways.  The only downside of setting up the external editor is that it blocks on opening so you can't mess around in Houdini until you are done.

You can also try using a Script node.  I tested it out and I think it will work for what you want to do just fine, since you only want to hit a button with it.  This is tested and works.  Whenever the node cooks, that tick box gets ticked.  Simple and straight to the point.


Judging by your image, you will probably want something like:

list(map(lambda x: x[0].pressButton(), map(lambda y: y.globParms("reload"), hou.node(".").parent().glob("Test*"))))

This will execute from left to right, first finding all nodes in the parent of the script node whose names start with "Test", then finding all reload parameters on those nodes, then pressing all of the buttons on them.  I even tested it and it does indeed execute the code on each 'reload' parm that is found.

Edited by Adam Ferestad
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...