Page MenuHome

Drag Drop: allow customizable drawing
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Oct 20 2021, 10:52 PM.

Details

Summary

No functional changes.

As indicated in D12912, it is important to change the drawing that follows
the cursor during dragging.

The solution in that patch was to create the parameter drag->no_preview
which is set in the pool function and when true ignores part of the
drawing.

But that abuses the pool function and is not enough to setup the final
drawing.

This patch proposes to create 3 callbacks for wmDropBox:

void (*draw)(struct bContext *C, struct wmWindow *win, struct wmDrag *drag, const int xy[2]);
void (*draw_activate)(struct wmDrag *drag);
void (*draw_deactivate)(struct wmDrag *drag);
  • draw: overwrites the default drawing
  • draw_activate: called when a drag item activates the dropbox the first time
  • draw_deactivate: called when the dropbox of a drag item changes or when the drag item is freed.

Diff Detail

Repository
rB Blender

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Oct 20 2021, 10:52 PM
Germano Cavalcante (mano-wii) created this revision.
Germano Cavalcante (mano-wii) retitled this revision from Cleanup: remove unused parameter to Drag Drop: allow customizable drawing.Oct 20 2021, 10:54 PM
Germano Cavalcante (mano-wii) edited the summary of this revision. (Show Details)

I didn't check all details, but seems fine generally. Note that you will get some merge conflicts when updating this to master since I removed some arguments in AbstractTreeViewItem::drop_tooltip() and related functions. Should be easy to resolve though.

This revision is now accepted and ready to land.Oct 25 2021, 11:34 AM
  • Updates based on chages in D12912
  • Updated with the changes proposed in D12912