PDA

View Full Version : Copy light object


kovitch
04-03-2012, 11:45 AM
Hi,

I'am trying to copy light objects by using the following code:

general_light= viz.addLight()
general_light.position(11.496,4.195,2.63)
general_light.direction(0,-1,0)
general_light.spread(180)
general_light.intensity(1)
general_light.spotexponent(3)

light_1 = general_light.copy()
light_1.setPosition(11.496,4.195,5.63)
light_2 = general_light.copy()
light_2.setPosition(11.496,4.195,7.289)

...and I get the error:
** ERROR: Failed to copy node
** ERROR: Failed to copy node

Is there any special way to copy a light object?

Best regards,

Alex.

farshizzo
04-04-2012, 05:57 PM
No, this is not currently supported. In your specific case you can define a function that creates the light and sets the parameters:def addGeneralLight():
general_light= viz.addLight()
general_light.position(11.496,4.195,2.63)
general_light.direction(0,-1,0)
general_light.spread(180)
general_light.intensity(1)
general_light.spotexponent(3)
return general_light

light_1 = addGeneralLight()
light_1.setPosition(11.496,4.195,5.63)
light_2 = addGeneralLight()
light_2.setPosition(11.496,4.195,7.289)