diff options
author | Julian Eisel <julian@blender.org> | 2022-05-23 21:54:15 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-05-23 22:00:01 +0300 |
commit | 8f79fa9c6780dd5526dccce039c49bc7f69f47df (patch) | |
tree | 25c22e1473eb5967cf07058d22a5f49947894cf8 /source/blender/editors | |
parent | 0d6dda4555bcae82cf581bdb23d639e9733057b5 (diff) |
Fix further issues when mixing link & append for asset drag & drop
917c096be6b9 applied to objects only, this also applies the same fix for
the general 3D View drop operations, e.g. used for dragging materials,
images, worlds, etc.
This is needed to fix T95706, but apparently something else is still
going on. Needs further investigation.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 76dcfbd8d36..0a85a60eda8 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2629,11 +2629,9 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent Object *ob = ED_view3d_give_material_slot_under_cursor(C, event->mval, &mat_slot); mat_slot = max_ii(mat_slot, 1); - Material *ma; - char name[MAX_ID_NAME - 2]; + Material *ma = (Material *)WM_operator_properties_id_lookup_from_name_or_session_uuid( + bmain, op, ID_MA); - RNA_string_get(op->ptr, "name", name); - ma = (Material *)BKE_libblock_find_name(bmain, ID_MA, name); if (ob == NULL || ma == NULL) { return OPERATOR_CANCELLED; } @@ -2663,7 +2661,7 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot) ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL; /* properties */ - RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign"); + WM_operator_properties_id_lookup(ot, true); } /** \} */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 5ddfc4fe3cc..e7732f07ed9 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -823,15 +823,15 @@ static void view3d_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *dr { ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); - RNA_string_set(drop->ptr, "name", id->name + 2); + WM_operator_properties_id_lookup_set_from_id(drop->ptr, id); } static void view3d_id_drop_copy_with_type(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop) { ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); - RNA_string_set(drop->ptr, "name", id->name + 2); RNA_enum_set(drop->ptr, "type", GS(id->name)); + WM_operator_properties_id_lookup_set_from_id(drop->ptr, id); } static void view3d_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop) @@ -839,7 +839,7 @@ static void view3d_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBo ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); if (id) { - RNA_string_set(drop->ptr, "name", id->name + 2); + WM_operator_properties_id_lookup_set_from_id(drop->ptr, id); RNA_struct_property_unset(drop->ptr, "filepath"); } else if (drag->path[0]) { |