TextureMonkey in the pipeline...

While testing out the textureMonkey script I came across a couple of little hurdles to get it working within the current pipeline.

The most annoying bug came from the naming of the PSD files themselves. Many had been named with the _d, _n and _s already in the PSD name, in order to work with a Photoshop action that was already doing a basic version of what TextureMonkey was intended for- saving the flattened PSD as a TGA in a couple of different directories.

When TextureMonkey was used on these files, it came out with an ugly export name, eg:

'psd_name_d_d'
'psd_name_d_n'
'psd_name_d_s'

Lameness, but a reasonably easy fix. I added a basic function that checks for the extensions in the PSD name, and if they were there, to remove them from the export file name:

def name_check(name_check):
    """Checks the PSD name for the old naming convention.
    """
    doc_name = name_check
    old_name = ('_d', '_n', '_s', '_a', '_t', '_D', '_N', '_S', '_A', '_T')

    #Create a test case to test against the PSD name
    name_check = doc_name[:-2]
    for name in old_name:  

        test_case = name_check + name

        if test_case == doc_name:
            doc_name = doc_name[:-2]
            print "It looks like the file is using the old naming conventions"
            print "Monkey wants to fix that for you!"
            print "TADA! Removed ", name, "from", doc_name, "source"
            print "Proceeding"
            return doc_name
            break
            
    #If we did not pick up anything in the for loop 
    #we can pass through an unmodified doc_name 
    return doc_name
   

Works pretty well, and does the job. Ideally, all the source files wouldn't have the extensions already in the name, but its not a show stopper.

-Pete