UNSOLVED Custom Drag and Drop to Viewport Functionality?


Is there a custom drag and drop to viewport functionality in redshift?

For example, by default, if you drag file named, "dragme.txt" to viewport. It will error out (i.e. unknown format).

I was wondering if there is a way to preprocess this. So if I drag a "dragme.txt" in the viewport, I want to create a primitive box, etc.

Is this possible?


Cinema 4D will try to open any file you drag and drop on its windows. It will call the function Identify of every plugin register with RegisterSceneLoaderPlugin. This function needs to return True if your plugin can open it. If true is return, Cinema 4D will call the function Load of the same plugin. You, of course, need to override both functions.
The Load function can be called within a thread, so get extra precautions to not call function that will trigger uncontrolled updates of the document.

Unfortunately, we don't have any example in our github repository for python, but we have one for c++

Be aware that the first plugin returning true in its Identify function will open the file, but no other scene loader will be called. The first one wins, short circuiting the others. Maybe using .txt files is not the best idea.