Hi everyone,
I am fairly new to Maya, after changing over from 10 years of 3ds max, and therefor even more n00b at Mel/Python.
Goal:
I am trying to write a simple script that will select ALL vraymtl in the scene, and change the BRDF to GGX (from the default blinn or what ever). p.s. why is this not default in 3.1 already?
I someone was kind of enough to write something for me on the max forums, that does exactly this in max... but now.. Maya.
Problem:
I simply don't know Mel well enough to figure it out.
I have found the basic commands of selecting a specific vraymtl and changing its BRDF but, I can't seem to figure out how to mass select by type of material.
Thanks in advance guys!
EDIT:
So I found this other script that randomises colours in diffuse and changed it.
"
// User must select bunch of materials first (maybe inside Hypershade)
//store selected material as an array of String
string $materials[] = `ls -sl` ;
//loop through new selection of materials
for($mat in $materials)
{
//get attributes on material
string $attrs[] = `listAttr -v -k -u $mat` ;
//loop through every attribute
for($a in $attrs)
{
$randomR = rand(0,1);
$randomG = rand(0,1);
$randomB = rand(0,1);
//if the attribute is diffuse, then set the attribute
if($a == "brdfType")
{
setAttr ($mat + ".brdfType") 3;
}
}
}
"
This actually works! but I am pretty sure it's bloated with stuff I don't need?
Is there a better way of looking for the brdf attr ?
"
//loop through every attribute
for($a in $attrs)
{
$randomR = rand(0,1);
$randomG = rand(0,1);
$randomB = rand(0,1);
"
thanks
I am fairly new to Maya, after changing over from 10 years of 3ds max, and therefor even more n00b at Mel/Python.
Goal:
I am trying to write a simple script that will select ALL vraymtl in the scene, and change the BRDF to GGX (from the default blinn or what ever). p.s. why is this not default in 3.1 already?
I someone was kind of enough to write something for me on the max forums, that does exactly this in max... but now.. Maya.
Problem:
I simply don't know Mel well enough to figure it out.
I have found the basic commands of selecting a specific vraymtl and changing its BRDF but, I can't seem to figure out how to mass select by type of material.
Thanks in advance guys!
EDIT:
So I found this other script that randomises colours in diffuse and changed it.
"
// User must select bunch of materials first (maybe inside Hypershade)
//store selected material as an array of String
string $materials[] = `ls -sl` ;
//loop through new selection of materials
for($mat in $materials)
{
//get attributes on material
string $attrs[] = `listAttr -v -k -u $mat` ;
//loop through every attribute
for($a in $attrs)
{
$randomR = rand(0,1);
$randomG = rand(0,1);
$randomB = rand(0,1);
//if the attribute is diffuse, then set the attribute
if($a == "brdfType")
{
setAttr ($mat + ".brdfType") 3;
}
}
}
"
This actually works! but I am pretty sure it's bloated with stuff I don't need?
Is there a better way of looking for the brdf attr ?
"
//loop through every attribute
for($a in $attrs)
{
$randomR = rand(0,1);
$randomG = rand(0,1);
$randomB = rand(0,1);
"
thanks
Comment