diff options
author | Julian Eisel <julian@blender.org> | 2022-05-24 18:00:59 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-05-24 18:08:02 +0300 |
commit | b0da080c2cb951c167c6154de75e154532ab0f0d (patch) | |
tree | 339546b0aeb952fc4f31a1eceb9149cdc82303ec /source/blender/editors/space_view3d/view3d_edit.c | |
parent | 7b778166db4048b5109146bc073ab85fa49261f4 (diff) |
Drag & drop: Use session UUID of IDs instead of name for dropping
Dropping would pass the name of the ID to drop to the properties of the
drop operator. This would then lookup the ID by name. With linking
and/or library overrides, multiple IDs of the same name and type may
exist, which is why the session UUID should be used instead. All
operators used for dropping support this now and the drop code passes
the session UUID instead of the name.
Also see 917c096be6b9 and 8f79fa9c6780.
Some drop operators were already using the session UUIDs. This converts
the remaining ones. The "name" property is kept working as before, since
some scripts use this.
Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, which was the case for some of these operators, 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/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e52ff062302..9f8d7afd9a8 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -608,7 +608,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign"); + WM_operator_properties_id_lookup(ot, true); WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, @@ -678,10 +678,8 @@ static int drop_world_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - char name[MAX_ID_NAME - 2]; - - RNA_string_get(op->ptr, "name", name); - World *world = (World *)BKE_libblock_find_name(bmain, ID_WO, name); + World *world = (World *)WM_operator_properties_id_lookup_from_name_or_session_uuid( + bmain, op->ptr, ID_WO); if (world == NULL) { return OPERATOR_CANCELLED; } @@ -718,7 +716,7 @@ void VIEW3D_OT_drop_world(wmOperatorType *ot) ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL; /* properties */ - RNA_def_string(ot->srna, "name", "World", MAX_ID_NAME - 2, "Name", "World to assign"); + WM_operator_properties_id_lookup(ot, true); } /** \} */ |