kubabuk Posted March 28, 2006 Share Posted March 28, 2006 Hi, I have a problem, I'd like to import 500 obj files into houdini. I have an idea of creating a loop which will be executed at every frame. It will put a fileSOP and load the file with the same sufix number as the frame, in which this operation is excuted (Hope you will understand - sorry for my english) The problem is I don't know where to start and even don't know if it's possible to be done...? maybe there is any easiest way... I have to import that model this way - because it's too big to load it in one pice. Thanks Kuba Quote Link to comment Share on other sites More sharing options...
michael Posted March 28, 2006 Share Posted March 28, 2006 your on the right track... just put down a file SOP and point it to a piece of geometry on disc...then opscript the file SOP to see how it's made in hscript... then build a loop that will create a file SOP for each object you need to bring in (or an object with a file SOP inside for each object...depending on your needs)... but you DON'T have to do this per frame....if your geometry is a sequence of files just put $F4 in the file name - " myGeoChunk_number44.$F4.obj " etc this will pull in myGeoChunk_number44.0001.obj on frame 1, myGeoChunk_number44.0002.obj on frame 2 etc etc HTH Quote Link to comment Share on other sites More sharing options...
stevenong Posted March 28, 2006 Share Posted March 28, 2006 Yeah, what arctor said. An additional note, I would recommend you save out the obj files as .bgeos after you successfully create the File SOP(s) or read them into Houdini. If you don't, Houdini will have to convert the geometry from obj to bgeo everytime you process something. If the geometry is heavy, your processing time may increase substantially. Good luck! Cheers! steven Quote Link to comment Share on other sites More sharing options...
michael Posted March 28, 2006 Share Posted March 28, 2006 oh and another thing...your script should bring in everything but turn all the displays OFF...that way your file will actually open Quote Link to comment Share on other sites More sharing options...
kubabuk Posted March 29, 2006 Author Share Posted March 29, 2006 oh and another thing...your script should bring in everything but turn all the displays OFF...that way your file will actually open 26073[/snapback] That's COOL ! Thanks guys for such a quick response. Here it's the code. Please optimize my lame work... for i = 1 to 3 # Node file$i opadd -n file file$i oplocate -x 0.885435 -y 1.92979 file$i opparm file$i file ( '$HIP/obj/mesh$i.obj' ) reload ( 0 ) chlock file$i -* chautoscope file$i -* opcolor -c 0.7 0.7 0.7 file$i opset -d off -r on -h off -f off -y off -t off -l off -s off -u off -c off -C on -p on -e on -b off file$i opcf /obj/model opcf $saved_path end I don't know why, but sometimes the script loads the same file into each fileSOP.... HELP Is that true if I copy to textport on more line after the "end" the script runs automaticly. Kuba Quote Link to comment Share on other sites More sharing options...
kubabuk Posted March 29, 2006 Author Share Posted March 29, 2006 I did something wrong now it keeps loading the same obj FIle into each fileSOP.... Quote Link to comment Share on other sites More sharing options...
stevenong Posted March 29, 2006 Share Posted March 29, 2006 Is it a geometry sequence you're trying to read in or multiple files? If it's a sequence, use $F for files named like so: foo1.obj or foo.1.obj. Use $F4 for padded numbers: foo0001.obj or foo.0001.obj If it's multiple files, you can type the " ` " key (backtick or the key to the left of the 1 key) to select multiple files. In the dialog, navigate to the directory you want, click & select the files you want to import then Accept. Houdini will then create a File SOP for every file you selected. No scripting necessary. Sorry, I don't have time to go through your script at the moment though it looks like it should work. I'll see if I can go through it later. Cheers! steven Quote Link to comment Share on other sites More sharing options...
kubabuk Posted March 29, 2006 Author Share Posted March 29, 2006 It works correct now. I just missed backtics before and after $i variable in following line: '$HIP/obj/mesh'$i'.obj' and here it is the script: for i = 1 to 3 # Node file$i opadd -n file file$i oplocate -x 1.39412 -y 2.68235 file$i opparm file$i file ( '$HIP/obj/mesh'$i'.obj' ) reload ( 0 ) chlock file$i -* chautoscope file$i -* opcolor -c 0.7 0.7 0.7 file$i opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C on -p on -e on -b off file$i opcf /obj/model opcf $saved_path end I also attach rar file with my little test scene. thanks for help kuba fileSOPloop.rar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.