Prevent Projects from opening if dragged.



  • Hey there,

    I'm currently working on a treeview where I want to act on c4d files that are dragged into the treeview.

    Everything works expected using AcceptDragObject but I'm not quite sure I can stop C4D from opening the c4d file itself. I can of course close the document right away, but with bigger files the loading process can take a while and I just want to have the path to that file essentially.

        def AcceptDragObject(self, root, userdata, obj, dragtype, dragobject):
            if dragtype == c4d.DRAGTYPE_FILENAME_SCENE:
                #get me the path without ever opening the file...
    
    

    Hope it makes sense, and there might be a way to prevent this from happening.

    Thanks,
    Lasse



  • There ist. Simply return NOTOK to prevent C4Ds default behavior.



  • Hi @lasselauch I think this reply TreeView: c4d.DRAGTYPE_FILES answers your questions.

    Cheers,
    Maxime



  • Hi @m_adam, thanks for the link!
    While this is an interesting discussion, I think I mainly want to know if there is a way to prevent C4D from opening the dragged .c4d file?

    This wasn't really discussed in that thread and I'm not really sure if there's anything we can do about it...

    Any ideas?
    Much appreciated.

    Thanks,
    Lasse



  • There ist. Simply return NOTOK to prevent C4Ds default behavior.



  • @mp5gosu Whooop! Thanks, Robert!

    You have to return a tuple so return (c4d.NOTOK, False) does the trick for me.

    Thank you!!!

    Cheers,
    Lasse