FBX Process

mail@pastecode.io avatar
unknown
python
2 months ago
1.3 kB
14
Indexable
Never
import hou

obj = hou.node("/obj")

fbx_nodes = hou.selectedNodes();

if fbx_nodes:
    for fbx_node in fbx_nodes:
        if fbx_node.type().name() == "subnet":
            newGeo = obj.createNode("geo")
            newGeo.moveToGoodPosition()
            fbx_parts = fbx_node.children()
            for fbx_part in fbx_parts:
                if fbx_part.type().name() == "null":
                    newMerge = newGeo.createNode("merge")
                    fbx_part_group = fbx_part.outputs()
                    for i in range(len(fbx_part_group)):
                    # for part in fbx_part_group:
                        if fbx_part_group[i].type().name() == "geo":
                            files_inside = fbx_part_group[i].children()
                            for file in files_inside:
                                if file.type().name() == "file":
                                    node_path = file.path()
                                    newObjMerge = newGeo.createNode("object_merge")
                                    newObjMerge.moveToGoodPosition()
                                    newObjMerge.parm("objpath1").set(node_path)
                                    newMerge.setInput(i, newObjMerge)
                                    newMerge.moveToGoodPosition()
Leave a Comment