Jump to content

Loading arbitrary objects from any given folder?


Recommended Posts

As in batch processing? without even opening houdini ?

What is your output supposed to be? A modified model or a rendered image or...?

For the above you probably will want to use python, or I believe they call the houdini version hython. Anyway, it will be a script kicking things off.

If you want to do it inside of houdini you can do quite a bit with a bit of python to scan your directory, a foreach sop for processing and a file sop inside the foreach to write it out.

You could make your houdini network and use wedges to load and write different copies per frame.

Depending on your needs I would be tempted to do it all in the batch in the shell. Because you can most likely run several batches at once if your machine can handle it - so you make it more thread friendly. Not sure if you can run all (or a certain number of) your wedges in parallel. Probably that must be possible, haven't tried it though.

Link to comment
Share on other sites

pclaes,

I was thinking that I would do more like batch processing. The output will be processed geometry. Instead of loading all the objects in a folder in a scene and copy the processing nodes many times, I thought that it would be smarter to create one processing scene that can be applied to many. The only thing is that the file names might be irrelevant or non sequential.

I know Python, so I am sure I can do that. I was just looking for an embedded solution if there was such thing, before delving into scripting solution.

thanks for the tips.

Edited by kursad
Link to comment
Share on other sites

Hmm... Is this what you are looking for?

Hi

Thanks for the file.

Your setup assumes that the file names are incremental or sequential. What I am trying to do is to process any file that has a legitimate extension with arbitrary names in a given folder. So I do not want to describe any file name, rather just point out to a directory. Files can have any names , mixed extensions etc, which might be coming from various sources. So in that respect trying to come up with a file naming rule wont work.

I will try scripting it out as pclaes suggested. Python offers decent OS file access.

Link to comment
Share on other sites

You can probably write your own python sop that will:

*) ask for a directory

*) allows a few filters to be applied (extension, contains word,...)

*) scans that directory

*) Gives you back the total amount of files to be processed (in a locked integer field)

*) Gives you a slider (integer number), that allows you to show the current file that needs to be loaded.

*) That way you give a user in houdini access with an easy python sop to load the geometry, and you make it a lot easier on yourself if you ever wanted to batch process it.

I believe there is even a $WEDGE or $WEDGENUM variable that is being used when you do wedges.

Very similar to what the arg() would do:

argc(bob,ted,john,tim,$WEDGE)

-> returns john (if $WEDGE=2)

Now you can use a wedge and modify that "current number".

But yes, the filtering will have to be done in python. I'm not so sure how much filtering you get out of the box with python, but I know there are modules to allow for regular expressions... and that gives you access to any rule you want.

I would allow users to choose between using some filters, or to put in their own custom regular expressions rule - then you have all bases covered.

If you have not seen it already, this is really interesting of how to use houdini as a "tool" for python, rather than use python as a tool for houdini:

http://www.sidefx.com/index.php?option=com_content&task=view&id=1412&Itemid=132

Edited by pclaes
Link to comment
Share on other sites

pclaes

Thanks for the points. I did not know about the wedge tools. I am reading about it.

I have watched the Python master class, so I am aware of possibilities. As I mentioned I do not suck at Python, I am hopeful that I can crack this nut. Maybe I can release as digital asset when I have a real solution.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...