title: MaxScript to collect all VRay materials in the scene
body: <p>Hello this is my first script ever. 
  I am trying to write a script that will get all VRay materials in the scene into an array, after that I want to pull them trough for loop and attach each vray material to a slot in Multi/Sub-Object. And then output of multi/sub object connect to VRayMtlWrapper and keep the old multisub object as sub material.</p>
  
  <p>I can do that in graph but it takes to long with double digits amount of materials.</p>
  
  <p>I've scraped some scripts and read maxscript help to find what I need but with no luck.</p>
  
  <p>Atm I know to collect materials in the scene</p>
  
  <pre><code>materials = for m in scenematerials collect m;
  </code></pre>
  
  <p>but after that i dont know how to write so that i can access their outputs/inputs or attributes and connect them with a multi sub object.
  I have developed the logic in my head but dont know how to write the syntax to realise it.
  Any info, directions, links would be appreciated.</p>
  
  <p>Here's even an image of what im trying to do with a script automaticaly 
  <a href="https://i.stack.imgur.com/AM1vg.jpg" rel="nofollow noreferrer">example</a></p>