Home Technical Talk

Maya : Mel Script : surfaceSampler

polycounter lvl 17
Offline / Send Message
sama.van polycounter lvl 17
I'm actually creating a script using the surfaceSampler function...
It worked very well during to last days, and this morning I obtain a stupid error, and impossible to know what it means! T_T....

if someone knows what means :

// Error: line 1: image has unsupported number of bytes per channel: 255 //
// Error: line 1: Output format does not support depth. Ignoring z-buffer //
// Error: line 1: Failed to open output file: C:/BoxA.tga //

The error "Failed to open output file: " is bullet of shit because Maya create a file like "C:/BoxA.tga.iff" in the right directory >____<

Look at the .tga.iff ...

I use the Eval function to launch it and the result of my string is :

surfaceSampler
-target boxA
-uvSet map1
-searchOffset 0
-maxSearchDistance 0
-searchCage ""
-source boxB
-mapOutput Normal
-mapWidth 512
-mapHeight 1024
-max 1
-mapSpace tangent
-mapMaterials 1
-shadows 0
-filename "C:/BoxA"
-fileFormat tga
-superSampling 0
-filterType 0
-filterSize 2
-overscan 1
-searchMethod 0
-useGeometryNormals 1;


Thank you by advance, I really can't success to resolve this problem T_T ...

Replies

  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    It looks like the problem is the mapOutput flag. Apparently it's just that the string is case sensitive. If you type in 'normal' instead of 'Normal' it should write it out fine.
  • sama.van
    Offline / Send Message
    sama.van polycounter lvl 17
    Shit you right >__<

    Stupid Maya!!! Can't say it doesn't know it???? "z-buffer"..... baka!!!

    Thank a lot!
  • sama.van
    Offline / Send Message
    sama.van polycounter lvl 17
    I don't really know where I can put that stuff...
    Because there is not really Mel script section on Polycount...

    Anyway, I recently had some problems with the basic Save option on maya 2008 with Vista...
    Sometimes it crashes Maya and kill my *.ma file...

    Then some lines for preventing of this stupid error...


    - First replace your basic "Ctrl+S" Hotkey with :


    nameCommand
    -annotation "SAMA_SaveMeCorrectly"
    -command "SAMA_SaveMeCorrectly ()"
    SAMA_SaveMeCorrectlyCommand;
    hotkey -k "s" -ctl -name "SAMA_SaveMeCorrectlyCommand";


    What the script do :
    - Save another version of your file with a "_" before the basic name.
    - and only after that, save on the orginal file...

    drop this function in your maya :

    global proc SAMA_SaveMeCorrectly ()
    {
    string $fileName = `file -q -sn -shn`;
    string $tempName = "_" + $fileName;
    //syring $basicName = `substitute ".ma" $fileName ""`;

    string $absolutePathFile = `file -q -sn `;
    string $buffer[] = stringToStringArray ($absolutePathFile, "/");
    int $bufferSize = `size $buffer`;
    $buffer[$bufferSize - 1] = $tempName;
    string $temptAbsolutFullPath = stringArrayToString ($buffer, "/");

    file -rename $temptAbsolutFullPath;
    file -save -de 0 -type "mayaAscii";

    file -rename $absolutePathFile;
    file -save -de 0 -type "mayaAscii";

    print ("\nTempFile : " + $temptAbsolutFullPath );
    print ("\nFile : " + $temptAbsolutFullPath );
    }



    You can also copy past the full command line in you userSetup.mel file :

    nameCommand
    -annotation "SAMA_SaveMeCorrectly"
    -command "SAMA_SaveMeCorrectly ()"
    SAMA_SaveMeCorrectlyCommand;
    hotkey -k "s" -ctl -name "SAMA_SaveMeCorrectlyCommand";

    global proc SAMA_SaveMeCorrectly ()
    {
    string $fileName = `file -q -sn -shn`;
    string $tempName = "_" + $fileName;
    //syring $basicName = `substitute ".ma" $fileName ""`;

    string $absolutePathFile = `file -q -sn `;
    string $buffer[] = stringToStringArray ($absolutePathFile, "/");
    int $bufferSize = `size $buffer`;
    $buffer[$bufferSize - 1] = $tempName;
    string $temptAbsolutFullPath = stringArrayToString ($buffer, "/");

    file -rename $temptAbsolutFullPath;
    file -save -de 0 -type "mayaAscii";

    file -rename $absolutePathFile;
    file -save -de 0 -type "mayaAscii";

    print ("\nTempFile : " + $temptAbsolutFullPath );
    print ("\nFile : " + $temptAbsolutFullPath );
    }



    I can work at home on maya now, cya guys!
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Oooh this sounds familiar. Do you have this crash with .ma files, but not with .mb files?
    I had the same problem recently, drove me nuts. On the bright side, usually the .ma becomes empty (!) but the temp file created in the same folder has the file contents in it.

    By the way ... if you bring up the 'open file' dialog, select a file without opening it, and try to rename it from there, does your maya lock up? I have to ctrl-tab out and back in to wake it up.
    Crazy.
  • sama.van
    Offline / Send Message
    sama.van polycounter lvl 17
    yop, you right, it does that only with ma file....

    Anyway, I stoped for long time to understand stupidity of Vista or Maya by the same way...

    I did some modifcations to my script, now it detects if your working with ma or mb gfile :) :

    global proc SAMA_SaveMeCorrectly ()
    {
    string $fileName = `file -q -sn -shn`;
    string $tempName = "_" + $fileName;

    string $absolutePathFile = `file -q -sn `;
    string $buffer[] = stringToStringArray ($absolutePathFile, "/");
    int $bufferSize = `size $buffer`;
    $buffer[$bufferSize - 1] = $tempName;
    string $temptAbsolutFullPath = stringArrayToString ($buffer, "/");

    string $fileType = "mayaAscii";

    if (`gmatch $fileName "*.ma"` == 1) $fileType = "mayaAscii";
    else if (`gmatch $fileName "*.mb"` == 1) $fileType = "mayaBinary";

    file -rename $temptAbsolutFullPath;
    file -save -de 0 -type $fileType;

    file -rename $absolutePathFile;
    file -save -de 0 -type $fileType;

    print ("\nTempFile : " + $temptAbsolutFullPath );
    print ("\nFile : " + $temptAbsolutFullPath );
    }
Sign In or Register to comment.