Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Custom Drag and Drop to Viewport Functionality?

    Cinema 4D SDK
    r21 r23 python
    3
    3
    405
    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.
    • B
      bentraje
      last edited by

      Hi,

      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?

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hi,

        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.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand
          last edited by

          Hello @bentraje,

          without any further questions and other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

          Thank you for your understanding,
          Ferdinand

          MAXON SDK Specialist
          developers.maxon.net

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