diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-22 18:18:42 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-22 18:18:42 +0300 |
commit | 650cdc6b2d91b12a80d7c8e680224c4713cfeb5e (patch) | |
tree | 0a568ce7f9f097ee2817e3d6c069f392e8366418 /release | |
parent | 0628fe7a6cf33bec370a4db53bb9d5980fa40162 (diff) |
Drag & Drop: Support Open/Link/Append when dropping .blend file
When a .blend file is dropped into Blender a small menu opens.
In that menu the user can choose between three options: Open, Link and Append.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3801
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 4e2cea5e4db..5ba430ab9f5 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -2677,6 +2677,30 @@ class WM_MT_splash(Menu): layout.separator() +class WM_OT_drop_blend_file(Operator): + bl_idname = "wm.drop_blend_file" + bl_label = "Handle dropped .blend file" + bl_options = {'INTERNAL'} + + filepath: StringProperty() + + def invoke(self, context, event): + context.window_manager.popup_menu(self.draw_menu, title=bpy.path.basename(self.filepath), icon='QUESTION') + return {"FINISHED"} + + def draw_menu(self, menu, context): + layout = menu.layout + + col = layout.column() + col.operator_context = 'EXEC_DEFAULT' + col.operator("wm.open_mainfile", text="Open", icon='FILE_FOLDER').filepath = self.filepath + + layout.separator() + col = layout.column() + col.operator_context = 'INVOKE_DEFAULT' + col.operator("wm.link", text="Link...", icon='LINK_BLEND').filepath = self.filepath + col.operator("wm.append", text="Append...", icon='APPEND_BLEND').filepath = self.filepath + classes = ( BRUSH_OT_active_index_set, WM_OT_addon_disable, @@ -2710,6 +2734,7 @@ classes = ( WM_OT_copy_prev_settings, WM_OT_doc_view, WM_OT_doc_view_manual, + WM_OT_drop_blend_file, WM_OT_keyconfig_activate, WM_OT_keyconfig_export, WM_OT_keyconfig_import, |