[Bf-blender-cvs] [2cdfb4b9f68] asset-greasepencil: GPencil: Fix problems after merge

Antonio Vazquez noreply at git.blender.org
Tue Aug 3 11:12:48 CEST 2021


Commit: 2cdfb4b9f68dd5d5010dcdd15a595ce2f99bb5da
Author: Antonio Vazquez
Date:   Tue Aug 3 11:12:36 2021 +0200
Branches: asset-greasepencil
https://developer.blender.org/rB2cdfb4b9f68dd5d5010dcdd15a595ce2f99bb5da

GPencil: Fix problems after merge

The operator was not executed because the general poll for data import was true and always was executed instead of GPencil import operator.

===================================================================

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 889d338e4f0..6f4c81f861e 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -531,12 +531,17 @@ static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event
 static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
 {
   ID_Type id_type = view3d_drop_id_in_main_region_poll_get_id_type(C, drag, event);
-  if (id_type && OB_DATA_SUPPORT_ID(id_type)) {
+  if (id_type && OB_DATA_SUPPORT_ID(id_type) && (id_type != ID_GD)) {
     return true;
   }
   return false;
 }
 
+static bool view3d_gpencil_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+{
+  return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GD);
+}
+
 static char *view3d_object_data_drop_tooltip(bContext *UNUSED(C),
                                              wmDrag *UNUSED(drag),
                                              const wmEvent *UNUSED(event))
@@ -720,10 +725,11 @@ static void view3d_dropboxes(void)
                  view3d_id_drop_copy_with_type,
                  WM_drag_free_imported_drag_ID,
                  view3d_object_data_drop_tooltip);
+
+  /* TODO(@antoniov): Change to use a temp copy using BLO_library_temp_load_id (). */
   WM_dropbox_add(lb,
                  "GPENCIL_OT_asset_import",
-                 view3d_gpencil_data_drop_poll,
-                 // TODO: Change to use a temp copy using BLO_library_temp_load_id ()
+                 view3d_gpencil_drop_poll,
                  view3d_id_drop_copy_with_type,
                  WM_drag_free_imported_drag_ID,
                  view3d_object_data_drop_tooltip);



More information about the Bf-blender-cvs mailing list