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:
1 Answer
$\begingroup$
$\endgroup$
0
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.
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