Post #2395: ![](https://blenderartists.org/user_avatar/blenderartists.org/anminmakura/48/575

📋 Metadata

🏷️ Tags

popup-dialog custom-properties advanced solved

  • Popup Dialog Editor
  • Property Editor
  • Custom Properties

💬 Content

anminmakura:

This time I had a hard time because the condition specification was different from the previous one because I want to make a form that allows multiple selection of buttons.

Yes, in this case the code can be more complex. Instead of 0, 1, 2, ... indices items have 1 << 0, 1 << 1, 1 << 2, ... indices.
In getter you need to return bitwise OR of all selected items:

1 << 0 | 1 << 1 | 1 << 2 | ...

In setter you need to parse value:

value & 1 << 0 and print("0 item is selected"); value & 1 << 1 and print("1 item is selected"); value & 1 << 2 and print("2 item is selected"); ...

Here is an example.
LayersProperty allows to show/hide collections. You can find usages in LayersProperty Usage Examples popup.


❤️ 1 likes


🔗 View on Blender Artists