Home Technical Talk

Tutorial - "Holy Crap! I lost all my work!!"

polycounter lvl 15
Offline / Send Message
Lamont polycounter lvl 15
I posted this on GA.org, but I'll share with ya'll.

The best protection from loosing your work is iteration saving. OFTEN. Although you can't protect yourself from spontaneous disk failure. That being said here is a tutorial on recovering Maya Ascii AND Maya Binary files. It is really easy to do, but will be tedious. This should work for all versions of Maya.

The first steps you should try are simple:
  • Just rename the file that's crashing (I've done this and it works sometimes works for 3DS Max too)
  • Go to the temp directory and grab that file, rename the extension to a *.MA.
  • Rename the Maya.env file.
  • Just import the corrupted scene into a new scene.


But sometimes the corruption is Chicago politics in size and even the file in the temp directory is FUBAR.

Step 1 - It crashed!!

So Maya gets errors on loading your scene and you are using the Maya Binary format. Don't panic. Even though it's the MB format, you can still get in there and fix it. After you try and load the file, it will crash, let it crash and then go to the temp directory and grab the backup file Maya created. This file will be a Maya Ascii file. If this file does not open, it means an object/element in your file is whack.

Step 2 - Don't use Notepad

You need a text editor that can enumerate the lines so you know what you are doing. I use Context or UltraEdit. Context is free. Now open the file and just go over it. A 2MB file will have 44,000+ lines in it. So it will take a while.

Step 3 - Start testing

I make a copy of the file and start by cutting the first half of the file and seeing if it loads. You want to keep the lines that read:

//Maya ASCII 2009 scene
//Name: YOURFILENAME.SOMEDATE.THETIME.ma
//Last modified: Thu, Oct 01, 2009 03:47:15 PM
//Codeset: 1252


If it loads, then that means the problem is in that part you cut. So put that back. Write down what range of lines are safe. Now after you put the lines you cut back. Take that and cut it in half and see if it loads. Looks like this assuming the file has 100 lines:

Lines 0-50 are cut. Save the file. The file loads. I put lines 0-50 back and cut lines 0-25. Save. Then load it. If it loads, then cut lines 0-12. If it fails then you know the problem is in lines 13-25. Start the same process on lines 13-25. You keep doing this till you narrow it down to a single operation.

It will take time on a huge file. You wanted your work back right?

Hints: Try not to cut the file in the middle of a statement, like as follows. This is a complete statement/operation.
setAttr ".cc" -type "nurbsCurve"
3 5 0 no 3
10 0 0 0 1 2 3 4 5 5 5
8
-2.516579900571164 2.944635797360073 -3.3306690738754696e-016
-2.5076345104276574 2.944635797360073 1.0612110241999617
-1.9981322597759368 2.9073699178673067 2.7228741609104921
-1.2331151997899805 2.8514710986281568 3.221954082554356
-0.92545172481672378 2.8328381588817733 3.2660247172653381
1.6722997616392101 2.7763404118438242 3.1665627683866653
3.8578350134606567 2.5840028283966832 2.9826259940656881
4.6964847318555849 2.447394095523618 2.8916169638550593
;
Here is one where I cut in the middle. Maya may not like this and you're just contributing to the problem of finding the real error.
setAttr ".cc" -type "nurbsCurve"
3 5 0 no 3
10 0 0 0 1 2 3 4 5 5 5
8
-2.516579900571164 2.944635797360073 -3.3306690738754696e-016
-2.5076345104276574 2.944635
You want to cut from AFTER the first ";" and after the next ";"

Replies

  • javi
    Offline / Send Message
    javi polycounter lvl 16
    thanks! I was always wondering how to recover files like this!
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 15
    Some tips...
    • What can make this easier is if you name your objects/shaders/nodes. "Polycube2000Shape" means nothing. A good clean file can make finding the last thing you did to cause the error easier.
    • You can also get a cue to where to look when you open the log files from crashes. Usually it's the operation that made it freak out on the last few lines.
    • Junk nodes can build up over time and can corrupt your file because an operation is attempting to apply something to it. I kill history as I reach important stages.
  • Mimp
    Is there a particular reason that Maya doesn't have an autoback feature?
  • Guriamo
    Offline / Send Message
    Guriamo polycounter lvl 17
    Mimp wrote: »
    Is there a particular reason that Maya doesn't have an autoback feature?

    it would take the fun out of recovering files? :P

    well when maya crashes its most likely that it saves a copy of the file in your temp folder... 80% of the time it works for me... but using our inhouse autoback to ensure safety :)
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 15
    Well in the example above, an autoback will contain the same data that caused a file corruption. If you're working on a file for 12 hours straight, and introduced a corruption 2 hours into it, it doesn't matter how many autobacks you have.
  • Whargoul
    Offline / Send Message
    Whargoul polycounter lvl 18
    Two more problems that are usually easy to fix:

    search for QNAN and #INF and replace with a 0.

    Sometimes Maya gets an infinite number (the second one) - and the first is not a number. You'll see a camera transform in the .ma file that's like: 23.QNAN so if you replace it with a zero it will work.
Sign In or Register to comment.