title: How do I extend a 3Ds Max material correctly
body: <p>Basically, I'm just trying to add a few more properties to the "Standard" material in 3Ds Max 9. I've actually managed to accomplish this through max script, but it is breaking our exporter.</p>
  
  <p>The exporter works fine for anything skinned with the normal "Standard" material, but the extended version seems to hide the base class's properties from the exporter.</p>
  
  <p>What I have so far is this:</p>
  
  <pre><code>
  plugin material Standard_WithOutlines
  name:"Standard & Outlines"
  classID:#(0x73212413, 0x1ca9e3e6)
  extends:Standard replaceUI:false version:1
  (
      parameters shaderParameters
      (
          diffuse type:#color
          glossiness type:#float
          specular type:#color
          specularLevel type:#float
          selfIllumColor type:#color
          selfIllumAmount type:#float
          opacity type:#float
  
          on diffuse get val do delegate.diffuse
          on glossiness get val do delegate.glossiness / 100.0
          on specular get val do delegate.specular
          on specularLevel get val do delegate.specularLevel
          on selfIllumColor get val do delegate.selfIllumColor
          on selfIllumAmount get val do delegate.selfIllumAmount
          on opacity get val do delegate.opacity / 100.0
  
          on diffuse set val do delegate.diffuse = val
          on glossiness set val do delegate.glossiness = val * 100.0
          on specular set val do delegate.specular = val
          on specularLevel set val do delegate.specularLevel = val
          on selfIllumColor set val do delegate.selfIllumColor = val
          on selfIllumAmount set val do delegate.selfIllumAmount = val
          on opacity set val do delegate.opacity = val * 100.0
      )
  
      parameters MainParams rollout:ExtendedMatRollout
      (
          ShowOutlining type:#boolean animatable:false default:false ui:outline_Enabled
          OutlineColour type:#color animatable:false default:(color 0 0 0) ui:outline_Colour
          OutlineThickness type:#float animatable:false default:5 ui:outline_Thickness
      )
  
      rollout ExtendedMatRollout "Extended Parameters"
      (
          groupBox outlinegrp "Outlining" pos:[8,0] width:312 height:62
          checkbox outline_Enabled "Enabled" pos:[18,16] width:128 height:16
          colorPicker outline_Colour "Colour:" pos:[160,34] width:56 height:20 enabled:ShowOutlining
          spinner outline_Thickness "Thickness:" pos:[50,36] width:80 height:16 enabled:ShowOutlining range:[0,100,0]
          on outline_Enabled changed state do
          (
              outline_Colour.enabled = state
              outline_Thickness.enabled = state
          )
  
      )
  )</code></pre>
  
  <p>By declaring the variables myself, the exporter could read them, but this didn't actually link to the values being set by the UI. To solve that, I used the 'on XXX get/set' events to link to the hidden items. So those now work correctly, but the material maps for things like diffuse and specular don't work (which is the only way to texture the thing AFAIK).</p>
  
  <p>How should I be going about adding these couple of settings to a material type, so that it exports all of the data within the 'delegate' class as well (is basic inheritance too much to ask for)?</p>
  
  <p>Thanks</p>