Fix the Invalid use of Maya object error

Disclaimer: the following is based on my personal experience, altering Maya native scripts should be handled with care as it might break the application.
Test on your own risk.

In some occasions when using render layers, switching between these layers will give the following error:
// Error: Invalid use of Maya object “persp”. //
This errors can sometimes stops the render layer from being rendered specially if the render manger was not set up correctly to bypass errors and just report them

Open the mel scrip createMayaSoftwareCommonGlobalsTab.mel found in here
“install location”\Autodesk\Maya2012\scripts\others

The lines in questions are
Line 1558 >
scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $maskCommand;
Line 1566 >
scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $depthCommand;

Commenting these lines out seems to work as a workaround.
For example:
// scriptJob -parent $parent -attributeChange “renderLayerManager.currentRenderLayer” $maskCommand;

While using this workaround, I didn’t get any serious side effects of this modifaction.
Please let me know if someone might find this un-useful.

Recent Entries

11 Responses to “Fix the Invalid use of Maya object error”

  1. Justin Says:

    wow, this was annoying me so much. thank you! I’ll let you know if i run into any undesired side effects.

  2. IJsbrand Says:

    Hi,

    I’m using Maya 2011 and I don’t have a folder “scripts”. I can’t seem to fix this error. Any ideas where I can find a script or another solution to this problem?

  3. Ashraf Says:

    2011 has it as well
    Look again in the install location.

  4. Basti Says:

    Thank you, thank you, thank you!

    I’ve just spend a night to render each of my renderlayer in the render preview … Not again :D

    BTW: in 2011.5 it’s line 1556 and 1564.

    @IJsbrand: Do you have the Mac-Version? Then it’s inside the “Maya.app” (right click -> Show Package Contents)

  5. Ian Zeigler Says:

    Thanks testing this on the Mac.

  6. Olygraph Says:

    Try this instead on the line just above:
    They forgot the ”

    1557
    string $maskCommand = “cameraMaskChange(\”"+$chkbox+”\”, \”"+$camera+”\”, \”mask\”)”;

    1565
    string $depthCommand = “cameraMaskChange(\”"+$chkbox+”\”, \”"+$camera+”\”, \”depth\”)”;

  7. Rakesh Says:

    Hi Can any One Help Me Out….. How To Fix The Rendering Problem Actually I am Using maya 2011 i Have created 2 Layers 1st One Is Master Layer (Software Rendering) and Other One is Aoc i mean occlusion Pass(mental Ray Rendering) The Problem is that Aoc Pass will Stop Rendering After 2 Frames…….can any one Fix it

  8. sandra Says:

    Hi

    I’m having the same problem. I don’t no much about scripting. I’m a mac user. So I found the scene and I opened it with maya but I can’t see thosse 2 lines. Can anyone tell me what I do wrong?

  9. Ashraf Says:

    You need to find the actual location of Maya install folder
    It will be something like > Applications > Autodesk >Maya

  10. Ashraf Says:

    This seems to be very specific to that file. most of the time I do my render from command line
    try doing something like this
    render -r mr -rl (layerNmae) fileNmae.ma

  11. sandra Says:

    Ashraf I don’t understand the last thing you are saying. I can find the script folder but I don’t not if I should open de createMayaSoftwareCommonGlobalsTab.mel with maya or something else. Because when I open it with maya I can’t see those 2 lines I should fix.

Leave a Reply