papsphilip Posted September 19, 2021 Share Posted September 19, 2021 Diving inside the network i can see the rop fbx responsible for exporting the low res fbx geo. I am trying to do the same thing in an other setup but i cant figure out how does it get triggered. Usually you have to press the Save button or build a TOP network. i dont see any TOP networks inside the HDA Quote Link to comment Share on other sites More sharing options...
smoluck Posted November 16, 2021 Share Posted November 16, 2021 Hi Papsphilip i'm also looking at an automatic solution in one of my HDA. If you've already found a way, please reply here. Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted November 16, 2021 Share Posted November 16, 2021 This is triggered using a Python script on the HDA itself. Here's the short version : To see the script, right click the HDA → Type Properties Go into the Scripts tab. There's some stuff in there, but we are looking for one keyword in particular, the name of the ROP FBX Output node. Lo and behold, line 20, there it is → a_node.node("low_export").render() That's all nice and well, but how did I get there (aka Reverse Engineering 101). I realize that some of the investigation steps may not be obvious to a beginner in Houdini, as there are a few hoops to jump through. So here's some more explanation. It is strongly recommended to note the name of the ROP FBX Output node and keep it in mind during our investigation. Dive inside the HDA and take a note of FBX node name. "low_export". Gotcha. So then, let's first start with the end. What triggers the fbx to export in the first place ? Why, it's the Render button on the HDA ! Let's start with this fella. Let's open Type Properties and see what happens when we press that Render button. Ah, there's a callback script on the button → kwargs['node'].hm().Render(kwargs['node']) What's all this then ? A callback script is a (generally) small script that executes when the button is pressed. You could print("Hello World") in it, set some parameter value, etc etc. Note that the icon on the right is the Python logo, which was manually changed from the default Hscript, meaning that this expects a Python script. kwargs is a dictionary containing some info about the node and parm it's called from. https://www.sidefx.com/docs/houdini/hom/locations.html#call (ctrl+f search for kwargs in the page) Breaking this down, kwargs['node'] means the current node (the HDA itself), hm() is the asset's Python module (that info is in the same page ↑ if you search "hm()"), and Render(kwargs['node']) is a custom function, taking the current node as a parameter. In not-so-layman's terms, the button calls a function from the Python Module on the HDA. So, let's go the the Scripts tab on the HDA, and take a look at the Render() function. (Look at the second picture, I won't copy it here again for the sake of not making this message any bigger than it is) Alright, it's doing a few stuff about frame mode and ranges, we don't care about that, something about cook (cook miiight sound interesting but it's for the foreach_end1, so let's skip that), and then aha ! "low_export" ! Interesting So, it's calling .render() on the low_export node. That sounds like the answer ! (because it is) One more nice step is to figure out where does this render() function comes from. What if we want more info about it, pass some arguments ? We can print stuff out to figure out stuff. We can take a look at the type() of a node with print(type(nodeName)) If we print(type(a_node.node("low_export"))), we'll see <class 'hou.RopNode'>. This will allows us to take a look at the documentation for the node (not for the FBX Output node specifically, but for the overarching node type, the "parent" from which the FBX Output inherits stuff from) https://www.sidefx.com/docs/houdini/hom/hou/RopNode.html And, right there, render(aBunchOfOptionalArguments) Taking a look at the description, we won't be surprised with it. That wasn't a necessary step in this context, but it is super useful to know how to find stuff out in the documentation. What can we do with a node, what is this or that argument, etc etc. Note that there is another solution for exporting the fbx, and that's the pressButton() function. https://www.sidefx.com/docs/houdini/hom/hou/Parm.html (search for pressButton). Those are equivalent. a_node.node("low_export").render() a_node.node("low_export").parm("execute").pressButton() Quote Link to comment Share on other sites More sharing options...
smoluck Posted November 16, 2021 Share Posted November 16, 2021 Hi Alain. I've followed your steps, and after setting the python code in Scripts Tab: def Render(a_node): a_node.node("FBXExportNode").render() a_node.node("FBXExportNode").parm("execute").pressButton() and having the Callback Script line using : kwargs['node'].hm().Render(kwargs['node']) I can render the FBX output. But what i don't understand is how we can trigger this once the HDA is cooked via an HDA Processor then. Quote Link to comment Share on other sites More sharing options...
smoluck Posted November 16, 2021 Share Posted November 16, 2021 (edited) I have a switch for instance as upper input of the RopFBX Output node. can i get the cook state of this Switch node to trigger the button itself ? Edited November 16, 2021 by smoluck typo error Quote Link to comment Share on other sites More sharing options...
smoluck Posted November 16, 2021 Share Posted November 16, 2021 Do i have to create 2 parameter like "framemode" and a vector 2 parameter "framerangex and y" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.