Page MenuHome

Drag & Drop: Use session id instead of name to identify dropped object.
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Apr 29 2021, 2:49 PM.

Details

Summary

Using the name of ids did not work when there were multiple ids with the same name (which can happen when ids are linked in). This patch updates some drag and drop operators to use session uuids instead which are different even when two ids have the same name.

This fixes T87912.

There are a few more cases where the same fix could be applied, but I didn't want to make this patch unnecessarily large for now. Other cases can also just be fixed separately.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Apr 29 2021, 2:49 PM
Jacques Lucke (JacquesLucke) created this revision.

This change seems quite sensible. I'm not sure how this was ever meant to work for IDs with the same name.

The only downside is that now there are two ways to specify which data-block the operator should use. They might even potentially disagree with each other if they're both set, that's an edge case though I guess.

Short of changing the design for the drag and drop system (Make the drag data part of the context maybe?), I think this is the best way forward.

This revision is now accepted and ready to land.May 3 2021, 4:45 PM

Good to have this addressed. But guess Bastien should confirm?

Checking over this patch again, the title says it's for dropped object, but I realized dragging object is exactly one of the cases it doesn't cover :) Better clarify that.

There are many ways to drop an object, which do you mean? It does handle dropping the object in the node editor.

Well, dropping the object into the 3D View I mean.

This revision now requires review to proceed.Nov 3 2021, 5:52 PM
  • Merge branch 'blender-v3.0-release' into fix-dropping-id-with-duplicate-name
  • Merge branch 'blender-v3.0-release' into fix-dropping-id-with-duplicate-name
  • cleanup

LGTM, besides detail noted below.

source/blender/editors/object/object_add.c
1766–1774

Would rather have that before the call to object_add_drop_xy_props

This revision is now accepted and ready to land.Nov 19 2021, 11:32 AM