Skip to main content
edited title
Link
Karan
  • 2.7k
  • 1
  • 7
  • 27

How to show limited Enumsenum items?

deleted 2 characters in body
Source Link
Karan
  • 2.7k
  • 1
  • 7
  • 27

I want to show enums up to 5 items.

Is it possible?

enter image description hereenter image description here

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) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5', expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10', expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum del bpy.types.Scene.enum_type if __name__ == "__main__": register() 

I want to show enums up to 5 items.

Is it possible?

enter image description here

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) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5', expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10', expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum del bpy.types.Scene.enum_type if __name__ == "__main__": register() 

I want to show enums up to 5 items.

Is it possible?

enter image description here

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) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5', expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10', expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum del bpy.types.Scene.enum_type if __name__ == "__main__": register() 
added 36 characters in body
Source Link
Karan
  • 2.7k
  • 1
  • 7
  • 27

I want to show enums up to 55 items.

Is it possible?

enter image description here

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''enum_type', expand=True) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5', expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10', expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum del bpy.types.Scene.enum_type  if __name__ == "__main__": register() 

I want to show enums up to 5

Is it possible?

enter image description here

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', expand=True) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5' expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10' expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum if __name__ == "__main__": register() 

I want to show enums up to 5 items.

Is it possible?

enter image description here

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) # I want like this: if context.scene.enum_type == 'FIRST': col.prop(context.scene, 'enum', text='Enum 1-5', expand=True) elif context.scene.enum_type == 'LAST': col.prop(context.scene, 'enum', text='Enum 6-10', expand=True) enum_type = ( ('FIRST', 'First', ''), ('LAST', 'Last', ''), ) enum_items = ( ('1', '1', ''), ('2', '2', ''), ('3', '3', ''), ('4', '4', ''), ('5', '5', ''), (None), ('6', '6', ''), ('7', '7', ''), ('8', '8', ''), ('9', '9', ''), ('10', '10', ''), ) def register(): bpy.utils.register_class(HelloWorldPanel) bpy.types.Scene.enum = bpy.props.EnumProperty(name='Enums', items=enum_items) bpy.types.Scene.enum_type = bpy.props.EnumProperty(name='Types', items=enum_type) def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.enum del bpy.types.Scene.enum_type  if __name__ == "__main__": register() 
added 175 characters in body
Source Link
Karan
  • 2.7k
  • 1
  • 7
  • 27
Loading
Source Link
Karan
  • 2.7k
  • 1
  • 7
  • 27
Loading