Fix: Zeroed transform with asset object drag & drop

In future files from 4.2, `object_to_world` is moved to a runtime struct
and therefore isn't saved in files. It was always considered runtime information
though, since it's built by depsgraph evaluation and copied back to the original
object. Therefore to have the proper data in `object_to_world` we need to
evaluate the depsgraph.

This partially solves #118694, but there is still an issue with the snap cursor
system never running before using the `plane_omat` value.
This commit is contained in:
Hans Goudey
2024-03-06 12:23:50 -05:00
parent d08f63e7cb
commit d196046a3a

View File

@@ -808,6 +808,11 @@ static void view3d_ob_drop_copy_external_asset(bContext *C, wmDrag *drag, wmDrop
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_object_tag(C);
/* Make sure the depsgraph is evaluated so the new object's transforms are up-to-date.
* The evaluated #Object::object_to_world() will be copied back to the original object
* and used below. */
CTX_data_ensure_evaluated_depsgraph(C);
V3DSnapCursorState *snap_state = static_cast<V3DSnapCursorState *>(drop->draw_data);
if (snap_state) {
float obmat_final[4][4];