Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Prevent Projects from opening if dragged.

    Cinema 4D SDK
    python sdk
    3
    5
    732
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lasselauchL
      lasselauch
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

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

        Cheers,
        Maxime

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • lasselauchL
          lasselauch
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • M
            mp5gosu
            last edited by

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

            lasselauchL 1 Reply Last reply Reply Quote 0
            • lasselauchL
              lasselauch @mp5gosu
              last edited by

              @mp5gosu Whooop! Thanks, Robert!

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

              Thank you!!!

              Cheers,
              Lasse

              1 Reply Last reply Reply Quote 0
              • First post
                Last post