I have created a panel in which I like to make elements selectable. I know that before the 2.8 version, it was
row.prop(obj, ‘select’, …)
to add a checkbox in the panel.
I know the new way to select an object is : obj.select_set(state=True) but how to do that in a panel ?
I tried :
row.prop(obj, ‘select_set’, …)
Here my draw code :
def draw(self, context):
layout = self.layout
scene = context.scene
objs = scene.objects
layout.label(text = "Lights in current scene") for obj in objs: if obj.type == 'LIGHT': row = layout.row() # here the code to select a light row.prop(obj.data, 'type', text='') # type of the light (sun, area, spot, point) row.prop(obj, 'name',text='') row.prop(obj.data, 'color', text='') # color of the light row.prop(obj.data, 'energy', text='') # power of the light
Can someone help me how to select a light (or anything) in a panel ?