基本上,我只是想在 3Ds Max 9 中为“标准”材质添加更多属性。我实际上已经通过 max 脚本实现了这一点,但它破坏了我们的导出器。
导出器适用于任何使用普通“标准”材质蒙皮的东西,但扩展版本似乎对导出器隐藏了基类的属性。
我到目前为止是这样的:
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
)
)
)
通过自己声明变量,导出器可以读取它们,但这实际上并没有链接到 UI 设置的值。为了解决这个问题,我使用了“on XXX get/set”事件来链接到隐藏的项目。所以这些现在可以正常工作,但是诸如漫反射和镜面反射之类的材质贴图不起作用(这是对事物进行纹理化的唯一方法 AFAIK)。
我应该如何将这两个设置添加到材质类型中,以便它也导出“委托”类中的所有数据(要求基本继承太多了)?
谢谢