Search Maya Zest



Showing posts with label MEL. Show all posts
Showing posts with label MEL. Show all posts

Wednesday, June 17, 2020

Add vray subdivision node to all selected objects in Maya MEL



Here is a little MEL code snippet to add an individual vray subdivision node to each of your selected objects in Maya.

Simply select all your geo, paste into the MEL script line in maya and hit enter!


{
string $sel[] = `ls -sl -dag -s`;
for ($each in $sel){
 if (`nodeType $each`=="mesh"){ 
  print ("// adding VRay subdivision attributes to "+$each+"\n");
  vrayAddAttr($each, "vraySubdivEnable");
  vrayAddAttr($each, "vraySubdivUVsAtBorders");
 }
}
}


Alternatively, this tip from Raymond in the comments below. If you would like ONE vray subdivision node to effect all objects. Which is easier to control simply:

Select your objects, then: Create > VRay > VRay Displacement > Apply Single VRayDisplacement Node To Selection

Then on the VRayDisplacement node, in the Attribute Editor: Attributes > VRay > OpenSubDiv (or whatever you want)

Friday, September 1, 2017

MEL Code to change filter type of all your images/textures (MAYA)

Sometimes you might want to turn of the texture filtering for ALL textures or ALL SELECTED textures in your maya project. This is because the default filtering method (quadratic) can lead to very soft or smudgy textures.

Paste one of these scripts into your script editor with MEL selected. Then highlight the code snippet and press the play button to execute.





// Sets filter type to "Off" on ALL file textures

string $fileList[] = `ls -type "file"`;
for ($file in $fileList){
       
        setAttr ($file + ".filterType") 0;
             
}




// Sets filter type to "Off" on selected file textures

string $fileList[] = `ls -sl -type "file"`;

for ($file in $fileList){
       
        setAttr ($file + ".filterType") 0;
             
}

Wednesday, July 27, 2016

Select every other edge loop on your model (maya)



1. Make sure your script panel in the bottom is set to MEL

2. Select your edge selection tool and highlight one edge in your object. Double click to get the entire loop.

3. Once that loop is selected drop this code snippet in your script editor and hit enter

polySelectEdgesEveryN "edgeRing" 2;

It should select every other loop in your model.

Wednesday, May 8, 2013

Source a MEL script with a shelf icon in Maya


Well it happened  you found a MEL or Python script you just love using over and over, now you just need to create a quick shelf icon so you can start it instantly.

Friday, April 22, 2011

enabling production shaders (MAYA)


Enabling Mentalray Production Shaders

Maya hides the Mentalray production shaders (mip shaders) by default. To enable the mip shaders as of Maya 2009 run the following MEL code by typing it in the script box at the bottom of Maya and pressing enter.
optionVar -iv "MIP_SHD_EXPOSE" 1;

Please check "HELPFUL" below if it was, if not COMMENT below and tell me why! Don't miss another tutorial or tip! Subscribe to Maya Zest