I have an EnumProperty
set up on the Scene in the register function:
def register():
bpy.types.Scene.my_enum = bpy.props.EnumProperty(
name = "My enum",
description = "My enum description",
items = [
("FIRST" , "First one" , "Description..."),
("SECNOD", "Second one", "Some other description")
]
)
Now, elsewhere in the code I have a Panel, which is to display the 'enum' for selection:
class SomePanel(bpy.types.Panel):
bl_idname = "some_panel"
bl_label = "A panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
def draw(self, context):
layout = self.layout
scene = context.scene
layout.prop(scene, "my_enum")
So far so good, the control draws correctly, but not the way I want:
Thing is - I wanted a different appearance - I didn't want a dropdown field, instead I want a radio-button like field, as the one found for example here:
... where I can choose one of the options regarding the color mode (BW , RGB or RGBA).
I've found that I can put the "ENUM_FLAG"
in the options field of the EnumProperty
definition:
def register():
bpy.types.Scene.my_enum = bpy.props.EnumProperty(
name = "My enum",
description = "My enum description",
items = [
("FIRST" , "First one" , "Description..."),
("SECNOD", "Second one", "Some other description")
],
options = {"ENUM_FLAG"}
)
This too worked fine, the result I got now is this:
But now I can activate both buttons at once using Shift, and that's what I want to avoid:
So How can make the selection exclusive? How to force Blender to switch from one option to the other (or in other words: How to disable the Shift functionality)?
options = {'ENUM_FLAG'}
to remove multi-select. You can then set a default.,, eg default='FIRST', $\endgroup$ – batFINGER Dec 25 '15 at 15:55options={'ENUM_FLAG'}
then non-exclusivity isn't even in the realm of possibilities for the enum. hence my thoughts about the title. $\endgroup$ – zeffii Dec 25 '15 at 20:50