<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using RootNode to store material in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159529#M21834</link>
    <description>See this script as reference:&lt;BR /&gt;&lt;A href="http://www.scriptspot.com/3ds-max/scripts/smes-super-material-editor-switcher" target="_blank"&gt;http://www.scriptspot.com/3ds-max/scripts/smes-super-material-editor-switcher&lt;/A&gt;</description>
    <pubDate>Tue, 06 Jul 2010 15:11:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-06T15:11:46Z</dc:date>
    <item>
      <title>Using RootNode to store material</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159528#M21833</link>
      <description>Hi , i've been reading trough some post here and I realized i could store material in the scene rootnode. In fact , I am trying to make a list of persistent global materials that are NOT assigned to any objects in the scene. I need them to stay in the background if the user needs it.&lt;BR /&gt;I don't want to load the Material editor slots neither.&lt;BR /&gt;&lt;BR /&gt;Somebody talked about a way to store the material data into the rootnode but i've been looking in the maxscript help and around the net , there is not much informations about it.&lt;BR /&gt;Can anyone help? thank you!</description>
      <pubDate>Tue, 06 Jul 2010 00:15:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159528#M21833</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-06T00:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using RootNode to store material</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159529#M21834</link>
      <description>See this script as reference:&lt;BR /&gt;&lt;A href="http://www.scriptspot.com/3ds-max/scripts/smes-super-material-editor-switcher" target="_blank"&gt;http://www.scriptspot.com/3ds-max/scripts/smes-super-material-editor-switcher&lt;/A&gt;</description>
      <pubDate>Tue, 06 Jul 2010 15:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159529#M21834</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-06T15:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using RootNode to store material</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159530#M21835</link>
      <description>Maybe there is another way to do that, but this worked fine for me:&lt;BR /&gt;&lt;BR /&gt;First you have to define a custom attribute to store the material, something like:&lt;BR /&gt;&lt;PRE&gt; myMatCA = attributes _mat&lt;BR /&gt; attribID:#(0x3b86c5cc, 0x336784d7)&lt;BR /&gt; (&lt;BR /&gt; parameters main rollout:params&lt;BR /&gt; (&lt;BR /&gt; _material type: #material ui:btn_material&lt;BR /&gt; )&lt;BR /&gt; &lt;BR /&gt; rollout params "pick Material" width:162 height:258&lt;BR /&gt; (&lt;BR /&gt; materialButton btn_material "Pick Material" pos: width:119 height:25 material:undefined&lt;BR /&gt; on btn_material picked newMat do&lt;BR /&gt; (&lt;BR /&gt; btn_material.caption = newMat.name&lt;BR /&gt; )&lt;BR /&gt; )&lt;BR /&gt; &lt;BR /&gt; fn getRollout = params&lt;BR /&gt; )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;the attribID can be generated with the genClassID() function.&lt;BR /&gt;&lt;BR /&gt;Then, you can add a new node:&lt;BR /&gt;&lt;PRE&gt;newTrackViewNode "yourCustomName"&lt;/PRE&gt;&lt;BR /&gt;This will just add a new track (you can check that on the trackview), named "yourCustomName" that will serve as a container for your custom attribute. You should then add the custom attribute to that node:&lt;BR /&gt;&lt;PRE&gt; &lt;BR /&gt;mCA = myMatCA&lt;BR /&gt;custAttributes.add (trackviewnodes ) mca&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Now everything is set up to start writing your code. To read or set the material, use&lt;BR /&gt;&lt;PRE&gt;trackviewnodes._mat._material&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;and if you need an interface for your scripts, you can get the rollout with&lt;BR /&gt;&lt;PRE&gt;trackviewnodes._mat.getRollout()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This is a very simple and basic setup, from there you can play around, like creating multiple material properties (or any other kind of properties) for your custom attributes, or adding multiple tracks to store different materials, or maybe keep just one global track, and add different controllers with the custom attribute on each one, etc. There are multiple possibilities from there.&lt;BR /&gt;&lt;BR /&gt;I hope it helps,</description>
      <pubDate>Tue, 06 Jul 2010 16:12:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/using-rootnode-to-store-material/m-p/4159530#M21835</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-06T16:12:19Z</dc:date>
    </item>
  </channel>
</rss>

