PDA

View Full Version : OBJ Sequence UV Map Naming Issue



evolross
03-30-2011, 02:12 PM
I have a situation where I have a sequence of OBJ files that all need the same surface. But unlike other posts, each OBJ has a different number of vertices and a unique UV map. It's a head object with UVs, not a fluid sim.

So the problem with surfacing them all in Modeler using the "By Scene" dropdown or using a script in Layout is that a single surface won't work because of the unique UV map issue on each object.

So would a Modeler LScript be able to rename the UV map of all open objects in Modeler to a single UV map and then save? So a single surface would then work? Or maybe a Layout LScript that would know how to assign each object in an OBJ/LWO sequence with the the surface but with the correct (incrementing) UV map name?

Any other suggestions for this? I tried opening the OBJ file in a text editor to see if I could rename the UV map there but its name isn't in the OBJ file. I'm assuming Lightwave gives the UV map the default name based on the overall file name, which is incrementing because it's a sequence.

I could do all this by hand, but I need something procedural as I may have a lot of shots, each with an OBJ sequence.

maxim capra
03-31-2011, 02:36 AM
i did something similar for a job, a script which copies surfaces to a object-sequence (they don't have to be opened in modeler, so it's memory efficient, too). maybe i can adjust it to your needs, but i would need more information. to you want to convert the obj's into lwo's? are the obj-files numbered? one surface or more? one map or more? how does the naming convention of the files/surfaces/maps look like? most helpful would be a small number of representive obj's (10 for example), so i have something to test with.

evolross
03-31-2011, 10:08 AM
Cool, thanks for your help. I'm unable to send any of the objects unfortunately. But here's the details:

They don't necessarily need to be converted to LWO, as it seems Layout handles OBJs pretty similarly to LWOs. But if it's easy to convert them to LWOs then sure. That will probably ultimately provide more flexibility.
They are in a numbered sequence (e.g. head_001.obj, head_002.obj, head_003.obj, etc)
There's only one UV map per object and it gets the same name as the object (e.g. head_001_uv, head_002_uv, head_003_uv, etc)
There's only one surface called "Default". All the objects get this surfaced named the same, no incrementing. And I'll only need one surface for what I need to do.

I'm not sure a script would work on a sequence of OBJ's outside of Modeler/Layout because the OBJ's don't have the UV name in the file. I searched the file to see if I could rename them that way. The name is auto-generated by LW.

But yeah, if you gave me a script to start with, I could probably modify it to get it to work in my situation. I'm not real good with LScript because I've never used it, but I do have a lot of experience in programming/scripting.

maxim capra
04-01-2011, 03:30 AM
ok now this is really hacky, but it should do, what you want. i simply changed a few lines from my existing script, it's far away from user friendly, but it does what it should do at that's what i want from most of my scripts :)

load it in modeler. start script. first line, point at a master lwo. this lwo is the object with the surface you want to copy to the sequence. then select a file from the sequence in the second line. the script iterates from file000.obj to maximum file999.obj. you can simply change that in the script if you need another starting point or another type of numbering. it doesn't matter which file from the sequence is selected. the third line is the hacky uv-stuff. you're right, when you open a .obj, lightwave assigns the filename+"_uv" to the texture vertex map. so i simply rename the file before opening. here you can define the name. so if you type in "test", you will get a uv on every object in the sequence called "test_uv". use the same uv name on your master object and everything will be fine :)

then the script opens one obj after the other and copies the surface from master to currently opened obj. this is a important step, because this way you can iterate through really hi-dense mesh sequences, because there are always only 2 objects at a time open. i did it this way once, because ram is full very soon if you open a lot of meshes at once for copying surfaces...

if lightwave look like it's frozen: yeah, it's working. look in your finder/explorer to see how it writes the new LWO's. as soon as it's finished it becomes responsive again.

hope this helps
Philipp

evolross
04-12-2011, 01:18 PM
Sorry about the delay - yes this did the trick!

You're an LScript virtuoso! :bowdown: :bowdown: :bowdown: I didn't know Lightwave had this kind of power with LScript. Thanks for showing me this. The script demonstrates several cool ways to manipulate LWOs and their maps.

Blochi
04-22-2011, 06:52 PM
Hey Maxim,

Nice one. Did a similar script before, think it was for batch-surfacing realflow sequences. Does almost the same, but in Layout. Other differences:

- It needs a surface file that you have previously saved off.
- Load any object of the sequence into Layout first.
- Auto-detects sequences with up to 7-digit padding.
- Run the script and point it to the surface file.

It does its thing with a progress bar.
.Blochi

maxim capra
07-05-2012, 05:59 AM
Hey Blochi - forgot to thank you last year :) I'm currently rewriting this little tool for a job and your input comes in handy ... that's how a community should work :) Thanks!

I will post my finished piece if it's worth it ;) ...

Philipp

maxim capra
10-30-2012, 03:51 AM
ah, well. here it is, hope someone finds this one useful. it manages OBJ or LWO sequences (converting, renaming, surface copying, subdividing, welding, ...)