mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-29 23:26:00 +00:00
Fixed: #933 Correctly update 3ds Max NeL Material parameters from v11 to latest version.
This commit is contained in:
parent
0107b510f2
commit
a2f203f7a9
1 changed files with 103 additions and 52 deletions
|
@ -328,26 +328,27 @@ plugin material NelMaterial
|
||||||
classID:#(0x64c75fec, 0x222b9eb9)
|
classID:#(0x64c75fec, 0x222b9eb9)
|
||||||
extends:standard
|
extends:standard
|
||||||
replaceUI:true
|
replaceUI:true
|
||||||
version:12.0
|
version:14.0
|
||||||
(
|
(
|
||||||
local loadShader
|
local loadShader
|
||||||
local globalUpdateUI
|
local globalUpdateUI
|
||||||
local updateTextureName
|
local updateTextureName
|
||||||
|
|
||||||
local updateToVersion4 = false
|
local updateToVersion4 = false
|
||||||
|
local updateToVersion14 = false
|
||||||
|
|
||||||
parameters nlbp rollout:nelBasicParameters
|
parameters nlbp rollout:nelBasicParameters
|
||||||
(
|
(
|
||||||
bTwoSided type:#boolean ui:cbTwoSided
|
bTwoSided type:#boolean
|
||||||
cAmbient type:#color ui:cpAmbient
|
cAmbient type:#color
|
||||||
cDiffuse type:#color ui:cpDiffuse
|
cDiffuse type:#color
|
||||||
pOpacity type:#percent ui:spOpacity
|
pOpacity type:#percent
|
||||||
cSpecular type:#color ui:cpSpecular
|
cSpecular type:#color
|
||||||
pSpecularLevel type:#percent ui:spSpecularLevel
|
pSpecularLevel type:#percent
|
||||||
pGlossiness type:#percent ui:spGlossiness
|
pGlossiness type:#percent
|
||||||
cSelfIllumColor type:#color ui:cpSelfIllumColor
|
cSelfIllumColor type:#color
|
||||||
pSelfIllumAmount type:#percent ui:spSelfIllumAmount
|
pSelfIllumAmount type:#percent
|
||||||
bUseSelfIllumColor type:#boolean ui:cbUseSelfIllumColor
|
bUseSelfIllumColor type:#boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
parameters main rollout:NelParams
|
parameters main rollout:NelParams
|
||||||
|
@ -549,8 +550,8 @@ plugin material NelMaterial
|
||||||
|
|
||||||
group "Standard Lighting"
|
group "Standard Lighting"
|
||||||
(
|
(
|
||||||
Label lblNlbpslA "Diffuse is the color in light, ambient in the dark." align:#right
|
-- Label lblNlbpslA "Diffuse is the color in light, ambient in the dark." align:#right
|
||||||
Label lblNlbpslB "Ambient and diffuse multiply with the textures and global sun." align:#right
|
-- Label lblNlbpslB "Ambient and diffuse multiply with the textures and global sun." align:#right
|
||||||
ColorPicker cpAmbient "Ambient" color:[63,63,63] align:#left across:3
|
ColorPicker cpAmbient "Ambient" color:[63,63,63] align:#left across:3
|
||||||
ColorPicker cpDiffuse "Diffuse" color:[127,127,127] align:#left
|
ColorPicker cpDiffuse "Diffuse" color:[127,127,127] align:#left
|
||||||
Spinner spOpacity "Opacity" range:[0,100,100] type:#integer scale:1 align:#left
|
Spinner spOpacity "Opacity" range:[0,100,100] type:#integer scale:1 align:#left
|
||||||
|
@ -558,8 +559,8 @@ plugin material NelMaterial
|
||||||
|
|
||||||
group "Specular"
|
group "Specular"
|
||||||
(
|
(
|
||||||
Label lblNlbpsA "Increase the specular level to see the specular color." align:#right
|
-- Label lblNlbpsA "Increase the specular level to see the specular color." align:#right
|
||||||
Label lblNlbpsB "Multiplies with sun. Glossiness changes the size of the specular." align:#right
|
-- Label lblNlbpsB "Multiplies with sun. Glossiness changes the size of the specular." align:#right
|
||||||
ColorPicker cpSpecular "Specular" color:[255,255,255] align:#left across:3
|
ColorPicker cpSpecular "Specular" color:[255,255,255] align:#left across:3
|
||||||
Spinner spSpecularLevel "Level" range:[0,100,0] type:#integer scale:1 align:#left
|
Spinner spSpecularLevel "Level" range:[0,100,0] type:#integer scale:1 align:#left
|
||||||
Spinner spGlossiness "Glossiness"range:[0,80,10] type:#integer scale:1 align:#left
|
Spinner spGlossiness "Glossiness"range:[0,80,10] type:#integer scale:1 align:#left
|
||||||
|
@ -567,64 +568,91 @@ plugin material NelMaterial
|
||||||
|
|
||||||
group "Self Illumination"
|
group "Self Illumination"
|
||||||
(
|
(
|
||||||
Label lblNlbpsiA "Set the self illumination by color or by amount." align:#right
|
-- Label lblNlbpsiA "Set the self illumination by color or by amount." align:#right
|
||||||
ColorPicker cpSelfIllumColor "Self Illum"color:[0,0,0] align:#left across:3
|
ColorPicker cpSelfIllumColor "Self Illum"color:[0,0,0] align:#left across:3
|
||||||
Spinner spSelfIllumAmount "Self Illum" range:[0,100,0] type:#integer scale:1 align:#left
|
Spinner spSelfIllumAmount "Self Illum" range:[0,100,0] type:#integer scale:1 align:#left
|
||||||
CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right
|
CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right
|
||||||
)
|
)
|
||||||
|
|
||||||
on cbTwoSided changed bval do
|
on cbTwoSided changed bval do
|
||||||
delegate.twoSided = bval
|
updateUI false
|
||||||
|
|
||||||
on cpAmbient changed cval do
|
on cpAmbient changed cval do
|
||||||
delegate.ambient = cval
|
updateUI false
|
||||||
|
|
||||||
on cpDiffuse changed cval do
|
on cpDiffuse changed cval do
|
||||||
delegate.diffuse = cval
|
updateUI false
|
||||||
|
|
||||||
on spOpacity changed pval do
|
on spOpacity changed pval do
|
||||||
delegate.opacity = pval
|
updateUI false
|
||||||
|
|
||||||
on cpSpecular changed cval do
|
on cpSpecular changed cval do
|
||||||
delegate.specular = cval
|
updateUI false
|
||||||
|
|
||||||
on spSpecularLevel changed pval do
|
on spSpecularLevel changed pval do
|
||||||
delegate.specularLevel = pval
|
updateUI false
|
||||||
|
|
||||||
on spGlossiness changed pval do
|
on spGlossiness changed pval do
|
||||||
delegate.glossiness = pval
|
updateUI false
|
||||||
|
|
||||||
on cpSelfIllumColor changed cval do
|
on cpSelfIllumColor changed cval do
|
||||||
delegate.selfIllumColor = cval
|
updateUI false
|
||||||
|
|
||||||
on spSelfIllumAmount changed bval do
|
on spSelfIllumAmount changed bval do
|
||||||
delegate.selfIllumAmount = bval
|
updateUI false
|
||||||
|
|
||||||
on cbUseSelfIllumColor changed bval do
|
on cbUseSelfIllumColor changed bval do
|
||||||
(
|
updateUI false
|
||||||
delegate.useSelfIllumColor = bval
|
|
||||||
spSelfIllumAmount.visible = not bval
|
|
||||||
cpSelfIllumColor.visible = bval
|
|
||||||
)
|
|
||||||
|
|
||||||
Fn updateUI update =
|
Fn updateUI update =
|
||||||
(
|
(
|
||||||
cbTwoSided.checked = delegate.twoSided
|
if (version >= 14) then
|
||||||
cpAmbient.color = delegate.ambient
|
(
|
||||||
cpDiffuse.color = delegate.diffuse
|
if update == true then
|
||||||
spOpacity.value = delegate.opacity
|
(
|
||||||
cpSpecular.color = delegate.specular
|
cbTwoSided.checked = bTwoSided
|
||||||
spSpecularLevel.value = delegate.specularLevel
|
cpAmbient.color = cAmbient
|
||||||
spGlossiness.value = delegate.glossiness
|
cpDiffuse.color = cDiffuse
|
||||||
cpSelfIllumColor.color = delegate.selfIllumColor
|
spOpacity.value = pOpacity
|
||||||
spSelfIllumAmount.value = delegate.selfIllumAmount
|
cpSpecular.color = cSpecular
|
||||||
cbUseSelfIllumColor.checked = delegate.useSelfIllumColor
|
spSpecularLevel.value = pSpecularLevel
|
||||||
|
spGlossiness.value = pGlossiness
|
||||||
spSelfIllumAmount.visible = not delegate.useSelfIllumColor
|
cpSelfIllumColor.color = cSelfIllumColor
|
||||||
cpSelfIllumColor.visible = delegate.useSelfIllumColor
|
spSelfIllumAmount.value = pSelfIllumAmount
|
||||||
delegate.adTextureLock = false
|
cbUseSelfIllumColor.checked = bUseSelfIllumColor
|
||||||
delegate.adLock = false
|
|
||||||
delegate.dsLock = false
|
spSelfIllumAmount.visible = not bUseSelfIllumColor
|
||||||
|
cpSelfIllumColor.visible = bUseSelfIllumColor
|
||||||
|
)
|
||||||
|
else
|
||||||
|
(
|
||||||
|
bTwoSided = cbTwoSided.checked
|
||||||
|
cAmbient = cpAmbient.color
|
||||||
|
cDiffuse = cpDiffuse.color
|
||||||
|
pOpacity = spOpacity.value
|
||||||
|
cSpecular = cpSpecular.color
|
||||||
|
pSpecularLevel = spSpecularLevel.value
|
||||||
|
pGlossiness = spGlossiness.value
|
||||||
|
cSelfIllumColor = cpSelfIllumColor.color
|
||||||
|
pSelfIllumAmount = spSelfIllumAmount.value
|
||||||
|
bUseSelfIllumColor = cbUseSelfIllumColor.checked
|
||||||
|
|
||||||
|
delegate.twoSided = bTwoSided
|
||||||
|
delegate.ambient = cAmbient
|
||||||
|
delegate.diffuse = cDiffuse
|
||||||
|
delegate.opacity = pOpacity
|
||||||
|
delegate.specular = cSpecular
|
||||||
|
delegate.specularLevel = pSpecularLevel
|
||||||
|
delegate.glossiness = pGlossiness
|
||||||
|
delegate.selfIllumColor = cSelfIllumColor
|
||||||
|
delegate.selfIllumAmount = pSelfIllumAmount
|
||||||
|
delegate.useSelfIllumColor = bUseSelfIllumColor
|
||||||
|
)
|
||||||
|
|
||||||
|
delegate.adTextureLock = false
|
||||||
|
delegate.adLock = false
|
||||||
|
delegate.dsLock = false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
on nelBasicParameters open do
|
on nelBasicParameters open do
|
||||||
|
@ -2050,16 +2078,16 @@ plugin material NelMaterial
|
||||||
)
|
)
|
||||||
|
|
||||||
on load do
|
on load do
|
||||||
(
|
(
|
||||||
-- Trap Patch
|
-- Trap Patch
|
||||||
if version >= 4 then
|
if version >= 4 and version < 14 then
|
||||||
(
|
(
|
||||||
if (delegate.DiffuseMap != undefined) and (tTexture_1 == undefined) then
|
if (delegate.DiffuseMap != undefined) and (tTexture_1 == undefined) then
|
||||||
(
|
(
|
||||||
tTexture_1 = delegate.DiffuseMap
|
tTexture_1 = delegate.DiffuseMap
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Update to version 4 ?
|
-- Update to version 4 ?
|
||||||
if updateToVersion4 == true then
|
if updateToVersion4 == true then
|
||||||
(
|
(
|
||||||
|
@ -2135,18 +2163,35 @@ plugin material NelMaterial
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
updateToVersion4 = false
|
updateToVersion4 = false
|
||||||
|
|
||||||
|
if updateToVersion14 == true then
|
||||||
|
(
|
||||||
|
bTwoSided = delegate.twoSided
|
||||||
|
cAmbient = delegate.ambient
|
||||||
|
cDiffuse = delegate.diffuse
|
||||||
|
pOpacity = delegate.opacity
|
||||||
|
cSpecular = delegate.specular
|
||||||
|
pSpecularLevel = delegate.specularLevel
|
||||||
|
pGlossiness = delegate.glossiness
|
||||||
|
cSelfIllumColor = delegate.selfIllumColor
|
||||||
|
pSelfIllumAmount = delegate.selfIllumAmount
|
||||||
|
bUseSelfIllumColor = delegate.useSelfIllumColor
|
||||||
|
)
|
||||||
|
|
||||||
|
updateToVersion14 = false
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
on create do
|
on create do
|
||||||
(
|
(
|
||||||
-- Single shader
|
-- Single shader
|
||||||
loadShader ShaderSingleTexture
|
loadShader ShaderSingleTexture
|
||||||
)
|
)
|
||||||
|
|
||||||
on update do
|
on update do
|
||||||
(
|
(
|
||||||
-- Initialise V3 fields.
|
-- Initialise V3 fields.
|
||||||
if (version < 3) and (version >= 1) then
|
if (version < 3) and (version >= 1) then
|
||||||
(
|
(
|
||||||
|
@ -2168,10 +2213,16 @@ plugin material NelMaterial
|
||||||
(
|
(
|
||||||
updateToVersion4 = true
|
updateToVersion4 = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (version < 14) and (version >= 1) then
|
||||||
|
(
|
||||||
|
updateToVersion14 = true
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
fn globalUpdateUI update =
|
fn globalUpdateUI update =
|
||||||
(
|
(
|
||||||
|
nelBasicParameters.updateUI update
|
||||||
NelParams.updateUI update
|
NelParams.updateUI update
|
||||||
NelTexture.updateUI update
|
NelTexture.updateUI update
|
||||||
NelMultitextureSlot1.updateUI update
|
NelMultitextureSlot1.updateUI update
|
||||||
|
|
Loading…
Reference in a new issue