import multiple files into 1 node

   10187   6   3
User Avatar
Member
196 posts
Joined: Aug. 2011
Offline
hi !

e.g. there's n obj files in a folder.

is it possible to import all n files from the folder in 1 step ( file in ) ?

( into the same frame, not as an animated sequence I mean )

any input welcome !

matt
User Avatar
Member
13 posts
Joined: Oct. 2013
Offline
Hey Matt,

Depending on your naming convention, you may be able to get them all in using a fileMerge sop. For example, if they are named something like $HIP/bgeos/obj.$F.bgeo then you can load them all in using “F” as your merge variable. Or if you work in the $SLICE variable as well.

~Ilan
User Avatar
Member
196 posts
Joined: Aug. 2011
Offline
hi !

thanks so far !

that works with a specific number of files and a ‘hardcoded’ merge range end value. Would there be a way to write an expression that goes and gets the number of files (integer) in the folder and uses hat value ?
User Avatar
Member
575 posts
Joined: Nov. 2005
Offline
i guess You could use a python expression with os.listdir() and filtering the list for all valid files (no folder, and right filetypes), but never tried it
User Avatar
Member
196 posts
Joined: Aug. 2011
Offline
yep, works:

import hou
import glob

path = “CUsers/myUser/Desktop/new folder/”
files = glob.glob(path + “*.obj”)
nFiles = len(files)

return nFiles

thanks !
User Avatar
Member
1769 posts
Joined: Dec. 2006
Offline
Or, just press ` above the network view, select all your files, import them, then select all the geo containers and press on combine, on the modify shelf
daniel bukovec | senior fx td | weta digital
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
User Avatar
Member
196 posts
Joined: Aug. 2011
Offline
I was searching for a procedural method .. so I'm happy with the above ..

Thanks !

matt
  • Quick Links