I'm using the Gorgeous example as it is what I want to use and it's a great example ;)
see How to show limited enum items?
The problem when I run the script, is if I select in first list the item at index 4 and I switch to the last list, which have only one item here, the fact that the index is at 4 it won't select by default the first item of the last list, it will try to select the 5th item and because there's only one item, this item is not selected
So is it possible to do so ? at least select the first item when switching to the last list ?
Thanks
import bpy 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 = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Test" def draw(self, context): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False col = layout.column() col.prop(context.scene, 'enum_type', expand=True) text = 'Enum 1-5' if context.scene.enum_type == "FIRST" else 'Enum 6-10' col.prop(context.scene, 'enum', text=text, expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) def get_enum_items(self, context): get_enum_items.items.clear() if context.scene.enum_type == "FIRST": get_enum_items.items = [ ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), ] elif context.scene.enum_type == "LAST": get_enum_items.items = [ ('6', '6', ''), ] return get_enum_items.items get_enum_items.items = [] def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=get_enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) if __name__ == "__main__": register()