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

    Drag and Drop inside C4D

    SDK Help
    0
    2
    268
    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.
    • H
      Helper
      last edited by

      On 12/08/2016 at 03:53, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R17 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello.

      I need to drag and drop inside C4D some files and create materials based on them.
      I have a SceneLoaderData plugin and I use the Load call to add the materials.

      One problem comes when I try to drag and drop multiple files. Even though the Load runs once for each droppped file, the parameter BaseDocument is not the same. Also, it looks like the dropped files are considered whole documents.

      The code works correctly if only 1 external file is dropped inside C4D.
      I create an empty BaseMaterial with BaseMaterial::Alloc(MY_MATERIAL_PLUGIN) and after filling its parameters, I insert it in the BaseDocument that's given as parameter.

      What can I do to consider the dropped files materials and add all of them in the Active Document.
      Is it safe to use GetActiveDocument ?

      Thank you very much for your time.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 15/08/2016 at 08:17, xxxxxxxx wrote:

        Hi,

        I can only discourage the use of GetActiveDocument() in a SceneLoaderData (like basically in all NodeData derived plugins).
        Unfortunately you have run into a limitation of SceneLoaderData plugins. They virtually import scenes into (new) documents, with the exception of being called by the "Merge" command from "File" menu.

        As a workaround you could use a dialog and handle drag'n'drop and importing of the files manually (without SceneLoaderData). Then you are free from the above limitation and can load as many dropped files into a single document as you like.

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