Maybe you would need to keep a record of the last objects you had changed
and their previous setting. Then each time the condition fires, you would
reset all of the last objects that aren't in the current selection.
 On 8/10/2014 8:32 AM, "Aren Voorhees" <[email protected]> wrote:

> Hey All, I'm trying to use pymel to create a scriptJob that will assign a
> particular material to whatever object(s) you have selected.  When you
> select something else, I need the previously selected objects to switch
> back their original material.  Making it assign a material based on
> selection was not too hard, but I haven't been able to figure out how to
> re-assign the original material once the object is no longer selected.
> Thanks for any help!
>
> from pymel.core import *
>
> def assignBlueMatFn():
>
>     curSel = ls(sl=True)
>
>     for i in curSel:
>         hyperShade(i, assign='Blue_MAT')
>
> scriptJob(event=['SelectionChanged', 'assignBlueMatFn()'])
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/cb1e5b7e-b8a7-45fe-ae71-1e6af723ce11%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/cb1e5b7e-b8a7-45fe-ae71-1e6af723ce11%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2HtiOy7R5Fo6vQVsFa37NnSZ%2BTovYb%2BSBM3eOjZ-QHnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to