Skip to content
Snippets Groups Projects
model_gui.py 38.9 KiB
Newer Older
  • Learn to ignore specific revisions
  •     bl_space_type = "VIEW_3D"
        bl_context_mode = "OBJECT"
    
    
        # 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"
    
        bl_icon = os.path.join(icon_path, "pov.add.blobcapsule")
        bl_widget = None
        bl_keymap = (
    
            ("pov.addblobcapsule", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
        )
    
        bl_space_type = "VIEW_3D"
        bl_context_mode = "OBJECT"
    
    
        # 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"
    
        bl_icon = os.path.join(icon_path, "pov.add.blobplane")
        bl_widget = None
        bl_keymap = (
    
            ("pov.addblobplane", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
        )
    
        bl_space_type = "VIEW_3D"
        bl_context_mode = "OBJECT"
    
    
        # 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"
    
        bl_icon = os.path.join(icon_path, "pov.add.blobellipsoid")
        bl_widget = None
        bl_keymap = (
    
            ("pov.addblobellipsoid", {"type": "LEFTMOUSE", "value": "PRESS"}, {"properties": None}),
        )
    
        bl_space_type = "VIEW_3D"
        bl_context_mode = "OBJECT"
    
    
        # 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"
    
        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's avatar
    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's avatar
    Maurice Raybaud committed
        OBJECT_PT_POV_obj_parametric,
        OBJECT_PT_povray_replacement_text,
        VIEW_MT_POV_primitives_add,
        VIEW_MT_POV_Basic_Shapes,
    )
    
    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,
    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    def register():
        for cls in classes:
            register_class(cls)
    
    
        # 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
            )
    
        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
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        # 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)
    
    
        for wtl in reversed(tool_classes):
            unregister_tool(wtl)
    
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        for cls in reversed(classes):
            unregister_class(cls)