I once had a go with this, but came up empty. I ended up with something similar to what you suggest, but rather than making it a button I simply ran cmds.ls(selection=True) in the dropEvent and required users to first select the items they are about to drag. Not ideal, but was simple enough and works fine.
On 19 July 2016 at 19:49, Peter Makal <[email protected]> wrote: > Hey guys! > > I'm writing a plugin in which I really like to have a drag and drop > feature: copy selected objects from Maya Outliner into my own *QTreeView*. > I started with obvious: setDragEnabled(True), setAcceptDrops(True) and > setDropIndicatorShown(True) functions for my view. Didn't work. I > overwrote canDropMimeData and dropMimeData functions for my model with > simple print instructions just to see if they will fire... Nope. So after > some googling I came across *MExternalDropCallback *class in Maya API but > it seems to work only the other way around - drag and drop from custom > widget into Maya UI. > > Is there any way to do this? In the end I can add a button saying > something like: "Add selected objects" and just add them by using > *MSelectionList > *and not drag and drop behaviour but it seems less UI/UX friendly. > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/1b11ce11-e1cc-4e84-98a0-d2d240fd5965%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/1b11ce11-e1cc-4e84-98a0-d2d240fd5965%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC756cp4c0Jg1uw2vyV1%2Bk-d7jTyxghtaaaEOtBJSg3%3Dw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
