# for http://blender.stackexchange.com/questions/58171/how-to-create-a-boolean-vector-property-that-is-single-selection
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "",
"version": (0, 0, 1),
"blender": (2, 70, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
"wiki_url": "",
"tracker_url": "",
"category": "Development"
}
import bpy
# ------------------------------------------------------------------------
# store properties in the active scene
# ------------------------------------------------------------------------
class MySettings(bpy.types.PropertyGroup):
my_bool = bpy.props.BoolProperty(
name="Enable or Disable",
description="A bool property",
default = False
)
my_axis = bpy.props.EnumProperty(
name="Axis",
description="Description",
items = (('POS_X', "X", ""),
('POS_Y', "Y", ""),
('POS_Z', "Z", ""),
),
default='POS_X'
)
# ------------------------------------------------------------------------
# my tool in objectmode
# ------------------------------------------------------------------------
class OBJECT_PT_my_panel(bpy.types.Panel):
bl_idname = "OBJECT_PT_my_panel"
bl_label = "My Panel"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Tools"
bl_context = "objectmode"
@classmethod
def poll(self,context):
return context.object is not None
def draw(self, context):
layout = self.layout
scene = context.scene
mytool = scene.my_tool
layout.prop(mytool, "my_bool")
layout.row().prop(mytool, "my_axis", expand=True)
# ------------------------------------------------------------------------
# register and unregister
# ------------------------------------------------------------------------
def register():
bpy.utils.register_module(__name__)
bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=MySettings)
def unregister():
bpy.utils.unregister_module(__name__)
del bpy.types.Scene.my_tool
if __name__ == "__main__":
register()