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-07-20 22:26:55 +0300
committerJulian Eisel <julian@blender.org>2021-07-20 22:30:04 +0300
commitcb0b017d8f5178b58a59c66e9588199f2864608b (patch)
tree964a1532fc149534b3a4b6d34323f70bb51cc60e /source/blender/editors/interface/interface.c
parent0af08cea40964b69a48a2be773aeb22304d2b46f (diff)
Cleanup: Store asset-handle in drag data
Would previously pass a few properties that are available via the asset-handle now. This asset-handle is also required for some of the asset API, e.g. the temporary ID loading. This will probably be needed before too long.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ddde4f5a9dc..72e379e9b0a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6176,10 +6176,12 @@ void UI_but_drag_set_id(uiBut *but, ID *id)
but->dragpoin = (void *)id;
}
+/**
+ * \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,
- const char *name,
+ const AssetHandle *asset,
const char *path,
- int id_type,
int import_type,
int icon,
struct ImBuf *imb,
@@ -6187,9 +6189,10 @@ void UI_but_drag_set_asset(uiBut *but,
{
wmDragAsset *asset_drag = MEM_mallocN(sizeof(*asset_drag), "wmDragAsset");
- BLI_strncpy(asset_drag->name, name, sizeof(asset_drag->name));
+ asset_drag->asset_handle = MEM_mallocN(sizeof(asset_drag->asset_handle),
+ "wmDragAsset asset handle");
+ *asset_drag->asset_handle = *asset;
asset_drag->path = path;
- asset_drag->id_type = id_type;
asset_drag->import_type = import_type;
but->dragtype = WM_DRAG_ASSET;