openPipeline

About
Download
Documentation
Tutorials
Add-Ons
Specification

Contact: rob (at) kickstandlabs.com



Custom Master Scripts

At many times you will want to run a script at the moment of mastering a file. The reasons are numerous and could be to do a clean-up of a file, or to run special functions on the file that are critical to its mastered version. Custom master scripts are just MEL scripts that are run when the master button is pressed, after the workshop is saved and right before the master is saved. The add a powerful step to the openPipeline workflow and allow users to customize the mastering step for their needs.

  1. Custom Master Command
    The "Custom Master Command" field on the Master File Switchboard (fig. 1) is a place where you could place the name of a MEL command to be run. This command must be sourced already and ready to be run by Maya.

    fig. 1

  2. Sample Custom Master Script As a simple example of a Custom Master Script, say you would like to make sure that your models have their transforms frozen and/or their history deleted before they are mastered in the pipeline. The following script could take care of that at the mastering stage. This leaves the transforms and history in the workshop file so that the modeler still has access to them when they make edits.

    global proc preMasterFreezeModel(int $freeze, int $history)
    {
    	string $allPolygons[] = `ls -tr -type "mesh"`;
    	
    	for($eachMesh in $allPolygons)
    	{
    		if($freeze)
    		{
    			// freeze transformation
    			makeIdentity -apply true -t 1 -r 1 -s 1 $eachMesh;
    		}
    		
    		if($history)
    		{
    			// delete history
    			delete -ch $eachMesh;
    		}
    	}
    }
    
    In the "Custom Master Command" field you would enter:
    • preMasterFreezeModel(1,1) to freeze transformations and delete history.
    • preMasterFreezeModel(1,0) to freeze transformations but not delete history.
    • preMasterFreezeModel(0,1) to delete history but not freeze transformations.


  3. A master step provides a non-destructive point to run this script as it does not impact the workshop file which is the only file edits should be made on. Said another way, you should never hand edit the master file.

    If you have a custom master script that you would like to share please send them over or send us a link to your website or post on Highend3D.