Notifications
Clear all
[Closed] Scripted Material: On Update not available??
Apr 02, 2007 7:21 pm
I’m trying to use the On Update event handler inside a Scripted Material, but on evaluation, it doesn’t seem to like it???
Even in something as benign as this:
plugin material testMTL
name:"Test0r"
classID:#(0x45aac0f5, 0x20559386)
extends:Standard replaceUI:true version:1
(
parameters main rollout:params
(
Name type:#string default:"uber"
)
rollout Params "Uber-Material"
(
on update do
(
)
)
)
Anyone know if the update handler is just not available within a material? It seems to work fine in other types of attribute block usage....
edit: the "on create" handler also appears to gag the evaluator, despite what the MaxScript documentation eludes too. :( Any insight at all would be immensly appreciated!
Even more odd is that if I paste this example code given in the help under the Scripted Plug-in Clauses heading:
plugin material MyMaterial
name:"MyMaterial"
classID:#(0x33fdd816, 0x2f94507)
extends:Standard replaceUI:true
(
parameters hardwareShaders rollout:shaderRoll
(
)
rollout shaderRoll "Hardware Shaders" width:328 height:189
(
label l1 "AA"
)
on create do format "created: %
" this
on clone orig do format "cloned: % : % : % : %
" this orig
(this == orig) (delegate == orig.delegate)
)
a=mymaterial()
b=copy a
I get the typical maxScript error
-- Syntax error: at (, expected Plugin clause:
-- In line: (t
-- Syntax error: at ), expected <factor>
-- In line: )
2 Replies
Apr 02, 2007 7:21 pm
Hi,
You have to set the on update handler in the plugin material body (not inside the rollout definition) like this:
plugin material testMTL
name:"Test0r"
classID:#(0x45aac0f5, 0x20559386)
extends:Standard replaceUI:true version:1
(
parameters main rollout:params
(
Name type:#string default:"uber"
)
rollout Params "Uber-Material"
(
)
on update do
(
)
)
About the error in the help sample, modify one of the last line (problem with line return):
on clone orig do format "cloned: % : % : % : %
" this orig (this == orig) (delegate == orig.delegate)