Hython method for listing supported file extensions

   1849   7   4
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
I've been looking for a Hython method or something that would return a list of all supported file extensions (by type preferably) but so far haven't had much luck. Anyone know how to get this. I'd prefer not to have to hard code it myself.
User Avatar
Member
23 posts
Joined: Sept. 2015
Offline
If you're talking about images, they are stored in “FBfiles” file, you can fetch them using that snippet:

file_types = []
for fb in hou.findFiles("FBFiles"):
    with open(fb, 'r') as f:
        file_types += [ft.strip() for ft in f.readlines() if \
                       not ft.startswith("#")]

print file_types
http://cgtoolbox.com/ [cgtoolbox.com] Houdini tools and scripts for free ! :)
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
GuillaumeJ
If you're talking about images, they are stored in “FBfiles” file, you can fetch them using that snippet:

file_types = []
for fb in hou.findFiles("FBFiles"):
    with open(fb, 'r') as f:
        file_types += [ft.strip() for ft in f.readlines() if \
                       not ft.startswith("#")]

print file_types

Thanks GuillaumeJ! This is definitely a step in the right direction. Now is there a similar file where I can find supported geometry file extensions?
User Avatar
Member
17 posts
Joined: May 2010
Offline
Same code with “GEOfiles” instead of FBFiles
Houdini Pipeline TD - Ubisoft
http://www.cgtoolbox.com [www.cgtoolbox.com]
Free scripts for Houdini !
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Thanks!
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So this works for 90% of the file types, however I noticed it doesn't include some supported formats like .obj or .ia. Would these be listed in a separate file?

I found GEOio.json which has a bunch of the other extensions as well as other related info, so for now I am extracting them from the json and adding them to the ones I got from the GEOfiles file. Not ideal, but it kinda works.
Edited by NFX - Nov. 22, 2017 22:16:10
User Avatar
Member
23 posts
Joined: Sept. 2015
Offline
GEOio.json would world for that yep
http://cgtoolbox.com/ [cgtoolbox.com] Houdini tools and scripts for free ! :)
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Drat. I was hoping there was a better way. Oh well.
  • Quick Links