Import multiple fbx files in a for loop

   3116   5   1
User Avatar
Member
118 posts
Joined: 12月 2013
Offline
Currently I am bringing in multiple fbx files based on an input folder using 'Python' node. This setup is working as intended.
import os
import hou

objects_path = hou.node(".").parm("import").eval()
folder = os.listdir(objects_path)

merge = hou.node("../").createNode("merge")
file_input = hou.node("../FILE_INPUT")

## Create loop that goes over the files in the folder
i = 0
for file in folder:
    if file.endswith(".fbx"):
        path = objects_path + file
        file_node = hou.node("../").createNode("file")
        file_node.parm("file").set(path)
        
        ## Connect files to Merge node
        merge.setInput(i, file_node)
        i += 1

file_input.setInput(0, merge)

Is it possible to create the same workflow using a 'file' node inside a for loop?
Edited by GlenD - 2023年3月31日 09:07:40
User Avatar
Member
16 posts
Joined: 9月 2019
Offline
Have you tried the PDG/Top Network using the File Pattern node?
User Avatar
Member
118 posts
Joined: 12月 2013
Offline
bentraje
Have you tried the PDG/Top Network using the File Pattern node?
Thanks, I will check it out.
Glen
User Avatar
Member
118 posts
Joined: 12月 2013
Offline
I was able to look at the File Pattern node in the Top Network and it works as expected. The only issue is loading multiple files using an array. This video, 'Tech Talk | Process and Render Geometry and Textures with TOPS | Michael Buckley' goes over the process, just getting the array part to work is my current blocker. https://www.youtube.com/watch?v=L51DUKjrkIo [www.youtube.com]

Has anyone referenced an array in a file node using the File Pattern Top Network?

Edited by GlenD - 2023年4月11日 10:09:27

Attachments:
PDG_Input_01.png (65.3 KB)

User Avatar
Member
8796 posts
Joined: 7月 2007
Offline
use TOP Geometry SOP to load all your fbx files and pass through its output
https://www.sidefx.com/forum/topic/87322/#post-376990 [www.sidefx.com]

you can alternatively use File Merge SOP if the file names only differ with some number in name or alter it to fit your needs, but TOPs should allow you to do this out of the box
Edited by tamte - 2023年4月11日 12:19:54
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
118 posts
Joined: 12月 2013
Offline
tamte
use TOP Geometry SOP to load all your fbx files and pass through its output
https://www.sidefx.com/forum/topic/87322/#post-376990 [www.sidefx.com]

you can alternatively use File Merge SOP if the file names only differ with some number in name or alter it to fit your needs, but TOPs should allow you to do this out of the box
Thanks! We ended up using the File Merge SOP, since we were having an issue of Unreal picking up the Files using TOP Geometry.
Glen
  • Quick Links