Hello, I am writing a script that aligns the sun direction of the sky texture node to the rotation of a sun lamp. I want to rename the lamp data to “Sunlight”. I can do that, what I want to do is check if there is already lamp data called Sunlight and if so, assign the new sun’s lamp data to that data. How could I do this?
Not sure which you want, if you want to FIND a lamp data called sunlight and link it to your new light…
if 'Sunlight' in bpy.data.lamps:
new_lamp.data = bpy.data.lamps['Sunlight']
else:
. ... make your new lamp data
or if you want to link your new lamp data to wherever Sunlight was used:
new_sunlight = ... make your new lamp data
if 'Sunlight' in bpy.data.lamps:
bpy.data.lamps['Sunlight'].user_remap(new_sunlight)
How could i reach a Bool property of such a light and be able to set it to False