help me understand this undefined error

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  1 Week Ago
help me understand this undefined error

This is a part of a script I am working on. The BSLMat array is much longer but cut it down to make it easier to follow. First time I run the script it will always do:

>> MAXScript Rollout Handler Exception:
-- Unknown property: "blendState" in undefined <<

Second time it will do as I want. I have had similar errors before when functions isn't declared in the right order and such (scope). But this just doesn't make sense... Does anyone know what is weird? And if there is a better way to do it I'm all up to it! Am new to Maxscript and am trying to learn.

Thanks in advance!

fn standardToBSLFx obj =
(
local BSLMat=#(
#(
"AlphaParam"
),
#(
"blendState"
)
)
--get old material and make a new BSLFX
oldMat=obj.material
newMat = BSLightingFX()
for i = 1 to BSLMat[1].count do
(
execute("newMat."+BSLMat[1][i]+"="+"oldMat."+BSLMat[2][i])
)
obj.material=newMat
)

--convert just selected objects materials
fn convertSel=(
objs=(Selection as array)
for obj in objs do (
if (classof obj.material == Standardmaterial) then (
obj.material=standardToBSLFx(obj)
)
)
)

rollout RL_UiddsSel1 "Convert Imported Materials" width:160 height:100
(
button btn_cnvS "Convert Selection" pos:[16,45] width:130 height:21
on btn_cnvS pressed do
(
convertSel()
)
)
FirstDialogs = newRolloutFloater "FO4" 180 630
addrollout RL_UiddsSel1 FirstDialogs
 
  1 Week Ago
Your error is on line 13:

newMat = BSLightingFX()


Ther is no BSLightingFX() function in the code.
 
  6 Days Ago
That is a Bethesda Game Studios Material plugin.
__________________
Felipe Nogueira aka: PePeTD
Technical Artist/Character TD
http://felipenogueira3d.com
 
  5 Days Ago
execute("newMat."+BSLMat[1][i]+"="+"oldMat."+BSLMat[2][i])


You know, execute works in global scope, not local scope. 90% of the cases you think 'I know, I'll use execute', think again. Use getProperty+setProperty instead here.
__________________
Scripts :: linkedin
 
  1 Day Ago
Ah, yes, that is a Beth material.

Interesting that execute don't work in local scope. Will look into get/setProperty. Thanks!
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:23 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.