PDA

View Full Version : Massive OBJ export . . I need some help.


AtrusDni
03-21-2006, 03:52 AM
Ok so im going to be using ZBrush on a character, but there are a ton of peices that I want to export to obj files, so of course I would like to make a script to do this. Im a total n00b when it comes to coding, so any help would be appreciated.

So the following is what I have to far:
------------------------------------------------------------
string $OBJselected[] = `ls -sl`;
int $OBJnumSelected = size($OBJselected);
for ($i=0; $i<size($OBJselected); $i++)
{
}

//And the code that I want to execute inside the for-loop. Although the last part needs to
//be updated based on the name of the object selected.
//-----------------------------------------------------------
file -op "groups=0;ptgroups=0;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es (NAMEOFOBJECT TO EXPORT);

I have an array from the selected objects, and integer with the number of objects in the array and a for loop that will execute as many times as there are objects selected.

Soooo . . . My problem is that I would like to query the array each time in the for loop, find the objects name, select the object and run the export code, that way it doesnt keep exporting into the same file. I would love to finish this part but am unsure of the syntax required to do so. Any help would be appreciated. Thank you.

Bonedaddy
03-21-2006, 04:33 AM
This what you're looking for?


string $OBJselected[] = `ls -sl`;
int $OBJnumSelected = size($OBJselected);
for ($object in $OBJselected)
{
select $object;
file -op "groups=0;ptgroups=0;materials=0;smoothing=1;normals=1" -typ "OBJexport" -pr -es $object;
}




The form I used, "for ($page in $book)" is shorthand. Basically, if you wanted to do it your way, you'd have:

for ($i=0;$i<size($book);$i++) {
$page=$book[$i];
//do whatever
}



Incidentally, how's Stargate?

AtrusDni
03-21-2006, 05:50 PM
ahh sweet. Thanks for the help. Doing good over here at the gate . . . same old stuff. We are gonna be working on Battleground the steven king short story. Seems like its going to be a fun project to work on. Thanks again for the help.

Bonedaddy
03-21-2006, 10:49 PM
That's cool. I actually just a call from Stargate asking if I could come in for a bit as a Maya Generalist, but couldn't take them up on it, as I just started a different gig. So I was curious. :)

CGTalk Moderation
03-21-2006, 10:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.