Jump to content
Sign in to follow this  

[PYTHON] Getting current frame over network using rpyc

Recommended Posts

Hello !

I'm trying to do some tests using rpyc to control Houdini over the network (currently only on the same computer)

I managed to get it to work (creating some nodes, getting the frame range, setting the frame)
But, strangely, I can't get the correct current frame number

It will return 1.0, but if I use hou.setFrame(XX) it will then return that value (whatever XX was) even after manually changing the frame in Houdini
I tried using hou.frame(), hou.expandString("$F")
They both had the same problem

My steps to get it to work were copying the rpyc folder at
C:\Program Files\Side Effects Software\Houdini 17.0.XXX\python27\lib\site-packages
C:\Program Files\Autodesk\Maya2017\Python\Lib\site-packages

In Houdini, open a Python Shell and write/execute

import hrpyc

In Maya, open a Python Shell and write/execute

import rpyc

connection = rpyc.classic.connect("localhost", 18811)
hou = connection.modules.hou

print hou.frame() # Returns 1.0
hou.setFrame(52) # Sets the frame to 52
print hou.frame() # Returns 52.0
print hou.expandString("$F") # Returns 52

But if you manually change the frame in Houdini and only execute the print hou.frame() line, the problem will be apparent

Even in another Houdini instance the problem is present.

import hrpyc
connection, hou = hrpyc.import_remote_module()

print hou.frame()

Is there something I did wrong, missed or anything ?

Thanks !

Edited by Alain2131

Share this post

Link to post
Share on other sites

I work with hrpyc every day and haven't seen such a problem before. Consider this as a bug and report to SideFx. As a workaround try hou.hscript("fcur").

Share this post

Link to post
Share on other sites

Hey Alex, thanks for the answer !

I'll send an RFE as you proposed

But do you think this is because I'm using rpyc in Maya instead of hrpyc ?
I don't really know what I'm doing, I'm just poking around :)

Meanwhile, fcur does return the correct frame ! Noice ! Thanks for that =)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this