[Bf-blender-cvs] [eedde9db74b] asset-browser-snap-dragging: Adjustments to drag info drawing

Julian Eisel noreply at git.blender.org
Sun Jun 13 23:54:12 CEST 2021


Commit: eedde9db74bb41b8fbdc5fb91663d307ba55c43c
Author: Julian Eisel
Date:   Sun Jun 13 23:48:06 2021 +0200
Branches: asset-browser-snap-dragging
https://developer.blender.org/rBeedde9db74bb41b8fbdc5fb91663d307ba55c43c

Adjustments to drag info drawing

* Change the "Add Named Object" drag into string to "Add Object". The "Named"
  part is kinda useless info and relates to an implementation detail.
* Draw drag info closer to the cursor. Looked quite off before.

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

M	source/blender/editors/object/object_add.c
M	source/blender/windowmanager/intern/wm_dragdrop.c

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

diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index f7e3de27fdd..223706ec61f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -3574,7 +3574,7 @@ static int object_add_named_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_add_named(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Add Named Object";
+  ot->name = "Add Object";
   ot->description = "Add named object";
   ot->idname = "OBJECT_OT_add_named";
 
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index ba2f3d0b24e..bb63190758e 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -618,7 +618,8 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
     int padding = 4 * UI_DPI_FAC;
 
     /* image or icon */
-    int x, y;
+    int x = cursorx - 2 * padding;
+    int y = cursory - 2 * UI_DPI_FAC;
     if (drag->no_preview) {
       /* Pass. */
     }
@@ -648,9 +649,6 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
       }
     }
     else {
-      x = cursorx - 2 * padding;
-      y = cursory - 2 * UI_DPI_FAC;
-
       if (rect) {
         drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
       }
@@ -660,7 +658,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
     }
 
     /* item name */
-    if (drag->imb) {
+    if (!drag->no_preview && drag->imb) {
       x = cursorx - drag->sx / 2;
       y = cursory - drag->sy / 2 - iconsize;
     }



More information about the Bf-blender-cvs mailing list