0
$\begingroup$

so, i have the ui list and many properties for each element witch is added to it. The idea is that when the user selects an object in the list, its properties are displayed at the bottom. He can change them for each element. The problem is that I can't get access to these properties in any way, more specifically to objects that have these properties. Here my ui lis:

class OBJECT_UL_my_list(bpy.types.UIList):
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        obj = item
        row = layout.row()
        if self.layout_type in {'DEFAULT'}:
            if item:
                row.prop(obj, "name", text="", emboss=False, icon_value=icon, event=False)
                row.prop(obj, "weight", text="")

        elif self.layout_type == 'GRID':
            layout.alignment = 'CENTER'
            row.prop(text="", icon_value=icon)

but I still have 4 properties for each object, and putting them all in a row in the list of items would be just awful, so they should be under the list. Like so: How I want to do it, but it doesnt work out

On the screenshot, other properties from another propertyGroup are marked in red, but I need the properties of the selected object from the list. That is, I need to change these properties and the changes are recorded in the uilist

$\endgroup$

1 Answer 1

1
$\begingroup$

You would have to draw the elements after the UI list depending on the active element of the UI list.

The active element index is the active_propname of the active_dataptr which is an index of an element of the collection propname of dataptr which you set when you draw the UI list.

For example:

dataptr: bpy.context.object

propname: 'vertex_groups'

active_dataptr: bpy.context.object.vertex_groups

active_propname: 'active_index'

The active element: bpy.context.object.vertex_groups[bpy.context.object.vertex_groups.active_index]

$\endgroup$
3
  • $\begingroup$ does it also work with custom properties? $\endgroup$
    – blend file
    Commented Apr 14 at 13:10
  • $\begingroup$ Thank you very much! $\endgroup$
    – blend file
    Commented Apr 14 at 13:13
  • $\begingroup$ It works for bpy.types.AnyType which is any possible data. $\endgroup$
    – unwave
    Commented Apr 14 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .