nav
nav
nav
nav
nav
nav
nav
nav
nav
nav
nav
nav nav
nav
 
 
 

hard-surface modeling
hard-surface modelinghard-surface modeling
hard-surface modeling
hard-surface modelinghard-surface modeling

 
On this page, you'll find a collection of MEL-scripts, which I've written in the last years. If you have any questions, suggestions, found any bugs or wrote a bugfix for one of the scripts, please don't hesitate to contact me.


mmAlignControl.mel

latest version:

1.0 download mel 2 kB, ZIP-file

trenner

Description:

Creates animation controlers based on the translation, rotation and scale of an object.

Instructions:

  • Copy the mel-scripts from the ZIP-file to your script directory.
  • Source the script mmAlignControl.mel.
  • Select an object and execute the following mel-command: mmAlignControl(X), where X is a number between 1 and 3 and defines the number of controls being created.

    example: mmAlignControl(3);

trenner

Bugs, Limitations and Workarounds:

  • n/a
top
trenner

mmCurveDistribute.mel

latest version:

1.0 download mel 7 kB, MEL-file

trenner
Description:


Instances an object several times and attaches the instances to a curve, using motion paths. Useful to create all kinds of chains or treads.
In order to create tank treads, attach the instances to a circle and after creation, deform the circle, using a lattice.

trennerInstructions:

  • Load the UI, define the curve along which the objects shall be instanced.
  • Select the "World Up Type". In case "Object Up" or "Object Rotation Up" is selected, a "World Up Object" needs to be defined, as well.
  • Define the object which shall be instanced along the curve
  • Define the number of instances. Press Instance.
  • After creation, the scale of the individual instances can be adjusted, using the "objectScale"-slider.

trenner
Bugs, Limitations and Workarounds:

  • n/a
top
trenner

mmFalloffSpotLight.mel
img

latest version:

1.0 download mel 7 kB, MEL-file

trenner
Description:

Creates a spotlight that gives you precise control over it's brightness in relation to it's distance. Regions can be intuitively adjusted in Maya's viewport by using the light's standard decay-region manipulators. The light will give you control over 5 different regions.

Works both with Mental Ray and Maya Software Renderer.

  • Max Brightness Region: The shines with the highest, constant intensity in this area.
  • Near Fallof & Far Falloff Cone: Area in which the light;s intensity will be defined by a linear falloff, ranging from it's maxBrightness to it's near- or farBrightness region.
  • Near Brigthess & Far Brightness Region: In this area the light shines with a constant intensity (which is in all cases must be less or equal to it's maxBrightness).

trennerInstructions:

  • Copy the mel-file into Maya's script directory and source the script (source "mmFalloffSpotLight.mel";)
  • To create a light, type the following command mmFalloffSpotlight(); or assign it to a shelf-button.
  • A new spotlight will be created. At the first glance, it's indistinguishable from Maya's default-spotlight,

    except for a couple of new attributes. You will also notice that the light's intensity attribute has an incoming connection. It's intensity must be controlled using maxBrightness, nearBrightness and farBrightness

    The maxBrightness controls the spotlight's intensity in the maxBrightness region. It's an absolute value and the light intensity in that area will be constant.


    img
    The nearBrightness and farBrightness attributes are relative values, which are indicating their intensity in relation to the maxBrightness (0 means "no light", 1 means "as bright as maxBrightness", 0.4 means "40% intensity of maxBrightness" and so on...)
    The fields nearValue and Far Value indicate the light intensity in these areas as absolute values. The values from the example above will result in the followong light distribution:

    img

  • In order to adjust the light's decay in various areas, select it and press "T". A manipulator will pop-up. Click on it for 5 times (until the indicator is at 7 o`clock). Left- or middle-mouse drag any of the four circles. The space between the 1st & 2nd and between the 3rd & 4th circle are the falloff regions with linear light decay. The space in the middle is the maxBrightness region. The area before and after the regions mentioned above are the Near- and Far Brightness.
img img

trenner
Bugs, Limitations and Workarounds:

  • Deleting a mmFalloffSpotLight: The script creates the spotlight and a couple of additional shading nodes. Deleting the light from the outliner will not remove those nodes from the scene. To get rid of the nodes, manually delete the whole network, using the hyperShade or use "delete unused nodes" after deleting the light.
  • There are two more circle-shaped manipulators, both set to zero. Don't touch them, they don't have any effect. Also leave the checkbox for "Use Decay Regions" unchecked in the attribute editor. Activating that attribute will result in unpredictable light distribution.
top
trenner

mmInstanceArray.mel

latest version:

1.0 download mel 18 kB, MEL-file

trenner
Description:


This script lets you instance an object a number of times in Y and Z. Each individual objects attributes Visibility, TranslateY and ScaleY can be easily adjusted and animated, using textures.

trennerInstructions:

  • Select the object you want to instance.
  • Choose the number of instances in X and Z direction. (higher values above 40*40 take quite long to calculate)
  • All instances are grouped under a node called "instanceGroup"
    3
  • The settings, as well as the connections of the textures to the instanced objects are stored in the "mmInstanceArraySettings" node. Pipe any textures into that node in order to drive the various attributes via expressions. After adjusting an attribute in any of the connected textures, you need to scrub through the timeline in order to see the effect.

    mmInstanceArray4

trenner
Bugs, Limitations and Workarounds:

  • While instancing the objects, a status bar pops up. Even though it states "Press ESC to Cancel", it's not possible to interrupt that process. This is especially critical if a huge amount of instances is being created.
  • After adjusting an attribute in any of the connected textures, you need to scrub through the timeline in order to see the effect.
  • There can only be one instanceArray in a scene, due to some name-clashes. A workaround would be to create various arrays, each in a scene of their own and then to import all of them into the final scene.
top


mmIsolateAsset.mel

latest version:

1.0 download mel 2 kB, MEL-file

trenner
Description:


Pick one or multiple objects and execute the script. If objects are nested in a hierarchy, the entire hierarchy of the selected objects will be isolated in the currently active viewport. Very useful to quickly isolate whole characters, props or assets.

trennerInstructions:

  • Source the script and assign a hotkey to the following command: mmIsolateAsset()
    Personally I'm using the ~ key (shift + tilde).

trenner
Bugs, Limitations and Workarounds:

  • n/a
top
trenner


mmIsolateSelect.mel

latest version:

1.0 download mel 1 kB, MEL-file

trenner
Description:


A tiny script that lets you toggle "isolateSelect" for the currently active viewport. Very useful when working with heavily cluttered scenes.

trennerInstructions:

  • Source the script and assign a hotkey to the following command: mmIsolateSelect()
    Personally I'm using the ` key (tilde).

trenner
Bugs, Limitations and Workarounds:

  • n/a
top
trenner
 
mmListMelScripts.mel

latest version:

1.0.3 download mel 38 kB, MEL-file
      mel 4 kb BMP shelf-button

trenner
Description:

This comes in handy, in order to manage a large amount of scripts, spread over a variety of different folders:

Generates a list of all mel-scripts, with options to eXecute, Source or Edit the files. A search function is included as well, for better overview over a large amount of scripts.

Right-click on a script lists all global procs within the file with options to show additional information, such as return types and arguments. Right-click on one of the coloured buttons (X, E or S) will bring up additional options, such as "add to shelf", "duplicate file" and "copy file to...".

trennerVersion History:

  • 1.0.3 Added right-click functionality: Add to shelf, duplicate script, copy to folder, open folder, load into script-editor.
  • 1.0.2 Added right-click functionality: searching for global procs and arguments within mel-scripts.
  • 1.0.1 Paths can now be conveniently edited from within Maya. No need to modify the path in the script itself.
  • 1.0.1 First release.

trennerInstallation:

  • Source the script. Execute the following command, in order to run the script: mmListMelScripts();
  • Click on "Preferences".
    If you want to use an external editor to edit the scripts, define it's path under 3.)
    Under 4.) enter as many paths as desired to the folder's containing your mel-scripts

trennerInstructions:
trenner
Getting Started

  • The script will generate a list of all mel-scripts in the pre-defined directories.
  • It is possible to quickly filter the list of scripts, by using the integrated search-function. You can use * as a wildcard.
    mmListMelScripts02

  • To execute a script or a procedure, hit the blue "X"-button. mmListMelScripts
    The script will look into the textfield associated with the button and execute it's text.

  • To source a script, hit the pink "S"-button. mmListMelScripts

  • To edit the script in an external text editor, such as WordPad, hit the green "E"-button. mmListMelScripts
trenner

Right Click Options

  • There are several ways of searching, displaying and executing the procedures of a script:
    Right-clicking on a script's texfield opens a popup-menu, which displays the script's filename and lists all it's global procs.

    mmListMelScripts

    Selecting one of the procedures from the list, will load it into the textfield. Bold letters indicate, that the content of the textfield has changed. Pressing the blue "X" button will execute the selected procedure.

    mmListMelScripts

    An arrow -> besides a procedure indicates, that it's most likely the script's main procedure which e.g. builds the UI or calls all the other procs. Selecting it will set the textfield back to the default font.

    mmListMelScripts

    trenner

  • mmListMelScripts
    This option is activated by default. In case that a procedure has a return value or argument(s), those will be displayed in a sub-menu.

    mmListMelScripts

    In case calling the procedure requires some arguments , simply enter those in the textfield in between the brackets and then hit the blue "X" button.

    mmListMelScripts

    trenner

  • mmListMelScripts
    mmListMelScripts

    Those two options are deactivated by default. They offer an alternative way of displaying a procedure's return value or argument(s), in a textfield's main right-click menu.

    mmListMelScripts

    trenner

  • Right-clicking on one of the buttons on the left side opens a popup-menu, which displays the script's filename and some additional options.

    mmListMelScripts

  • "eXecute", "Source" and "Edit" work exactly as the buttons mmListMelScriptsmmListMelScriptsmmListMelScripts

    trenner
  • "Duplicate file" will create a copy of the mel-file. Useful to create a backup of a script before modifying it. The copy of "myFile.mel" will be named "myFile_Copy1.mel".

    mmListMelScripts

  • "Copy file to..." copies the mel-file into from it's current location to any of the other folder as defined in the preferences. If a file of the same name already exists in the destination directory, the copied file will be named "myFile_Copy1.mel".
  • "Open folder" opens the folder in which the file is located in the file manager.

    trenner

    mmListMelScripts

  • "Add to shelf... -> proc from textField;"
    Creates a shelf button calling the procedure from the textfield e.g. myProc();
  • "Add to shelf... -> source script;"
    Creates a shelf button which will source the script e.g. source "C:\\myScripts\\myScript.mel";
  • "Add to shelf... -> source script;proc from textField; "
    Creates a shelf button which will source the script and then call the procedure from the textField
    e.g. source "C:\\myScripts\\myScript.mel"; myProc( );
  • "Add to shelf... ->entire script from file "
    Creates a shelf button containing the whole code of the mell-file.

    trenner

    mmListMelScripts

  • "Print to Script Editor... -> to History"
    Clears the history (the upper area) of the script editor first and then displays the code from the mel-file. Useful to quickly see the code of a script without using an external editor or clearing the input area of Maya's script editor.
  • "Print to Script Editor... -> to Input "
    Clears the input (the lower area) of the script editor first and then loads the code from the mel-file for convenient editing.

trenner
Bugs, Limitations and Workarounds:

  • Works only on Windows machines. Tested under Win XP (english Version).
top
trenner

 
All contents on this site, unless otherwise stated © Manuel Macha 2005