I was trying to recall the discussions we had in the past about this, but I
couldn't find anything. I don't remember what the result of my own
experience with this was either. Does it really not register anything in
the target widget, when you implement the dragEnterEvent() in the tree
view? You are right that it would not be handled on the Maya Outliner side
of things. A drag and drop operation kind of goes though this generic
process where arbitrary mime data is delivered to the target. The target
has to decide whether it can handle it.

But if I remember correctly, the data that is provided by dragging Maya's
own tree view items is an internal and undocumented format. It was never
useful to determine any information about it. So you would have to just
identify that it is a Maya drag in general and then follow Marcus's
suggestion of looking at the current selection.



On Wed, Jul 20, 2016 at 7:13 AM Marcus Ottosson <[email protected]>
wrote:

> 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
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC756cp4c0Jg1uw2vyV1%2Bk-d7jTyxghtaaaEOtBJSg3%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA2bf4t2A5%2BvRdnxTNDFzx07gwZD565DQuk4mVaAY%2BwoNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to