Page MenuHome

Outliner: allow DragDrop for constraints/modifiers/vertexgroups (plus dropping them to console/texteditor)
AbandonedPublic

Authored by Philipp Oeser (lichtwerk) on Jan 15 2015, 10:26 PM.

Details

Summary

This patch will allow drag n drop for constraints/modifiers/vertexgroups in the outliner and make them first class citizens in dragndrop.
First usecase: you can drag those three types to the console/texteditor to get their full python path and drag them to other buttons to paste their names.
This is also a prepearation for other drag n drop stuff regarding constraints/modifiers/vertexgroups in the future
(this is part of more work on the outliner, I've split this up in smaller pieces for review now...)

Let me know what you think...

Diff Detail

Event Timeline

Philipp Oeser (lichtwerk) retitled this revision from to Outliner: allow DragDrop for constraints/modifiers/vertexgroups (plus dropping them to console/texteditor).
Philipp Oeser (lichtwerk) updated this object.
Campbell Barton (campbellbarton) requested changes to this revision.Jan 21 2015, 2:47 PM

Generally looks fine, some callbacks look like they could be de-duplicated.

source/blender/editors/space_console/space_console.c
211

Looks like these can use a generic callback.

source/blender/editors/space_text/space_text.c
499

and again - Looks like these can use a generic callback.

This revision now requires changes to proceed.Jan 21 2015, 2:47 PM
Philipp Oeser (lichtwerk) edited edge metadata.

hopefully adressed issues raised in first review by @Campbell Barton (campbellbarton) (thanx for having a look!)

Campbell Barton (campbellbarton) requested changes to this revision.Jan 28 2015, 5:50 PM
Campbell Barton (campbellbarton) edited edge metadata.

Only minor change requested.

source/blender/editors/interface/interface.c
4019

WM_DRAG_*** isn't private, so would prefer just to have UI_but_drag_set(uiBut *but, PointerRNA *ptr, int dragtype) which takes the WM_DRAG_*** argument too. Then it can be used anywhere.

This revision now requires changes to proceed.Jan 28 2015, 5:50 PM
Sergey Sharybin (sergey) requested changes to this revision.Jan 28 2015, 5:50 PM
Sergey Sharybin (sergey) added inline comments.
source/blender/editors/interface/interface.c
4019

Would suggest something like

void UI_but_drag_set_rna_type(uiBut *but, int type, PointerRNA *ptr)
{
  but->dragtype = type;
  but->dragpoin = (void *)ptr;
}
source/blender/editors/interface/interface_handlers.c
1741

If the suggestion above is followed this seems to be really couple of lines only?

source/blender/editors/space_outliner/outliner_draw.c
877–886

Same as above.

Philipp Oeser (lichtwerk) updated this revision to Diff 3303.EditedJan 29 2015, 3:59 PM
Philipp Oeser (lichtwerk) edited edge metadata.

hopefully adressed issues raised in review by @Campbell Barton (campbellbarton) and @Sergey Sharybin (sergey) (thanx for having a look!)

  • also removed unneeded includes
  • used RNA to best (uneducated) knowledge to avoid explicit casts
  • not sure I got a memleak now, though? (see code comment)...
Campbell Barton (campbellbarton) requested changes to this revision.Feb 2 2015, 11:07 AM
Campbell Barton (campbellbarton) edited edge metadata.
Campbell Barton (campbellbarton) added inline comments.
source/blender/editors/interface/interface_handlers.c
1744

I dont see why this would leak memory, can the comment be removed?

source/blender/makesrna/intern/rna_object.c
1467

It works with Python, but not RNA path resolution.

This should use " quotes, nowhere else uses single quotes in RNA.

source/blender/windowmanager/intern/wm_dragdrop.c
284

This shouldn't be some unknown question, run blender with --debug and it will print unfreed blocks.

This revision now requires changes to proceed.Feb 2 2015, 11:07 AM
Philipp Oeser (lichtwerk) edited edge metadata.

fixed the issues mentined by @Campbell Barton (campbellbarton) (thanx again for continuous feedback!)...
...except for the memleak (its cause is actually elsewhere -- see inline comment)

source/blender/editors/space_outliner/outliner_draw.c
931

this seems to be one of the causes for the memleak (still looking for the right place to free mem again, tried stuff with WM_DRAG_FREE_DATA, but that seems to free too early...)

937

other cause for memleak

957

other cause for memleak

Campbell Barton (campbellbarton) requested changes to this revision.Feb 4 2015, 6:24 PM
Campbell Barton (campbellbarton) edited edge metadata.

marking as requesting changes, until memory leaks are resolved.

We could have an arg ..., bool *r_is_alloc) for eg, so the caller knows to free. But would reather avoid this if possible.

This revision now requires changes to proceed.Feb 4 2015, 6:24 PM

Cant find a good solution for the memleak atm..., abondoning for now...