Python Set Input To Node

   1739   4   1
User Avatar
Member
7 posts
Joined: Aug. 2009
Offline
I'm trying to write a python script that will automate decimation of models using Houdini's polyReduce within Maya. I'm currently stuck on setting the geometry I want to decimate as the input to the polyReduce node. What is the Python command for this? The best I've found in MEL is “AEhoudiniAssetSetInputToSelection”, but I'm not sure what to import to use this with Python, and even if I was I would rather be able to specify the object I want to use rather than having to select it first.

Thanks for any help!
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
In 15.5 (and older), “AEhoudiniAssetSetInputToSelection” would be the best way. In the upcoming 16.0, the input mechanism is largely rewritten, and there's a more straightforward function without relying on selection.
Andrew / アンドリュー
User Avatar
Member
5 posts
Joined: Nov. 2013
Offline
Hey Andew!
I'm trying to implement exactly this. Is the more straightforward way out yet? Other than “AEhoudiniAssetSetInputToSelection” I couldn't find anything.

Thanks!
Johannes
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
If you're using 16.0, you can call the houdiniEngine_setAssetInputMEL command.

// for parameter input
houdiniEngine_setAssetInput "test_null1.input[0].inputNodeId" {"pCube1"};
// for node input
houdiniEngine_setAssetInput "test_null1.houdiniAssetParm_objpath1__node" {"pCube1"};

From Python, you'd have to run the MEL commands with maya.mel.eval.
Andrew / アンドリュー
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
Note that the parameter for the input objects is an array. Similar to the “Set to Selection” button, it's possible to pass in multiple objects of different types, which is a new feature in 16.0. The objects would be merged together on the Houdini side.
Andrew / アンドリュー
  • Quick Links