Maya crashes after deleting lights…

Hi all, this is my first post. This blog is pretty new and actually there is nothing more than the standard wordpress installation. Things will change a lot in the next future.

Let’s start with the first post.

Few days ago i discovered a bug in Maya, well not the only one, and i figured out how to fix it. I know it’s quite famous bug but Autodesk didn’t solve it. So in the meanwhile i decided to find a way to get around it.

The scenario i simple. You have a scene with some reference in it and some light. It’s something quite common. Now if some of these lights have a lightlink to one of these referenced objects and you try to delete just one of those lights and then try to save the scene maya will crash. Funny not? Moreover maya will also totally wipe the file you are trying to save. These could mean only one thing, everyone who is working on that scene will probably lose some work.

The easiest workaround is to hide that light and keep working on a scene with some useless hidden light. Nothing too bad but absolutely not clean.

What i discovered is that if I unreference the lightlinked object and then delete the light it will let maya save the file without any crash.

Obviously if you got hundreds of referenced objects and those are also rigged characters or environments this workaround will take some time to understand what to unload. Moreover unloading references, deleting the light and then reloading the reference will take some time, more than just deleting a light!

First of all we have to understand what the light is linklinked to. To do that whe should provide a function that given a light will tell us which reference is lightlinked to. This is quite simple asking what objects are lightlinked with “lightlink” command and then looping thru them asking if the object is part of a reference with the referenceQuery command.

After that we should store a list of reference nodes, unload those references, delete the light and then reload the references.

This script will avoid maya crash. That’s pretty good but is not sufficient to prevent people to delete lights and it will be much slower than just deleting a light. So it’s better to figure out a better way to let people work like they used to do until the introduction of this new featured bug.

In the next post i will manage a way to overrinde the delete function just for lights using callbacks and use a temporary hidden group to delete the lights when saving or loading the scene.

6 Responses

  1. I’m glad it was helpful for you and that you have found my blog! You are probably the first user!
    If you are interested in I managed a better way to work around that problem.
    I actually overrided the “doDelete” maya function. The first thing to check is if you are trying to delete a light or something that contains a light. If this is true parent the light into a dummy hidden group and leave it there. Then i added a callback that run on load (before reading referenced files) and if the group exists deletes it.
    It is really faster than the brutal method i explained in the post. I should probably write a new one…

  2. Hey, glad i’m not the only one suffering this issue! I don’t see where you posted the script which alleviates this problem… is it up anywhere?

    thanks,
    mark

  3. I may have another work around…haven’t fully tested it yet. But if you load no references in your open scene options, load your scene those bad lights, the save scene will work!
    Then reopen scene and enable all your references it works just fine.
    Basically what you are doing, just a manual way.

    1. missed a word…in the open scene options choose no references. load the scene, delete those bad lights and save your scene. reopen with references loaded. no problems.

Leave a Reply