PDA

View Full Version : Why the script can't Correctly run ?


su37
09-02-2011, 01: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
)
------------------------------------------------------------

denisT
09-02-2011, 03:06 PM
Help
I write a simple script,but the script can Correctly run ,
a messge " Unknown property: "color" in undefined"
The script:
------------------------------------------------------------
...
global theColor
...
do (theColor.color = $.material.diffuse)
...
------------------------------------------------------------

the theColor is undefined and doesn't have a "color" property

Raytracer05
09-02-2011, 03:38 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.

su37
09-03-2011, 02:44 AM
Thanks all !!

CGTalk Moderation
09-03-2011, 02:44 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.