>> MAXScript Rollout Handler Exception:
-- Unknown property: "castShadow" in $Editable_Mesh:subMeshTest002 @ [-5.230925,6.493752,0.000000] <<
"castShadow" in undefined <<
"castShadow" in Editable_mesh <<
I understand that Unknown property is a common problem.. But the reason why I'm posting about it is that I have make a check statement to see if the attribute exists.. and it's crashing because the attribute doesn't exist -,- which is counter intuitive. Also, for that object there was that custom attribute, so it didn't find it for some reason :(
if( objects[numNodes] == undefined) do continue
body = objects[numNodes] -- collision body to export
-- code emitted to save space
if body.castShadow != undefined then -- this right here is causing the exception.. but it's supposed to be checking for existance.. which non existance should be an acceptable outcome
(
--do stuff
)
the custom attribute is defined here:
newAttrib = attributes entityAttrib
(
parameters posParam rollout:entParams
(
xPos type:#boolean ui:castShadow checked:false
)
rollout entParams "Entity Atributes"
(
checkbox castShadow "Casts Shadows?"
)
)
custAttributes.add $ newAttrib
Maybe i'm doing this all wrong.. maybe somone can tell me the correct way to do the following:
I'm trying to add a rollout to object's to allow you to have custom properties which later my level (xml) exporter goes through all objects, it the attempts to see if each of the objects it is running through has the custom attribute, it will then add an xml node for that attribute if it existed... I might just resort to manually adding object properties, but that's not desirable and will also not solve the error mentioned at the start.
=========================================================
FULL SOLUTION:
=========================================================
newAttrib = attributes entityAttrib
(
parameters posParam rollout:entParams
(
xPos type:#boolean ui:castShadow checked:false
)
rollout entParams "Entity Atributes"
(
checkbox castShadow "Casts Shadows?"
)
)
custAttributes.add $ newAttrib
-- ---------------------------------------
-- THIS IS THE SOLUTION FOR ATTRIBUTES:!!!
-- ---------------------------------------
$.baseObject.entityAttrib.castShadow = on
isProperty $.baseObject #castShadow
and the solution for the exporter
change this:
if body.castShadow != undefined then
(
--do stuff
)
TO THIS
if isProperty body.baseObject #castShadow == true do
(
format "\t\t<castShadow> % </castShadow>\n" body.baseObject.entityAttrib.castShadow to:currentFile
)
=========================================================
FOR HELP LEARNING MAX SCRIPT:
=========================================================
EDIT: omited plausible illegal link
Also theses forums have many answered questions about maxscript
http://forums.cgsociety.org/forumdisplay.php?f=98
http://www.polycount.com/forum/
http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/
barigazy · 2012-09-06