Working across the board_mel script


#1

Hi. I’m a beginner at Mel Script. And I’m not an English speaker, so I’m not good at English. I’m sorry in advance!

I want to take care of a lot of things at once.

For example, it’s like this.

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

Which script should be applied to unselect ‘Lock Fresh IOR To Reflection IOR’ in multiple vray shading node properties?
I think I should use “setAttr”, but I can’t because I’m using a similar code. :sob:

Thank you in advance. :smile:

Below are the codes I’ve tried.

    vray("getRequiredAttrs", "lockFresnelIORToRefractionIOR" 0;); 



string $filelist[] = `ls -sl -force "vray"`; 
for ($filelist in $file){ 
        
        setAttr ($filelist + ".lockFresnelIORToRefractionIOR") 0;

              
};



string $material[] = `ls -force "vray"`; 
for ($material in $vray){ 
        
        setAttr ($vray + ".lockFresnelIORToRefractionIOR") 0;

              
};



string $material[] = `ls -materials "VRayMtl"`; 
for ($material in $VRayMtl){ 
        
        setAttr ($VRayMtl + ".vraylockFresnelIORToRefractionIOR") 0;

              
};



setAttr "VRayMtl1.lockFresnelIORToRefractionIOR" 0;
setAttr "VRayMtl1.bumpMapType" 1;




string $VRayMtl[] = `ls -materials "VRayMtl"`; 
for ($VRayMtl in $Reflection){ 
        
        setAttr ($Reflection + ".vraylockFresnelIORToRefractionIOR") 0;

              
};

// Error: for ($VRayMtl in $Reflection){ 
 // 
// Error: Line 2.29: "$Reflection" is an undeclared variable. // 
// Error:         setAttr ($Reflection + ".vraylockFresnelIORToRefractionIOR") 0;
 // 
// Error: Line 4.30: "$Reflection" is an undeclared variable. // 



string $VRayMtl[] = `ls -materials "VRayMtl"`; 
for ($VRayMtl in $Reflection){ 
        
        setAttr ($VRayMtl + ".vraylockFresnelIORToRefractionIOR") 0;

              
};



string $checkior[] = `ls -mat "VRayMtl"`; 
for ($checkior in $Reflection){ 
        
        setAttr ($VRayMtl + ".vraylockFresnelIORToRefractionIOR") 0;

              
};