creating a grouped row of named boolean buttons?

Hi. I tried the BoolVectorProperty but that gives me checkboxes.
I’d like to create a compressed row of toggle buttons, a label within each one, none exclusive. (any or all at once). I suspect I need a ‘collection’ or a ‘group’ but I’m getting a little over my head on this, can’t find any examples!
thanks

what do you want to use the boolVector for? because depending of the subtype you choose blender wil automaticly add a label.
e.g. the subtype EULER wil give you the labels X,Y,Z

my_bool_vector = BoolVectorProperty(  name = "Example Bool Vector", 
                                              description = "Bool Vector Desc",
                                               default = (  True, False, True),
                                              subtype = 'EULER')

if you want you bools to toggle use this

col.prop( scn, "my_bool_vector" , toggle = True) 

if you want different labels, i suggest you make different bool properties and put them all in a row or column with align = True, that way you will get the same effect.

Hi
You can add a label to the prop with text=“Label”

Here is a simple example with a size 4 boolvectorprop with a list created for their names.
There is also a boolprop for toggling all on or off.


import bpy
from bpy.props import BoolVectorProperty, BoolProperty

def flag_all(self, context):
    for i, flag in enumerate(self.flags):
        self.flags[i] = self.flag_all
    return None

bpy.types.Scene.flags = BoolVectorProperty(size=4)
flag_names = []
i = 0
while i < 4:
    flag_names.append("flag%d" % i)
    i += 1

bpy.types.Scene.flag_all = BoolProperty(update=flag_all)

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        row = layout.row()
        row.prop(scene, "flag_all", text="SELECT ALL")
        row = layout.row(align=True)
        for i,name in enumerate(flag_names):
            
            row.prop(scene, "flags", index=i, text=name, toggle=True)


def register():
    bpy.utils.register_class(HelloWorldPanel)


def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)


if __name__ == "__main__":
    register()

@olifant

Not sure I’d use subtype=‘EULER’ in this context. Use it more for unit typing, for example a euler vectorfloatproperty will be size 3 and will be displayed as a rotation unit (degrees or radians), using the rotation widget, or subtype=‘COLOR’ will give you a colorwheel.

@batFinger

thanks voor the tip, i dident know the index attr