Monitoring a file for changes

   1550   1   1
User Avatar
Member
39 posts
Joined: Dec. 2018
Offline
Hi everybody

Is there a node that can monitor, say, a json file, so that if the file changes it is reprocesses and potentially triggers a cascade of updates on downstream nodes?

Right now I can think only of a simple infinite loop in python. I'm wondering if there is anything more Houdini-native.

Kind regards,

Manu
User Avatar
Member
151 posts
Joined: June 2019
Online
I don't think there is a builtin way to do that.

The easiest way I think is utilizing Qt QFileSystemWatcher: https://doc.qt.io/qtforpython-5/PySide2/QtCore/QFileSystemWatcher.html [doc.qt.io]

You can look at example of using it in Houdini Expression Editor shipped with Labs. Originally taken from this: https://github.com/cgtoolbox/HoudiniExprEditor [github.com] . Under the hood is really simple and nice idea, for any parameter it creates a temporary file and place a file watcher on it. Every time you update the file content it updates the linked parameter with it.
Edited by elovikov - Nov. 8, 2021 16:49:51
  • Quick Links