Triggering Maya Python or MEL from a Houdini Engine Asset button callback

   600   4   3
User Avatar
Member
12 posts
Joined: March 2015
Offline
Does anyone know if this is possible? I want to save out a multi-frame ROP of a rigid body simulation, but it doesn't work if you just tell the ROP to do a frame range as Maya doesn't send it updated data for each frame, just on the one where the cook is called (https://www.sidefx.com/forum/topic/45488/). I wrote a script in Maya to go through frame by frame and write the ROP one frame at a time, but I would like to be able to launch this script from one of the buttons on my Houdini Asset rather than having an external button to do it. I've tried importing maya.cmds into python on a Houdini button callback but none of the commands I call from it seem to do anything in Maya.
User Avatar
Member
593 posts
Joined:
Offline
No. This is why people write custom wrappers.
B.Henriksson, DICE
User Avatar
Staff
65 posts
Joined: Oct. 2017
Offline
If we did want to provide a (somewhat) more general solution for this kind of problems - would one of these approaches work? Bearing in mind that it would need to work with the engine running out of process -

If you want to access data outside of the current Maya time - allow Maya input objects to be cached? So if you had the cacheInput option on and the frame range specified - we could pre-cache the input geo on the Maya side, and have a cache reader connected to your assets geo inputs. It would make the plugin code/workflow more complicated to set up and waste disk space, but if we could transparently hook up the cache reader independently of the asset, then he asset itself wouldn't need to know anything about where its geo is coming from.

Or make it easier to export a callback script or scripts to Maya so that we can generate default UI for the asset, or apply them in Maya in some other way? But still invoking the script in Maya directly, as opposed to trying to invoke it as a callback through the asset. (Which won't work running out of process anyway - and even in-process, if you were trying to invoke a Maya callback out of the plugin's compute that wants to step time and trigger another plugin compute it may well be hitting a DG cycle and stopping)

Or are there enough variations that, as kahuna031 points out, you'd end up having to write custom wrappers anyway?

Julia.
User Avatar
Member
593 posts
Joined:
Offline
I vote for the envoke script in hda's as this follows Houdini's native workflow best. Having a paralell system to hda's python tools could be a great addition (“on created” scripts, python module etc). Forcing recaching on the other hand sounds like a very special setup and could be a real annoyance during realtime editing.
B.Henriksson, DICE
User Avatar
Member
316 posts
Joined: Feb. 2013
Offline
I think whatever you go with, there should be at least one solution where a user plugs in the thing, specifies the frame range and sample rate (and whatever else makes sense) and it gets solved under the hood. And that solution should be the same for Maya, Unreal, Unity and all other Houdini Engine versions. It's great to be able to build your own thing for everything and that should be possible, but standards save time.

- A hybrid solution I would therefore suggest is that you do the script based thing and then build a “cacher HDA” with that. Then a user can basically do their own thing, or import the “cacher HDA”. The “cacher HDA” builds a cache. Then the user plugs that “cacher HDA” (or a file from disk) into their own HDA.

I hope this makes sense, it's late. Xp
  • Quick Links