Fix #124027: EEVEE light influence UI disappears when light is pinned

As desribed in #90039, we dont have a context object when pinning data,
this was accessed though leading to python errors.

The object was only used for the active state of certain layouts, do to
resolve the errors (and disappearing UI), check if we actually get an
object from context. That means the correct active state of certain
layouts is lost (it could either be always ON or always OFF, PR is using
the former -- since the default visibility is ON, so that would be more
common).

Pull Request: https://projects.blender.org/blender/blender/pulls/124091
This commit is contained in:
Philipp Oeser 2024-07-03 13:43:39 +02:00 committed by Clément Foucault
parent 81e4fa29b8
commit cbbeeccd08

@ -185,19 +185,19 @@ class DATA_PT_EEVEE_light_influence(DataButtonsPanel, Panel):
col = layout.column(align=True)
sub = col.column(align=True)
sub.active = ob.visible_diffuse
sub.active = ob is None or ob.visible_diffuse
sub.prop(light, "diffuse_factor", text="Diffuse")
sub = col.column(align=True)
sub.active = ob.visible_glossy
sub.active = ob is None or ob.visible_glossy
sub.prop(light, "specular_factor", text="Glossy")
sub = col.column(align=True)
sub.active = ob.visible_transmission
sub.active = ob is None or ob.visible_transmission
sub.prop(light, "transmission_factor", text="Transmission")
sub = col.column(align=True)
sub.active = ob.visible_volume_scatter
sub.active = ob is None or ob.visible_volume_scatter
sub.prop(light, "volume_factor", text="Volume Scatter", text_ctxt=i18n_contexts.id_id)