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>2022-05-24 17:47:48 +0300
committerJulian Eisel <julian@blender.org>2022-05-24 18:08:02 +0300
commit7b778166db4048b5109146bc073ab85fa49261f4 (patch)
tree8d95e63e4c3fd655ccc322c1fd8cda49b79465ce /source/blender/editors/interface/interface_ops.c
parent25d216724bc195d25aaaf336ab1cd3e7c55d78bf (diff)
Cleanup: Use new helpers for passing IDs from drag & drop to operators
There are now some generalized helpers for passing IDs from drag & drop to operators via operator properties, mostly introduced in 917c096be6b9 and 8f79fa9c6780. These can be used in a bunch of places to reduce duplicated code and explicitly share a common solution. Side-effect: The "Name" property won't show up in the Adjust Last Operation anymore, and its value won't be remembered over multiple executions of the operator. Both were not at all useful from what I can tell, and I doubt this was done intentionally.
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r--source/blender/editors/interface/interface_ops.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index f14c6ad9924..c066ced21cb 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -2142,11 +2142,8 @@ static int ui_drop_material_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- if (!RNA_struct_property_is_set(op->ptr, "session_uuid")) {
- return OPERATOR_CANCELLED;
- }
- const uint32_t session_uuid = (uint32_t)RNA_int_get(op->ptr, "session_uuid");
- Material *ma = (Material *)BKE_libblock_find_session_uuid(bmain, ID_MA, session_uuid);
+ Material *ma = (Material *)WM_operator_properties_id_lookup_from_name_or_session_uuid(
+ bmain, op->ptr, ID_MA);
if (ma == NULL) {
return OPERATOR_CANCELLED;
}
@@ -2184,16 +2181,7 @@ static void UI_OT_drop_material(wmOperatorType *ot)
ot->exec = ui_drop_material_exec;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- PropertyRNA *prop = RNA_def_int(ot->srna,
- "session_uuid",
- 0,
- INT32_MIN,
- INT32_MAX,
- "Session UUID",
- "Session UUID of the data-block to assign",
- INT32_MIN,
- INT32_MAX);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
+ WM_operator_properties_id_lookup(ot, false);
}
/** \} */