Notifications
Clear all
[Closed] Why the script can't Correctly run ?
Sep 02, 2011 1:58 pm
Help
I write a simple script,but the script can Correctly run ,
a messge ” Unknown property: “color” in undefined”
The script:
(
global theColor
fn yansegj = (
if selection.count == 1 do
(
if (classof $.material == Standardmaterial) or (classof $.material == Vraymtl)
do (theColor.color = $.material.diffuse)
))
rollout change_wirecolor “Object Color Changer”
(
global theColor
colorpicker theColor “Wireframe color:” color:[0,0,255]
on theColor changed new_col do $.material.diffuse = new_col
on change_wirecolor open do ( registerRedrawViewsCallback yansegj ))
createDialog change_wirecolor –modal:true
)
3 Replies
Sep 02, 2011 1:58 pm
(
try (destroyDialog change_wirecolor) catch ()
--global change_wirecolor
fn yansegj =
(
if selection.count == 1 do
(
if (classof $.material == Standardmaterial) or (classof $.material == Vraymtl)
do (change_wirecolor.theColor.color = $.material.diffuse)
)
)
rollout change_wirecolor "Object Color Changer"
(
on change_wirecolor open do (registerRedrawViewsCallback yansegj )
on change_wirecolor close do (unregisterRedrawViewsCallback yansegj )
colorpicker theColor "Wireframe color:" color:[0,0,255]
on theColor changed new_col do $.material.diffuse = new_col
)
createDialog change_wirecolor --modal:true
)
It is better to declare the rollout as global and access theColor as change_wirecolor.theColor from outside.