How to place the 3Ds Max material correctly
Basically, I'm just trying to add a few more properties to the "Standard" material in 3Ds Max 9. I did manage to accomplish this with a max script, but it breaks our exporter.
The exporter works fine for anything that works with normal "standard" stuff, but the extended version seems to hide the base class properties from the exporter.
What I still know:
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
)
)
)
By declaring the variables themselves, the exporter could read them, but it did not really refer to the values set by the user interface. To solve this problem, I used "on XXX get / set" events to refer to hidden items. So now they work correctly, but material maps for things like diffuse and specular don't work (which is the only way to texture the thing AFAIK).
How am I going to add these couple of settings to the material type so that it also exports all the data in the delegate class (inheritance too simple)?
thanks
a source to share
Two possibilities:
-
Is your exporter listing all passwords? I suppose your parameters in the script will end up in an extra pblock. If your exporter is just looking at pblock 0, that might be your problem.
-
I haven't seen this use before the parameters have the same name in the script and delegate. I think you should generally create new parameters in your script and assign them to the appropriate delegates using different names. At least the way I did it.
a source to share
Here is the main advanced shader. I think your problem is that your rollout is not specified for parameters. If it is not defined then you cannot find then if it cannot find them then the exporter will get the whole error.
plugin material Matte name:"Matte" classID:#(0x61108483, 0x4d218a72) extends:Standard replaceUI:true version:1
(
parameters main rollout:params
(
kdColor type:#color default:[90,90,90] ui:mkdColor
on kdColor set val do delegate.diffuse_color = val
)
rollout params "Matte Parameters"
(
-- Basic matte parameters
group "Basic Parameters" (
colorpicker mkdColor "Diffuse: " across:2
)
)
)
a source to share