+1 on Richards answer. Then you aren't limited to specific light names
in the code, and you have the option of either passing in the names in
one go, or using the currently selected lights.


On Jul 29, 9:13 am, Richard Kazuo <[email protected]> wrote:
> Or you could make a more generic function:
>
> *def setIntensity(intensityValue, lightList = None):
>     if lightList == None: lightList = cmds.ls(sl=1)
>
>     for light in lightList: cmds.setAttr(light+".intensity", intensityValue)
> *
>
> Then for general use:
>
>    1. Select lights and run:
>
>    *setIntensity(0.5)
>
>    *
>    2. **Run:
>
>    lightList = ['back_building_light_1', 'back_building_light_2', '
>    back_building_light_3']*
>    setIntensity(0.5, lightList)*
>
> On Fri, Jul 29, 2011 at 12:54 PM, matthew evans <[email protected]
>
>
>
>
>
>
>
> > wrote:
> > personally i would just make it into a quick function:
>
> > cmds.spotLight( n='back_building_light_1', ca=20 )
> > cmds.move( -8,10,0 )
> > cmds.spotLight( n='back_building_light_2', ca=20 )
> > cmds.move( 0,10,0 )
> > cmds.spotLight( n='back_building_light_3', ca=20 )
> > cmds.move( 8,10,0 )
> > cmds.group( 'back_building_light_1', 'back_building_light_2',
> > 'back_building_light_3', n='back_bldng_lgts_grp' )
> > cmds.rotate( -90,0,0 )
>
> > cmds.polyPlane( w=20, h=20, sx=10, sw=10 )
>
> > def intense(x):
> >     cmds.setAttr( "back_building_light_1.intensity"=x)
> >     cmds.setAttr( "back_building_light_2.intensity"=x)
> >     cmds.setAttr( "back_building_light_3.intensity"=x)
>
> > intense(20)
> > intense(40)
> > intense(5)
>
> > you get the picture :)
>
> > On Fri, Jul 29, 2011 at 1:06 AM, Marc Stephen <[email protected]> wrote:
>
> >> Hi there,
> >> I'm new to Python, and I have a simple question for you guys.
>
> >> How would I go about changing the attributes on group? In this case,
> >> it is a group of 3 spotlights. I just want to be able to change the
> >> intensity on them all at once, instead of individually.
>
> >> Here is the code...
>
> >> cmds.spotLight( n='back_building_light_1', ca=20 )
> >> cmds.move( -8,10,0 )
> >> cmds.spotLight( n='back_building_light_2', ca=20 )
> >> cmds.move( 0,10,0 )
> >> cmds.spotLight( n='back_building_light_3', ca=20 )
> >> cmds.move( 8,10,0 )
> >> cmds.group( 'back_building_light_1', 'back_building_light_2',
> >> 'back_building_light_3', n='back_bldng_lgts_grp' )
> >> cmds.rotate( -90,0,0 )
>
> >> cmds.polyPlane( w=20, h=20, sx=10, sw=10 )
>
> >> cmds.setAttr( 'back_building_lights.intensity=0.5) ????
>
> >> Thanks
>
> >> --
> >> view archives:http://groups.google.com/group/python_inside_maya
> >> change your subscription settings:
> >>http://groups.google.com/group/python_inside_maya/subscribe
>
> >  --
> > view archives:http://groups.google.com/group/python_inside_maya
> > change your subscription settings:
> >http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to