2
$\begingroup$

I need to know how can we add in a custom option using python in the 'Make Links' menu which appears when Ctrl+L is pressed in the 3D view, as shown below:

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

It's bpy.types.VIEW3D_MT_make_links. For demonstration purposes I've added a 'Frame Rate' menu to 'Make Links' menu via append() method.

enter image description here
Frame Rate menu 'appended'

bl_info = {"name": "My Test Addon", "category": "Object"}

import bpy

class CustomFrameRateMenu(bpy.types.Menu):
    bl_label = "Frame Rate"
    bl_idname = "RENDER_MT_framerate_menu"

    def draw(self, context):
        scene = context.scene
        layout = self.layout

        #frame rate properties
        layout.prop(scene.render, "fps_base", text="FPS Base")
        layout.prop(scene.render, "fps", text="FPS")
        layout.menu("RENDER_MT_framerate_presets", text="Presets", icon="SCENE")

def draw_frame_rate_menu(self, context):
    layout = self.layout
    layout.menu(CustomFrameRateMenu.bl_idname)

def register():
    bpy.utils.register_module(__name__)

    # lets add the menu to Make Links menu
    bpy.types.VIEW3D_MT_make_links.append(draw_frame_rate_menu)

def unregister():
    bpy.utils.unregister_module(__name__)

    # remove custom menu from Make Links menu
    bpy.types.VIEW3D_MT_make_links.remove(draw_frame_rate_menu)

if __name__ == "__main__":
    register()

Further information you can find here: https://blender.stackexchange.com/a/34490/3710

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .