Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-11-18 13:23:15 +0300
committerJulian Eisel <julian@blender.org>2021-11-18 13:47:21 +0300
commite5774282b94772af8822f4e3ab8b24207a450fb8 (patch)
treede686b5cdabb16597a7d4d06c22e16f80169cd8b /source/blender/editors/interface/interface.c
parent8c0370ef7b8d2854ca6eac8f57c626bb3c4b2f2b (diff)
Fix asset preview not showing up for current file data-blocks
For data-blocks from the current file, the image-buffer for dragging wasn't set at all. This wasn't intentional, dragging things in the Asset Browser should just always show the preview.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 9f9324505ad..6ad0ef9de18 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6239,6 +6239,16 @@ void UI_but_drag_set_id(uiBut *but, ID *id)
}
/**
+ * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`).
+ * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image.
+ */
+void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale)
+{
+ but->imb = imb;
+ but->imb_scale = scale;
+}
+
+/**
* \param asset: May be passed from a temporary variable, drag data only stores a copy of this.
*/
void UI_but_drag_set_asset(uiBut *but,
@@ -6266,8 +6276,7 @@ void UI_but_drag_set_asset(uiBut *but,
}
but->dragpoin = asset_drag;
but->dragflag |= UI_BUT_DRAGPOIN_FREE;
- but->imb = imb;
- but->imb_scale = scale;
+ UI_but_drag_attach_image(but, imb, scale);
}
void UI_but_drag_set_rna(uiBut *but, PointerRNA *ptr)
@@ -6322,8 +6331,7 @@ void UI_but_drag_set_image(
if (use_free) {
but->dragflag |= UI_BUT_DRAGPOIN_FREE;
}
- but->imb = imb;
- but->imb_scale = scale;
+ UI_but_drag_attach_image(but, imb, scale);
}
PointerRNA *UI_but_operator_ptr_get(uiBut *but)