UNSOLVED DragDrop Model from UserArea into Viewport or Object Manager

I am trying to do what is described in this old thread.

https://plugincafe.maxon.net/topic/6844/7627_how-to-use-handlemousedrag?_=1664942133957

Basically I have a c4d file on disk that I have the Filename for, I then start a HandleMouseDrag from my GeUserArea and want to be able to drop it into the Viewport or Object Manager and have it load.

So far with my testing none of the following types work.

  • DRAGTYPE_FILES
  • DRAGTYPE_FILENAME_SCENE
  • DRAGTYPE_FILENAME_OTHER

So I have instead tried doing it via a different approach. I am loading the document, grabbing some models from the scene, adding them to an AtomArray and then doing a HandleMouseDrag using the type DRAGTYPE_ATOMARRAY. But this only seems to work when dropping into the Object Manager. If you drop it over the viewport then nothing happens.

Is there anyway to be able initiate a drag drop from a GeUserArea and have C4D merge the file that is dropped? Or is there a way to manually do it an have the Viewport accepted the dropped content? Needs to work in R20 to 2023.

Thanks!

Hi Kent, so far for the moment the viewport drop operation are more related to scene management rather than scene creation. By that I means except for an asset being loaded which create new elements (scene, object, material, etc...) other drag command are just here to act on the active object.

So regarding drag operation for file, only DRAGTYPE_FILENAME_IMAGE is allowed and an object should be selected, then a texture tag will be applied to this object and a new material with the texture will be automatically assigned. DRAGTYPE_FILENAME_SCENE is not supported.

For DRAGTYPE_ATOMARRAY it is only allowed for some particular categories, like layers to be applied on the active object or even materials for the same condition, so in any case the layer/material should already be part of the scene.

So for the moment the only workaround would be to create your own temporary asset and pass this asset to be inserted into the document. For more information about the asset API I let you read Asset API - Handbook but this is S26.0+ only.

Cheers,
Maxime.