[Bf-blender-cvs] [4f1926fba81] asset-engine: Assets/lib drag'n'drop: append by default, link when shift is held.
Bastien Montagne
noreply at git.blender.org
Tue Dec 5 22:40:53 CET 2017
Commit: 4f1926fba81e55e3ddb81f80409aee2bd1351a81
Author: Bastien Montagne
Date: Tue Dec 5 20:45:18 2017 +0100
Branches: asset-engine
https://developer.blender.org/rB4f1926fba81e55e3ddb81f80409aee2bd1351a81
Assets/lib drag'n'drop: append by default, link when shift is held.
===================================================================
M source/blender/editors/space_view3d/space_view3d.c
===================================================================
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index ee8816742de..e682745dcba 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -586,9 +586,9 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
}
}
-static int view3d_path_link_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static int view3d_path_link_append_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const bool is_link)
{
- if (event->shift == false) {
+ if ((!event->shift && !is_link) || (event->shift && is_link)) {
if (drag->type == WM_DRAG_LIBRARY) {
uiDragLibraryHandle *drag_data = drag->poin;
char libname[FILE_MAX];
@@ -610,6 +610,16 @@ static int view3d_path_link_drop_poll(bContext *C, wmDrag *drag, const wmEvent *
return 0;
}
+static int view3d_path_link_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+{
+ return view3d_path_link_append_drop_poll(C, drag, event, true);
+}
+
+static int view3d_path_append_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+{
+ return view3d_path_link_append_drop_poll(C, drag, event, false);
+}
+
static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
@@ -745,6 +755,7 @@ static void view3d_dropboxes(void)
ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
WM_dropbox_add(lb, "WM_OT_link", view3d_path_link_drop_poll, view3d_path_link_drop_copy);
+ WM_dropbox_add(lb, "WM_OT_append", view3d_path_append_drop_poll, view3d_path_link_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_add_named", view3d_ob_drop_poll, view3d_ob_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy);
WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_mesh_drop_poll, view3d_id_path_drop_copy);
More information about the Bf-blender-cvs
mailing list