The purpose of this MEL script is to help users manage texture file names and paths. This will fix texture paths coming from other users or change all the filenames from absolute to relative.
Usage:
The window has three main areas: the General
Options section which lets you set all the options for the command,
Scene Info section (collapsed by default) gives you some information
about your scene, and the Preview section which is a preview window
and is useful to check the result before you hit the Apply button.
GENERAL OPTIONS SECTION
This area includes the following options:
Relocation mode
Set this button to Relative or
Absolute in order to have absolute or relative paths. When this
button is set to Absolute, the absolute path will be your current
project's absolute path.
Relocate to
This option is set to Automatic by default
and this covers most of cases. Since this option is an "advanced" feature,
needs some explanation and will be described in detail in a further section
of this document.
This area includes information about the current scene, and is collapsed by default. To expand this window, click on the small triangle next to Scene info. The information available is:
Current "sourceimages" directory:
This is the current project's sourceimages
subdirectory used when Relocate to is set to Automatic.
Number of textures found
Reports the number of file texture nodes
found in the current scene.
This grey section at the bottom is a preview. When the tool is first started, it lists all the filenames found in the current scene's file nodes. The list, updates automatically as soon as you change some of the options, reporting the changes to the paths. When the list is not updated automatically, you can refresh the window contents by pushing the Preview button. To go back to the current scene's original paths press the Reset button.
Every "empty" file node in the scene, (a texture file with an empty "Image name" field ) appears in the list as <empty node - IGNORED - >
USING THE SCRIPT
This example will show you how to take advantage of the Relocate to option.
The Relocate to option, affects the "sourceimages" part of a filename. A filename, is generally made of three elements. The following is a typical filename:
NT
C:\aw\awdemo\maya\projects\sourceimages\pixfile
NT
C:\aw\awdemo\maya\projects\)
This part is omitted or deleted if Relocation mode is set to relative.
The third and last part of the name is the filename.
When Relocate to is set to Automatic, the current sourceimages directory is taken as the "second part" of the new pathname and any existing subdirectory in the original file name is ignored.
For example, if you have two textures with the paths:
they both change to :
...projects/sourceimages/floor.iff
...projects/sourceimages/tail.iff
If you have subdirectories and all the textures in your scene refer to a common sourceimages directory like:
...projects/mytexturesdir/characters/dog/tail.iff
...projects/mytexturesdir/characters/dog/nose.iff
...projects/mytexturesdir/characters/man/dress/tie.iff
...projects/mytexturesdir/characters/man/body/head/hires/eye.iff
You can turn on the Trace original path checkbox specifying mytexturesdir in the text field and the subdirectories structure below the mytexturesdir directory will be preserved.
NOTE: Be sure all textures have mytextures in the path or you may get undesirable results. In this case a dialog box will warn you.
TIP: Leaving the textfield empty, will work if you want to fix paths missing their "sourceimages" directory like:
NOTE: The script, scans your project directory structure to automatically prompt the available directories. If you haven't set a file texture location in your project, the popup menu can contain incorrect directory names.
Tip: If used in conjunction with
the Change Selected nodes, allows you to manually relocate
groups of nodes.