Home Technical Talk

Maya .ma file modification error.

c22dunbar
polycounter lvl 14
Offline / Send Message
c22dunbar polycounter lvl 14
Hi

i'm having some problems with the way Maya handles multiple uv sets. I need to export a model that has 3 uvsets, and my exporter uses uvs that are located in the uv array at .uvst[0] .uvst[1] .uvst[2]

Because of some uv creating/deleting my three UVs are placed in .uvst[0] .uvst[3] .uvst[4] and that is not what my exporter will export.

I've exported the mesh to .ma file and using notepad i've changed ONLY the indices from 3 to 1 and from 4 to 2.

When i import the mesh back to maya the two UVsets are empty. I've tried to look for errors in Script Editor Listener, but even with Echo All Commands enabled nothing unusal is listed.

What am i doing wrong? The only thing that i edit are the indices. Any ideas?

Replies

  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Yeah editing the maya ascii wont work as maya will just make new empty uv sets. One thing I would say is if you can talk to your programmer and see if they can tweak the exporter to say grab the first three uv sets and use that or export that. Anywho a workaround I think might work is something like:

    Duplicate your model
    Run this script
    string $node2[] = `ls -sl`;
    int $indices[] = `polyUVSet -q -allUVSetsIndices $node2[0]`;
    print $indices;
    for( $i in $indices )
    {
        print ("UV Set Name is " + `getAttr ($node2[0]+".uvSet["+$i+"].uvSetName")` + " Index is " + $i +"\n");
    }
    

    That should tell you want index your uvset is etc. So look through that and copy the uvsets into the appropriate index and setname. If there is one missing, create a new uvset and run the script again. It should get the correct index (so if you had 0,1,4,5 it should make 2) Let me know if this works. Also at the end just clean up and delete the un-needed sets. Guess you could also just remember this and not do it again though I still think talking to the programmer is the best bet.

    EDIT: Also just thought of it, could create a script to loop through, check if say 0,1,2 are there if not create them then let the user move the uvsets into the appropriate sets. I can take a stab at this today or tommorow if you want.
  • c22dunbar
    Options
    Offline / Send Message
    c22dunbar polycounter lvl 14
    Thanks for that, i'll try this next thing in the morning :)

    But out of curiosity, why is maya making empty uvsets? How can it tell that there has been a change in the indices?
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Well maya is making empty uvsets cause you told it to :D If you setAttr on a non-existent uvset, it just makes a new one. Setattr a MEL command that is used to make or edit various objects in maya. Not sure how maya knows but I think it also stores the history somewhere. havent looked too much into the ascii files.
Sign In or Register to comment.