ayon-core icon indicating copy to clipboard operation
ayon-core copied to clipboard

Enhancement: EnumDef multiselection allow no items

Open BigRoy opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Please describe the feature you have in mind and explain what the current shortcomings are?

The recently added feature to EnumDef to allow multiselection=True allows an artist to pick from zero, one or more items from a list.

I currently have an EnumDef with multiselection in the USD PR which allows to add 'job contexts' to the exporter. The items are dynamic based on what contexts the USD plug-in supports at that moment in time with your current combination of plug-ins, where it could potentially be none at all.

Whenever it hits the case that it has no items the EnumDef can't be initialized and raises errors.

How would you imagine the implementation of the feature?

Allow the EnumDef with multiselection to contain zero items, e.g. take items=[] or items=None.

Potentially the widget itself could appear 'disabled' or show a "<No Items>" entries while visible - or better yet allow to have a customizable placeholder text for if there are no items, so that the EnumDef could provide a specific 'empty' label, like e.g. "No job contexts available."

Are there any labels you wish to add?

  • [X] I have added the relevant labels to the enhancement request.

Describe alternatives you've considered:

Excluding the EnumDef from the returned attribute definitions if it didn't have any items or fake an empty entry like <do not use> by adding that whenever items is empty.

Additional context:

No response

[cuID:OP-6759]

BigRoy avatar Sep 06 '23 19:09 BigRoy