I've put together an HDA for exporting FBXs out of Houdini while preserving mesh hierarchy, allowing hierarchy-preserving round trips between e.g. Maya and Houdini.
A new version has been uploaded which adds new export options to tackle path nodes with duplicate names in them.
Here's a download link for the HDA if you want to get right to it.
Put this hda in this folder if you're on windows:
or the equivalent folder on other systems or HDD setups, and then restart Houdini.
Houdini, when exporting FBXs, only care about splitting /obj level transforms, so anything inside of a single geo node will get "collapsed" to a single mesh when brought into other packages like Unity, UE4, Maya etc.
What this HDA does is it generates a temporary network of /obj level transform nodes based on some primitive string attribute of your choice. The default is "name" which is the attribute created when importing FBXs using a file node, so this HDA should work with imported FBXs out of the box.
The primitive attribute should essentially be the path to the mesh, i.e. "group1/group2/sphere" will generate the two groups as empty transforms, placing the sphere mesh in a third. A name like just "Sphere" is also fine.
- Out on the /obj level, search for FBX Hierarchical Export and grab that.
- Simply connect your geo output to exporter input, or manually add the path to your geo to the Object input box
- Choose a name for the attribute you want to base the hierarchy on
- Choose your output path
The default settings only support unique names in the path. Meaning any part of a path that shares name with any other part of a path is considered the same object.
This is not OK, Box is repeated twice upstream
This is also not OK, these two Sphere will be considered the same object, even though they are in different paths.
As of v0.6, I added some toggles for various export options. These are there mostly to avoid issues with duplicate nodes in the paths, as Houdini nodes in the same context must have unique names. These options mainly pad the names to make them unique, but that means this padding will have to be removed later if you need the names to make sense.
The most extreme version is the Append upstream path on each node setting, which should work with any path setup, regardless of various setups of duplicate names. It adds the upstream path at every path node, separated by ".", which comes out as "FBXASC046" in Maya. Here's a little snippet of Python that you can run in maya to remove this "padding". Select all the objects you want to rename and run this:
import maya.cmds as cmds # loop over all selected meshes for mesh in cmds.ls(l=False, sl=True): # if it is a transform and contains the seperator if "FBXASC046" in mesh and "Shape" not in mesh: # rename cmds.rename(mesh, mesh.split("FBXASC046")[-1])
Similarly, this can be run if you used the Append path depth to each node instead, to remove the number at the end of each node.
import maya.cmds as cmds for mesh in cmds.ls(l=False, sl=True): if "Shape" not in mesh: cmds.rename(mesh, "_".join(mesh.split("_")[:-1]))
A couple words of caution
I'm consciously using the term hierarchy-preserving, because this is not transform-preserving, so all transforms will be zeroed out. This is because the information needed to recreate the transforms is just not available, as it is not imported using the file node and there is no clean way of storing it if you created it by hand, since Houdini doesn't have the same notion of pivots as say Maya.
I put this together to solve an issue with hierarchy preservation, and noticed a lot of other people having this issue without any fix being easily available. It is definitely a niche problem, but here it is for download should it be of any help.
Also I've labeled this as v0.6, meaning there might still be the odd case breaking it, especially if you put something funky in the name attribute. If you do get into issues let me know and I'll see about updating it!
fixes issues with duplicate names in the path with various export options
initial published version