2 comments for “3delight tool script

  1. October 7, 2013 at 9:58 am

    Hi!
    I’am glad my script has been featured on this great blog! I would like to share the updated version of the script that allows to work in a linear color space. Basically I added options for sRGB and Linear conversion.
    Here is the latest script:

    if (window -exists tdlmake)
    deleteUI tdlmake;

    window -widthHeight 500 240 -title “Anteprima 3delight tools v1” tdlmake;
    columnLayout headLayout;
    frameLayout -label “converter” -collapsable 1 converter;
    columnLayout;
    textFieldButtonGrp -label “source” -text “” -buttonLabel “Browse” -bc “browse()” sourceField;
    text -label “”;
    rowColumnLayout -numberOfColumns 4 -columnOffset 1 “left” 50 -columnOffset 2 “left” 30 -columnOffset 3 “left” 20 -columnOffset 4 “left” 13 compression;
    string $collection = radioCollection;
    string $rb1, $rb2, $rb3, $rb5;
    $r1 = radioButton -label "LZW" lzw;
    $r2 = radioButton -label "Deflate" deflate;
    $r3 = radioButton -label "PackBits" apple;
    $r4 = radioButton -label "uncompressed" nocompres;
    text -l “”;
    string $bitCollection = radioCollection;
    string $rb1, $rb2, $rb3, $rb5;
    $r1 = radioButton -label "8" a;
    $r2 = radioButton -label "16" b;
    $r3 = radioButton -label "32" c;
    text -l “”;
    string $MapCollection = radioCollection;
    $map1 = radioButton -label "longLat" longLat;
    $map2 = radioButton -label "lightProbe" lightProbe;
    $map3 = radioButton -label "texture" texture;
    text -l “”;
    string $RGBCollection = radioCollection;
    $r1 = radioButton -label "sRGB" sRGB;
    $r2 = radioButton -label "linear" linear;
    text -l “”;
    text -l “”;
    string $LODCollection = radioCollection;
    $r1 = radioButton -label "noLOD" noLOD;
    $r2 = radioButton -label "LOD" LOD;

    setParent ..;
    rowLayout -columnAttach 1 “left” 140 ;
    button -l ” convert ” -c “tdl()”;
    setParent ..;
    setParent ..;
    setParent ..;
    frameLayout -label “tools” -collapsable 1;
    rowColumnLayout -numberOfRows 1 -rs 1 5 -co 1 “left” 0;
    button -l ” i-display ” -c “preview()” -al “left”;
    text -l ” “;
    button -l ” ptcView ” -c “ptcView()” -al “right”;
    setParent ..;
    setParent ..;
    setParent ..;
    showWindow tdlmake;

    global proc browse()
    {
    string $source = fileDialog;
    textFieldButtonGrp -e -text $source sourceField;
    }

    global proc tdl()
    {
    string $compress;
    if (radioButton -q -select lzw ==1) $compress = “-lzw”;
    if (radioButton -q -select deflate ==1) $compress = “-deflate”;
    if (radioButton -q -select apple ==1) $compress = “-packbits”;
    if (radioButton -q -select nocompres ==1) $compress = “-c”;

    string $bit;
    if (radioButton -q -select a ==1) $bit = “-byte”;
    if (radioButton -q -select b ==1) $bit = “-ushort”;
    if (radioButton -q -select c ==1) $bit = “-float”;

    string $map;
    if (radioButton -q -select lightProbe ==1) $map = “-lightprobe”;
    if (radioButton -q -select longLat ==1) $map = “-envlatl”;
    if (radioButton -q -select texture ==1) $map = “”;
    string $color;
    if (radioButton -q -select sRGB==1) $color = “-colorspace srgb”;
    if (radioButton -q -select linear == 1) $color = “-colorspace linear”;

    string $lod;
    if (radioButton -q -select noLOD == 1) $lod = “-nomipmap “;
    if (radioButton -q -select LOD == 1) $lod = “”;

    string $source = textFieldButtonGrp -q -text sourceField;
    int $stringSize = size $source;
    int $extension = $stringSize – 3;
    string $output = (substring $source 1 $extension+ “tdl”);
    string $tdl = “tdlmake.exe”;
    string $code = ($tdl + ” “+$map +” “+ $lod +” ” +$compress +” “+ $bit + ” “+ $color +” ” +” \”” +$source +”\”” +” ” +”\””+$output+”\””);
    system ($code);
    print (“Done!”);
    }

    global proc preview()
    {
    string $display = “i-display.exe”;
    string $source = textFieldButtonGrp -q -text sourceField;
    $size = size $source;
    if ($size > 0)
    {
    int $stringSize = size $source;
    int $extension = $stringSize – 3;
    string $output = “\””+(substring $source 1 $extension+ “tdl”)+”\””;
    string $code = ($display + ” ” + $output);
    system ($code);
    }
    else
    system ($display);
    }

    global proc ptcView()
    {
    system (“ptcview”);
    }

  2. Admin
    October 7, 2013 at 5:06 pm

    Cheers Einar, Glad that your liking the blog and thanks for the updated script. I’m sure it will be
    well received! Heres a link to that script
    if you copy and paste straight straight from the comments the code gets mangled somehow – so just download and it should be ok.

Leave a Reply

Your email address will not be published. Required fields are marked *