Skip to content
Snippets Groups Projects
add_mesh_pipe_joint.py 34.6 KiB
Newer Older
  • Learn to ignore specific revisions
  •                 createFaces(loopsJoints[loopIdx],
    
    Martin Buerbaum's avatar
    Martin Buerbaum committed
                    loopsEndCircles[loopIdx], closed=True))
    
            base = create_mesh_object(context, verts, [], faces, "N Joint")
    
            return {'FINISHED'}
    
    class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu):
        # Define the "Pipe Joints" menu
        bl_idname = "INFO_MT_mesh_pipe_joints_add"
        bl_label = "Pipe Joints"
    
        def draw(self, context):
            layout = self.layout
            layout.operator_context = 'INVOKE_REGION_WIN'
            layout.operator("mesh.primitive_elbow_joint_add",
                text="Pipe Elbow")
            layout.operator("mesh.primitive_tee_joint_add",
                text="Pipe T-Joint")
            layout.operator("mesh.primitive_wye_joint_add",
                text="Pipe Y-Joint")
            layout.operator("mesh.primitive_cross_joint_add",
                text="Pipe Cross-Joint")
            layout.operator("mesh.primitive_n_joint_add",
    
    
    ################################
    
    
    # Define "Pipe Joints" menu
    
    def menu_func(self, context):
        self.layout.menu("INFO_MT_mesh_pipe_joints_add", icon="PLUGIN")
    
        # Add "Pipe Joints" menu to the "Add Mesh" menu
    
        bpy.types.INFO_MT_mesh_add.append(menu_func)
    
        # Remove "Pipe Joints" menu from the "Add Mesh" menu.
    
        bpy.types.INFO_MT_mesh_add.remove(menu_func)
    
    
    
    if __name__ == "__main__":
        register()