You can customize AEnewNonNumericMulti.mel so that you can disable buttons such as the "Add New Item" button by doing the following:
Modify AEnewNonNumericMulti.mel in runTime/scripts/AETemplates to examine the type for $nodeName. For example, use one of the following two statements if you want to disable a field if the relevant node is of type “fooType”:
int $showField = nodeType( $nodeName ) != "fooType"; int $showField = !`objectType -isa "fooType" $nodeName`;
Set the managed state for each field appropriately by adding the flag " -m $showField " to the appropriate UI control to hide or show that field (for example, button, text, rowLayout). You also need to do something similar in AEreplaceNonNumericMulti to enable or disable the same field(s) when a new node is loaded using that template.
Once a procedure is in the midst of executing (for example, a call to AEnewNonNumericMulti has been triggered), you should never source a script from that procedure that would cause a re-definition of said procedure. Otherwise, an error would occur.
Some scripts, such as finalGatherMergeFileUtils.mel, explicitly source AEnewNonNumericMulti.mel, so you cannot simply source your version of this script to override the definition of the procedure AEnewNonNumericMulti. To check where a procedure is defined, use whatIs.
For example, if you source your own version of AEnewNonNumericMulti.mel, and enter:
whatIs “AEnewNonNumericMulti”;
Maya returns something along the lines of // Result: Mel procedure found in <somePath>/myAEnewNonNumericMulti.mel //
However, if you then open the Render Settings window, and select the Indirect Lighting tab, the original AEnewNonNumericMulti.mel file will be sourced, and the procedure will be redefined. If you now enter:
whatIs “AEnewNonNumericMulti”;
Maya returns something along the lines of // Result: Mel procedure found in <somePath>/runTime/scripts/AETemplates/AEnewNonNumericMulti.mel //
The latter confirms that the procedure used came from the default script file, and not from your own version.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License