title: Link procedure to each button command maya
body: <p>I made this script that creates two material with different color values.How can I attach this procedure so that when I click color 1 button it creates material color 1 and color 2 when I click second button.If there is a much better way to achieve this is python.Please let me know</p>
  
  <pre><code>global string $list_of_names[];
  global float $matColor[];
  $list_of_names = {"color1","color2"};
  $matColor = { 1.0,0.355,0.5,0.545,0.5,1.0};
  
  
  global proc create() {
  global string $list_of_names[];
  global float $matColor[];
  
     for ($i=0; $i&lt;`size $list_of_names`; ++$i){
          shadingNode -asShader VRayMtl -n $list_of_names;
          setAttr ($list_of_names[$i] + ".color") -type double3 $matColor[($i*3)] $matColor[($i*3)+1] $matColor[($i*3)+2];                   
      } 
  
  }
  
  
  window -width 150;
  columnLayout -adjustableColumn true;
  
  for ($i=0; $i&lt;`size $list_of_names`; ++$i){
      button -label $list_of_names[$i] -command "create()";
  }
  
  showWindow;
  </code></pre>