Using python to interact with an OTL

   3215   1   1
User Avatar
Member
8 posts
Joined: Jan. 2016
Offline
Howdy all,

I am currently working on some pipeline tools and am using Houdini engine in Maya to prep geo for export and later use in Houdini. The OTL is simply adding a rest attribute and creating some groups…all very simple.

The problem I am running into is that the only way I have figure out to kick off the alembic rop in the otl is to promote the render button to the top level and to activate it with a maya.cmds.setAttr() call.

This does fire off the render, but the script doesn't hold while the geo writes as the button returns as pressed immediately. This results in the script continuing to run while the geo is being written, so the script gets to the cleanup stage before the write is complete. This deletes the engine node in Maya and results in a failed or broken alembic.

Ideally I would like a way to directly access the alembic rop and push a call such as alembic_rop.render().

Any thoughts?
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
This is probably because the asset isn't cooked at the point where you call setAttr. It's likely being cooked when the viewport updates, which probably happens after your script finished. Your script could force a cook immediately by running getAttr on the .output attribute.

However, I think there's a bigger issue due to a limitation of Houdini Engine. Every time the asset cooks, only a single frame of Maya geometry is available on the Houdini side. This means various nodes that require fetching geometries from different frames doesn't work well through Houdini Engine. And the Alembic ROP is one of them. When you render the Alembic file, the Alembic ROP requires fetching geometries from every frame of the frame range. However, only a single frame of Maya geometries is available inside the Houdini world, so the Alembic ROP will see the same geometry for every frame.

The best workaround right now is probably to use .bgeo files. The Maya world would have to loop through every frame, and render the Geometry ROP every frame. This would give you a .bgeo file for each frame. Then, you could use a separate asset to read the .bgeo files, and write out a single Alembic file. This works because reading the .bgeo files is entirely inside the Houdini world, and the Alembic ROP would hav access to every frame of geometry inside the Houdini world.

I actually made an example script in this post [sidefx.com] that could help you get started. The only missing step is an asset that reads .bgeo files and write out a Alembic file, which should be easy enough to make.

Hope this helps!
Andrew / アンドリュー
  • Quick Links