From 463077a3d59df3de8a8fdc218c06c38116829f3e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 24 May 2022 14:22:59 +0200 Subject: Fix possible lingering around of ID after asset dropping failed More and more of the drop operations are being switched to use the ID's session UUID rather than the name, but the cleanup after a drop operator was cancelled assumed they would set the name. They will now first attempt to use the session UUID and fallback to the name if needed. --- source/blender/editors/object/object_add.cc | 6 +++--- source/blender/editors/object/object_relations.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 0fc504f7de5..20b9844ac89 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -1653,7 +1653,7 @@ static std::optional collection_add_info_get_from_op(bContext PropertyRNA *prop_location = RNA_struct_find_property(op->ptr, "location"); add_info.collection = reinterpret_cast( - WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op, ID_GR)); + WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_GR)); bool update_location_if_necessary = false; if (add_info.collection) { @@ -3717,7 +3717,7 @@ static int object_add_named_exec(bContext *C, wmOperator *op) /* Find object, create fake base. */ Object *ob = reinterpret_cast( - WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op, ID_OB)); + WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_OB)); if (ob == nullptr) { BKE_report(op->reports, RPT_ERROR, "Object not found"); @@ -3829,7 +3829,7 @@ static int object_transform_to_mouse_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = reinterpret_cast( - WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op, ID_OB)); + WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_OB)); if (!ob) { ob = OBACT(view_layer); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 0a85a60eda8..6b1eb84341f 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2630,7 +2630,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent mat_slot = max_ii(mat_slot, 1); Material *ma = (Material *)WM_operator_properties_id_lookup_from_name_or_session_uuid( - bmain, op, ID_MA); + bmain, op->ptr, ID_MA); if (ob == NULL || ma == NULL) { return OPERATOR_CANCELLED; -- cgit v1.2.3