On 06/03/2014 at 07:45, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R14 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi there!
I just tested the following code from within a custom dialog:

Bool ImageArea::InputEvent(const BaseContainer& msg)   
      AutoAlloc<AtomArray> arr;   
      HandleMouseDrag(msg, DRAGTYPE_ATOMARRAY, arr, 0);   
      return TRUE;   
return FALSE;   

This works as exspected if I drop into the object manager (creates new object) or content browser (new preset). But if I drop into the viewport, nothing happens. Any idea whats going wronge here?

On 08/01/2015 at 03:12, xxxxxxxx wrote:

I'm still wondering if there is a reliable way to drop an object from my dialog into the viewport.. When using GeUserArea::HandleMouseDrag() a drop into the viewport gets accepted but nothing happens when performed. If I drop into the object manager the objects gets created properly.

As a workaround I currently traverse through all editor windows and check if the mouse is over it by using BaseView::TestPoint(). This works quite good, but causes problems for overlapping views (can't check z-order of windows in a a reliable way). Another problem is that, I can't support a drop into the attribute manager like this.

Basically what I want to achieve is the same behavior as the Content Browser, with the addition that the dropped object gets placed at the drop position.

Any ideas someone?

On 09/01/2015 at 07:54, xxxxxxxx wrote:

Hello Satara,

at first I'd like to say sorry, your post remained unanswered for such a long time.
And I'm even more sorry, that I probably won't provide the answer you'd like to get.

From your other posts I know, that you are already quite familiar with drag'n'drop.
So you will probably already know, that it's not the one, who's starting the drag'n'drop, who decides on what to do with the dragged item, but rather the receiver. In your case the viewport.

And although it may seem as if the it is possible to drag object from the content browser into the viewport, in order to add them to the active scene, it actually works a bit different. In reality the content browser passes a info structure similar to the SDKBrowserDragInfo structure, which contains only a URL of the scene, which then gets merged into the active scene via LoadDocument() by the viewport.

So I thought, you may be able to imitate this behavior to reach your desired result by creating a temporary scene with the object positioned as desired and then starting a DRAGTYPE_BROWSER with this scene. But unfortunately you can't, as you don't have the means to instantiate a correctly filled drag info structure. SDKBrowserDragInfo only serves for receiving drags from the browser (as shown in the asynctest.cpp SDK example) and can't be used for your purposes.

To make a long story short, I don't think, it is possible to achieve, what you are asking for. :cry:

On 13/01/2015 at 01:13, xxxxxxxx wrote:

Thanks for your detailed explanation, Andreas. I was already expecting something like this but it's better to have it black on white.
Do you see any possibility to add drag and drop support for the object manager if I keep my viewport functionality as described in my previous post?
I can't use GeUserArea::HandleMouseDrag() directly because I wouldn't be able to perform the viewport check at the same time since it blocks everything else..

On 13/01/2015 at 08:56, xxxxxxxx wrote:

Unfortunately I have no idea. Seems a bit "hacky" already.
I also discussed this with the rest of the team. No result there either. Sorry.

I'd regard this as closed (and mark it respectively). If you want, I can leave it open for some more time, so nobody with an creative idea turns away just because it says [CLOSED] in the topic heading...

On 13/01/2015 at 09:17, xxxxxxxx wrote:

my only idea is do it on 2 steps, content browser is doing a "merge" to the other file as it is, after merging do another step of taking the mouse drop position, convert it to 3d space, offset the merged objects to this 3d position