Python - get UI progress bar data and print it to console

   667   1   1
User Avatar
Member
18 posts
Joined: Aug. 2022
Offline
I have a script `test.py` that has line `node.parm("export").pressButton()`.

When this button pressed inside UI it shows UI progress popup but when I call this script from console using `hython test.py` I can't see it and I can't see the progress.

Is there some way to show it's progress in console?

User Avatar
Member
18 posts
Joined: Aug. 2022
Offline
Andrej730
I have a script `test.py` that has line `node.parm("execute").pressButton()`.

When this button pressed inside UI it shows UI progress popup but when I call this script from console using `hython test.py` I can't see it and I can't see the progress.

Is there some way to show it's progress in console?


In case if it's important the node is ROP node `niagara_rop` that exports hbjson file from abc. It seems when I do "execute" it starts "render" but adding `rop.addRenderEventCallback(callback)` doesn't help - `callback` is never called.


UPDATE. Turned out I needed to add callback not to `out/niagara_rop1` but to `out/niagara_rop1/ROP` that was actually rendered and it worked. Still curious if there is more general solution to cover all UI progress bars.


def callback(node, event_type: hou.ropRenderEventType, t):
    if event_type != hou.ropRenderEventType.PreFrame:
        return
    current = hou.frame()
    print(f"{time()-t0:7.2f} sec. Processing frame #{current:5.0f}")


rop = hou.node("out/niagara_rop1/ROP")
assert isinstance(rop, hou.RopNode)
rop.addRenderEventCallback(callback)
Edited by Andrej730 - Aug. 9, 2024 03:06:10
  • Quick Links