Newer
Older
bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT"
Maurice Raybaud
committed
# The prefix of the idname should be your add-on name.
bl_idname = "pov.addblobcapsule"
bl_label = "Add POV blob capsule"
bl_description = "add a POV capsule shaped blob primitive"
Maurice Raybaud
committed
bl_icon = os.path.join(icon_path, "pov.add.blobcapsule")
bl_widget = None
bl_keymap = (
("pov.addblobcapsule", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
)
Maurice Raybaud
committed
class VIEW_WT_POV_blobplane_add(WorkSpaceTool):
bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT"
Maurice Raybaud
committed
# The prefix of the idname should be your add-on name.
bl_idname = "pov.addblobplane"
bl_label = "Add POV blob plane"
bl_description = "add a POV plane shaped blob primitive"
Maurice Raybaud
committed
bl_icon = os.path.join(icon_path, "pov.add.blobplane")
bl_widget = None
bl_keymap = (
("pov.addblobplane", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
)
Maurice Raybaud
committed
class VIEW_WT_POV_blobellipsoid_add(WorkSpaceTool):
bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT"
Maurice Raybaud
committed
# The prefix of the idname should be your add-on name.
bl_idname = "pov.addblobellipsoid"
bl_label = "Add POV blob ellipsoid"
bl_description = "add a POV ellipsoid shaped blob primitive"
Maurice Raybaud
committed
bl_icon = os.path.join(icon_path, "pov.add.blobellipsoid")
bl_widget = None
bl_keymap = (
("pov.addblobellipsoid", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
)
Maurice Raybaud
committed
class VIEW_WT_POV_blobcube_add(WorkSpaceTool):
bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT"
Maurice Raybaud
committed
# The prefix of the idname should be your add-on name.
bl_idname = "pov.addsblobcube"
bl_label = "Add POV blob cube"
bl_description = "add a POV cube shaped blob primitive"
Maurice Raybaud
committed
bl_icon = os.path.join(icon_path, "pov.add.blobcube")
bl_widget = None
bl_keymap = (
("pov.addblobcube", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
)
Maurice Raybaud
committed
classes = (
# ObjectButtonsPanel,
# PovDataButtonsPanel,
DATA_PT_POV_normals,
DATA_PT_POV_texture_space,
DATA_PT_POV_vertex_groups,
DATA_PT_POV_shape_keys,
DATA_PT_POV_uv_texture,
DATA_PT_POV_vertex_colors,
DATA_PT_POV_customdata,
MODIFIERS_PT_POV_modifiers,
OBJECT_PT_POV_obj_parameters,
OBJECT_PT_POV_obj_sphere,
OBJECT_PT_POV_obj_cylinder,
OBJECT_PT_POV_obj_cone,
OBJECT_PT_POV_obj_superellipsoid,
OBJECT_PT_POV_obj_torus,
OBJECT_PT_POV_obj_supertorus,
Maurice Raybaud
committed
OBJECT_PT_POV_obj_isosurface,
OBJECT_PT_POV_obj_parametric,
OBJECT_PT_povray_replacement_text,
VIEW_MT_POV_primitives_add,
VIEW_MT_POV_Basic_Shapes,
)
Maurice Raybaud
committed
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
tool_classes = (
VIEW_WT_POV_plane_add,
VIEW_WT_POV_box_add,
VIEW_WT_POV_sphere_add,
VIEW_WT_POV_cylinder_add,
VIEW_WT_POV_cone_add,
VIEW_WT_POV_torus_add,
VIEW_WT_POV_prism_add,
VIEW_WT_POV_lathe_add,
VIEW_WT_POV_spheresweep_add,
VIEW_WT_POV_heightfield_add,
VIEW_WT_POV_superellipsoid_add,
VIEW_WT_POV_rainbow_add,
VIEW_WT_POV_loft_add,
VIEW_WT_POV_polytocircle_add,
VIEW_WT_POV_parametric_add,
VIEW_WT_POV_isosurface_add,
VIEW_WT_POV_isosurfacebox_add,
VIEW_WT_POV_isosurfacesphere_add,
VIEW_WT_POV_isosurfacesupertorus_add,
VIEW_WT_POV_blobsphere_add,
VIEW_WT_POV_blobcapsule_add,
VIEW_WT_POV_blobplane_add,
VIEW_WT_POV_blobellipsoid_add,
VIEW_WT_POV_blobcube_add,
)
def register():
for cls in classes:
register_class(cls)
Maurice Raybaud
committed
# Register tools
last_tool = {"builtin.measure"}
for index, wtl in enumerate(tool_classes):
# Only separate first and 12th tools and hide subtools only in 8th (isosurfaces)
register_tool(
wtl, after=last_tool, separator=index in {0, 7, 11, 12, 14, 19}, group=index == 15
)
Maurice Raybaud
committed
last_tool = {wtl.bl_idname}
Maurice Raybaud
committed
bpy.types.VIEW3D_MT_add.prepend(menu_func_add)
# Below was used for parametric objects but made the other addon unreachable on
# unregister for other tools to use. Created a user action call instead
# addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True)
def unregister():
# addon_utils.disable("add_mesh_extra_objects", default_set=False)
bpy.types.VIEW3D_MT_add.remove(menu_func_add)
Maurice Raybaud
committed
for wtl in reversed(tool_classes):
unregister_tool(wtl)
for cls in reversed(classes):
unregister_class(cls)