Skip to main content
mayaphotoshop

maya to photoshop 3D layer script

By May 7, 20104 Comments

Dave Girard with a Maya MEL script that sends models from Maya to Photoshop CS4 and CS5 as a 3D layer. If you are using a mac, try the script below to try it out by adding it to the shelf in maya as a MEL command. If you are using CS4, just replace the text “CS5” in the script with “CS4”.

file -force -options “(groups=1;ptgroups=1;materials=1;smoothing=1;normals=1”
-typ “OBJexport” -pr
-es “/tmp/GoP.obj”;
system (“open -a \”/Applications/Adobe\ Photoshop\ CS5/Adobe\ Photoshop\ CS5.app\” \”/tmp/GoP.obj\””);

Send model to Photoshop from Maya (Mac) from Dave Girard on Vimeo.

Photoshop CS4 and CS5 Extended support OBJ and Collada models, so you can use a simple script on OS X to drag and drop created OBJ files onto the app. The script is below

file -force -options “(groups=1;ptgroups=1;materials=1;smoothing=1;normals=1”
-typ “OBJexport” -pr
-es “/tmp/GoP.obj”;
system (“open -a \”/Applications/Adobe\ Photoshop\ CS5/Adobe\ Photoshop\ CS5.app\” \”/tmp/GoP.obj\””);

lesterbanks

3D, VFX, design, and typography. Twenty year veteran instructor in all things computer graphics.

4 Comments

  • Great script, very simple but useful and can be extended 🙂 Thanks for sharing this.

    Unfortunately, I found that this does not work in PC, so it needs a slight tweak. After checking some forum, here is a PC version of the MEL script that works

    (Thanks to Ebrahim Jahromi for his clever UI script!)
    http://forums.cgsociety.org/showthread.php?f=89&t=880402#post6503774

    /////// MayaOBJ2PS4 Script that will work in PC, as below ////////

    // firstly, save out selected OBJ into temp folder in your hard disk
    // just make sure there is folder called temp on your C drive
    file -force -op “groups=1;ptgroups=1;materials=1;smoothing=1;normals=1”
    -type “OBJexport” -pr -es “C:/temp/GoP.obj”;

    // surely, the script above can be improved by making it auto save as incremental OBJ name, such as GoP_001.obj, GoP_002.obj and so on. as well, a script that create directory, if not existed. or even better simply save it inside DATA on your project files.

    // next, using script below, we ask Maya to call Photoshop and open up a file.

    global proc loadPsObj()
    {
    string $psFile = “C:/Program\ Files/Adobe/Adobe\ Photoshop\ CS4\ (64\ Bit)/Photoshop.exe”;
    // this is an absolute path Photoshop CS4, normally it is like this. for Photoshop CS5, just change it yourself.

    // this step is very important, otherwise Maya won’t open the file in Photoshop
    string $objFileDummy = “C:/temp/GoP.obj”;
    // this will then correctly call the path into variable
    string $objFile = toNativePath($objFileDummy);
    // this final script will do it
    system(“start \””+$psFile+”\” \””+$objFile+”\””);
    }

    loadPsObj();

  • No worries, thanks to you for sharing this script.

    Btw, just to add:
    Sometimes when you copy paste script into web, it tends to have wrong kind of “quotation mark” that will not work right away in MEL. It’s HTML thing. If the script does not work when you copy paste, simply retype the script in Maya.

    Hope it works.

  • Kiernan says:

    Hi Jimmy,

    I get this error:

    line 24.1: Syntax error