[Sidefx-houdini-list] Reading files inside folder via node?

Sandy Sutherland sandy.maillists at gmail.com
Sat Jan 20 11:57:08 EST 2018


You can probably do something like this as python code added to a method in
the nodes script python module of a subnet made into an HDA -

 for file in [os.path.join(basepath, x) for x in os.listdir(basepath) if
x.endswith('.fbx')]:
filenode = hou.pwd().createNode('file')
filenode.parm('fileName').set(file)

Obviously you need to pass your path where the fbx files are held into the
method, and I am not sure if fileName is the right parm name (not in front
of Houdini right now), you can run this method from a button parm added to
the subnet parameters.  Also I was not able to tab indent the lines after
the first line in the email!

Sandy

On 20 January 2018 at 16:00, Fabricio Chamon <fabricio.chamon at gmail.com>
wrote:

> just to make myself clear: all I need from the files are the names (or
> fullpaths).
>
> 2018-01-20 13:56 GMT-02:00 Fabricio Chamon <fabricio.chamon at gmail.com>:
>
> > Hey smart people,
> >
> > I`m looking for a way to read files from a folder and store as an array
> > attribute on a geometry..would that even be possible?
> >
> > The "script" node runs a python file, am I able to pass over parameters
> to
> > a python function or something ? Just to contextualize: I'm creating a
> > crowd agent and building a clip library for it. I have this folder full
> of
> > fbx's and as it is right now I need to create an "agent" node for each
> fbx,
> > then bake out the clip to disk. I'd like to automate this process by
> > looping over files inside folder instead of manually creating a node for
> > each animation, all from inside the node network, so each time I create a
> > new fbx it is just a matter of re-cooking the output.
> >
> > I have had this need on many occasions before, like merging files or
> > tracing geometry.. so that would be a multi purpose thing really.
> >
> > suggestions?
> >
> >
> >
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>


More information about the Sidefx-houdini-list mailing list